@arenarium/maps 1.0.31 → 1.0.33

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.
@@ -726,4 +726,4 @@ uniform ${C} ${A} u_${E};
726
726
  `),ie=ee.concat(Nr.prelude.vertexSource,y.vertexSource,i.vertexSource).join(`
727
727
  `);Zr(T)||(te=function(ge){return ge.replace(/\bin\s/g,"varying ").replace("out highp vec4 fragColor;","").replace(/fragColor/g,"gl_FragColor").replace(/texture\(/g,"texture2D(")}(te),ie=function(ge){return ge.replace(/\bin\s/g,"attribute ").replace(/\bout\s/g,"varying ").replace(/texture\(/g,"texture2D(")}(ie));const he=T.createShader(T.FRAGMENT_SHADER);if(T.isContextLost())return void(this.failedToCreate=!0);if(T.shaderSource(he,te),T.compileShader(he),!T.getShaderParameter(he,T.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${T.getShaderInfoLog(he)}`);T.attachShader(this.program,he);const se=T.createShader(T.VERTEX_SHADER);if(T.isContextLost())return void(this.failedToCreate=!0);if(T.shaderSource(se,ie),T.compileShader(se),!T.getShaderParameter(se,T.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${T.getShaderInfoLog(se)}`);T.attachShader(this.program,se),this.attributes={};const ye={};this.numAttributes=E.length;for(let ge=0;ge<this.numAttributes;ge++)E[ge]&&(T.bindAttribLocation(this.program,ge,E[ge]),this.attributes[E[ge]]=ge);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(se),T.deleteShader(he);for(let ge=0;ge<K.length;ge++){const Ie=K[ge];if(Ie&&!ye[Ie]){const ke=T.getUniformLocation(this.program,Ie);ke&&(ye[Ie]=ke)}}this.fixedUniforms=l(e,ye),this.terrainUniforms=((ge,Ie)=>({u_depth:new o.bF(ge,Ie.u_depth),u_terrain:new o.bF(ge,Ie.u_terrain),u_terrain_dim:new o.b8(ge,Ie.u_terrain_dim),u_terrain_matrix:new o.bH(ge,Ie.u_terrain_matrix),u_terrain_unpack:new o.bI(ge,Ie.u_terrain_unpack),u_terrain_exaggeration:new o.b8(ge,Ie.u_terrain_exaggeration)}))(e,ye),this.projectionUniforms=((ge,Ie)=>({u_projection_matrix:new o.bH(ge,Ie.u_projection_matrix),u_projection_tile_mercator_coords:new o.bI(ge,Ie.u_projection_tile_mercator_coords),u_projection_clipping_plane:new o.bI(ge,Ie.u_projection_clipping_plane),u_projection_transition:new o.b8(ge,Ie.u_projection_transition),u_projection_fallback_matrix:new o.bH(ge,Ie.u_projection_fallback_matrix)}))(e,ye),this.binderUniforms=s?s.getUniforms(e,ye):[]}draw(e,i,s,l,h,f,y,v,T,C,A,E,O,Z,W,q,H,K,ee){const te=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(te.TEXTURE2),te.bindTexture(te.TEXTURE_2D,v.depthTexture),e.activeTexture.set(te.TEXTURE3),te.bindTexture(te.TEXTURE_2D,v.texture);for(const he in this.terrainUniforms)this.terrainUniforms[he].set(v[he])}if(T)for(const he in T)this.projectionUniforms[Jd[he]].set(T[he]);if(y)for(const he in this.fixedUniforms)this.fixedUniforms[he].set(y[he]);q&&q.setUniforms(e,this.binderUniforms,Z,{zoom:W});let ie=0;switch(i){case te.LINES:ie=2;break;case te.TRIANGLES:ie=3;break;case te.LINE_STRIP:ie=1}for(const he of O.get()){const se=he.vaos||(he.vaos={});(se[C]||(se[C]=new mc)).bind(e,this,A,q?q.getPaintVertexBuffers():[],E,he.vertexOffset,H,K,ee),te.drawElements(i,he.primitiveLength*ie,te.UNSIGNED_SHORT,he.primitiveOffset*ie*2)}}}function ns(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),y=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,y>>16],u_pixel_coord_lower:[65535&f,65535&y]}}const gh=(u,e,i,s)=>{const l=u.style.light,h=l.properties.get("position"),f=[h.x,h.y,h.z],y=o.bL();l.properties.get("anchor")==="viewport"&&o.bM(y,u.transform.bearingInRadians),o.bN(f,f,y);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}},Uo=(u,e,i,s,l,h,f)=>o.e(gh(u,e,i,s),ns(h,u,f),{u_height_factor:-Math.pow(2,l.overscaledZ)/f.tileSize/8}),_h=(u,e,i,s)=>o.e(ns(e,u,i),{u_fill_translate:s}),as=(u,e)=>({u_world:u,u_fill_translate:e}),Qd=(u,e,i,s,l)=>o.e(_h(u,e,i,l),{u_world:s}),yh=(u,e,i,s,l)=>{const h=u.transform;let f,y,v=0;if(i.paint.get("circle-pitch-alignment")==="map"){const T=o.aw(e,1,h.zoom);f=!0,y=[T,T],v=T/(o.Z*Math.pow(2,e.tileID.overscaledZ))*2*Math.PI*l}else f=!1,y=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:y,u_globe_extrude_scale:v,u_translate:s}},ep=u=>({u_pixel_extrude_scale:[1/u.width,1/u.height]}),xh=u=>({u_viewport_size:[u.width,u.height]}),$o=(u,e=1)=>({u_color:u,u_overlay:0,u_overlay_scale:e}),gc=(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}},_c=(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")}},vh=(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:ga(0,e.tileID),u_light:[i.paint.get("hillshade-exaggeration"),f],u_shadow:s,u_highlight:l,u_accent:h}},bh=(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 ga(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 Go=(u,e,i,s)=>{const l=u.transform;return{u_translation:Th(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]]}},wh=(u,e,i,s,l)=>o.e(Go(u,e,i,s),{u_image:0,u_image_height:l}),$s=(u,e,i,s,l)=>{const h=u.transform,f=Gs(e,h);return{u_translation:Th(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]]}},tp=(u,e,i,s,l,h)=>{const f=u.lineAtlas,y=Gs(e,u.transform),v=i.layout.get("line-cap")==="round",T=f.getDash(l.from,v),C=f.getDash(l.to,v),A=T.width*h.fromScale,E=C.width*h.toScale;return o.e(Go(u,e,i,s),{u_patternscale_a:[y/A,-T.height/2],u_patternscale_b:[y/E,-C.height/2],u_sdfgamma:f.width/(256*Math.min(A,E)*u.pixelRatio)/2,u_image:0,u_tex_y_a:T.y,u_tex_y_b:C.y,u_mix:h.t})};function Gs(u,e){return 1/o.aw(u,1,e.tileZoom)}function Th(u,e,i){return o.ax(u.transform,e,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}const ip=(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:Ph(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 Ph(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 yc=(u,e,i,s,l,h,f,y,v,T,C,A,E)=>{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:y,u_coord_matrix:v,u_is_text:+C,u_pitch_with_map:+s,u_is_along_line:l,u_is_variable_anchor:h,u_texsize:A,u_texture:0,u_translation:T,u_pitched_scale:E}},xc=(u,e,i,s,l,h,f,y,v,T,C,A,E,O)=>{const Z=f.transform;return o.e(yc(u,e,i,s,l,h,f,y,v,T,C,A,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})},vc=(u,e,i,s,l,h,f,y,v,T,C,A,E)=>o.e(xc(u,e,i,s,l,h,f,y,v,T,!0,C,0,E),{u_texsize_icon:A,u_texture_icon:1}),Sh=(u,e)=>({u_opacity:u,u_color:e}),qo=(u,e,i,s,l)=>o.e(function(h,f,y,v){const T=y.imageManager.getPattern(h.from.toString()),C=y.imageManager.getPattern(h.to.toString()),{width:A,height:E}=y.imageManager.getPixelSize(),O=Math.pow(2,v.tileID.overscaledZ),Z=v.tileSize*Math.pow(2,y.transform.tileZoom)/O,W=Z*(v.tileID.canonical.x+v.tileID.wrap*O),q=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:C.tl,u_pattern_br_b:C.br,u_texsize:[A,E],u_mix:f.t,u_pattern_size_a:T.displaySize,u_pattern_size_b:C.displaySize,u_scale_a:f.fromScale,u_scale_b:f.toScale,u_tile_units_to_pixels:1/o.aw(v,1,y.transform.tileZoom),u_pixel_coord_upper:[W>>16,q>>16],u_pixel_coord_lower:[65535&W,65535&q]}}(i,l,e,s),{u_opacity:u}),en=(u,e)=>{},bc={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:en,clippingMask:en,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 wc{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 Tc={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Mh{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[Tc[h.type]],!1,this.itemSize,h.offset+this.itemSize*(s||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class jt{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 _a extends jt{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 Pc extends jt{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}}class rp extends jt{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}}class np extends jt{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 ap extends jt{getDefault(){return!0}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}}class sp extends jt{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}}class Ih extends jt{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 op extends jt{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 Ch extends jt{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 Wo extends jt{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 Ho extends jt{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 Xo extends jt{getDefault(){return this.gl.LESS}set(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}}class Sc extends jt{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 ya extends jt{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 ss extends jt{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 Er extends jt{getDefault(){return this.gl.FUNC_ADD}set(e){(e!==this.current||this.dirty)&&(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}}class kh extends jt{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 Eh extends jt{getDefault(){return this.gl.BACK}set(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1)}}class Mc extends jt{getDefault(){return this.gl.CCW}set(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1)}}class xa extends jt{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}}class Ko extends jt{getDefault(){return this.gl.TEXTURE0}set(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}}class Yo extends jt{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 qs extends jt{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 Jo extends jt{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 Ah extends jt{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 os extends jt{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 ls extends jt{getDefault(){return null}set(e){const i=this.gl;i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class zh extends jt{getDefault(){return null}set(e){var i;if(e===this.current&&!this.dirty)return;const s=this.gl;Zr(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 Ic extends jt{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 Bt extends jt{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 jt{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 Cc extends jt{constructor(e,i){super(e),this.context=e,this.parent=i}getDefault(){return null}}class Rh extends Cc{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 Ws extends Cc{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 lp extends Cc{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 Dh="Framebuffer is not complete";class Lh{constructor(e,i,s,l,h){this.context=e,this.width=i,this.height=s;const f=e.gl,y=this.framebuffer=f.createFramebuffer();if(this.colorAttachment=new Rh(e,y),l)this.depthAttachment=h?new lp(e,y):new Ws(e,y);else if(h)throw new Error("Stencil cannot be set without depth");if(f.checkFramebufferStatus(f.FRAMEBUFFER)!==f.FRAMEBUFFER_COMPLETE)throw new Error(Dh)}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 cp{constructor(e){var i,s;if(this.gl=e,this.clearColor=new _a(this),this.clearDepth=new Pc(this),this.clearStencil=new rp(this),this.colorMask=new np(this),this.depthMask=new ap(this),this.stencilMask=new sp(this),this.stencilFunc=new Ih(this),this.stencilOp=new op(this),this.stencilTest=new Ch(this),this.depthRange=new Wo(this),this.depthTest=new Ho(this),this.depthFunc=new Xo(this),this.blend=new Sc(this),this.blendFunc=new ya(this),this.blendColor=new ss(this),this.blendEquation=new Er(this),this.cullFace=new kh(this),this.cullFaceSide=new Eh(this),this.frontFace=new Mc(this),this.program=new xa(this),this.activeTexture=new Ko(this),this.viewport=new Yo(this),this.bindFramebuffer=new qs(this),this.bindRenderbuffer=new Jo(this),this.bindTexture=new Ah(this),this.bindVertexBuffer=new os(this),this.bindElementBuffer=new ls(this),this.bindVertexArray=new zh(this),this.pixelStoreUnpack=new Ic(this),this.pixelStoreUnpackPremultiplyAlpha=new Bt(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),Zr(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 wc(this,e,i)}createVertexBuffer(e,i,s){return new Mh(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 Lh(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,ri.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 Zr(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 Zr(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 cs;function Hs(u,e,i,s,l){const h=u.context,f=u.transform,y=h.gl,v=u.useProgram("collisionBox"),T=[];let C=0,A=0;for(let H=0;H<s.length;H++){const K=s[H],ee=e.getTile(K).getBucket(i);if(!ee)continue;const te=l?ee.textCollisionBox:ee.iconCollisionBox,ie=ee.collisionCircleArray;ie.length>0&&(T.push({circleArray:ie,circleOffset:A,coord:K}),C+=ie.length/4,A=C),te&&v.draw(h,y.LINES,vt.disabled,Rt.disabled,u.colorModeForRenderPass(),Ot.disabled,ep(u.transform),u.style.map.terrain&&u.style.map.terrain.getTerrainData(K),f.getProjectionData({overscaledTileID:K,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),i.id,te.layoutVertexBuffer,te.indexBuffer,te.segments,null,u.transform.zoom,null,null,te.collisionVertexBuffer)}if(!l||!T.length)return;const E=u.useProgram("collisionCircle"),O=new o.bP;O.resize(4*C),O._trim();let Z=0;for(const H of T)for(let K=0;K<H.circleArray.length/4;K++){const ee=4*K,te=H.circleArray[ee+0],ie=H.circleArray[ee+1],he=H.circleArray[ee+2],se=H.circleArray[ee+3];O.emplace(Z++,te,ie,he,se,0),O.emplace(Z++,te,ie,he,se,1),O.emplace(Z++,te,ie,he,se,2),O.emplace(Z++,te,ie,he,se,3)}(!cs||cs.length<2*C)&&(cs=function(H){const K=2*H,ee=new o.bR;ee.resize(K),ee._trim();for(let te=0;te<K;te++){const ie=6*te;ee.uint16[ie+0]=4*te+0,ee.uint16[ie+1]=4*te+1,ee.uint16[ie+2]=4*te+2,ee.uint16[ie+3]=4*te+2,ee.uint16[ie+4]=4*te+3,ee.uint16[ie+5]=4*te+0}return ee}(C));const W=h.createIndexBuffer(cs,!0),q=h.createVertexBuffer(O,o.bQ.members,!0);for(const H of T){const K=xh(u.transform);E.draw(h,y.TRIANGLES,vt.disabled,Rt.disabled,u.colorModeForRenderPass(),Ot.disabled,K,u.style.map.terrain&&u.style.map.terrain.getTerrainData(H.coord),null,i.id,q,W,o.aG.simpleSegment(0,2*H.circleOffset,H.circleArray.length,H.circleArray.length/2),null,u.transform.zoom,null,null,null)}q.destroy(),W.destroy()}const el=o.at(new Float32Array(16));function kc(u,e,i,s,l,h){const{horizontalAlign:f,verticalAlign:y}=o.aB(u);return new o.P((-(f-.5)*e/l+s[0])*h,(-(y-.5)*i/l+s[1])*h)}function Ec(u,e,i,s,l,h){const f=e.tileAnchorPoint.add(new o.P(e.translation[0],e.translation[1]));if(e.pitchWithMap){let y=s.mult(h);i||(y=y.rotate(-l));const v=f.add(y);return we(v.x,v.y,e.pitchedLabelPlaneMatrix,e.getElevation).point}if(i){const y=Lt(e.tileAnchorPoint.x+1,e.tileAnchorPoint.y,e).point.sub(u),v=Math.atan(y.y/y.x)+(y.x<0?Math.PI:0);return u.add(s.rotate(v))}return u.add(s)}function Fh(u,e,i,s,l,h,f,y,v,T,C,A){const E=u.text.placedSymbolArray,O=u.text.dynamicLayoutVertexArray,Z=u.icon.dynamicLayoutVertexArray,W={};O.clear();for(let q=0;q<E.length;q++){const H=E.get(q),K=H.hidden||!H.crossTileID||u.allowVerticalPlacement&&!H.placedOrientation?null:s[H.crossTileID];if(K){const ee=new o.P(H.anchorX,H.anchorY),te={getElevation:A,width:l.width,height:l.height,pitchedLabelPlaneMatrix:h,pitchWithMap:i,transform:l,tileAnchorPoint:ee,translation:T,unwrappedTileID:C},ie=i?He(ee.x,ee.y,te):Lt(ee.x,ee.y,te),he=fe(l.cameraToCenterDistance,ie.signedDistanceFromCamera);let se=o.ai(u.textSizeData,y,H)*he/o.av;i&&(se*=u.tilePixelRatio/f);const{width:ye,height:ge,anchor:Ie,textOffset:ke,textBoxScale:Se}=K,Ne=kc(Ie,ye,ge,ke,Se,se),Be=l.getPitchedTextCorrection(ee.x+T[0],ee.y+T[1],C),Ee=Ec(ie.point,te,e,Ne,-l.bearingInRadians,Be),Xe=u.allowVerticalPlacement&&H.placedOrientation===o.ah.vertical?Math.PI/2:0;for(let xt=0;xt<H.numGlyphs;xt++)o.ao(O,Ee,Xe);v&&H.associatedIconIndex>=0&&(W[H.associatedIconIndex]={shiftedAnchor:Ee,angle:Xe})}else lt(H.numGlyphs,O)}if(v){Z.clear();const q=u.icon.placedSymbolArray;for(let H=0;H<q.length;H++){const K=q.get(H);if(K.hidden)lt(K.numGlyphs,Z);else{const ee=W[H];if(ee)for(let te=0;te<K.numGlyphs;te++)o.ao(Z,ee.shiftedAnchor,ee.angle);else lt(K.numGlyphs,Z)}}u.icon.dynamicLayoutVertexBuffer.updateData(Z)}u.text.dynamicLayoutVertexBuffer.updateData(O)}function tl(u,e,i){return i.iconsInText&&e?"symbolTextAndIcon":u?"symbolSDF":"symbolIcon"}function Xs(u,e,i,s,l,h,f,y,v,T,C,A,E){const O=u.context,Z=O.gl,W=u.transform,q=y==="map",H=v==="map",K=y!=="viewport"&&i.layout.get("symbol-placement")!=="point",ee=q&&!H&&!K,te=!i.layout.get("symbol-sort-key").isConstant();let ie=!1;const he=u.getDepthModeForSublayer(0,vt.ReadOnly),se=i._unevaluatedLayout.hasValue("text-variable-anchor")||i._unevaluatedLayout.hasValue("text-variable-anchor-offset"),ye=[],ge=W.getCircleRadiusCorrection();for(const Ie of s){const ke=e.getTile(Ie),Se=ke.getBucket(i);if(!Se)continue;const Ne=l?Se.text:Se.icon;if(!Ne||!Ne.segments.get().length||!Ne.hasVisibleVertices)continue;const Be=Ne.programConfigurations.get(i.id),Ee=l||Se.sdfIcons,Xe=l?Se.textSizeData:Se.iconSizeData,xt=H||W.pitch!==0,Nt=u.useProgram(tl(Ee,l,Se),Be),bt=o.ag(Xe,W.zoom),Wt=u.style.map.terrain&&u.style.map.terrain.getTerrainData(Ie);let ei,ai,qt,Ht,ki=[0,0],Oi=null;if(l)ai=ke.glyphAtlasTexture,qt=Z.LINEAR,ei=ke.glyphAtlasTexture.size,Se.iconsInText&&(ki=ke.imageAtlasTexture.size,Oi=ke.imageAtlasTexture,Ht=xt||u.options.rotating||u.options.zooming||Xe.kind==="composite"||Xe.kind==="camera"?Z.LINEAR:Z.NEAREST);else{const _i=i.layout.get("icon-size").constantOr(0)!==1||Se.iconsNeedLinear;ai=ke.imageAtlasTexture,qt=Ee||u.options.rotating||u.options.zooming||_i||xt?Z.LINEAR:Z.NEAREST,ei=ke.imageAtlasTexture.size}const Vi=o.aw(ke,1,u.transform.zoom),mr=me(q,u.transform,Vi),bn=o.K();o.aj(bn,mr);const an=de(H,q,u.transform,Vi),Wn=o.ax(W,ke,h,f),Hn=W.getProjectionData({overscaledTileID:Ie,applyGlobeMatrix:!E,applyTerrainMatrix:!0}),Ia=se&&Se.hasTextData(),sn=i.layout.get("icon-text-fit")!=="none"&&Ia&&Se.hasIconData();if(K){const _i=u.style.map.terrain?(Di,Kt)=>u.style.map.terrain.getElevation(Ie,Di,Kt):null,yi=i.layout.get("text-rotation-alignment")==="map";Ve(Se,u,l,mr,bn,H,T,yi,Ie.toUnwrapped(),W.width,W.height,Wn,_i)}const wn=l&&se||sn,wr=K||wn?el:H?mr:u.transform.clipSpaceToPixelsMatrix,Tn=Ee&&i.paint.get(l?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let Ca;Ca=Ee?Se.iconsInText?vc(Xe.kind,bt,ee,H,K,wn,u,wr,an,Wn,ei,ki,ge):xc(Xe.kind,bt,ee,H,K,wn,u,wr,an,Wn,l,ei,0,ge):yc(Xe.kind,bt,ee,H,K,wn,u,wr,an,Wn,l,ei,ge);const ka={program:Nt,buffers:Ne,uniformValues:Ca,projectionData:Hn,atlasTexture:ai,atlasTextureIcon:Oi,atlasInterpolation:qt,atlasInterpolationIcon:Ht,isSDF:Ee,hasHalo:Tn};if(te&&Se.canOverlap){ie=!0;const _i=Ne.segments.get();for(const yi of _i)ye.push({segments:new o.aG([yi]),sortKey:yi.sortKey,state:ka,terrainData:Wt})}else ye.push({segments:Ne.segments,sortKey:0,state:ka,terrainData:Wt})}ie&&ye.sort((Ie,ke)=>Ie.sortKey-ke.sortKey);for(const Ie of ye){const ke=Ie.state;if(O.activeTexture.set(Z.TEXTURE0),ke.atlasTexture.bind(ke.atlasInterpolation,Z.CLAMP_TO_EDGE),ke.atlasTextureIcon&&(O.activeTexture.set(Z.TEXTURE1),ke.atlasTextureIcon&&ke.atlasTextureIcon.bind(ke.atlasInterpolationIcon,Z.CLAMP_TO_EDGE)),ke.isSDF){const Se=ke.uniformValues;ke.hasHalo&&(Se.u_is_halo=1,il(ke.buffers,Ie.segments,i,u,ke.program,he,C,A,Se,ke.projectionData,Ie.terrainData)),Se.u_is_halo=0}il(ke.buffers,Ie.segments,i,u,ke.program,he,C,A,ke.uniformValues,ke.projectionData,Ie.terrainData)}}function il(u,e,i,s,l,h,f,y,v,T,C){const A=s.context;l.draw(A,A.gl.TRIANGLES,h,f,y,Ot.backCCW,v,C,T,i.id,u.layoutVertexBuffer,u.indexBuffer,e,i.paint,s.transform.zoom,u.programConfigurations.get(i.id),u.dynamicLayoutVertexBuffer,u.opacityVertexBuffer)}function up(u,e,i,s,l){const h=u.context,f=h.gl,y=Rt.disabled,v=new ri([f.ONE,f.ONE],o.b7.transparent,[!0,!0,!0,!0]),T=e.getBucket(i);if(!T)return;const C=s.key;let A=i.heatmapFbos.get(C);A||(A=Bh(h,e.tileSize,e.tileSize),i.heatmapFbos.set(C,A)),h.bindFramebuffer.set(A.framebuffer),h.viewport.set([0,0,e.tileSize,e.tileSize]),h.clear({color:o.b7.transparent});const E=T.programConfigurations.get(i.id),O=u.useProgram("heatmap",E,!l),Z=u.transform.getProjectionData({overscaledTileID:e.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),W=u.style.map.terrain.getTerrainData(s);O.draw(h,f.TRIANGLES,vt.disabled,y,v,Ot.disabled,gc(e,u.transform.zoom,i.paint.get("heatmap-intensity"),1),W,Z,i.id,T.layoutVertexBuffer,T.indexBuffer,T.segments,i.paint,u.transform.zoom,E)}function Ac(u,e,i,s,l){const h=u.context,f=h.gl,y=u.transform;h.setColorMode(u.colorModeForRenderPass());const v=zc(h,e),T=i.key,C=e.heatmapFbos.get(T);if(!C)return;h.activeTexture.set(f.TEXTURE0),f.bindTexture(f.TEXTURE_2D,C.colorAttachment.get()),h.activeTexture.set(f.TEXTURE1),v.bind(f.LINEAR,f.CLAMP_TO_EDGE);const A=y.getProjectionData({overscaledTileID:i,applyTerrainMatrix:l,applyGlobeMatrix:!s});u.useProgram("heatmapTexture").draw(h,f.TRIANGLES,vt.disabled,Rt.disabled,u.colorModeForRenderPass(),Ot.disabled,_c(u,e,0,1),null,A,e.id,u.rasterBoundsBuffer,u.quadTriangleIndexBuffer,u.rasterBoundsSegments,e.paint,y.zoom),C.destroy(),e.heatmapFbos.delete(T)}function Bh(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 y=(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,y,null);const T=u.createFramebuffer(e,i,!1,!1);return T.colorAttachment.set(f),T}function zc(u,e){return e.colorRampTexture||(e.colorRampTexture=new wt(u,e.colorRamp,u.gl.RGBA)),e.colorRampTexture}function Ks(u,e,i,s,l){if(!i||!s||!s.imageAtlas)return;const h=s.imageAtlas.patternPositions;let f=h[i.to.toString()],y=h[i.from.toString()];if(!f&&y&&(f=y),!y&&f&&(y=f),!f||!y){const v=l.getPaintProperty(e);f=h[v],y=h[v]}f&&y&&u.setConstantPatternPositions(f,y)}function rl(u,e,i,s,l,h,f,y){const v=u.context.gl,T="fill-pattern",C=i.paint.get(T),A=C&&C.constantOr(1),E=i.getCrossfadeParameters();let O,Z,W,q,H;const K=u.transform,ee=i.paint.get("fill-translate"),te=i.paint.get("fill-translate-anchor");f?(Z=A&&!i.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",O=v.LINES):(Z=A?"fillPattern":"fill",O=v.TRIANGLES);const ie=C.constantOr(null);for(const he of s){const se=e.getTile(he);if(A&&!se.patternsLoaded())continue;const ye=se.getBucket(i);if(!ye)continue;const ge=ye.programConfigurations.get(i.id),Ie=u.useProgram(Z,ge),ke=u.style.map.terrain&&u.style.map.terrain.getTerrainData(he);A&&(u.context.activeTexture.set(v.TEXTURE0),se.imageAtlasTexture.bind(v.LINEAR,v.CLAMP_TO_EDGE),ge.updatePaintBuffers(E)),Ks(ge,T,ie,se,i);const Se=K.getProjectionData({overscaledTileID:he,applyGlobeMatrix:!y,applyTerrainMatrix:!0}),Ne=o.ax(K,se,ee,te);if(f){q=ye.indexBuffer2,H=ye.segments2;const Ee=[v.drawingBufferWidth,v.drawingBufferHeight];W=Z==="fillOutlinePattern"&&A?Qd(u,E,se,Ee,Ne):as(Ee,Ne)}else q=ye.indexBuffer,H=ye.segments,W=A?_h(u,E,se,Ne):{u_fill_translate:Ne};let Be;if(u.renderPass==="translucent"&&y){const[Ee]=u.getStencilConfigForOverlapAndUpdateStencilID(s);Be=Ee[he.overscaledZ]}else Be=u.stencilModeForClipping(he);Ie.draw(u.context,O,l,Be,h,Ot.backCCW,W,ke,Se,i.id,ye.layoutVertexBuffer,q,H,i.paint,u.transform.zoom,ge)}}function nl(u,e,i,s,l,h,f,y){const v=u.context,T=v.gl,C="fill-extrusion-pattern",A=i.paint.get(C),E=A.constantOr(1),O=i.getCrossfadeParameters(),Z=i.paint.get("fill-extrusion-opacity"),W=A.constantOr(null),q=u.transform;for(const H of s){const K=e.getTile(H),ee=K.getBucket(i);if(!ee)continue;const te=u.style.map.terrain&&u.style.map.terrain.getTerrainData(H),ie=ee.programConfigurations.get(i.id),he=u.useProgram(E?"fillExtrusionPattern":"fillExtrusion",ie);E&&(u.context.activeTexture.set(T.TEXTURE0),K.imageAtlasTexture.bind(T.LINEAR,T.CLAMP_TO_EDGE),ie.updatePaintBuffers(O));const se=q.getProjectionData({overscaledTileID:H,applyGlobeMatrix:!y,applyTerrainMatrix:!0});Ks(ie,C,W,K,i);const ye=o.ax(q,K,i.paint.get("fill-extrusion-translate"),i.paint.get("fill-extrusion-translate-anchor")),ge=i.paint.get("fill-extrusion-vertical-gradient"),Ie=E?Uo(u,ge,Z,ye,H,O,K):gh(u,ge,Z,ye);he.draw(v,v.gl.TRIANGLES,l,h,f,Ot.backCCW,Ie,te,se,i.id,ee.layoutVertexBuffer,ee.indexBuffer,ee.segments,i.paint,u.transform.zoom,ie,u.style.map.terrain&&ee.centroidVertexBuffer)}}function al(u,e,i,s,l,h,f,y,v){var T;const C=u.style.projection,A=u.context,E=u.transform,O=A.gl,Z=u.useProgram("hillshade"),W=!u.options.moving;for(const q of s){const H=e.getTile(q),K=H.fbo;if(!K)continue;const ee=C.getMeshFromTileID(A,q.canonical,y,!0,"raster"),te=(T=u.style.map.terrain)===null||T===void 0?void 0:T.getTerrainData(q);A.activeTexture.set(O.TEXTURE0),O.bindTexture(O.TEXTURE_2D,K.colorAttachment.get());const ie=E.getProjectionData({overscaledTileID:q,aligned:W,applyGlobeMatrix:!v,applyTerrainMatrix:!0});Z.draw(A,O.TRIANGLES,h,l[q.overscaledZ],f,Ot.backCCW,vh(u,H,i),te,ie,i.id,ee.vertexBuffer,ee.indexBuffer,ee.segments)}}const us=[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 hs(u,e,i,s,l,h,f,y,v=!1,T=!1){const C=s[s.length-1].overscaledZ,A=u.context,E=A.gl,O=u.useProgram("raster"),Z=u.transform,W=u.style.projection,q=u.colorModeForRenderPass(),H=!u.options.moving;for(const K of s){const ee=u.getDepthModeForSublayer(K.overscaledZ-C,i.paint.get("raster-opacity")===1?vt.ReadWrite:vt.ReadOnly,E.LESS),te=e.getTile(K);te.registerFadeDuration(i.paint.get("raster-fade-duration"));const ie=e.findLoadedParent(K,0),he=e.findLoadedSibling(K),se=hp(te,ie||he||null,e,i,u.transform,u.style.map.terrain);let ye,ge;const Ie=i.paint.get("raster-resampling")==="nearest"?E.NEAREST:E.LINEAR;A.activeTexture.set(E.TEXTURE0),te.texture.bind(Ie,E.CLAMP_TO_EDGE,E.LINEAR_MIPMAP_NEAREST),A.activeTexture.set(E.TEXTURE1),ie?(ie.texture.bind(Ie,E.CLAMP_TO_EDGE,E.LINEAR_MIPMAP_NEAREST),ye=Math.pow(2,ie.tileID.overscaledZ-te.tileID.overscaledZ),ge=[te.tileID.canonical.x*ye%1,te.tileID.canonical.y*ye%1]):te.texture.bind(Ie,E.CLAMP_TO_EDGE,E.LINEAR_MIPMAP_NEAREST),te.texture.useMipmap&&A.extTextureFilterAnisotropic&&u.transform.pitch>20&&E.texParameterf(E.TEXTURE_2D,A.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,A.extTextureFilterAnisotropicMax);const ke=u.style.map.terrain&&u.style.map.terrain.getTerrainData(K),Se=Z.getProjectionData({overscaledTileID:K,aligned:H,applyGlobeMatrix:!T,applyTerrainMatrix:!0}),Ne=ip(ge||[0,0],ye||1,se,i,y),Be=W.getMeshFromTileID(A,K.canonical,h,f,"raster");O.draw(A,E.TRIANGLES,ee,l?l[K.overscaledZ]:Rt.disabled,q,v?Ot.frontCCW:Ot.backCCW,Ne,ke,Se,i.id,Be.vertexBuffer,Be.indexBuffer,Be.segments)}}function hp(u,e,i,s,l,h){const f=s.paint.get("raster-fade-duration");if(!h&&f>0){const y=ae.now(),v=(y-u.timeAdded)/f,T=e?(y-e.timeAdded)/f:-1,C=i.getSource(),A=mn(l,{tileSize:C.tileSize,roundZoom:C.roundZoom}),E=!e||Math.abs(e.tileID.overscaledZ-A)>Math.abs(u.tileID.overscaledZ-A),O=E&&u.refreshedUponExpiration?1:o.ae(E?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 Oh=new o.b7(1,0,0,1),Ti=new o.b7(0,1,0,1),va=new o.b7(0,0,1,1),Ar=new o.b7(1,0,1,1),Rc=new o.b7(0,1,1,1);function sl(u,e,i,s){xn(u,0,e+i/2,u.transform.width,i,s)}function Dc(u,e,i,s){xn(u,e-i/2,0,i,u.transform.height,s)}function xn(u,e,i,s,l,h){const f=u.context,y=f.gl;y.enable(y.SCISSOR_TEST),y.scissor(e*u.pixelRatio,i*u.pixelRatio,s*u.pixelRatio,l*u.pixelRatio),f.clear({color:h}),y.disable(y.SCISSOR_TEST)}function Ys(u,e,i){const s=u.context,l=s.gl,h=u.useProgram("debug"),f=vt.disabled,y=Rt.disabled,v=u.colorModeForRenderPass(),T="$debug",C=u.style.map.terrain&&u.style.map.terrain.getTerrainData(i);s.activeTexture.set(l.TEXTURE0);const A=e.getTileByID(i.key).latestRawTileData,E=Math.floor((A&&A.byteLength||0)/1024),O=e.getTile(i).tileSize,Z=512/Math.min(O,512)*(i.overscaledZ/u.transform.zoom)*.5;let W=i.canonical.toString();i.overscaledZ!==i.canonical.z&&(W+=` => ${i.overscaledZ}`),function(H,K){H.initDebugOverlayCanvas();const ee=H.debugOverlayCanvas,te=H.context.gl,ie=H.debugOverlayCanvas.getContext("2d");ie.clearRect(0,0,ee.width,ee.height),ie.shadowColor="white",ie.shadowBlur=2,ie.lineWidth=1.5,ie.strokeStyle="white",ie.textBaseline="top",ie.font="bold 36px Open Sans, sans-serif",ie.fillText(K,5,5),ie.strokeText(K,5,5),H.debugOverlayTexture.update(ee),H.debugOverlayTexture.bind(te.LINEAR,te.CLAMP_TO_EDGE)}(u,`${W} ${E}kB`);const q=u.transform.getProjectionData({overscaledTileID:i,applyGlobeMatrix:!0,applyTerrainMatrix:!0});h.draw(s,l.TRIANGLES,f,y,ri.alphaBlended,Ot.disabled,$o(o.b7.transparent,Z),null,q,T,u.debugBuffer,u.quadTriangleIndexBuffer,u.debugSegments),h.draw(s,l.LINE_STRIP,f,y,v,Ot.disabled,$o(o.b7.red),C,q,T,u.debugBuffer,u.tileBorderIndexBuffer,u.debugSegments)}function ol(u,e,i,s){const{isRenderingGlobe:l}=s,h=u.context,f=h.gl,y=u.transform,v=u.colorModeForRenderPass(),T=u.getDepthModeFor3D(),C=u.useProgram("terrain");h.bindFramebuffer.set(null),h.viewport.set([0,0,u.width,u.height]);for(const A of i){const E=e.getTerrainMesh(A.tileID),O=u.renderToTexture.getTexture(A),Z=e.getTerrainData(A.tileID);h.activeTexture.set(f.TEXTURE0),f.bindTexture(f.TEXTURE_2D,O.texture);const W=e.getMeshFrameDelta(y.zoom),q=y.calculateFogMatrix(A.tileID.toUnwrapped()),H=Qr(W,q,u.style.sky,y.pitch,l),K=y.getProjectionData({overscaledTileID:A.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});C.draw(h,f.TRIANGLES,T,Rt.disabled,v,Ot.backCCW,H,Z,K,"terrain",E.vertexBuffer,E.indexBuffer,E.segments)}}function Lc(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 pa(u.createVertexBuffer(i,Un.members),u.createIndexBuffer(s),o.aG.simpleSegment(0,0,i.length,s.length))}return e.mesh}class jh{constructor(e,i){this.context=new cp(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 Fo}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,Un.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,Un.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,fc.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,Un.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,Un.members),this.viewportSegments=o.aG.simpleSegment(0,0,4,2);const y=new o.bX;y.emplaceBack(0),y.emplaceBack(1),y.emplaceBack(3),y.emplaceBack(2),y.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(y);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 Rt({func:T.ALWAYS,mask:0},0,255,T.ZERO,T.ZERO,T.ZERO),this.tileExtentMesh=new pa(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,vt.disabled,this.stencilClearMode,ri.disabled,Ot.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(ri.disabled),l.setDepthMode(vt.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,y=this.style.projection,v=this.transform,T=this.useProgram("clippingMask");for(const C of i){const A=e[C.key],E=this.style.map.terrain&&this.style.map.terrain.getTerrainData(C),O=y.getMeshFromTileID(this.context,C.canonical,l,!0,"stencil"),Z=v.getProjectionData({overscaledTileID:C,applyGlobeMatrix:!0,applyTerrainMatrix:!0});T.draw(h,f.TRIANGLES,vt.disabled,new Rt({func:f.ALWAYS,mask:0},A,255,f.KEEP,f.KEEP,f.REPLACE),ri.disabled,s?Ot.disabled:Ot.backCCW,null,E,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(),y=pe(l,{tileSize:l.tileSize});for(const v of y){const T=this.style.map.terrain&&this.style.map.terrain.getTerrainData(v),C=s.getMeshFromTileID(this.context,v.canonical,!0,!0,"raster"),A=l.getProjectionData({overscaledTileID:v,applyGlobeMatrix:!0,applyTerrainMatrix:!0});h.draw(e,i.TRIANGLES,f,Rt.disabled,ri.disabled,Ot.backCCW,null,T,A,"$clipping",C.vertexBuffer,C.indexBuffer,C.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const e=this.nextStencilID++,i=this.context.gl;return new Rt({func:i.NOTEQUAL,mask:255},e,255,i.KEEP,i.KEEP,i.REPLACE)}stencilModeForClipping(e){const i=this.context.gl;return new Rt({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,y)=>y.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 y=0;y<h;y++)f[y+l]=new Rt({func:i.GEQUAL,mask:255},y+this.nextStencilID,255,i.KEEP,i.KEEP,i.REPLACE);return this.nextStencilID+=h,[f,s]}return[{[l]:Rt.disabled},s]}stencilConfigForOverlapTwoPass(e){const i=this.context.gl,s=e.sort((f,y)=>y.overscaledZ-f.overscaledZ),l=s[s.length-1].overscaledZ,h=s[0].overscaledZ-l+1;if(this.clearStencil(),h>1){const f={},y={};for(let v=0;v<h;v++)f[v+l]=new Rt({func:i.GREATER,mask:255},h+1+v,255,i.KEEP,i.KEEP,i.REPLACE),y[v+l]=new Rt({func:i.GREATER,mask:255},1+v,255,i.KEEP,i.KEEP,i.REPLACE);return this.nextStencilID=2*h+1,[f,y,s]}return this.nextStencilID=3,[{[l]:new Rt({func:i.GREATER,mask:255},2,255,i.KEEP,i.KEEP,i.REPLACE)},{[l]:new Rt({func:i.GREATER,mask:255},1,255,i.KEEP,i.KEEP,i.REPLACE)},s]}colorModeForRenderPass(){const e=this.context.gl;return this._showOverdrawInspector?new ri([e.CONSTANT_COLOR,e.ONE],new o.b7(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?ri.unblended:ri.alphaBlended}getDepthModeForSublayer(e,i,s){if(!this.opaquePassEnabledForLayer())return vt.disabled;const l=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new vt(s||this.context.gl.LEQUAL,i,[l,l])}getDepthModeFor3D(){return new vt(this.context.gl.LEQUAL,vt.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(ae.now()),this.imageManager.beginFrame();const h=this.style._order,f=this.style.sourceCaches,y={},v={},T={},C={isRenderingToTexture:!1,isRenderingGlobe:((s=e.projection)===null||s===void 0?void 0:s.transitionState)>0};for(const E in f){const O=f[E];O.used&&O.prepare(this.context),y[E]=O.getVisibleCoordinates(!1),v[E]=y[E].slice().reverse(),T[E]=O.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let E=0;E<h.length;E++)if(this.style._layers[h[E]].is3D()){this.opaquePassCutoff=E;break}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const E of h){const O=this.style._layers[E];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,C)}if((l=this.style.projection)===null||l===void 0||l.updateGPUdependent({context:this.context,useProgram:E=>this.useProgram(E)}),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(E,O){const Z=E.context,W=Z.gl,q=((he,se,ye)=>{const ge=Math.cos(se.rollInRadians),Ie=Math.sin(se.rollInRadians),ke=Ka(se),Se=se.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:he.properties.get("sky-color"),u_horizon_color:he.properties.get("horizon-color"),u_horizon:[(se.width/2-ke*Ie)*ye,(se.height/2+ke*ge)*ye],u_horizon_normal:[-Ie,ge],u_sky_horizon_blend:he.properties.get("sky-horizon-blend")*se.height/2*ye,u_sky_blend:Se}})(O,E.style.map.transform,E.pixelRatio),H=new vt(W.LEQUAL,vt.ReadWrite,[0,1]),K=Rt.disabled,ee=E.colorModeForRenderPass(),te=E.useProgram("sky"),ie=Lc(Z,O);te.draw(Z,W.TRIANGLES,H,K,ee,Ot.disabled,q,null,void 0,"sky",ie.vertexBuffer,ie.indexBuffer,ie.segments)}(this,this.style.sky),this._showOverdrawInspector=i.showOverdrawInspector,this.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=h.length-1;this.currentLayer>=0;this.currentLayer--){const E=this.style._layers[h[this.currentLayer]],O=f[E.source],Z=y[E.source];this._renderTileClippingMasks(E,Z,!1),this.renderLayer(this,O,E,Z,C)}this.renderPass="translucent";let A=!1;for(this.currentLayer=0;this.currentLayer<h.length;this.currentLayer++){const E=this.style._layers[h[this.currentLayer]],O=f[E.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(E,C))continue;this.opaquePassEnabledForLayer()||A||(A=!0,C.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());const Z=(E.type==="symbol"?T:v)[E.source];this._renderTileClippingMasks(E,y[E.source],!1),this.renderLayer(this,O,E,Z,C)}if(C.isRenderingGlobe&&function(E,O,Z){const W=E.context,q=W.gl,H=E.useProgram("atmosphere"),K=new vt(q.LEQUAL,vt.ReadOnly,[0,1]),ee=E.transform,te=function(Se,Ne){const Be=Se.properties.get("position"),Ee=[-Be.x,-Be.y,-Be.z],Xe=o.at(new Float64Array(16));return Se.properties.get("anchor")==="map"&&(o.a_(Xe,Xe,Ne.rollInRadians),o.a$(Xe,Xe,-Ne.pitchInRadians),o.a_(Xe,Xe,Ne.bearingInRadians),o.a$(Xe,Xe,Ne.center.lat*Math.PI/180),o.bm(Xe,Xe,-Ne.center.lng*Math.PI/180)),o.bV(Ee,Ee,Xe),Ee}(Z,E.transform),ie=ee.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),he=O.properties.get("atmosphere-blend")*ie.projectionTransition;if(he===0)return;const se=No(ee.worldSize,ee.center.lat),ye=ee.inverseProjectionMatrix,ge=new Float64Array(4);ge[3]=1,o.ap(ge,ge,ee.modelViewProjectionMatrix),ge[0]/=ge[3],ge[1]/=ge[3],ge[2]/=ge[3],ge[3]=1,o.ap(ge,ge,ye),ge[0]/=ge[3],ge[1]/=ge[3],ge[2]/=ge[3],ge[3]=1;const Ie=((Se,Ne,Be,Ee,Xe)=>({u_sun_pos:Se,u_atmosphere_blend:Ne,u_globe_position:Be,u_globe_radius:Ee,u_inv_proj_matrix:Xe}))(te,he,[ge[0],ge[1],ge[2]],se,ye),ke=Lc(W,O);H.draw(W,q.TRIANGLES,K,Rt.disabled,ri.alphaBlended,Ot.disabled,Ie,null,null,"atmosphere",ke.vertexBuffer,ke.indexBuffer,ke.segments)}(this,this.style.sky,this.style.light),this.options.showTileBoundaries){const E=function(O,Z){let W=null;const q=Object.values(O._layers).flatMap(te=>te.source&&!te.isHidden(Z)?[O.sourceCaches[te.source]]:[]),H=q.filter(te=>te.getSource().type==="vector"),K=q.filter(te=>te.getSource().type!=="vector"),ee=te=>{(!W||W.getSource().maxzoom<te.getSource().maxzoom)&&(W=te)};return H.forEach(te=>ee(te)),W||K.forEach(te=>ee(te)),W}(this.style,this.transform.zoom);E&&function(O,Z,W){for(let q=0;q<W.length;q++)Ys(O,Z,W[q])}(this,E,E.getVisibleCoordinates())}this.options.showPadding&&function(E){const O=E.transform.padding;sl(E,E.transform.height-(O.top||0),3,Oh),sl(E,O.bottom||0,3,Ti),Dc(E,O.left||0,3,va),Dc(E,E.transform.width-(O.right||0),3,Ar);const Z=E.transform.centerPoint;(function(W,q,H,K){xn(W,q-1,H-10,2,20,K),xn(W,q-10,H-1,20,2,K)})(E,Z.x,E.transform.height-Z.y,Rc)}(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 y=h.context,v=y.gl,T=h.transform,C=ri.unblended,A=new vt(v.LEQUAL,vt.ReadWrite,[0,1]),E=f.sourceCache.getRenderableTiles(),O=h.useProgram("terrainDepth");y.bindFramebuffer.set(f.getFramebuffer("depth").framebuffer),y.viewport.set([0,0,h.width/devicePixelRatio,h.height/devicePixelRatio]),y.clear({color:o.b7.transparent,depth:1});for(const Z of E){const W=f.getTerrainMesh(Z.tileID),q=f.getTerrainData(Z.tileID),H=T.getProjectionData({overscaledTileID:Z.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),K={u_ele_delta:f.getMeshFrameDelta(T.zoom)};O.draw(y,v.TRIANGLES,A,Rt.disabled,C,Ot.backCCW,K,q,H,"terrain",W.vertexBuffer,W.indexBuffer,W.segments)}y.bindFramebuffer.set(null),y.viewport.set([0,0,h.width,h.height])}(this,this.style.map.terrain),function(h,f){const y=h.context,v=y.gl,T=h.transform,C=ri.unblended,A=new vt(v.LEQUAL,vt.ReadWrite,[0,1]),E=f.getCoordsTexture(),O=f.sourceCache.getRenderableTiles(),Z=h.useProgram("terrainCoords");y.bindFramebuffer.set(f.getFramebuffer("coords").framebuffer),y.viewport.set([0,0,h.width/devicePixelRatio,h.height/devicePixelRatio]),y.clear({color:o.b7.transparent,depth:1}),f.coordsIndex=[];for(const W of O){const q=f.getTerrainMesh(W.tileID),H=f.getTerrainData(W.tileID);y.activeTexture.set(v.TEXTURE0),v.bindTexture(v.TEXTURE_2D,E.texture);const K={u_terrain_coords_id:(255-f.coordsIndex.length)/255,u_texture:0,u_ele_delta:f.getMeshFrameDelta(T.zoom)},ee=T.getProjectionData({overscaledTileID:W.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});Z.draw(y,v.TRIANGLES,A,Rt.disabled,C,Ot.backCCW,K,H,ee,"terrain",q.vertexBuffer,q.indexBuffer,q.segments),f.coordsIndex.push(W.tileID.key)}y.bindFramebuffer.set(null),y.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,y,v,T,C,A){if(f.renderPass!=="translucent")return;const{isRenderingToTexture:E}=A,O=Rt.disabled,Z=f.colorModeForRenderPass();(v._unevaluatedLayout.hasValue("text-variable-anchor")||v._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(W,q,H,K,ee,te,ie,he,se){const ye=q.transform,ge=q.style.map.terrain,Ie=ee==="map",ke=te==="map";for(const Se of W){const Ne=K.getTile(Se),Be=Ne.getBucket(H);if(!Be||!Be.text||!Be.text.segments.get().length)continue;const Ee=o.ag(Be.textSizeData,ye.zoom),Xe=o.aw(Ne,1,q.transform.zoom),xt=me(Ie,q.transform,Xe),Nt=H.layout.get("icon-text-fit")!=="none"&&Be.hasIconData();if(Ee){const bt=Math.pow(2,ye.zoom-Ne.tileID.overscaledZ),Wt=ge?(ei,ai)=>ge.getElevation(Se,ei,ai):null;Fh(Be,Ie,ke,se,ye,xt,bt,Ee,Nt,o.ax(ye,Ne,ie,he),Se.toUnwrapped(),Wt)}}}(T,f,v,y,v.layout.get("text-rotation-alignment"),v.layout.get("text-pitch-alignment"),v.paint.get("text-translate"),v.paint.get("text-translate-anchor"),C),v.paint.get("icon-opacity").constantOr(1)!==0&&Xs(f,y,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,E),v.paint.get("text-opacity").constantOr(1)!==0&&Xs(f,y,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,E),y.map.showCollisionBoxes&&(Hs(f,y,v,T,!0),Hs(f,y,v,T,!1))}(e,i,s,l,this.style.placement.variableOffsets,h):o.c0(s)?function(f,y,v,T,C){if(f.renderPass!=="translucent")return;const{isRenderingToTexture:A}=C,E=v.paint.get("circle-opacity"),O=v.paint.get("circle-stroke-width"),Z=v.paint.get("circle-stroke-opacity"),W=!v.layout.get("circle-sort-key").isConstant();if(E.constantOr(1)===0&&(O.constantOr(1)===0||Z.constantOr(1)===0))return;const q=f.context,H=q.gl,K=f.transform,ee=f.getDepthModeForSublayer(0,vt.ReadOnly),te=Rt.disabled,ie=f.colorModeForRenderPass(),he=[],se=K.getCircleRadiusCorrection();for(let ye=0;ye<T.length;ye++){const ge=T[ye],Ie=y.getTile(ge),ke=Ie.getBucket(v);if(!ke)continue;const Se=v.paint.get("circle-translate"),Ne=v.paint.get("circle-translate-anchor"),Be=o.ax(K,Ie,Se,Ne),Ee=ke.programConfigurations.get(v.id),Xe=f.useProgram("circle",Ee),xt=ke.layoutVertexBuffer,Nt=ke.indexBuffer,bt=f.style.map.terrain&&f.style.map.terrain.getTerrainData(ge),Wt={programConfiguration:Ee,program:Xe,layoutVertexBuffer:xt,indexBuffer:Nt,uniformValues:yh(f,Ie,v,Be,se),terrainData:bt,projectionData:K.getProjectionData({overscaledTileID:ge,applyGlobeMatrix:!A,applyTerrainMatrix:!0})};if(W){const ei=ke.segments.get();for(const ai of ei)he.push({segments:new o.aG([ai]),sortKey:ai.sortKey,state:Wt})}else he.push({segments:ke.segments,sortKey:0,state:Wt})}W&&he.sort((ye,ge)=>ye.sortKey-ge.sortKey);for(const ye of he){const{programConfiguration:ge,program:Ie,layoutVertexBuffer:ke,indexBuffer:Se,uniformValues:Ne,terrainData:Be,projectionData:Ee}=ye.state;Ie.draw(q,H.TRIANGLES,ee,te,ie,Ot.backCCW,Ne,Be,Ee,v.id,ke,Se,ye.segments,v.paint,f.transform.zoom,ge)}}(e,i,s,l,h):o.c1(s)?function(f,y,v,T,C){if(v.paint.get("heatmap-opacity")===0)return;const A=f.context,{isRenderingToTexture:E,isRenderingGlobe:O}=C;if(f.style.map.terrain){for(const Z of T){const W=y.getTile(Z);y.hasRenderableParent(Z)||(f.renderPass==="offscreen"?up(f,W,v,Z,O):f.renderPass==="translucent"&&Ac(f,v,Z,E,O))}A.viewport.set([0,0,f.width,f.height])}else f.renderPass==="offscreen"?function(Z,W,q,H){const K=Z.context,ee=K.gl,te=Z.transform,ie=Rt.disabled,he=new ri([ee.ONE,ee.ONE],o.b7.transparent,[!0,!0,!0,!0]);(function(se,ye,ge){const Ie=se.gl;se.activeTexture.set(Ie.TEXTURE1),se.viewport.set([0,0,ye.width/4,ye.height/4]);let ke=ge.heatmapFbos.get(o.bS);ke?(Ie.bindTexture(Ie.TEXTURE_2D,ke.colorAttachment.get()),se.bindFramebuffer.set(ke.framebuffer)):(ke=Bh(se,ye.width/4,ye.height/4),ge.heatmapFbos.set(o.bS,ke))})(K,Z,q),K.clear({color:o.b7.transparent});for(let se=0;se<H.length;se++){const ye=H[se];if(W.hasRenderableParent(ye))continue;const ge=W.getTile(ye),Ie=ge.getBucket(q);if(!Ie)continue;const ke=Ie.programConfigurations.get(q.id),Se=Z.useProgram("heatmap",ke),Ne=te.getProjectionData({overscaledTileID:ye,applyGlobeMatrix:!0,applyTerrainMatrix:!1}),Be=te.getCircleRadiusCorrection();Se.draw(K,ee.TRIANGLES,vt.disabled,ie,he,Ot.backCCW,gc(ge,te.zoom,q.paint.get("heatmap-intensity"),Be),null,Ne,q.id,Ie.layoutVertexBuffer,Ie.indexBuffer,Ie.segments,q.paint,te.zoom,ke)}K.viewport.set([0,0,Z.width,Z.height])}(f,y,v,T):f.renderPass==="translucent"&&function(Z,W){const q=Z.context,H=q.gl;q.setColorMode(Z.colorModeForRenderPass());const K=W.heatmapFbos.get(o.bS);K&&(q.activeTexture.set(H.TEXTURE0),H.bindTexture(H.TEXTURE_2D,K.colorAttachment.get()),q.activeTexture.set(H.TEXTURE1),zc(q,W).bind(H.LINEAR,H.CLAMP_TO_EDGE),Z.useProgram("heatmapTexture").draw(q,H.TRIANGLES,vt.disabled,Rt.disabled,Z.colorModeForRenderPass(),Ot.disabled,_c(Z,W,0,1),null,null,W.id,Z.viewportBuffer,Z.quadTriangleIndexBuffer,Z.viewportSegments,W.paint,Z.transform.zoom))}(f,v)}(e,i,s,l,h):o.c2(s)?function(f,y,v,T,C){if(f.renderPass!=="translucent")return;const{isRenderingToTexture:A}=C,E=v.paint.get("line-opacity"),O=v.paint.get("line-width");if(E.constantOr(1)===0||O.constantOr(1)===0)return;const Z=f.getDepthModeForSublayer(0,vt.ReadOnly),W=f.colorModeForRenderPass(),q=v.paint.get("line-dasharray"),H=v.paint.get("line-pattern"),K=H.constantOr(1),ee=v.paint.get("line-gradient"),te=v.getCrossfadeParameters(),ie=K?"linePattern":q?"lineSDF":ee?"lineGradient":"line",he=f.context,se=he.gl,ye=f.transform;let ge=!0;for(const Ie of T){const ke=y.getTile(Ie);if(K&&!ke.patternsLoaded())continue;const Se=ke.getBucket(v);if(!Se)continue;const Ne=Se.programConfigurations.get(v.id),Be=f.context.program.get(),Ee=f.useProgram(ie,Ne),Xe=ge||Ee.program!==Be,xt=f.style.map.terrain&&f.style.map.terrain.getTerrainData(Ie),Nt=H.constantOr(null);if(Nt&&ke.imageAtlas){const qt=ke.imageAtlas,Ht=qt.patternPositions[Nt.to.toString()],ki=qt.patternPositions[Nt.from.toString()];Ht&&ki&&Ne.setConstantPatternPositions(Ht,ki)}const bt=ye.getProjectionData({overscaledTileID:Ie,applyGlobeMatrix:!A,applyTerrainMatrix:!0}),Wt=ye.getPixelScale(),ei=K?$s(f,ke,v,Wt,te):q?tp(f,ke,v,Wt,q,te):ee?wh(f,ke,v,Wt,Se.lineClipsArray.length):Go(f,ke,v,Wt);if(K)he.activeTexture.set(se.TEXTURE0),ke.imageAtlasTexture.bind(se.LINEAR,se.CLAMP_TO_EDGE),Ne.updatePaintBuffers(te);else if(q&&(Xe||f.lineAtlas.dirty))he.activeTexture.set(se.TEXTURE0),f.lineAtlas.bind(he);else if(ee){const qt=Se.gradients[v.id];let Ht=qt.texture;if(v.gradientVersion!==qt.version){let ki=256;if(v.stepInterpolant){const Oi=y.getSource().maxzoom,Vi=Ie.canonical.z===Oi?Math.ceil(1<<f.transform.maxZoom-Ie.canonical.z):1;ki=o.ae(o.bT(Se.maxLineLength/o.Z*1024*Vi),256,he.maxTextureSize)}qt.gradient=o.bU({expression:v.gradientExpression(),evaluationKey:"lineProgress",resolution:ki,image:qt.gradient||void 0,clips:Se.lineClipsArray}),qt.texture?qt.texture.update(qt.gradient):qt.texture=new wt(he,qt.gradient,se.RGBA),qt.version=v.gradientVersion,Ht=qt.texture}he.activeTexture.set(se.TEXTURE0),Ht.bind(v.stepInterpolant?se.NEAREST:se.LINEAR,se.CLAMP_TO_EDGE)}let ai;if(A){const[qt]=f.getStencilConfigForOverlapAndUpdateStencilID(T);ai=qt[Ie.overscaledZ]}else ai=f.stencilModeForClipping(Ie);Ee.draw(he,se.TRIANGLES,Z,ai,W,Ot.disabled,ei,xt,bt,v.id,Se.layoutVertexBuffer,Se.indexBuffer,Se.segments,v.paint,f.transform.zoom,Ne,Se.layoutVertexBuffer2),ge=!1}}(e,i,s,l,h):o.c3(s)?function(f,y,v,T,C){const A=v.paint.get("fill-color"),E=v.paint.get("fill-opacity");if(E.constantOr(1)===0)return;const{isRenderingToTexture:O}=C,Z=f.colorModeForRenderPass(),W=v.paint.get("fill-pattern"),q=f.opaquePassEnabledForLayer()&&!W.constantOr(1)&&A.constantOr(o.b7.transparent).a===1&&E.constantOr(0)===1?"opaque":"translucent";if(f.renderPass===q){const H=f.getDepthModeForSublayer(1,f.renderPass==="opaque"?vt.ReadWrite:vt.ReadOnly);rl(f,y,v,T,H,Z,!1,O)}if(f.renderPass==="translucent"&&v.paint.get("fill-antialias")){const H=f.getDepthModeForSublayer(v.getPaintProperty("fill-outline-color")?2:0,vt.ReadOnly);rl(f,y,v,T,H,Z,!0,O)}}(e,i,s,l,h):o.c4(s)?function(f,y,v,T,C){const A=v.paint.get("fill-extrusion-opacity");if(A===0)return;const{isRenderingToTexture:E}=C;if(f.renderPass==="translucent"){const O=new vt(f.context.gl.LEQUAL,vt.ReadWrite,f.depthRangeFor3D);if(A!==1||v.paint.get("fill-extrusion-pattern").constantOr(1))nl(f,y,v,T,O,Rt.disabled,ri.disabled,E),nl(f,y,v,T,O,f.stencilModeFor3D(),f.colorModeForRenderPass(),E);else{const Z=f.colorModeForRenderPass();nl(f,y,v,T,O,Rt.disabled,Z,E)}}}(e,i,s,l,h):o.c5(s)?function(f,y,v,T,C){if(f.renderPass!=="offscreen"&&f.renderPass!=="translucent")return;const{isRenderingToTexture:A}=C,E=f.context,O=f.style.projection.useSubdivision,Z=f.getDepthModeForSublayer(0,vt.ReadOnly),W=f.colorModeForRenderPass();if(f.renderPass==="offscreen")(function(q,H,K,ee,te,ie,he){const se=q.context,ye=se.gl;for(const ge of K){const Ie=H.getTile(ge),ke=Ie.dem;if(!ke||!ke.data||!Ie.needsHillshadePrepare)continue;const Se=ke.dim,Ne=ke.stride,Be=ke.getPixels();if(se.activeTexture.set(ye.TEXTURE1),se.pixelStoreUnpackPremultiplyAlpha.set(!1),Ie.demTexture=Ie.demTexture||q.getTileTexture(Ne),Ie.demTexture){const Xe=Ie.demTexture;Xe.update(Be,{premultiply:!1}),Xe.bind(ye.NEAREST,ye.CLAMP_TO_EDGE)}else Ie.demTexture=new wt(se,Be,ye.RGBA,{premultiply:!1}),Ie.demTexture.bind(ye.NEAREST,ye.CLAMP_TO_EDGE);se.activeTexture.set(ye.TEXTURE0);let Ee=Ie.fbo;if(!Ee){const Xe=new wt(se,{width:Se,height:Se,data:null},ye.RGBA);Xe.bind(ye.LINEAR,ye.CLAMP_TO_EDGE),Ee=Ie.fbo=se.createFramebuffer(Se,Se,!0,!1),Ee.colorAttachment.set(Xe.texture)}se.bindFramebuffer.set(Ee.framebuffer),se.viewport.set([0,0,Se,Se]),q.useProgram("hillshadePrepare").draw(se,ye.TRIANGLES,te,ie,he,Ot.disabled,bh(Ie.tileID,ke),null,null,ee.id,q.rasterBoundsBuffer,q.quadTriangleIndexBuffer,q.rasterBoundsSegments),Ie.needsHillshadePrepare=!1}})(f,y,T,v,Z,Rt.disabled,W),E.viewport.set([0,0,f.width,f.height]);else if(f.renderPass==="translucent")if(O){const[q,H,K]=f.stencilConfigForOverlapTwoPass(T);al(f,y,v,K,q,Z,W,!1,A),al(f,y,v,K,H,Z,W,!0,A)}else{const[q,H]=f.getStencilConfigForOverlapAndUpdateStencilID(T);al(f,y,v,H,q,Z,W,!1,A)}}(e,i,s,l,h):o.c6(s)?function(f,y,v,T,C){if(f.renderPass!=="translucent"||v.paint.get("raster-opacity")===0||!T.length)return;const{isRenderingToTexture:A}=C,E=y.getSource(),O=f.style.projection.useSubdivision;if(E instanceof Or)hs(f,y,v,T,null,!1,!1,E.tileCoords,E.flippedWindingOrder,A);else if(O){const[Z,W,q]=f.stencilConfigForOverlapTwoPass(T);hs(f,y,v,q,Z,!1,!0,us,!1,A),hs(f,y,v,q,W,!0,!0,us,!1,A)}else{const[Z,W]=f.getStencilConfigForOverlapAndUpdateStencilID(T);hs(f,y,v,W,Z,!1,!0,us,!1,A)}}(e,i,s,l,h):o.c7(s)?function(f,y,v,T,C){const A=v.paint.get("background-color"),E=v.paint.get("background-opacity");if(E===0)return;const{isRenderingToTexture:O}=C,Z=f.context,W=Z.gl,q=f.style.projection,H=f.transform,K=H.tileSize,ee=v.paint.get("background-pattern");if(f.isPatternMissing(ee))return;const te=!ee&&A.a===1&&E===1&&f.opaquePassEnabledForLayer()?"opaque":"translucent";if(f.renderPass!==te)return;const ie=Rt.disabled,he=f.getDepthModeForSublayer(0,te==="opaque"?vt.ReadWrite:vt.ReadOnly),se=f.colorModeForRenderPass(),ye=f.useProgram(ee?"backgroundPattern":"background"),ge=T||pe(H,{tileSize:K,terrain:f.style.map.terrain});ee&&(Z.activeTexture.set(W.TEXTURE0),f.imageManager.bind(f.context));const Ie=v.getCrossfadeParameters();for(const ke of ge){const Se=H.getProjectionData({overscaledTileID:ke,applyGlobeMatrix:!O,applyTerrainMatrix:!0}),Ne=ee?qo(E,f,ee,{tileID:ke,tileSize:K},Ie):Sh(E,A),Be=f.style.map.terrain&&f.style.map.terrain.getTerrainData(ke),Ee=q.getMeshFromTileID(Z,ke.canonical,!1,!0,"raster");ye.draw(Z,W.TRIANGLES,he,ie,se,Ot.backCCW,Ne,Be,Se,v.id,Ee.vertexBuffer,Ee.indexBuffer,Ee.segments)}}(e,0,s,l,h):o.c8(s)&&function(f,y,v,T){const{isRenderingGlobe:C}=T,A=f.context,E=v.implementation,O=f.style.projection,Z=f.transform,W=Z.getProjectionDataForCustomLayer(C),q={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:W},H=E.renderingMode?E.renderingMode:"2d";if(f.renderPass==="offscreen"){const K=E.prerender;K&&(f.setCustomLayerDefaults(),A.setColorMode(f.colorModeForRenderPass()),K.call(E,A.gl,q),A.setDirty(),f.setBaseState())}else if(f.renderPass==="translucent"){f.setCustomLayerDefaults(),A.setColorMode(f.colorModeForRenderPass()),A.setStencilMode(Rt.disabled);const K=H==="3d"?f.getDepthModeFor3D():f.getDepthModeForSublayer(0,vt.ReadOnly);A.setDepthMode(K),E.render(A.gl,q),A.setDirty(),f.setBaseState(),A.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?Xa:h.shaderVariantName}`+(this._showOverdrawInspector?"/overdraw":"")+(l?"/terrain":"");return this.cache[f]||(this.cache[f]=new Us(this.context,Nr[e],i,bc[e],this._showOverdrawInspector,l,s?Nr.projectionMercator:h.shaderPreludeCode,s?_n: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 wt(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 Fc(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(...y)=>(s=!0,h=this,i=y,l||f(),l)}class Bc{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=Fc(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,y=Math.round(i.lat*h)/h,v=this._map.getBearing(),T=this._map.getPitch();let C="";if(C+=e?`/${f}/${y}/${s}`:`${s}/${y}/${f}`,(v||T)&&(C+="/"+Math.round(10*v)/10),T&&(C+=`/${Math.round(T)}`),this._hashName){const A=this._hashName;let E=!1;const O=window.location.hash.slice(1).split("&").map(Z=>{const W=Z.split("=")[0];return W===A?(E=!0,`${W}=${C}`):Z}).filter(Z=>Z);return E||O.push(`${A}=${C}`),`#${O.join("&")}`}return`#${C}`}_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 ds={linearity:.3,easing:o.c9(0,0,.3,1)},ba=o.e({deceleration:2500,maxSpeed:1400},ds),Nh=o.e({deceleration:20,maxSpeed:1400},ds),Zh=o.e({deceleration:1e3,maxSpeed:360},ds),Vh=o.e({deceleration:1e3,maxSpeed:90},ds),Uh=o.e({deceleration:1e3,maxSpeed:360},ds);class $h{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:ae.now(),settings:e})}_drainInertiaBuffer(){const e=this._inertiaBuffer,i=ae.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=fs(i.pan.mag(),s,o.e({},ba,e||{})),f=i.pan.mult(h.amount/i.pan.mag()),y=this._map.cameraHelper.handlePanInertia(f,this._map.transform);l.center=y.easingCenter,l.offset=y.easingOffset,ps(l,h)}if(i.zoom){const h=fs(i.zoom,s,Nh);l.zoom=this._map.transform.zoom+h.amount,ps(l,h)}if(i.bearing){const h=fs(i.bearing,s,Zh);l.bearing=this._map.transform.bearing+o.ae(h.amount,-179,179),ps(l,h)}if(i.pitch){const h=fs(i.pitch,s,Vh);l.pitch=this._map.transform.pitch+h.amount,ps(l,h)}if(i.roll){const h=fs(i.roll,s,Uh);l.roll=this._map.transform.roll+o.ae(h.amount,-179,179),ps(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 ps(u,e){(!u.duration||u.duration<e.duration)&&(u.duration=e.duration,u.easing=e.easing)}function fs(u,e,i){const{maxSpeed:s,linearity:l,deceleration:h}=i,f=o.ae(u*l/(e/1e3),-s,s),y=Math.abs(f)/(h*l);return{easing:i.easing,duration:1e3*y,amount:f*(y/2)}}class tr 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=G.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 ms 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=G.touchPos(i.getCanvasContainer(),l),f=h.map(v=>i.unproject(v)),y=h.reduce((v,T,C,A)=>v.add(T.div(A.length)),new o.P(0,0));super(e,{points:h,point:y,lngLats:f,lngLat:i.unproject(y),originalEvent:s}),this._defaultPrevented=!1}}class zr extends o.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,s){super(e,{originalEvent:s}),this._defaultPrevented=!1}}class tn{constructor(e,i){this._map=e,this._clickTolerance=i.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new zr(e.type,this._map,e))}mousedown(e,i){return this._mousedownPos=i,this._firePreventable(new tr(e.type,this._map,e))}mouseup(e){this._map.fire(new tr(e.type,this._map,e))}click(e,i){this._mousedownPos&&this._mousedownPos.dist(i)>=this._clickTolerance||this._map.fire(new tr(e.type,this._map,e))}dblclick(e){return this._firePreventable(new tr(e.type,this._map,e))}mouseover(e){this._map.fire(new tr(e.type,this._map,e))}mouseout(e){this._map.fire(new tr(e.type,this._map,e))}touchstart(e){return this._firePreventable(new ms(e.type,this._map,e))}touchmove(e){this._map.fire(new ms(e.type,this._map,e))}touchend(e){this._map.fire(new ms(e.type,this._map,e))}touchcancel(e){this._map.fire(new ms(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Gh{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new tr(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new tr("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new tr(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class pr{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 wa{constructor(e,i){this._map=e,this._tr=new pr(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&&(G.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=G.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),y=Math.min(l.y,s.y),v=Math.max(l.y,s.y);G.setTransform(this._box,`translate(${h}px,${y}px)`),this._box.style.width=f-h+"px",this._box.style.height=v-y+"px"}mouseupWindow(e,i){if(!this._active||e.button!==0)return;const s=this._startPos,l=i;if(this.reset(),G.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&&(G.remove(this._box),this._box=null),G.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,i){return this._map.fire(new o.l(e,{originalEvent:i}))}}function Oc(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 dp{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=Oc(s,i)))}touchmove(e,i,s){if(this.aborted||!this.centroid)return;const l=Oc(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 jc{constructor(e){this.singleTap=new dp(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 pp{constructor(e){this._tr=new pr(e),this._zoomIn=new jc({numTouches:1,numTaps:2}),this._zoomOut=new jc({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:y=>y.easeTo({duration:300,zoom:f.zoom+1,around:f.unproject(l)},{originalEvent:e})}):h?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:y=>y.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 gs{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&&G.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 Js={0:1,2:2};class br{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){const i=G.mouseButton(e);this._eventButton=i}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){return!function(i,s){const l=Js[s];return i.buttons===void 0||(i.buttons&l)!==l}(e,this._eventButton)}isValidEndEvent(e){return G.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 qh{constructor(e=new br({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 _s=u=>{u.mousedown=u.dragStart,u.mousemoveWindow=u.dragMove,u.mouseup=u.dragEnd,u.contextmenu=e=>{e.preventDefault()}};class Wh{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=Oc(s,i),h=new o.P(0,0),f=new o.P(0,0);let y=0;for(const T in l){const C=l[T],A=this._touches[T];A&&(h._add(C),f._add(C.sub(A)),y++,l[T]=C)}if(this._touches=l,this._shouldBePrevented(y)||!f.mag())return;const v=f.div(y);return this._sum._add(v),this._sum.mag()<this._clickTolerance?void 0:{around:h.div(y),panDelta:v}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ta{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=qn(s,i,l),y=qn(s,i,h);if(!f||!y)return;const v=this._aroundCenter?null:f.add(y).div(2);return this._move([f,y],v,e)}touchend(e,i,s){if(!this._firstTwoTouches)return;const[l,h]=this._firstTwoTouches,f=qn(s,i,l),y=qn(s,i,h);f&&y||(this._active&&G.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 qn(u,e,i){for(let s=0;s<u.length;s++)if(u[s].identifier===i)return e[s]}function Nc(u,e){return Math.log(u/e)/Math.LN2}class Ct extends Ta{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(Nc(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Nc(this._distance,s),pinchAround:i}}}function ll(u,e){return 180*u.angleWith(e)/Math.PI}class Hh extends Ta{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:ll(this._vector,l),pinchAround:i}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());const i=25/(Math.PI*this._minDiameter)*360,s=ll(e,this._startVector);return Math.abs(s)<i}}function Qs(u){return Math.abs(u.y)>Math.abs(u.x)}class Xh extends Ta{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,Qs(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 Qs(e)&&Qs(i)&&f}}const fp={panStep:100,bearingStep:15,pitchStep:10};class Zc{constructor(e){this._tr=new pr(e);const i=fp;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:y=>{const v=this._tr;y.easeTo({duration:300,easeId:"keyboardHandler",easing:Vc,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 Vc(u){return u*(2-u)}const Uc=4.000244140625;class Kh{constructor(e,i){this._onTimeout=s=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(s)},this._map=e,this._tr=new pr(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=ae.now(),l=s-(this._lastWheelEventTime||0);this._lastWheelEventTime=s,i!==0&&i%Uc==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=G.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 y=e.zoom-this._lastExpectedZoom;typeof this._startZoom=="number"&&(this._startZoom+=y),typeof this._targetZoom=="number"&&(this._targetZoom+=y)}if(this._delta!==0){const y=this._type==="wheel"&&Math.abs(this._delta)>Uc?this._wheelZoomRate:this._defaultZoomRate;let v=2/(1+Math.exp(-Math.abs(this._delta*y)));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 y=ae.now()-this._lastWheelEventTime,v=Math.min((y+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=(ae.now()-s.start)/s.duration,h=s.easing(l+.01)-s.easing(l),f=.27/Math.sqrt(h*h+1e-4)*.01,y=Math.sqrt(.0729-f*f);i=o.c9(f,y,.25,1)}return this._prevEase={start:ae.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 $c{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 mp{constructor(e){this._tr=new pr(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 gp{constructor(){this._tap=new jc({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 vn{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 ni{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 eo{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 cl{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=G.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&&(G.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 to=u=>u.zoom||u.drag||u.roll||u.pitch||u.rotate;class Yh extends o.l{}function ul(u){return u.panDelta&&u.panDelta.mag()||u.zoomDelta||u.bearingDelta||u.pitchDelta||u.rollDelta}class _p{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,y={needsRenderFrame:!1},v={},T={};for(const{handlerName:E,handler:O,allowed:Z}of this._handlers){if(!O.isEnabled())continue;let W;if(this._blockedByActive(T,Z,E))O.reset();else if(O[h||l.type]){if(o.cc(l,h||l.type)){const q=G.mousePos(this._map.getCanvas(),l);W=O[h||l.type](l,q)}else if(o.cd(l,h||l.type)){const q=this._getMapTouches(l.touches),H=G.touchPos(this._map.getCanvas(),q);W=O[h||l.type](l,H,q)}else o.ce(h||l.type)||(W=O[h||l.type](l));this.mergeHandlerResult(y,v,W,E,f),W&&W.needsRenderFrame&&this._triggerRenderFrame()}(W||O.isActive())&&(T[E]=O)}const C={};for(const E in this._previousActiveHandlers)T[E]||(C[E]=f);this._previousActiveHandlers=T,(Object.keys(C).length||ul(y))&&(this._changes.push([y,v,C]),this._triggerRenderFrame()),(Object.keys(T).length||ul(y))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:A}=y;A&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],A(this._map))},this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new $h(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)G.addEventListener(l,h,l===document?this.handleWindowEvent:this.handleEvent,f)}destroy(){for(const[e,i,s]of this._listeners)G.removeEventListener(e,i,e===document?this.handleWindowEvent:this.handleEvent,s)}_addDefaultHandlers(e){const i=this._map,s=i.getCanvasContainer();this._add("mapEvent",new tn(i,e));const l=i.boxZoom=new wa(i,e);this._add("boxZoom",l),e.interactive&&e.boxZoom&&l.enable();const h=i.cooperativeGestures=new cl(i,e.cooperativeGestures);this._add("cooperativeGestures",h),e.cooperativeGestures&&h.enable();const f=new pp(i),y=new mp(i);i.doubleClickZoom=new $c(y,f),this._add("tapZoom",f),this._add("clickZoom",y),e.interactive&&e.doubleClickZoom&&i.doubleClickZoom.enable();const v=new gp;this._add("tapDragZoom",v);const T=i.touchPitch=new Xh(i);this._add("touchPitch",T),e.interactive&&e.touchPitch&&i.touchPitch.enable(e.touchPitch);const C=()=>i.project(i.getCenter()),A=function({enable:te,clickTolerance:ie,aroundCenter:he=!0,minPixelCenterThreshold:se=100,rotateDegreesPerPixelMoved:ye=.8},ge){const Ie=new br({checkCorrectEvent:ke=>G.mouseButton(ke)===0&&ke.ctrlKey||G.mouseButton(ke)===2&&!ke.ctrlKey});return new gs({clickTolerance:ie,move:(ke,Se)=>{const Ne=ge();if(he&&Math.abs(Ne.y-ke.y)>se)return{bearingDelta:o.ca(new o.P(ke.x,Se.y),Se,Ne)};let Be=(Se.x-ke.x)*ye;return he&&Se.y<Ne.y&&(Be=-Be),{bearingDelta:Be}},moveStateManager:Ie,enable:te,assignEvents:_s})}(e,C),E=function({enable:te,clickTolerance:ie,pitchDegreesPerPixelMoved:he=-.5}){const se=new br({checkCorrectEvent:ye=>G.mouseButton(ye)===0&&ye.ctrlKey||G.mouseButton(ye)===2});return new gs({clickTolerance:ie,move:(ye,ge)=>({pitchDelta:(ge.y-ye.y)*he}),moveStateManager:se,enable:te,assignEvents:_s})}(e),O=function({enable:te,clickTolerance:ie,rollDegreesPerPixelMoved:he=.3},se){const ye=new br({checkCorrectEvent:ge=>G.mouseButton(ge)===2&&ge.ctrlKey});return new gs({clickTolerance:ie,move:(ge,Ie)=>{const ke=se();let Se=(Ie.x-ge.x)*he;return Ie.y<ke.y&&(Se=-Se),{rollDelta:Se}},moveStateManager:ye,enable:te,assignEvents:_s})}(e,C);i.dragRotate=new ni(e,A,E,O),this._add("mouseRotate",A,["mousePitch"]),this._add("mousePitch",E,["mouseRotate","mouseRoll"]),this._add("mouseRoll",O,["mousePitch"]),e.interactive&&e.dragRotate&&i.dragRotate.enable();const Z=function({enable:te,clickTolerance:ie}){const he=new br({checkCorrectEvent:se=>G.mouseButton(se)===0&&!se.ctrlKey});return new gs({clickTolerance:ie,move:(se,ye)=>({around:ye,panDelta:ye.sub(se)}),activateOnStart:!0,moveStateManager:he,enable:te,assignEvents:_s})}(e),W=new Wh(e,i);i.dragPan=new vn(s,Z,W),this._add("mousePan",Z),this._add("touchPan",W,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&i.dragPan.enable(e.dragPan);const q=new Hh,H=new Ct;i.touchZoomRotate=new eo(s,H,q,v),this._add("touchRotate",q,["touchPan","touchZoom"]),this._add("touchZoom",H,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&i.touchZoomRotate.enable(e.touchZoomRotate);const K=i.scrollZoom=new Kh(i,()=>this._triggerRenderFrame());this._add("scrollZoom",K,["mousePan"]),e.interactive&&e.scrollZoom&&i.scrollZoom.enable(e.scrollZoom);const ee=i.keyboard=new Zc(i);this._add("keyboard",ee),e.interactive&&e.keyboard&&i.keyboard.enable(),this._add("blockableMapEvent",new Gh(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!!to(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(!(ul(e)||f&&this._terrainMovement))return this._fireEvents(i,s,!0);l._stop(!0);let{panDelta:y,zoomDelta:v,bearingDelta:T,pitchDelta:C,rollDelta:A,around:E,pinchAround:O}=e;O!==void 0&&(E=O),E=E||l.transform.centerPoint,f&&!h.isPointOnMapSurface(E)&&(E=h.centerPoint);const Z={panDelta:y,zoomDelta:v,rollDelta:A,pitchDelta:C,bearingDelta:T,around:E};this._map.cameraHelper.useGlobeControls&&!h.isPointOnMapSurface(E)&&(E=h.centerPoint);const W=E.distSqr(h.centerPoint)<.01?h.center:h.screenPointToLocation(y?E.sub(y):E);f?(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(Z,h),this._terrainMovement||!i.drag&&!i.zoom?i.drag&&this._terrainMovement?h.setCenter(h.screenPointToLocation(h.centerPoint.sub(y))):this._map.cameraHelper.handleMapControlsPan(Z,h,W):(this._terrainMovement=!0,this._map._elevationFreeze=!0,this._map.cameraHelper.handleMapControlsPan(Z,h,W))):(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(Z,h),this._map.cameraHelper.handleMapControlsPan(Z,h,W)),l._applyUpdatedTransform(h),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(i,s,!0)}_fireEvents(e,i,s){const l=to(this._eventsInProgress),h=to(e),f={};for(const A in e){const{originalEvent:E}=e[A];this._eventsInProgress[A]||(f[`${A}start`]=E),this._eventsInProgress[A]=e[A]}!l&&h&&this._fireEvent("movestart",h.originalEvent);for(const A in f)this._fireEvent(A,f[A]);h&&this._fireEvent("move",h.originalEvent);for(const A in e){const{originalEvent:E}=e[A];this._fireEvent(A,E)}const y={};let v;for(const A in this._eventsInProgress){const{handlerName:E,originalEvent:O}=this._eventsInProgress[A];this._handlersById[E].isActive()||(delete this._eventsInProgress[A],v=i[E]||O,y[`${A}end`]=v)}for(const A in y)this._fireEvent(A,y[A]);const T=to(this._eventsInProgress),C=(l||h)&&!T;if(C&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const A=this._map._getTransformForUpdate();this._map.getCenterClampedToGround()&&A.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(A)}if(s&&C){this._updatingCamera=!0;const A=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),E=O=>O!==0&&-this._bearingSnap<O&&O<this._bearingSnap;!A||!A.essential&&ae.prefersReducedMotion?(this._map.fire(new o.l("moveend",{originalEvent:v})),E(this._map.getBearing())&&this._map.resetNorth()):(E(A.bearing||this._map.getBearing())&&(A.bearing=0),A.freezeElevation=!0,this._map.easeTo(A,{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 Yh("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class rn extends o.E{constructor(e,i,s){super(),this._renderFrameCallback=()=>{const l=Math.min((ae.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=wi.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 y=this.transform,v=new wi(e,i);return this.cameraHelper.cameraForBoxAndBearing(l,f,v,s,y)}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 y=s.zoom;this.cameraHelper.handleJumpToCenterZoom(s,e);const v=s.zoom!==y;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),y=f.x-h.x,v=f.y-h.y,T=f.z-h.z,C=Math.hypot(y,v,T);if(C===0)throw new Error("Can't calculate camera options with same From and To");const A=Math.hypot(y,v),E=o.ab(this.transform.cameraToCenterDistance/C/this.transform.tileSize),O=180*Math.atan2(y,-v)/Math.PI;let Z=180*Math.acos(A/C)/Math.PI;return Z=T<0?90-Z:90+Z,{center:f.toLngLat(),elevation:l,zoom:E,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&&ae.prefersReducedMotion)&&(e.duration=0);const s=this._getTransformForUpdate(),l=this.getBearing(),h=s.pitch,f=s.roll,y="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,C="padding"in e?e.padding:s.padding,A=o.P.convert(e.offset);let E,O;e.around&&(E=o.Q.convert(e.around),O=s.locationToScreenPoint(E));const Z={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},W=this.cameraHelper.handleEaseTo(s,{bearing:y,pitch:v,roll:T,padding:C,around:E,aroundPoint:O,offsetAsPoint:A,offset:e.offset,zoom:e.zoom,center:e.center});return this._rotating=this._rotating||l!==y,this._pitching=this._pitching||v!==h,this._rolling=this._rolling||T!==f,this._padding=!s.isPaddingEqual(C),this._zooming=this._zooming||W.isZooming,this._easeId=e.easeId,this._prepareEase(i,e.noMoveStart,Z),this.terrain&&this._prepareElevation(W.elevationCenter),this._ease(q=>{W.easeFunc(q),this.terrain&&!e.freezeElevation&&this._updateElevation(q),this._applyUpdatedTransform(s),this._fireMoveEvents(i)},q=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(i,q)},e),this}_prepareEase(e,i,s={}){this._moving=!0,i||s.moving||this.fire(new o.l("movestart",e)),this._zooming&&!s.zooming&&this.fire(new o.l("zoomstart",e)),this._rotating&&!s.rotating&&this.fire(new o.l("rotatestart",e)),this._pitching&&!s.pitching&&this.fire(new o.l("pitchstart",e)),this._rolling&&!s.rolling&&this.fire(new o.l("rollstart",e))}_prepareElevation(e){this._elevationCenter=e,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(e,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(e){this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));const i=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(e<1&&i!==this._elevationTarget){const s=this._elevationTarget-this._elevationStart;this._elevationStart+=e*(s-(i-(s*e+this._elevationStart))/(1-e)),this._elevationTarget=i}this.transform.setElevation(o.B.number(this._elevationStart,this._elevationTarget,e))}_finalizeElevation(){this._elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(e){if(!this.terrain&&e.elevation>=0&&e.pitch<=90)return{};const i=e.getCameraLngLat(),s=e.getCameraAltitude(),l=this.terrain?this.terrain.getElevationForLngLatZoom(i,e.zoom):0;if(s<l){const h=this.calculateCameraOptionsFromTo(i,l,e.center,e.elevation);return{pitch:h.pitch,zoom:h.zoom}}return{}}_applyUpdatedTransform(e){const i=[];if(i.push(l=>this._elevateCameraIfInsideTerrain(l)),this.transformCameraUpdate&&i.push(l=>this.transformCameraUpdate(l)),!i.length)return;const s=e.clone();for(const l of i){const h=s.clone(),{center:f,zoom:y,roll:v,pitch:T,bearing:C,elevation:A}=l(h);f&&h.setCenter(f),A!==void 0&&h.setElevation(A),y!==void 0&&h.setZoom(y),v!==void 0&&h.setRoll(v),T!==void 0&&h.setPitch(T),C!==void 0&&h.setBearing(C),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&&ae.prefersReducedMotion){const Se=o.O(e,["center","zoom","bearing","pitch","roll","elevation"]);return this.jumpTo(Se,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,y=s.padding,v="bearing"in e?this._normalizeBearing(e.bearing,l):l,T="pitch"in e?+e.pitch:h,C="roll"in e?this._normalizeBearing(e.roll,f):f,A="padding"in e?e.padding:s.padding,E=o.P.convert(e.offset);let O=s.centerPoint.add(E);const Z=s.screenPointToLocation(O),W=this.cameraHelper.handleFlyTo(s,{bearing:v,pitch:T,roll:C,padding:A,locationAtOffset:Z,offsetAsPoint:E,center:e.center,minZoom:e.minZoom,zoom:e.zoom});let q=e.curve;const H=Math.max(s.width,s.height),K=H/W.scaleOfZoom,ee=W.pixelPathLength;typeof W.scaleOfMinZoom=="number"&&(q=Math.sqrt(H/W.scaleOfMinZoom/ee*2));const te=q*q;function ie(Se){const Ne=(K*K-H*H+(Se?-1:1)*te*te*ee*ee)/(2*(Se?K:H)*te*ee);return Math.log(Math.sqrt(Ne*Ne+1)-Ne)}function he(Se){return(Math.exp(Se)-Math.exp(-Se))/2}function se(Se){return(Math.exp(Se)+Math.exp(-Se))/2}const ye=ie(!1);let ge=function(Se){return se(ye)/se(ye+q*Se)},Ie=function(Se){return H*((se(ye)*(he(Ne=ye+q*Se)/se(Ne))-he(ye))/te)/ee;var Ne},ke=(ie(!0)-ye)/q;if(Math.abs(ee)<2e-6||!isFinite(ke)){if(Math.abs(H-K)<1e-6)return this.easeTo(e,i);const Se=K<H?-1:1;ke=Math.abs(Math.log(K/H))/q,Ie=()=>0,ge=Ne=>Math.exp(Se*q*Ne)}return e.duration="duration"in e?+e.duration:1e3*ke/("screenSpeed"in e?+e.screenSpeed/q:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=l!==v,this._pitching=T!==h,this._rolling=C!==f,this._padding=!s.isPaddingEqual(A),this._prepareEase(i,!1),this.terrain&&this._prepareElevation(W.targetCenter),this._ease(Se=>{const Ne=Se*ke,Be=1/ge(Ne),Ee=Ie(Ne);this._rotating&&s.setBearing(o.B.number(l,v,Se)),this._pitching&&s.setPitch(o.B.number(h,T,Se)),this._rolling&&s.setRoll(o.B.number(f,C,Se)),this._padding&&(s.interpolatePadding(y,A,Se),O=s.centerPoint.add(E)),W.easeFunc(Se,Be,Ee,O),this.terrain&&!e.freezeElevation&&this._updateElevation(Se),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=ae.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 io={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class et{constructor(e=io){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=G.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=G.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=G.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(){G.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=G.sanitize(s),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class ot{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=G.create("div","maplibregl-ctrl");const i=G.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(){G.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class hl{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 Gc=o.aD([{name:"a_pos3d",type:"Int16",components:3}]);class qc extends o.E{constructor(e){super(),this._lastTilesetChange=ae.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 pe(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 Yr(l,this.tileSize),this._lastTilesetChange=ae.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 y=l.canonical.z-e.canonical.z,v=l.canonical.x-(l.canonical.x>>y<<y),T=l.canonical.y-(l.canonical.y>>y<<y),C=o.Z>>y;o.bO(f,0,C,C,0,0,1),o.L(f,f,[-v*C,-T*C,0])}else{if(!e.canonical.isChildOf(l.canonical))continue;{const y=e.canonical.z-l.canonical.z,v=e.canonical.x-(e.canonical.x>>y<<y),T=e.canonical.y-(e.canonical.y>>y<<y),C=o.Z>>y;o.bO(f,0,o.Z,o.Z,0,0,1),o.L(f,f,[v*C,T*C,0]),o.M(f,f,[1/2**y,1/2**y,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(),y=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(y,0,o.Z,o.Z,0,0,1),o.L(y,y,[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),C=h.canonical.y-(h.canonical.y>>v<<v),A=e.canonical.x-(h.canonical.x>>v),E=e.canonical.y-(h.canonical.y>>v),O=o.Z>>v;o.bO(y,0,O,O,0,0,1),o.L(y,y,[-T*O+A*o.Z,-C*O+E*o.Z,0])}else{const v=e.canonical.z-h.canonical.z,T=e.canonical.x-(e.canonical.x>>v<<v),C=e.canonical.y-(e.canonical.y>>v<<v),A=(e.canonical.x>>v)-h.canonical.x,E=(e.canonical.y>>v)-h.canonical.y,O=o.Z<<v;o.bO(y,0,O,O,0,0,1),o.L(y,y,[T*o.Z+A*O,C*o.Z+E*O,0])}f.terrainRttPosMatrix32f=new Float32Array(y),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 fr{constructor(e,i,s){this._meshCache={},this.painter=e,this.sourceCache=new qc(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),y=(h=f.tile)===null||h===void 0?void 0:h.dem;if(!y)return 0;const v=o.cf([],[i/l*o.Z,s/l*o.Z],f.u_terrain_matrix),T=[v[0]*y.dim,v[1]*y.dim],C=Math.floor(T[0]),A=Math.floor(T[1]),E=T[0]-C,O=T[1]-A;return y.get(C,A)*(1-E)*(1-O)+y.get(C+1,A)*E*(1-O)+y.get(C,A+1)*(1-E)*O+y.get(C+1,A+1)*E*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 wt(l,h,l.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new wt(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 wt(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),y=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,y*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 wt(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 wt(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 y=0;y<this._coordsTextureSize;y++,f+=4)i[f+0]=255&y,i[f+1]=255&h,i[f+2]=y>>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 wt(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),y=Math.round(this.painter.height/devicePixelRatio);s.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),l.readPixels(h,y-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),C=this.coordsIndex[255-i[3]],A=C&&this.sourceCache.getTileByID(C);if(!A)return null;const E=this._coordsTextureSize,O=(1<<A.tileID.canonical.z)*E;return new o.$((A.tileID.canonical.x*E+v)/O+A.tileID.wrap,(A.tileID.canonical.y*E+T)/O,this.getElevation(A.tileID,v,T,E))}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 y=this.painter.context,v=new o.ci,T=new o.aH,C=this.meshSize,A=o.Z/C,E=C*C;for(let se=0;se<=C;se++)for(let ye=0;ye<=C;ye++)v.emplaceBack(ye*A,se*A,0);for(let se=0;se<E;se+=C+1)for(let ye=0;ye<C;ye++)T.emplaceBack(ye+se,C+ye+se+1,C+ye+se+2),T.emplaceBack(ye+se,C+ye+se+2,ye+se+1);const O=v.length,Z=O+(C+1),W=(C+1)*C,q=l?o.b9:0,H=l?0:1,K=h?o.ba:o.Z,ee=h?0:1;for(let se=0;se<=C;se++)v.emplaceBack(se*A,q,H);for(let se=0;se<=C;se++)v.emplaceBack(se*A,K,ee);for(let se=0;se<C;se++)T.emplaceBack(W+se,Z+se,Z+se+1),T.emplaceBack(W+se,Z+se+1,W+se+1),T.emplaceBack(0+se,O+se+1,O+se),T.emplaceBack(0+se,0+se+1,O+se+1);const te=v.length,ie=te+2*(C+1);for(const se of[0,1])for(let ye=0;ye<=C;ye++)for(const ge of[0,1])v.emplaceBack(se*o.Z,ye*A,ge);for(let se=0;se<2*C;se+=2)T.emplaceBack(te+se,te+se+1,te+se+3),T.emplaceBack(te+se,te+se+3,te+se+2),T.emplaceBack(ie+se,ie+se+3,ie+se+1),T.emplaceBack(ie+se,ie+se+2,ie+se+3);const he=new pa(y.createVertexBuffer(v,Gc.members),y.createIndexBuffer(T),o.aG.simpleSegment(0,0,v.length,T.length));return this._meshCache[f]=he,he}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,y=Math.floor(h/o.Z),v=Math.floor(f/o.Z);return{tileID:new o.Y(i,0,i,y,v),mercatorX:h,mercatorY:f}}}class Jh{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 wt(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 sr={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class yp{constructor(e,i){this.painter=e,this.terrain=i,this.pool=new Jh(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 Or?h.terrainTileRanges:null;for(const y of l){const v=this.terrain.sourceCache.getTerrainCoords(y,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(sr[l.type]&&!this._coordsAscendingStr[h]){this._coordsAscendingStr[h]={};for(const f in this._coordsAscending[h])this._coordsAscendingStr[h][f]=this._coordsAscending[h][f].map(y=>y.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(sr[l]&&(this._prevType&&sr[this._prevType]||this._stacks.push([]),this._prevType=l,this._stacks[this._stacks.length-1].push(e.id),!f))return!0;if(sr[this._prevType]||sr[l]&&f){this._prevType=l;const y=this._stacks.length-1,v=this._stacks[y]||[];for(const T of this._renderableTiles){if(this.pool.isFull()&&(ol(this.painter,this.terrain,this._rttTiles,s),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(T),T.rtt[y]){const A=this.pool.getObjectForId(T.rtt[y].id);if(A.stamp===T.rtt[y].stamp){this.pool.useObject(A);continue}}const C=this.pool.getOrCreateFreeObject();this.pool.useObject(C),this.pool.stampObject(C),T.rtt[y]={id:C.id,stamp:C.stamp},h.context.bindFramebuffer.set(C.fbo.framebuffer),h.context.clear({color:o.b7.transparent,stencil:0}),h.currentStencilSource=void 0;for(let A=0;A<v.length;A++){const E=h.style._layers[v[A]],O=E.source?this._coordsAscending[E.source][T.tileID.key]:[T.tileID];h.context.viewport.set([0,0,C.fbo.width,C.fbo.height]),h._renderTileClippingMasks(E,O,!0),h.renderLayer(h,h.style.sourceCaches[E.source],E,O,s),E.source&&(T.rttCoords[E.source]=this._coordsAscendingStr[E.source][T.tileID.key])}}return ol(this.painter,this.terrain,this._rttTiles,s),this._rttTiles=[],this.pool.freeAllObjects(),sr[l]}return!1}}const ro={"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=ue,Pi={hash:!1,interactive:!0,bearingSnap:7,attributionControl:io,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},Qh={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};class no{constructor(e,i,s=!1){this.mousedown=h=>{this.startMove(h,G.mousePos(this.element,h)),G.addEventListener(window,"mousemove",this.mousemove),G.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=h=>{this.move(h,G.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=G.touchPos(this.element,h.targetTouches)[0],this.startMove(h,this._startPos),G.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),G.addEventListener(window,"touchend",this.touchend))},this.touchmove=h=>{h.targetTouches.length!==1?this.reset():(this._lastPos=G.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 qh;this._rotatePitchHanlder=new gs({clickTolerance:3,move:(h,f)=>{const y=i.getBoundingClientRect(),v=new o.P((y.bottom-y.top)/2,(y.right-y.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,G.addEventListener(i,"mousedown",this.mousedown),G.addEventListener(i,"touchstart",this.touchstart,{passive:!1}),G.addEventListener(i,"touchcancel",this.reset)}startMove(e,i){this._rotatePitchHanlder.dragStart(e,i),G.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;G.removeEventListener(e,"mousedown",this.mousedown),G.removeEventListener(e,"touchstart",this.touchstart,{passive:!1}),G.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),G.removeEventListener(window,"touchend",this.touchend),G.removeEventListener(e,"touchcancel",this.reset),this.offTemp()}offTemp(){G.enableDrag(),G.removeEventListener(window,"mousemove",this.mousemove),G.removeEventListener(window,"mouseup",this.mouseup),G.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),G.removeEventListener(window,"touchend",this.touchend)}}let nn;function dl(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 ao={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 pl(u,e,i){const s=u.classList;for(const l in ao)s.remove(`maplibregl-${i}-anchor-${l}`);s.add(`maplibregl-${i}-anchor-${e}`)}class Pa 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?dl(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()),G.setTransform(this._element,`${ao[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${f} ${h}`),ae.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=G.create("div");const i=G.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=G.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=G.createNS("http://www.w3.org/2000/svg","g");f.setAttributeNS(null,"fill-rule","nonzero");const y=G.createNS("http://www.w3.org/2000/svg","g");y.setAttributeNS(null,"transform","translate(3.0, 29.0)"),y.setAttributeNS(null,"fill","#000000");const v=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const H of v){const K=G.createNS("http://www.w3.org/2000/svg","ellipse");K.setAttributeNS(null,"opacity","0.04"),K.setAttributeNS(null,"cx","10.5"),K.setAttributeNS(null,"cy","5.80029008"),K.setAttributeNS(null,"rx",H.rx),K.setAttributeNS(null,"ry",H.ry),y.appendChild(K)}const T=G.createNS("http://www.w3.org/2000/svg","g");T.setAttributeNS(null,"fill",this._color);const C=G.createNS("http://www.w3.org/2000/svg","path");C.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(C);const A=G.createNS("http://www.w3.org/2000/svg","g");A.setAttributeNS(null,"opacity","0.25"),A.setAttributeNS(null,"fill","#000000");const E=G.createNS("http://www.w3.org/2000/svg","path");E.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"),A.appendChild(E);const O=G.createNS("http://www.w3.org/2000/svg","g");O.setAttributeNS(null,"transform","translate(6.0, 7.0)"),O.setAttributeNS(null,"fill","#FFFFFF");const Z=G.createNS("http://www.w3.org/2000/svg","g");Z.setAttributeNS(null,"transform","translate(8.0, 8.0)");const W=G.createNS("http://www.w3.org/2000/svg","circle");W.setAttributeNS(null,"fill","#000000"),W.setAttributeNS(null,"opacity","0.25"),W.setAttributeNS(null,"cx","5.5"),W.setAttributeNS(null,"cy","5.5"),W.setAttributeNS(null,"r","5.4999962");const q=G.createNS("http://www.w3.org/2000/svg","circle");q.setAttributeNS(null,"fill","#FFFFFF"),q.setAttributeNS(null,"cx","5.5"),q.setAttributeNS(null,"cy","5.5"),q.setAttributeNS(null,"r","5.4999962"),Z.appendChild(W),Z.appendChild(q),f.appendChild(y),f.appendChild(T),f.appendChild(A),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()}),pl(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.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),G.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 A=this._map.transform.isLocationOccluded(this._lngLat)?this._opacityWhenCovered:this._opacity;return void(this._element.style.opacity!==A&&(this._element.style.opacity=A))}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 y=-this._offset.y/l.transform.pixelsPerMeter,v=Math.sin(l.getPitch()*Math.PI/180)*y,T=l.terrain.depthAtPoint(new o.P(this._pos.x,this._pos.y-this._offset.y)),C=l.transform.lngLatToCameraDepth(this._lngLat,f+v)-T>.006;!((s=this._popup)===null||s===void 0)&&s.isOpen()&&C&&this._popup.remove(),this._element.style.opacity=C?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 Wc={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let ys=0,Sa=!1;const Hc={maxWidth:100,unit:"metric"};function fl(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]),y=u.unproject([h+s/2,l]),v=Math.round(u.project(y).x-u.project(f).x),T=Math.min(s,v,u._container.clientWidth),C=f.distanceTo(y);if(i&&i.unit==="imperial"){const A=3.2808*C;A>5280?Ma(e,T,A/5280,u._getUIString("ScaleControl.Miles")):Ma(e,T,A,u._getUIString("ScaleControl.Feet"))}else i&&i.unit==="nautical"?Ma(e,T,C/1852,u._getUIString("ScaleControl.NauticalMiles")):C>=1e3?Ma(e,T,C/1e3,u._getUIString("ScaleControl.Kilometers")):Ma(e,T,C,u._getUIString("ScaleControl.Meters"))}function Ma(u,e,i,s){const l=function(h){const f=Math.pow(10,`${Math.floor(h)}`.length-1);let y=h/f;return y=y>=10?10:y>=5?5:y>=3?3:y>=2?2:y>=1?1:function(v){const T=Math.pow(10,Math.ceil(-Math.log(v)/Math.LN10));return Math.round(v*T)/T}(y),f*y}(i);u.style.width=e*(l/i)+"px",u.innerHTML=`${l}&nbsp;${s}`}const Xc={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0},Kc=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function so(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 so(new o.P(0,0))}const Yc=ue;P.AJAXError=o.cm,P.Event=o.l,P.Evented=o.E,P.LngLat=o.Q,P.MercatorCoordinate=o.$,P.Point=o.P,P.addProtocol=o.cn,P.config=o.a,P.removeProtocol=o.co,P.AttributionControl=et,P.BoxZoomHandler=wa,P.CanvasSource=Za,P.CooperativeGesturesHandler=cl,P.DoubleClickZoomHandler=$c,P.DragPanHandler=vn,P.DragRotateHandler=ni,P.EdgeInsets=ci,P.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=G.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){G.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const u=this._fullscreenButton=G.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);G.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()}},P.GeoJSONSource=jn,P.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=wi.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&&Sa)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=G.create("button","maplibregl-ctrl-geolocate",this._container),G.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=G.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Pa({element:this._dotElement}),this._circleElement=G.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Pa({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({},Wc,u)}onAdd(u){return this._map=u,this._container=G.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return o._(this,arguments,void 0,function*(e=!1){if(nn!==void 0&&!e)return nn;if(window.navigator.permissions===void 0)return nn=!!window.navigator.geolocation,nn;try{nn=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{nn=!!window.navigator.geolocation}return nn})}().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(),G.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,ys=0,Sa=!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":ys--,Sa=!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"),ys++,ys>1?(u={maximumAge:6e5,timeout:0},Sa=!0):(u=this.options.positionOptions,Sa=!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)}},P.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=G.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=G.create("button","maplibregl-ctrl-globe",this._container),G.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(){G.remove(this._container),this._map.off("styledata",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}},P.Hash=Bc,P.ImageSource=Or,P.KeyboardHandler=Zc,P.LngLatBounds=wi,P.LogoControl=ot,P.Map=class extends rn{constructor(u){var e,i;o.cj.mark(o.ck.create);const s=Object.assign(Object.assign(Object.assign({},Pi),u),{canvasContextAttributes:Object.assign(Object.assign({},Pi.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 ui,h=new dr;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 hl,this._controls=[],this._mapId=o.a4(),this._contextLost=y=>{y.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new o.l("webglcontextlost",{originalEvent:y}))},this._contextRestored=y=>{this._setupPainter(),this.resize(),this._update(),this.fire(new o.l("webglcontextrestored",{originalEvent:y}))},this._onMapScroll=y=>{if(y.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({},ro),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=pt.addThrottleControl(()=>this.isMoving()),this._requestManager=new Mt(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 y=!1;const v=Fc(T=>{this._trackResize&&!this._removed&&(this.resize(T),this.redraw())},50);this._resizeObserver=new ResizeObserver(T=>{y?v(T):y=!0}),this._resizeObserver.observe(this._container)}this.handlers=new _p(this,s),this._hash=s.hash&&new Bc(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 et(typeof s.attributionControl=="boolean"?void 0:s.attributionControl)),s.maplibreLogo&&this.addControl(new ot,s.logoPosition),this.on("style.load",()=>{if(f||this._resizeTransform(),this.transform.unmodified){const y=o.O(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(y)}}),this.on("data",y=>{this._update(y.dataType==="style"),this.fire(new o.l(`${y.dataType}data`,y))}),this.on("dataloading",y=>{this.fire(new o.l(`${y.dataType}dataloading`,y))}),this.on("dataabort",y=>{this.fire(new o.l("sourcedataabort",y))})}_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 y=this._getClampedPixelRatio(i,s);this._resizeCanvas(i,s,y),this.painter.resize(i,s,y)}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(wi.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)),y=f.length!==0?this.queryRenderedFeatures(h.point,{layers:f}):[];y.length?s||(s=!0,i.call(this,new tr(u,this,h.originalEvent,{features:y}))):s=!1},mouseout:()=>{s=!1}}}}if(u==="mouseleave"||u==="mouseout"){let s=!1;return{layers:e,listener:i,delegates:{mousemove:f=>{const y=e.filter(v=>this.getLayer(v));(y.length!==0?this.queryRenderedFeatures(f.point,{layers:y}):[]).length?s=!0:s&&(s=!1,i.call(this,new tr(u,this,f.originalEvent)))},mouseout:f=>{s&&(s=!1,i.call(this,new tr(u,this,f.originalEvent)))}}}}{const s=l=>{const h=e.filter(y=>this.getLayer(y)),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]=(...y)=>{this._removeDelegatedListener(u,s,i),f(...y)}}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 is(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 is(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 fr(this.painter,e,u),this.painter.renderToTexture=new yp(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:y,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:C,height:A,data:E}=e,O=e;return this.style.addImage(u,{data:new o.R({width:C,height:A},new Uint8Array(E)),pixelRatio:s,stretchX:h,stretchY:f,content:y,textFitWidth:v,textFitHeight:T,sdf:l,version:0,userImage:O}),O.onAdd&&O.onAdd(this,u),this}}{const{width:C,height:A,data:E}=ae.getImageData(e);this.style.addImage(u,{data:new o.R({width:C,height:A},E),pixelRatio:s,stretchX:h,stretchY:f,content:y,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)?ae.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 y=!(e instanceof HTMLImageElement||o.b(e));return i.data.replace(f,y),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 pt.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=G.create("div","maplibregl-canvas-container",u);this._interactive&&e.classList.add("maplibregl-interactive"),this._canvas=G.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=G.create("div","maplibregl-control-container",u),h=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(f=>{h[f]=G.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 jh(i,this.transform),ve.testSupport(i)}migrateProjection(u,e){super.migrateProjection(u,e),this.painter.transform=u,this.fire(new o.l("projectiontransition",{newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(u){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||u,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(u){return this._update(),this._renderTaskQueue.add(u)}_cancelRenderFrame(u){this._renderTaskQueue.remove(u)}_render(u){var e,i,s,l,h;const f=this._idleTriggered?this._fadeDuration:0,y=((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 A=this.transform.zoom,E=ae.now();this.style.zoomHistory.update(A,E);const O=new o.C(A,{now:E,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!==y;(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 C=this._sourcesDirty||this._styleDirty||this._placementDirty;return C||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new o.l("idle")),!this._loaded||this._fullyLoaded||C||(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),pt.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),G.remove(this._canvasContainer),G.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,ae.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===Dh}(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)}},P.MapMouseEvent=tr,P.MapTouchEvent=ms,P.MapWheelEvent=zr,P.Marker=Pa,P.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({},Qh,u),this._container=G.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})),G.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})),G.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=G.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 no(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){G.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=G.create("button",u,this._container);return i.type="button",i.addEventListener("click",e),i}},P.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&&G.remove(this._content),this._container&&(G.remove(this._container),delete this._container),this._closeButton&&this._closeButton.removeEventListener("click",this._onClose),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=G.create("div","maplibregl-popup",this._map.getContainer()),this._tip=G.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const y of this.options.className.split(" "))this._container.classList.add(y);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?dl(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=so(this.options.offset);if(!l){const y=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<y/2?T.push("left"):s.x>this._map.transform.width-y/2&&T.push("right"),l=T.length===0?"bottom":T.join("-")}let f=s.add(h[l]);this.options.subpixelPositioning||(f=f.round()),G.setTransform(this._container,`${ao[l]} translate(${f.x}px,${f.y}px)`),pl(this._container,l,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=o.e(Object.create(Xc),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=G.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=G.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(Kc);u&&u.focus()}},P.RasterDEMTileSource=On,P.RasterTileSource=Br,P.ScaleControl=class{constructor(u){this._onMove=()=>{fl(this._map,this._container,this.options)},this.setUnit=e=>{this.options.unit=e,fl(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Hc),u)}getDefaultPosition(){return"bottom-left"}onAdd(u){return this._map=u,this._container=G.create("div","maplibregl-ctrl maplibregl-ctrl-scale",u.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){G.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},P.ScrollZoomHandler=Kh,P.Style=is,P.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=G.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=G.create("button","maplibregl-ctrl-terrain",this._container),G.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(){G.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},P.TwoFingersTouchPitchHandler=Xh,P.TwoFingersTouchRotateHandler=Hh,P.TwoFingersTouchZoomHandler=Ct,P.TwoFingersTouchZoomRotateHandler=eo,P.VectorTileSource=ua,P.VideoSource=jr,P.addSourceType=(u,e)=>o._(void 0,void 0,void 0,function*(){if(Rs(u))throw new Error(`A source type called "${u}" already exists.`);((i,s)=>{Va[i]=s})(u,e)}),P.clearPrewarmedResources=function(){const u=Gt;u&&(u.isPreloaded()&&u.numActive()===1?(u.release(Ut),Gt=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()"))},P.createTileMesh=Oo,P.getMaxParallelImageRequests=function(){return o.a.MAX_PARALLEL_IMAGE_REQUESTS},P.getRTLTextPluginStatus=function(){return pn().getRTLTextPluginStatus()},P.getVersion=function(){return Yc},P.getWorkerCount=function(){return Ii.workerCount},P.getWorkerUrl=function(){return o.a.WORKER_URL},P.importScriptInWorkers=function(u){return Pt().broadcast("IS",u)},P.prewarm=function(){Qt().acquire(Ut)},P.setMaxParallelImageRequests=function(u){o.a.MAX_PARALLEL_IMAGE_REQUESTS=u},P.setRTLTextPlugin=function(u,e){return pn().setRTLTextPlugin(u,e)},P.setWorkerCount=function(u){Ii.workerCount=u},P.setWorkerUrl=function(u){o.a.WORKER_URL=u}});var z=b;return z})}(qu)),qu.exports}var Zy=Ny();const Zd=Oy(Zy);class Vy{constructor(m){ta(this,"marker");ta(this,"libreMarker");Mr(this,ic,vi());Mr(this,rc,vi());Mr(this,nc,vi());Mr(this,ac,vi(!1));Mr(this,sc,vi());Mr(this,oc,vi(!1));this.marker=m,this.libreMarker=void 0,this.content=void 0,this.element=void 0,this.component=void 0,this.componentRendered=!1,this.circle=void 0,this.circleRendered=!1}get element(){return We(Vt(this,ic))}set element(m){ti(Vt(this,ic),m,!0)}get content(){return We(Vt(this,rc))}set content(m){ti(Vt(this,rc),m,!0)}get component(){return We(Vt(this,nc))}set component(m){ti(Vt(this,nc),m,!0)}get componentRendered(){return We(Vt(this,ac))}set componentRendered(m){ti(Vt(this,ac),m,!0)}get circle(){return We(Vt(this,sc))}set circle(m){ti(Vt(this,sc),m,!0)}get circleRendered(){return We(Vt(this,oc))}set circleRendered(m){ti(Vt(this,oc),m,!0)}}ic=new WeakMap,rc=new WeakMap,nc=new WeakMap,ac=new WeakMap,sc=new WeakMap,oc=new WeakMap;class om{constructor(m,b,M,k,z){ta(this,"bounds1");ta(this,"bounds2");ta(this,"getBounds",(m,b,M,k)=>new Zd.LngLatBounds([m,b],[M,k]));ta(this,"contains",(m,b)=>this.bounds1.contains([b,m])||this.bounds2.contains([b,m]));const P=m.unproject([b,M]),o=m.unproject([k,z]);if(P.lng<-180){this.bounds1=this.getBounds(-180,P.lat,o.lng,o.lat),this.bounds2=this.getBounds(P.wrap().lng,P.lat,180,o.lat);return}if(o.lng>180){this.bounds1=this.getBounds(P.lng,P.lat,180,o.lat),this.bounds2=this.getBounds(-180,P.lat,o.wrap().lng,o.lat);return}this.bounds1=this.getBounds(P.lng,P.lat,o.lng,o.lat),this.bounds2=this.getBounds(0,0,0,0)}}const Uy={version:8,sources:{openmaptiles:{type:"vector",url:"https://tiles.openfreemap.org/planet"}},glyphs:"https://tiles.openfreemap.org/fonts/{fontstack}/{range}.pbf",layers:[{id:"background",type:"background",paint:{"background-color":"rgba(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}}]},$y={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 Zt;(function(_){_.assertEqual=k=>k;function m(k){}_.assertIs=m;function b(k){throw new Error}_.assertNever=b,_.arrayToEnum=k=>{const z={};for(const P of k)z[P]=P;return z},_.getValidEnumValues=k=>{const z=_.objectKeys(k).filter(o=>typeof k[k[o]]!="number"),P={};for(const o of z)P[o]=k[o];return _.objectValues(P)},_.objectValues=k=>_.objectKeys(k).map(function(z){return k[z]}),_.objectKeys=typeof Object.keys=="function"?k=>Object.keys(k):k=>{const z=[];for(const P in k)Object.prototype.hasOwnProperty.call(k,P)&&z.push(P);return z},_.find=(k,z)=>{for(const P of k)if(z(P))return P},_.isInteger=typeof Number.isInteger=="function"?k=>Number.isInteger(k):k=>typeof k=="number"&&isFinite(k)&&Math.floor(k)===k;function M(k,z=" | "){return k.map(P=>typeof P=="string"?`'${P}'`:P).join(z)}_.joinValues=M,_.jsonStringifyReplacer=(k,z)=>typeof z=="bigint"?z.toString():z})(Zt||(Zt={}));var Vd;(function(_){_.mergeShapes=(m,b)=>({...m,...b})})(Vd||(Vd={}));const Je=Zt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),aa=_=>{switch(typeof _){case"undefined":return Je.undefined;case"string":return Je.string;case"number":return isNaN(_)?Je.nan:Je.number;case"boolean":return Je.boolean;case"function":return Je.function;case"bigint":return Je.bigint;case"symbol":return Je.symbol;case"object":return Array.isArray(_)?Je.array:_===null?Je.null:_.then&&typeof _.then=="function"&&_.catch&&typeof _.catch=="function"?Je.promise:typeof Map<"u"&&_ instanceof Map?Je.map:typeof Set<"u"&&_ instanceof Set?Je.set:typeof Date<"u"&&_ instanceof Date?Je.date:Je.object;default:return Je.unknown}},je=Zt.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"]),Gy=_=>JSON.stringify(_,null,2).replace(/"([^"]+)":/g,"$1:");class Lr extends Error{get errors(){return this.issues}constructor(m){super(),this.issues=[],this.addIssue=M=>{this.issues=[...this.issues,M]},this.addIssues=(M=[])=>{this.issues=[...this.issues,...M]};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(z){return z.message},M={_errors:[]},k=z=>{for(const P of z.issues)if(P.code==="invalid_union")P.unionErrors.map(k);else if(P.code==="invalid_return_type")k(P.returnTypeError);else if(P.code==="invalid_arguments")k(P.argumentsError);else if(P.path.length===0)M._errors.push(b(P));else{let o=M,ue=0;for(;ue<P.path.length;){const re=P.path[ue];ue===P.path.length-1?(o[re]=o[re]||{_errors:[]},o[re]._errors.push(b(P))):o[re]=o[re]||{_errors:[]},o=o[re],ue++}}};return k(this),M}static assert(m){if(!(m instanceof Lr))throw new Error(`Not a ZodError: ${m}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Zt.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(m=b=>b.message){const b={},M=[];for(const k of this.issues)k.path.length>0?(b[k.path[0]]=b[k.path[0]]||[],b[k.path[0]].push(m(k))):M.push(m(k));return{formErrors:M,fieldErrors:b}}get formErrors(){return this.flatten()}}Lr.create=_=>new Lr(_);const Mo=(_,m)=>{let b;switch(_.code){case je.invalid_type:_.received===Je.undefined?b="Required":b=`Expected ${_.expected}, received ${_.received}`;break;case je.invalid_literal:b=`Invalid literal value, expected ${JSON.stringify(_.expected,Zt.jsonStringifyReplacer)}`;break;case je.unrecognized_keys:b=`Unrecognized key(s) in object: ${Zt.joinValues(_.keys,", ")}`;break;case je.invalid_union:b="Invalid input";break;case je.invalid_union_discriminator:b=`Invalid discriminator value. Expected ${Zt.joinValues(_.options)}`;break;case je.invalid_enum_value:b=`Invalid enum value. Expected ${Zt.joinValues(_.options)}, received '${_.received}'`;break;case je.invalid_arguments:b="Invalid function arguments";break;case je.invalid_return_type:b="Invalid function return type";break;case je.invalid_date:b="Invalid date";break;case je.invalid_string:typeof _.validation=="object"?"includes"in _.validation?(b=`Invalid input: must include "${_.validation.includes}"`,typeof _.validation.position=="number"&&(b=`${b} at one or more positions greater than or equal to ${_.validation.position}`)):"startsWith"in _.validation?b=`Invalid input: must start with "${_.validation.startsWith}"`:"endsWith"in _.validation?b=`Invalid input: must end with "${_.validation.endsWith}"`:Zt.assertNever(_.validation):_.validation!=="regex"?b=`Invalid ${_.validation}`:b="Invalid";break;case je.too_small:_.type==="array"?b=`Array must contain ${_.exact?"exactly":_.inclusive?"at least":"more than"} ${_.minimum} element(s)`:_.type==="string"?b=`String must contain ${_.exact?"exactly":_.inclusive?"at least":"over"} ${_.minimum} character(s)`:_.type==="number"?b=`Number must be ${_.exact?"exactly equal to ":_.inclusive?"greater than or equal to ":"greater than "}${_.minimum}`:_.type==="date"?b=`Date must be ${_.exact?"exactly equal to ":_.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(_.minimum))}`:b="Invalid input";break;case je.too_big:_.type==="array"?b=`Array must contain ${_.exact?"exactly":_.inclusive?"at most":"less than"} ${_.maximum} element(s)`:_.type==="string"?b=`String must contain ${_.exact?"exactly":_.inclusive?"at most":"under"} ${_.maximum} character(s)`:_.type==="number"?b=`Number must be ${_.exact?"exactly":_.inclusive?"less than or equal to":"less than"} ${_.maximum}`:_.type==="bigint"?b=`BigInt must be ${_.exact?"exactly":_.inclusive?"less than or equal to":"less than"} ${_.maximum}`:_.type==="date"?b=`Date must be ${_.exact?"exactly":_.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(_.maximum))}`:b="Invalid input";break;case je.custom:b="Invalid input";break;case je.invalid_intersection_types:b="Intersection results could not be merged";break;case je.not_multiple_of:b=`Number must be a multiple of ${_.multipleOf}`;break;case je.not_finite:b="Number must be finite";break;default:b=m.defaultError,Zt.assertNever(_)}return{message:b}};let lm=Mo;function qy(_){lm=_}function Wu(){return lm}const Hu=_=>{const{data:m,path:b,errorMaps:M,issueData:k}=_,z=[...b,...k.path||[]],P={...k,path:z};if(k.message!==void 0)return{...k,path:z,message:k.message};let o="";const ue=M.filter(re=>!!re).slice().reverse();for(const re of ue)o=re(P,{data:m,defaultError:o}).message;return{...k,path:z,message:o}},Wy=[];function qe(_,m){const b=Wu(),M=Hu({issueData:m,data:_.data,path:_.path,errorMaps:[_.common.contextualErrorMap,_.schemaErrorMap,b,b===Mo?void 0:Mo].filter(k=>!!k)});_.common.issues.push(M)}class lr{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(m,b){const M=[];for(const k of b){if(k.status==="aborted")return yt;k.status==="dirty"&&m.dirty(),M.push(k.value)}return{status:m.value,value:M}}static async mergeObjectAsync(m,b){const M=[];for(const k of b){const z=await k.key,P=await k.value;M.push({key:z,value:P})}return lr.mergeObjectSync(m,M)}static mergeObjectSync(m,b){const M={};for(const k of b){const{key:z,value:P}=k;if(z.status==="aborted"||P.status==="aborted")return yt;z.status==="dirty"&&m.dirty(),P.status==="dirty"&&m.dirty(),z.value!=="__proto__"&&(typeof P.value<"u"||k.alwaysSet)&&(M[z.value]=P.value)}return{status:m.value,value:M}}}const yt=Object.freeze({status:"aborted"}),Io=_=>({status:"dirty",value:_}),xr=_=>({status:"valid",value:_}),Ud=_=>_.status==="aborted",$d=_=>_.status==="dirty",Cs=_=>_.status==="valid",Ol=_=>typeof Promise<"u"&&_ instanceof Promise;function Xu(_,m,b,M){if(typeof m=="function"?_!==m||!0:!m.has(_))throw new TypeError("Cannot read private member from an object whose class did not declare it");return m.get(_)}function cm(_,m,b,M,k){if(typeof m=="function"?_!==m||!0:!m.has(_))throw new TypeError("Cannot write private member to an object whose class did not declare it");return m.set(_,b),b}typeof SuppressedError=="function"&&SuppressedError;var at;(function(_){_.errToObj=m=>typeof m=="string"?{message:m}:m||{},_.toString=m=>typeof m=="string"?m:m==null?void 0:m.message})(at||(at={}));var jl,Nl;class Ln{constructor(m,b,M,k){this._cachedPath=[],this.parent=m,this.data=b,this._path=M,this._key=k}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 um=(_,m)=>{if(Cs(m))return{success:!0,data:m.value};if(!_.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 Lr(_.common.issues);return this._error=b,this._error}}};function St(_){if(!_)return{};const{errorMap:m,invalid_type_error:b,required_error:M,description:k}=_;if(m&&(b||M))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return m?{errorMap:m,description:k}:{errorMap:(P,o)=>{var ue,re;const{message:ne}=_;return P.code==="invalid_enum_value"?{message:ne??o.defaultError}:typeof o.data>"u"?{message:(ue=ne??M)!==null&&ue!==void 0?ue:o.defaultError}:P.code!=="invalid_type"?{message:o.defaultError}:{message:(re=ne??b)!==null&&re!==void 0?re:o.defaultError}},description:k}}class zt{get description(){return this._def.description}_getType(m){return aa(m.data)}_getOrReturnCtx(m,b){return b||{common:m.parent.common,data:m.data,parsedType:aa(m.data),schemaErrorMap:this._def.errorMap,path:m.path,parent:m.parent}}_processInputParams(m){return{status:new lr,ctx:{common:m.parent.common,data:m.data,parsedType:aa(m.data),schemaErrorMap:this._def.errorMap,path:m.path,parent:m.parent}}}_parseSync(m){const b=this._parse(m);if(Ol(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 M=this.safeParse(m,b);if(M.success)return M.data;throw M.error}safeParse(m,b){var M;const k={common:{issues:[],async:(M=b==null?void 0:b.async)!==null&&M!==void 0?M:!1,contextualErrorMap:b==null?void 0:b.errorMap},path:(b==null?void 0:b.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:m,parsedType:aa(m)},z=this._parseSync({data:m,path:k.path,parent:k});return um(k,z)}"~validate"(m){var b,M;const k={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:m,parsedType:aa(m)};if(!this["~standard"].async)try{const z=this._parseSync({data:m,path:[],parent:k});return Cs(z)?{value:z.value}:{issues:k.common.issues}}catch(z){!((M=(b=z==null?void 0:z.message)===null||b===void 0?void 0:b.toLowerCase())===null||M===void 0)&&M.includes("encountered")&&(this["~standard"].async=!0),k.common={issues:[],async:!0}}return this._parseAsync({data:m,path:[],parent:k}).then(z=>Cs(z)?{value:z.value}:{issues:k.common.issues})}async parseAsync(m,b){const M=await this.safeParseAsync(m,b);if(M.success)return M.data;throw M.error}async safeParseAsync(m,b){const M={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:aa(m)},k=this._parse({data:m,path:M.path,parent:M}),z=await(Ol(k)?k:Promise.resolve(k));return um(M,z)}refine(m,b){const M=k=>typeof b=="string"||typeof b>"u"?{message:b}:typeof b=="function"?b(k):b;return this._refinement((k,z)=>{const P=m(k),o=()=>z.addIssue({code:je.custom,...M(k)});return typeof Promise<"u"&&P instanceof Promise?P.then(ue=>ue?!0:(o(),!1)):P?!0:(o(),!1)})}refinement(m,b){return this._refinement((M,k)=>m(M)?!0:(k.addIssue(typeof b=="function"?b(M,k):b),!1))}_refinement(m){return new un({schema:this,typeName:mt.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 Bn.create(this,this._def)}nullable(){return ja.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return cn.create(this)}promise(){return Ao.create(this,this._def)}or(m){return $l.create([this,m],this._def)}and(m){return Gl.create(this,m,this._def)}transform(m){return new un({...St(this._def),schema:this,typeName:mt.ZodEffects,effect:{type:"transform",transform:m}})}default(m){const b=typeof m=="function"?m:()=>m;return new Kl({...St(this._def),innerType:this,defaultValue:b,typeName:mt.ZodDefault})}brand(){return new Wd({typeName:mt.ZodBranded,type:this,...St(this._def)})}catch(m){const b=typeof m=="function"?m:()=>m;return new Yl({...St(this._def),innerType:this,catchValue:b,typeName:mt.ZodCatch})}describe(m){const b=this.constructor;return new b({...this._def,description:m})}pipe(m){return Jl.create(this,m)}readonly(){return Ql.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Hy=/^c[^\s-]{8,}$/i,Xy=/^[0-9a-z]+$/,Ky=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Yy=/^[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,Jy=/^[a-z0-9_-]{21}$/i,Qy=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,ex=/^[-+]?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)?)??$/,tx=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ix="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Gd;const rx=/^(?:(?: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])$/,nx=/^(?:(?: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])$/,ax=/^(([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]))$/,sx=/^(([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])$/,ox=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,lx=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,hm="((\\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])))",cx=new RegExp(`^${hm}$`);function dm(_){let m="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return _.precision?m=`${m}\\.\\d{${_.precision}}`:_.precision==null&&(m=`${m}(\\.\\d+)?`),m}function ux(_){return new RegExp(`^${dm(_)}$`)}function pm(_){let m=`${hm}T${dm(_)}`;const b=[];return b.push(_.local?"Z?":"Z"),_.offset&&b.push("([+-]\\d{2}:?\\d{2})"),m=`${m}(${b.join("|")})`,new RegExp(`^${m}$`)}function hx(_,m){return!!((m==="v4"||!m)&&rx.test(_)||(m==="v6"||!m)&&ax.test(_))}function dx(_,m){if(!Qy.test(_))return!1;try{const[b]=_.split("."),M=b.replace(/-/g,"+").replace(/_/g,"/").padEnd(b.length+(4-b.length%4)%4,"="),k=JSON.parse(atob(M));return!(typeof k!="object"||k===null||!k.typ||!k.alg||m&&k.alg!==m)}catch{return!1}}function px(_,m){return!!((m==="v4"||!m)&&nx.test(_)||(m==="v6"||!m)&&sx.test(_))}class ln extends zt{_parse(m){if(this._def.coerce&&(m.data=String(m.data)),this._getType(m)!==Je.string){const z=this._getOrReturnCtx(m);return qe(z,{code:je.invalid_type,expected:Je.string,received:z.parsedType}),yt}const M=new lr;let k;for(const z of this._def.checks)if(z.kind==="min")m.data.length<z.value&&(k=this._getOrReturnCtx(m,k),qe(k,{code:je.too_small,minimum:z.value,type:"string",inclusive:!0,exact:!1,message:z.message}),M.dirty());else if(z.kind==="max")m.data.length>z.value&&(k=this._getOrReturnCtx(m,k),qe(k,{code:je.too_big,maximum:z.value,type:"string",inclusive:!0,exact:!1,message:z.message}),M.dirty());else if(z.kind==="length"){const P=m.data.length>z.value,o=m.data.length<z.value;(P||o)&&(k=this._getOrReturnCtx(m,k),P?qe(k,{code:je.too_big,maximum:z.value,type:"string",inclusive:!0,exact:!0,message:z.message}):o&&qe(k,{code:je.too_small,minimum:z.value,type:"string",inclusive:!0,exact:!0,message:z.message}),M.dirty())}else if(z.kind==="email")tx.test(m.data)||(k=this._getOrReturnCtx(m,k),qe(k,{validation:"email",code:je.invalid_string,message:z.message}),M.dirty());else if(z.kind==="emoji")Gd||(Gd=new RegExp(ix,"u")),Gd.test(m.data)||(k=this._getOrReturnCtx(m,k),qe(k,{validation:"emoji",code:je.invalid_string,message:z.message}),M.dirty());else if(z.kind==="uuid")Yy.test(m.data)||(k=this._getOrReturnCtx(m,k),qe(k,{validation:"uuid",code:je.invalid_string,message:z.message}),M.dirty());else if(z.kind==="nanoid")Jy.test(m.data)||(k=this._getOrReturnCtx(m,k),qe(k,{validation:"nanoid",code:je.invalid_string,message:z.message}),M.dirty());else if(z.kind==="cuid")Hy.test(m.data)||(k=this._getOrReturnCtx(m,k),qe(k,{validation:"cuid",code:je.invalid_string,message:z.message}),M.dirty());else if(z.kind==="cuid2")Xy.test(m.data)||(k=this._getOrReturnCtx(m,k),qe(k,{validation:"cuid2",code:je.invalid_string,message:z.message}),M.dirty());else if(z.kind==="ulid")Ky.test(m.data)||(k=this._getOrReturnCtx(m,k),qe(k,{validation:"ulid",code:je.invalid_string,message:z.message}),M.dirty());else if(z.kind==="url")try{new URL(m.data)}catch{k=this._getOrReturnCtx(m,k),qe(k,{validation:"url",code:je.invalid_string,message:z.message}),M.dirty()}else z.kind==="regex"?(z.regex.lastIndex=0,z.regex.test(m.data)||(k=this._getOrReturnCtx(m,k),qe(k,{validation:"regex",code:je.invalid_string,message:z.message}),M.dirty())):z.kind==="trim"?m.data=m.data.trim():z.kind==="includes"?m.data.includes(z.value,z.position)||(k=this._getOrReturnCtx(m,k),qe(k,{code:je.invalid_string,validation:{includes:z.value,position:z.position},message:z.message}),M.dirty()):z.kind==="toLowerCase"?m.data=m.data.toLowerCase():z.kind==="toUpperCase"?m.data=m.data.toUpperCase():z.kind==="startsWith"?m.data.startsWith(z.value)||(k=this._getOrReturnCtx(m,k),qe(k,{code:je.invalid_string,validation:{startsWith:z.value},message:z.message}),M.dirty()):z.kind==="endsWith"?m.data.endsWith(z.value)||(k=this._getOrReturnCtx(m,k),qe(k,{code:je.invalid_string,validation:{endsWith:z.value},message:z.message}),M.dirty()):z.kind==="datetime"?pm(z).test(m.data)||(k=this._getOrReturnCtx(m,k),qe(k,{code:je.invalid_string,validation:"datetime",message:z.message}),M.dirty()):z.kind==="date"?cx.test(m.data)||(k=this._getOrReturnCtx(m,k),qe(k,{code:je.invalid_string,validation:"date",message:z.message}),M.dirty()):z.kind==="time"?ux(z).test(m.data)||(k=this._getOrReturnCtx(m,k),qe(k,{code:je.invalid_string,validation:"time",message:z.message}),M.dirty()):z.kind==="duration"?ex.test(m.data)||(k=this._getOrReturnCtx(m,k),qe(k,{validation:"duration",code:je.invalid_string,message:z.message}),M.dirty()):z.kind==="ip"?hx(m.data,z.version)||(k=this._getOrReturnCtx(m,k),qe(k,{validation:"ip",code:je.invalid_string,message:z.message}),M.dirty()):z.kind==="jwt"?dx(m.data,z.alg)||(k=this._getOrReturnCtx(m,k),qe(k,{validation:"jwt",code:je.invalid_string,message:z.message}),M.dirty()):z.kind==="cidr"?px(m.data,z.version)||(k=this._getOrReturnCtx(m,k),qe(k,{validation:"cidr",code:je.invalid_string,message:z.message}),M.dirty()):z.kind==="base64"?ox.test(m.data)||(k=this._getOrReturnCtx(m,k),qe(k,{validation:"base64",code:je.invalid_string,message:z.message}),M.dirty()):z.kind==="base64url"?lx.test(m.data)||(k=this._getOrReturnCtx(m,k),qe(k,{validation:"base64url",code:je.invalid_string,message:z.message}),M.dirty()):Zt.assertNever(z);return{status:M.value,value:m.data}}_regex(m,b,M){return this.refinement(k=>m.test(k),{validation:b,code:je.invalid_string,...at.errToObj(M)})}_addCheck(m){return new ln({...this._def,checks:[...this._def.checks,m]})}email(m){return this._addCheck({kind:"email",...at.errToObj(m)})}url(m){return this._addCheck({kind:"url",...at.errToObj(m)})}emoji(m){return this._addCheck({kind:"emoji",...at.errToObj(m)})}uuid(m){return this._addCheck({kind:"uuid",...at.errToObj(m)})}nanoid(m){return this._addCheck({kind:"nanoid",...at.errToObj(m)})}cuid(m){return this._addCheck({kind:"cuid",...at.errToObj(m)})}cuid2(m){return this._addCheck({kind:"cuid2",...at.errToObj(m)})}ulid(m){return this._addCheck({kind:"ulid",...at.errToObj(m)})}base64(m){return this._addCheck({kind:"base64",...at.errToObj(m)})}base64url(m){return this._addCheck({kind:"base64url",...at.errToObj(m)})}jwt(m){return this._addCheck({kind:"jwt",...at.errToObj(m)})}ip(m){return this._addCheck({kind:"ip",...at.errToObj(m)})}cidr(m){return this._addCheck({kind:"cidr",...at.errToObj(m)})}datetime(m){var b,M;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:(M=m==null?void 0:m.local)!==null&&M!==void 0?M:!1,...at.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,...at.errToObj(m==null?void 0:m.message)})}duration(m){return this._addCheck({kind:"duration",...at.errToObj(m)})}regex(m,b){return this._addCheck({kind:"regex",regex:m,...at.errToObj(b)})}includes(m,b){return this._addCheck({kind:"includes",value:m,position:b==null?void 0:b.position,...at.errToObj(b==null?void 0:b.message)})}startsWith(m,b){return this._addCheck({kind:"startsWith",value:m,...at.errToObj(b)})}endsWith(m,b){return this._addCheck({kind:"endsWith",value:m,...at.errToObj(b)})}min(m,b){return this._addCheck({kind:"min",value:m,...at.errToObj(b)})}max(m,b){return this._addCheck({kind:"max",value:m,...at.errToObj(b)})}length(m,b){return this._addCheck({kind:"length",value:m,...at.errToObj(b)})}nonempty(m){return this.min(1,at.errToObj(m))}trim(){return new ln({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ln({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ln({...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}}ln.create=_=>{var m;return new ln({checks:[],typeName:mt.ZodString,coerce:(m=_==null?void 0:_.coerce)!==null&&m!==void 0?m:!1,...St(_)})};function fx(_,m){const b=(_.toString().split(".")[1]||"").length,M=(m.toString().split(".")[1]||"").length,k=b>M?b:M,z=parseInt(_.toFixed(k).replace(".","")),P=parseInt(m.toFixed(k).replace(".",""));return z%P/Math.pow(10,k)}class Fa extends zt{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)!==Je.number){const z=this._getOrReturnCtx(m);return qe(z,{code:je.invalid_type,expected:Je.number,received:z.parsedType}),yt}let M;const k=new lr;for(const z of this._def.checks)z.kind==="int"?Zt.isInteger(m.data)||(M=this._getOrReturnCtx(m,M),qe(M,{code:je.invalid_type,expected:"integer",received:"float",message:z.message}),k.dirty()):z.kind==="min"?(z.inclusive?m.data<z.value:m.data<=z.value)&&(M=this._getOrReturnCtx(m,M),qe(M,{code:je.too_small,minimum:z.value,type:"number",inclusive:z.inclusive,exact:!1,message:z.message}),k.dirty()):z.kind==="max"?(z.inclusive?m.data>z.value:m.data>=z.value)&&(M=this._getOrReturnCtx(m,M),qe(M,{code:je.too_big,maximum:z.value,type:"number",inclusive:z.inclusive,exact:!1,message:z.message}),k.dirty()):z.kind==="multipleOf"?fx(m.data,z.value)!==0&&(M=this._getOrReturnCtx(m,M),qe(M,{code:je.not_multiple_of,multipleOf:z.value,message:z.message}),k.dirty()):z.kind==="finite"?Number.isFinite(m.data)||(M=this._getOrReturnCtx(m,M),qe(M,{code:je.not_finite,message:z.message}),k.dirty()):Zt.assertNever(z);return{status:k.value,value:m.data}}gte(m,b){return this.setLimit("min",m,!0,at.toString(b))}gt(m,b){return this.setLimit("min",m,!1,at.toString(b))}lte(m,b){return this.setLimit("max",m,!0,at.toString(b))}lt(m,b){return this.setLimit("max",m,!1,at.toString(b))}setLimit(m,b,M,k){return new Fa({...this._def,checks:[...this._def.checks,{kind:m,value:b,inclusive:M,message:at.toString(k)}]})}_addCheck(m){return new Fa({...this._def,checks:[...this._def.checks,m]})}int(m){return this._addCheck({kind:"int",message:at.toString(m)})}positive(m){return this._addCheck({kind:"min",value:0,inclusive:!1,message:at.toString(m)})}negative(m){return this._addCheck({kind:"max",value:0,inclusive:!1,message:at.toString(m)})}nonpositive(m){return this._addCheck({kind:"max",value:0,inclusive:!0,message:at.toString(m)})}nonnegative(m){return this._addCheck({kind:"min",value:0,inclusive:!0,message:at.toString(m)})}multipleOf(m,b){return this._addCheck({kind:"multipleOf",value:m,message:at.toString(b)})}finite(m){return this._addCheck({kind:"finite",message:at.toString(m)})}safe(m){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:at.toString(m)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:at.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"&&Zt.isInteger(m.value))}get isFinite(){let m=null,b=null;for(const M of this._def.checks){if(M.kind==="finite"||M.kind==="int"||M.kind==="multipleOf")return!0;M.kind==="min"?(b===null||M.value>b)&&(b=M.value):M.kind==="max"&&(m===null||M.value<m)&&(m=M.value)}return Number.isFinite(b)&&Number.isFinite(m)}}Fa.create=_=>new Fa({checks:[],typeName:mt.ZodNumber,coerce:(_==null?void 0:_.coerce)||!1,...St(_)});class Ba extends zt{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)!==Je.bigint)return this._getInvalidInput(m);let M;const k=new lr;for(const z of this._def.checks)z.kind==="min"?(z.inclusive?m.data<z.value:m.data<=z.value)&&(M=this._getOrReturnCtx(m,M),qe(M,{code:je.too_small,type:"bigint",minimum:z.value,inclusive:z.inclusive,message:z.message}),k.dirty()):z.kind==="max"?(z.inclusive?m.data>z.value:m.data>=z.value)&&(M=this._getOrReturnCtx(m,M),qe(M,{code:je.too_big,type:"bigint",maximum:z.value,inclusive:z.inclusive,message:z.message}),k.dirty()):z.kind==="multipleOf"?m.data%z.value!==BigInt(0)&&(M=this._getOrReturnCtx(m,M),qe(M,{code:je.not_multiple_of,multipleOf:z.value,message:z.message}),k.dirty()):Zt.assertNever(z);return{status:k.value,value:m.data}}_getInvalidInput(m){const b=this._getOrReturnCtx(m);return qe(b,{code:je.invalid_type,expected:Je.bigint,received:b.parsedType}),yt}gte(m,b){return this.setLimit("min",m,!0,at.toString(b))}gt(m,b){return this.setLimit("min",m,!1,at.toString(b))}lte(m,b){return this.setLimit("max",m,!0,at.toString(b))}lt(m,b){return this.setLimit("max",m,!1,at.toString(b))}setLimit(m,b,M,k){return new Ba({...this._def,checks:[...this._def.checks,{kind:m,value:b,inclusive:M,message:at.toString(k)}]})}_addCheck(m){return new Ba({...this._def,checks:[...this._def.checks,m]})}positive(m){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:at.toString(m)})}negative(m){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:at.toString(m)})}nonpositive(m){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:at.toString(m)})}nonnegative(m){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:at.toString(m)})}multipleOf(m,b){return this._addCheck({kind:"multipleOf",value:m,message:at.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}}Ba.create=_=>{var m;return new Ba({checks:[],typeName:mt.ZodBigInt,coerce:(m=_==null?void 0:_.coerce)!==null&&m!==void 0?m:!1,...St(_)})};class Zl extends zt{_parse(m){if(this._def.coerce&&(m.data=!!m.data),this._getType(m)!==Je.boolean){const M=this._getOrReturnCtx(m);return qe(M,{code:je.invalid_type,expected:Je.boolean,received:M.parsedType}),yt}return xr(m.data)}}Zl.create=_=>new Zl({typeName:mt.ZodBoolean,coerce:(_==null?void 0:_.coerce)||!1,...St(_)});class ks extends zt{_parse(m){if(this._def.coerce&&(m.data=new Date(m.data)),this._getType(m)!==Je.date){const z=this._getOrReturnCtx(m);return qe(z,{code:je.invalid_type,expected:Je.date,received:z.parsedType}),yt}if(isNaN(m.data.getTime())){const z=this._getOrReturnCtx(m);return qe(z,{code:je.invalid_date}),yt}const M=new lr;let k;for(const z of this._def.checks)z.kind==="min"?m.data.getTime()<z.value&&(k=this._getOrReturnCtx(m,k),qe(k,{code:je.too_small,message:z.message,inclusive:!0,exact:!1,minimum:z.value,type:"date"}),M.dirty()):z.kind==="max"?m.data.getTime()>z.value&&(k=this._getOrReturnCtx(m,k),qe(k,{code:je.too_big,message:z.message,inclusive:!0,exact:!1,maximum:z.value,type:"date"}),M.dirty()):Zt.assertNever(z);return{status:M.value,value:new Date(m.data.getTime())}}_addCheck(m){return new ks({...this._def,checks:[...this._def.checks,m]})}min(m,b){return this._addCheck({kind:"min",value:m.getTime(),message:at.toString(b)})}max(m,b){return this._addCheck({kind:"max",value:m.getTime(),message:at.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}}ks.create=_=>new ks({checks:[],coerce:(_==null?void 0:_.coerce)||!1,typeName:mt.ZodDate,...St(_)});class Ku extends zt{_parse(m){if(this._getType(m)!==Je.symbol){const M=this._getOrReturnCtx(m);return qe(M,{code:je.invalid_type,expected:Je.symbol,received:M.parsedType}),yt}return xr(m.data)}}Ku.create=_=>new Ku({typeName:mt.ZodSymbol,...St(_)});class Vl extends zt{_parse(m){if(this._getType(m)!==Je.undefined){const M=this._getOrReturnCtx(m);return qe(M,{code:je.invalid_type,expected:Je.undefined,received:M.parsedType}),yt}return xr(m.data)}}Vl.create=_=>new Vl({typeName:mt.ZodUndefined,...St(_)});class Ul extends zt{_parse(m){if(this._getType(m)!==Je.null){const M=this._getOrReturnCtx(m);return qe(M,{code:je.invalid_type,expected:Je.null,received:M.parsedType}),yt}return xr(m.data)}}Ul.create=_=>new Ul({typeName:mt.ZodNull,...St(_)});class Co extends zt{constructor(){super(...arguments),this._any=!0}_parse(m){return xr(m.data)}}Co.create=_=>new Co({typeName:mt.ZodAny,...St(_)});class Es extends zt{constructor(){super(...arguments),this._unknown=!0}_parse(m){return xr(m.data)}}Es.create=_=>new Es({typeName:mt.ZodUnknown,...St(_)});class sa extends zt{_parse(m){const b=this._getOrReturnCtx(m);return qe(b,{code:je.invalid_type,expected:Je.never,received:b.parsedType}),yt}}sa.create=_=>new sa({typeName:mt.ZodNever,...St(_)});class Yu extends zt{_parse(m){if(this._getType(m)!==Je.undefined){const M=this._getOrReturnCtx(m);return qe(M,{code:je.invalid_type,expected:Je.void,received:M.parsedType}),yt}return xr(m.data)}}Yu.create=_=>new Yu({typeName:mt.ZodVoid,...St(_)});class cn extends zt{_parse(m){const{ctx:b,status:M}=this._processInputParams(m),k=this._def;if(b.parsedType!==Je.array)return qe(b,{code:je.invalid_type,expected:Je.array,received:b.parsedType}),yt;if(k.exactLength!==null){const P=b.data.length>k.exactLength.value,o=b.data.length<k.exactLength.value;(P||o)&&(qe(b,{code:P?je.too_big:je.too_small,minimum:o?k.exactLength.value:void 0,maximum:P?k.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:k.exactLength.message}),M.dirty())}if(k.minLength!==null&&b.data.length<k.minLength.value&&(qe(b,{code:je.too_small,minimum:k.minLength.value,type:"array",inclusive:!0,exact:!1,message:k.minLength.message}),M.dirty()),k.maxLength!==null&&b.data.length>k.maxLength.value&&(qe(b,{code:je.too_big,maximum:k.maxLength.value,type:"array",inclusive:!0,exact:!1,message:k.maxLength.message}),M.dirty()),b.common.async)return Promise.all([...b.data].map((P,o)=>k.type._parseAsync(new Ln(b,P,b.path,o)))).then(P=>lr.mergeArray(M,P));const z=[...b.data].map((P,o)=>k.type._parseSync(new Ln(b,P,b.path,o)));return lr.mergeArray(M,z)}get element(){return this._def.type}min(m,b){return new cn({...this._def,minLength:{value:m,message:at.toString(b)}})}max(m,b){return new cn({...this._def,maxLength:{value:m,message:at.toString(b)}})}length(m,b){return new cn({...this._def,exactLength:{value:m,message:at.toString(b)}})}nonempty(m){return this.min(1,m)}}cn.create=(_,m)=>new cn({type:_,minLength:null,maxLength:null,exactLength:null,typeName:mt.ZodArray,...St(m)});function ko(_){if(_ instanceof Si){const m={};for(const b in _.shape){const M=_.shape[b];m[b]=Bn.create(ko(M))}return new Si({..._._def,shape:()=>m})}else return _ instanceof cn?new cn({..._._def,type:ko(_.element)}):_ instanceof Bn?Bn.create(ko(_.unwrap())):_ instanceof ja?ja.create(ko(_.unwrap())):_ instanceof Fn?Fn.create(_.items.map(m=>ko(m))):_}class Si extends zt{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=Zt.objectKeys(m);return this._cached={shape:m,keys:b}}_parse(m){if(this._getType(m)!==Je.object){const re=this._getOrReturnCtx(m);return qe(re,{code:je.invalid_type,expected:Je.object,received:re.parsedType}),yt}const{status:M,ctx:k}=this._processInputParams(m),{shape:z,keys:P}=this._getCached(),o=[];if(!(this._def.catchall instanceof sa&&this._def.unknownKeys==="strip"))for(const re in k.data)P.includes(re)||o.push(re);const ue=[];for(const re of P){const ne=z[re],_e=k.data[re];ue.push({key:{status:"valid",value:re},value:ne._parse(new Ln(k,_e,k.path,re)),alwaysSet:re in k.data})}if(this._def.catchall instanceof sa){const re=this._def.unknownKeys;if(re==="passthrough")for(const ne of o)ue.push({key:{status:"valid",value:ne},value:{status:"valid",value:k.data[ne]}});else if(re==="strict")o.length>0&&(qe(k,{code:je.unrecognized_keys,keys:o}),M.dirty());else if(re!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const re=this._def.catchall;for(const ne of o){const _e=k.data[ne];ue.push({key:{status:"valid",value:ne},value:re._parse(new Ln(k,_e,k.path,ne)),alwaysSet:ne in k.data})}}return k.common.async?Promise.resolve().then(async()=>{const re=[];for(const ne of ue){const _e=await ne.key,ae=await ne.value;re.push({key:_e,value:ae,alwaysSet:ne.alwaysSet})}return re}).then(re=>lr.mergeObjectSync(M,re)):lr.mergeObjectSync(M,ue)}get shape(){return this._def.shape()}strict(m){return at.errToObj,new Si({...this._def,unknownKeys:"strict",...m!==void 0?{errorMap:(b,M)=>{var k,z,P,o;const ue=(P=(z=(k=this._def).errorMap)===null||z===void 0?void 0:z.call(k,b,M).message)!==null&&P!==void 0?P:M.defaultError;return b.code==="unrecognized_keys"?{message:(o=at.errToObj(m).message)!==null&&o!==void 0?o:ue}:{message:ue}}}:{}})}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:mt.ZodObject})}setKey(m,b){return this.augment({[m]:b})}catchall(m){return new Si({...this._def,catchall:m})}pick(m){const b={};return Zt.objectKeys(m).forEach(M=>{m[M]&&this.shape[M]&&(b[M]=this.shape[M])}),new Si({...this._def,shape:()=>b})}omit(m){const b={};return Zt.objectKeys(this.shape).forEach(M=>{m[M]||(b[M]=this.shape[M])}),new Si({...this._def,shape:()=>b})}deepPartial(){return ko(this)}partial(m){const b={};return Zt.objectKeys(this.shape).forEach(M=>{const k=this.shape[M];m&&!m[M]?b[M]=k:b[M]=k.optional()}),new Si({...this._def,shape:()=>b})}required(m){const b={};return Zt.objectKeys(this.shape).forEach(M=>{if(m&&!m[M])b[M]=this.shape[M];else{let z=this.shape[M];for(;z instanceof Bn;)z=z._def.innerType;b[M]=z}}),new Si({...this._def,shape:()=>b})}keyof(){return fm(Zt.objectKeys(this.shape))}}Si.create=(_,m)=>new Si({shape:()=>_,unknownKeys:"strip",catchall:sa.create(),typeName:mt.ZodObject,...St(m)}),Si.strictCreate=(_,m)=>new Si({shape:()=>_,unknownKeys:"strict",catchall:sa.create(),typeName:mt.ZodObject,...St(m)}),Si.lazycreate=(_,m)=>new Si({shape:_,unknownKeys:"strip",catchall:sa.create(),typeName:mt.ZodObject,...St(m)});class $l extends zt{_parse(m){const{ctx:b}=this._processInputParams(m),M=this._def.options;function k(z){for(const o of z)if(o.result.status==="valid")return o.result;for(const o of z)if(o.result.status==="dirty")return b.common.issues.push(...o.ctx.common.issues),o.result;const P=z.map(o=>new Lr(o.ctx.common.issues));return qe(b,{code:je.invalid_union,unionErrors:P}),yt}if(b.common.async)return Promise.all(M.map(async z=>{const P={...b,common:{...b.common,issues:[]},parent:null};return{result:await z._parseAsync({data:b.data,path:b.path,parent:P}),ctx:P}})).then(k);{let z;const P=[];for(const ue of M){const re={...b,common:{...b.common,issues:[]},parent:null},ne=ue._parseSync({data:b.data,path:b.path,parent:re});if(ne.status==="valid")return ne;ne.status==="dirty"&&!z&&(z={result:ne,ctx:re}),re.common.issues.length&&P.push(re.common.issues)}if(z)return b.common.issues.push(...z.ctx.common.issues),z.result;const o=P.map(ue=>new Lr(ue));return qe(b,{code:je.invalid_union,unionErrors:o}),yt}}get options(){return this._def.options}}$l.create=(_,m)=>new $l({options:_,typeName:mt.ZodUnion,...St(m)});const oa=_=>_ instanceof Wl?oa(_.schema):_ instanceof un?oa(_.innerType()):_ instanceof Hl?[_.value]:_ instanceof Oa?_.options:_ instanceof Xl?Zt.objectValues(_.enum):_ instanceof Kl?oa(_._def.innerType):_ instanceof Vl?[void 0]:_ instanceof Ul?[null]:_ instanceof Bn?[void 0,...oa(_.unwrap())]:_ instanceof ja?[null,...oa(_.unwrap())]:_ instanceof Wd||_ instanceof Ql?oa(_.unwrap()):_ instanceof Yl?oa(_._def.innerType):[];class Ju extends zt{_parse(m){const{ctx:b}=this._processInputParams(m);if(b.parsedType!==Je.object)return qe(b,{code:je.invalid_type,expected:Je.object,received:b.parsedType}),yt;const M=this.discriminator,k=b.data[M],z=this.optionsMap.get(k);return z?b.common.async?z._parseAsync({data:b.data,path:b.path,parent:b}):z._parseSync({data:b.data,path:b.path,parent:b}):(qe(b,{code:je.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[M]}),yt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(m,b,M){const k=new Map;for(const z of b){const P=oa(z.shape[m]);if(!P.length)throw new Error(`A discriminator value for key \`${m}\` could not be extracted from all schema options`);for(const o of P){if(k.has(o))throw new Error(`Discriminator property ${String(m)} has duplicate value ${String(o)}`);k.set(o,z)}}return new Ju({typeName:mt.ZodDiscriminatedUnion,discriminator:m,options:b,optionsMap:k,...St(M)})}}function qd(_,m){const b=aa(_),M=aa(m);if(_===m)return{valid:!0,data:_};if(b===Je.object&&M===Je.object){const k=Zt.objectKeys(m),z=Zt.objectKeys(_).filter(o=>k.indexOf(o)!==-1),P={..._,...m};for(const o of z){const ue=qd(_[o],m[o]);if(!ue.valid)return{valid:!1};P[o]=ue.data}return{valid:!0,data:P}}else if(b===Je.array&&M===Je.array){if(_.length!==m.length)return{valid:!1};const k=[];for(let z=0;z<_.length;z++){const P=_[z],o=m[z],ue=qd(P,o);if(!ue.valid)return{valid:!1};k.push(ue.data)}return{valid:!0,data:k}}else return b===Je.date&&M===Je.date&&+_==+m?{valid:!0,data:_}:{valid:!1}}class Gl extends zt{_parse(m){const{status:b,ctx:M}=this._processInputParams(m),k=(z,P)=>{if(Ud(z)||Ud(P))return yt;const o=qd(z.value,P.value);return o.valid?(($d(z)||$d(P))&&b.dirty(),{status:b.value,value:o.data}):(qe(M,{code:je.invalid_intersection_types}),yt)};return M.common.async?Promise.all([this._def.left._parseAsync({data:M.data,path:M.path,parent:M}),this._def.right._parseAsync({data:M.data,path:M.path,parent:M})]).then(([z,P])=>k(z,P)):k(this._def.left._parseSync({data:M.data,path:M.path,parent:M}),this._def.right._parseSync({data:M.data,path:M.path,parent:M}))}}Gl.create=(_,m,b)=>new Gl({left:_,right:m,typeName:mt.ZodIntersection,...St(b)});class Fn extends zt{_parse(m){const{status:b,ctx:M}=this._processInputParams(m);if(M.parsedType!==Je.array)return qe(M,{code:je.invalid_type,expected:Je.array,received:M.parsedType}),yt;if(M.data.length<this._def.items.length)return qe(M,{code:je.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),yt;!this._def.rest&&M.data.length>this._def.items.length&&(qe(M,{code:je.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),b.dirty());const z=[...M.data].map((P,o)=>{const ue=this._def.items[o]||this._def.rest;return ue?ue._parse(new Ln(M,P,M.path,o)):null}).filter(P=>!!P);return M.common.async?Promise.all(z).then(P=>lr.mergeArray(b,P)):lr.mergeArray(b,z)}get items(){return this._def.items}rest(m){return new Fn({...this._def,rest:m})}}Fn.create=(_,m)=>{if(!Array.isArray(_))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Fn({items:_,typeName:mt.ZodTuple,rest:null,...St(m)})};class ql extends zt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(m){const{status:b,ctx:M}=this._processInputParams(m);if(M.parsedType!==Je.object)return qe(M,{code:je.invalid_type,expected:Je.object,received:M.parsedType}),yt;const k=[],z=this._def.keyType,P=this._def.valueType;for(const o in M.data)k.push({key:z._parse(new Ln(M,o,M.path,o)),value:P._parse(new Ln(M,M.data[o],M.path,o)),alwaysSet:o in M.data});return M.common.async?lr.mergeObjectAsync(b,k):lr.mergeObjectSync(b,k)}get element(){return this._def.valueType}static create(m,b,M){return b instanceof zt?new ql({keyType:m,valueType:b,typeName:mt.ZodRecord,...St(M)}):new ql({keyType:ln.create(),valueType:m,typeName:mt.ZodRecord,...St(b)})}}class Qu extends zt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(m){const{status:b,ctx:M}=this._processInputParams(m);if(M.parsedType!==Je.map)return qe(M,{code:je.invalid_type,expected:Je.map,received:M.parsedType}),yt;const k=this._def.keyType,z=this._def.valueType,P=[...M.data.entries()].map(([o,ue],re)=>({key:k._parse(new Ln(M,o,M.path,[re,"key"])),value:z._parse(new Ln(M,ue,M.path,[re,"value"]))}));if(M.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const ue of P){const re=await ue.key,ne=await ue.value;if(re.status==="aborted"||ne.status==="aborted")return yt;(re.status==="dirty"||ne.status==="dirty")&&b.dirty(),o.set(re.value,ne.value)}return{status:b.value,value:o}})}else{const o=new Map;for(const ue of P){const re=ue.key,ne=ue.value;if(re.status==="aborted"||ne.status==="aborted")return yt;(re.status==="dirty"||ne.status==="dirty")&&b.dirty(),o.set(re.value,ne.value)}return{status:b.value,value:o}}}}Qu.create=(_,m,b)=>new Qu({valueType:m,keyType:_,typeName:mt.ZodMap,...St(b)});class As extends zt{_parse(m){const{status:b,ctx:M}=this._processInputParams(m);if(M.parsedType!==Je.set)return qe(M,{code:je.invalid_type,expected:Je.set,received:M.parsedType}),yt;const k=this._def;k.minSize!==null&&M.data.size<k.minSize.value&&(qe(M,{code:je.too_small,minimum:k.minSize.value,type:"set",inclusive:!0,exact:!1,message:k.minSize.message}),b.dirty()),k.maxSize!==null&&M.data.size>k.maxSize.value&&(qe(M,{code:je.too_big,maximum:k.maxSize.value,type:"set",inclusive:!0,exact:!1,message:k.maxSize.message}),b.dirty());const z=this._def.valueType;function P(ue){const re=new Set;for(const ne of ue){if(ne.status==="aborted")return yt;ne.status==="dirty"&&b.dirty(),re.add(ne.value)}return{status:b.value,value:re}}const o=[...M.data.values()].map((ue,re)=>z._parse(new Ln(M,ue,M.path,re)));return M.common.async?Promise.all(o).then(ue=>P(ue)):P(o)}min(m,b){return new As({...this._def,minSize:{value:m,message:at.toString(b)}})}max(m,b){return new As({...this._def,maxSize:{value:m,message:at.toString(b)}})}size(m,b){return this.min(m,b).max(m,b)}nonempty(m){return this.min(1,m)}}As.create=(_,m)=>new As({valueType:_,minSize:null,maxSize:null,typeName:mt.ZodSet,...St(m)});class Eo extends zt{constructor(){super(...arguments),this.validate=this.implement}_parse(m){const{ctx:b}=this._processInputParams(m);if(b.parsedType!==Je.function)return qe(b,{code:je.invalid_type,expected:Je.function,received:b.parsedType}),yt;function M(o,ue){return Hu({data:o,path:b.path,errorMaps:[b.common.contextualErrorMap,b.schemaErrorMap,Wu(),Mo].filter(re=>!!re),issueData:{code:je.invalid_arguments,argumentsError:ue}})}function k(o,ue){return Hu({data:o,path:b.path,errorMaps:[b.common.contextualErrorMap,b.schemaErrorMap,Wu(),Mo].filter(re=>!!re),issueData:{code:je.invalid_return_type,returnTypeError:ue}})}const z={errorMap:b.common.contextualErrorMap},P=b.data;if(this._def.returns instanceof Ao){const o=this;return xr(async function(...ue){const re=new Lr([]),ne=await o._def.args.parseAsync(ue,z).catch(G=>{throw re.addIssue(M(ue,G)),re}),_e=await Reflect.apply(P,this,ne);return await o._def.returns._def.type.parseAsync(_e,z).catch(G=>{throw re.addIssue(k(_e,G)),re})})}else{const o=this;return xr(function(...ue){const re=o._def.args.safeParse(ue,z);if(!re.success)throw new Lr([M(ue,re.error)]);const ne=Reflect.apply(P,this,re.data),_e=o._def.returns.safeParse(ne,z);if(!_e.success)throw new Lr([k(ne,_e.error)]);return _e.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...m){return new Eo({...this._def,args:Fn.create(m).rest(Es.create())})}returns(m){return new Eo({...this._def,returns:m})}implement(m){return this.parse(m)}strictImplement(m){return this.parse(m)}static create(m,b,M){return new Eo({args:m||Fn.create([]).rest(Es.create()),returns:b||Es.create(),typeName:mt.ZodFunction,...St(M)})}}class Wl extends zt{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})}}Wl.create=(_,m)=>new Wl({getter:_,typeName:mt.ZodLazy,...St(m)});class Hl extends zt{_parse(m){if(m.data!==this._def.value){const b=this._getOrReturnCtx(m);return qe(b,{received:b.data,code:je.invalid_literal,expected:this._def.value}),yt}return{status:"valid",value:m.data}}get value(){return this._def.value}}Hl.create=(_,m)=>new Hl({value:_,typeName:mt.ZodLiteral,...St(m)});function fm(_,m){return new Oa({values:_,typeName:mt.ZodEnum,...St(m)})}class Oa extends zt{constructor(){super(...arguments),jl.set(this,void 0)}_parse(m){if(typeof m.data!="string"){const b=this._getOrReturnCtx(m),M=this._def.values;return qe(b,{expected:Zt.joinValues(M),received:b.parsedType,code:je.invalid_type}),yt}if(Xu(this,jl)||cm(this,jl,new Set(this._def.values)),!Xu(this,jl).has(m.data)){const b=this._getOrReturnCtx(m),M=this._def.values;return qe(b,{received:b.data,code:je.invalid_enum_value,options:M}),yt}return xr(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 Oa.create(m,{...this._def,...b})}exclude(m,b=this._def){return Oa.create(this.options.filter(M=>!m.includes(M)),{...this._def,...b})}}jl=new WeakMap,Oa.create=fm;class Xl extends zt{constructor(){super(...arguments),Nl.set(this,void 0)}_parse(m){const b=Zt.getValidEnumValues(this._def.values),M=this._getOrReturnCtx(m);if(M.parsedType!==Je.string&&M.parsedType!==Je.number){const k=Zt.objectValues(b);return qe(M,{expected:Zt.joinValues(k),received:M.parsedType,code:je.invalid_type}),yt}if(Xu(this,Nl)||cm(this,Nl,new Set(Zt.getValidEnumValues(this._def.values))),!Xu(this,Nl).has(m.data)){const k=Zt.objectValues(b);return qe(M,{received:M.data,code:je.invalid_enum_value,options:k}),yt}return xr(m.data)}get enum(){return this._def.values}}Nl=new WeakMap,Xl.create=(_,m)=>new Xl({values:_,typeName:mt.ZodNativeEnum,...St(m)});class Ao extends zt{unwrap(){return this._def.type}_parse(m){const{ctx:b}=this._processInputParams(m);if(b.parsedType!==Je.promise&&b.common.async===!1)return qe(b,{code:je.invalid_type,expected:Je.promise,received:b.parsedType}),yt;const M=b.parsedType===Je.promise?b.data:Promise.resolve(b.data);return xr(M.then(k=>this._def.type.parseAsync(k,{path:b.path,errorMap:b.common.contextualErrorMap})))}}Ao.create=(_,m)=>new Ao({type:_,typeName:mt.ZodPromise,...St(m)});class un extends zt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===mt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(m){const{status:b,ctx:M}=this._processInputParams(m),k=this._def.effect||null,z={addIssue:P=>{qe(M,P),P.fatal?b.abort():b.dirty()},get path(){return M.path}};if(z.addIssue=z.addIssue.bind(z),k.type==="preprocess"){const P=k.transform(M.data,z);if(M.common.async)return Promise.resolve(P).then(async o=>{if(b.value==="aborted")return yt;const ue=await this._def.schema._parseAsync({data:o,path:M.path,parent:M});return ue.status==="aborted"?yt:ue.status==="dirty"||b.value==="dirty"?Io(ue.value):ue});{if(b.value==="aborted")return yt;const o=this._def.schema._parseSync({data:P,path:M.path,parent:M});return o.status==="aborted"?yt:o.status==="dirty"||b.value==="dirty"?Io(o.value):o}}if(k.type==="refinement"){const P=o=>{const ue=k.refinement(o,z);if(M.common.async)return Promise.resolve(ue);if(ue instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(M.common.async===!1){const o=this._def.schema._parseSync({data:M.data,path:M.path,parent:M});return o.status==="aborted"?yt:(o.status==="dirty"&&b.dirty(),P(o.value),{status:b.value,value:o.value})}else return this._def.schema._parseAsync({data:M.data,path:M.path,parent:M}).then(o=>o.status==="aborted"?yt:(o.status==="dirty"&&b.dirty(),P(o.value).then(()=>({status:b.value,value:o.value}))))}if(k.type==="transform")if(M.common.async===!1){const P=this._def.schema._parseSync({data:M.data,path:M.path,parent:M});if(!Cs(P))return P;const o=k.transform(P.value,z);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:M.data,path:M.path,parent:M}).then(P=>Cs(P)?Promise.resolve(k.transform(P.value,z)).then(o=>({status:b.value,value:o})):P);Zt.assertNever(k)}}un.create=(_,m,b)=>new un({schema:_,typeName:mt.ZodEffects,effect:m,...St(b)}),un.createWithPreprocess=(_,m,b)=>new un({schema:m,effect:{type:"preprocess",transform:_},typeName:mt.ZodEffects,...St(b)});class Bn extends zt{_parse(m){return this._getType(m)===Je.undefined?xr(void 0):this._def.innerType._parse(m)}unwrap(){return this._def.innerType}}Bn.create=(_,m)=>new Bn({innerType:_,typeName:mt.ZodOptional,...St(m)});class ja extends zt{_parse(m){return this._getType(m)===Je.null?xr(null):this._def.innerType._parse(m)}unwrap(){return this._def.innerType}}ja.create=(_,m)=>new ja({innerType:_,typeName:mt.ZodNullable,...St(m)});class Kl extends zt{_parse(m){const{ctx:b}=this._processInputParams(m);let M=b.data;return b.parsedType===Je.undefined&&(M=this._def.defaultValue()),this._def.innerType._parse({data:M,path:b.path,parent:b})}removeDefault(){return this._def.innerType}}Kl.create=(_,m)=>new Kl({innerType:_,typeName:mt.ZodDefault,defaultValue:typeof m.default=="function"?m.default:()=>m.default,...St(m)});class Yl extends zt{_parse(m){const{ctx:b}=this._processInputParams(m),M={...b,common:{...b.common,issues:[]}},k=this._def.innerType._parse({data:M.data,path:M.path,parent:{...M}});return Ol(k)?k.then(z=>({status:"valid",value:z.status==="valid"?z.value:this._def.catchValue({get error(){return new Lr(M.common.issues)},input:M.data})})):{status:"valid",value:k.status==="valid"?k.value:this._def.catchValue({get error(){return new Lr(M.common.issues)},input:M.data})}}removeCatch(){return this._def.innerType}}Yl.create=(_,m)=>new Yl({innerType:_,typeName:mt.ZodCatch,catchValue:typeof m.catch=="function"?m.catch:()=>m.catch,...St(m)});class eh extends zt{_parse(m){if(this._getType(m)!==Je.nan){const M=this._getOrReturnCtx(m);return qe(M,{code:je.invalid_type,expected:Je.nan,received:M.parsedType}),yt}return{status:"valid",value:m.data}}}eh.create=_=>new eh({typeName:mt.ZodNaN,...St(_)});const mx=Symbol("zod_brand");class Wd extends zt{_parse(m){const{ctx:b}=this._processInputParams(m),M=b.data;return this._def.type._parse({data:M,path:b.path,parent:b})}unwrap(){return this._def.type}}class Jl extends zt{_parse(m){const{status:b,ctx:M}=this._processInputParams(m);if(M.common.async)return(async()=>{const z=await this._def.in._parseAsync({data:M.data,path:M.path,parent:M});return z.status==="aborted"?yt:z.status==="dirty"?(b.dirty(),Io(z.value)):this._def.out._parseAsync({data:z.value,path:M.path,parent:M})})();{const k=this._def.in._parseSync({data:M.data,path:M.path,parent:M});return k.status==="aborted"?yt:k.status==="dirty"?(b.dirty(),{status:"dirty",value:k.value}):this._def.out._parseSync({data:k.value,path:M.path,parent:M})}}static create(m,b){return new Jl({in:m,out:b,typeName:mt.ZodPipeline})}}class Ql extends zt{_parse(m){const b=this._def.innerType._parse(m),M=k=>(Cs(k)&&(k.value=Object.freeze(k.value)),k);return Ol(b)?b.then(k=>M(k)):M(b)}unwrap(){return this._def.innerType}}Ql.create=(_,m)=>new Ql({innerType:_,typeName:mt.ZodReadonly,...St(m)});function mm(_,m){const b=typeof _=="function"?_(m):typeof _=="string"?{message:_}:_;return typeof b=="string"?{message:b}:b}function gm(_,m={},b){return _?Co.create().superRefine((M,k)=>{var z,P;const o=_(M);if(o instanceof Promise)return o.then(ue=>{var re,ne;if(!ue){const _e=mm(m,M),ae=(ne=(re=_e.fatal)!==null&&re!==void 0?re:b)!==null&&ne!==void 0?ne:!0;k.addIssue({code:"custom",..._e,fatal:ae})}});if(!o){const ue=mm(m,M),re=(P=(z=ue.fatal)!==null&&z!==void 0?z:b)!==null&&P!==void 0?P:!0;k.addIssue({code:"custom",...ue,fatal:re})}}):Co.create()}const gx={object:Si.lazycreate};var mt;(function(_){_.ZodString="ZodString",_.ZodNumber="ZodNumber",_.ZodNaN="ZodNaN",_.ZodBigInt="ZodBigInt",_.ZodBoolean="ZodBoolean",_.ZodDate="ZodDate",_.ZodSymbol="ZodSymbol",_.ZodUndefined="ZodUndefined",_.ZodNull="ZodNull",_.ZodAny="ZodAny",_.ZodUnknown="ZodUnknown",_.ZodNever="ZodNever",_.ZodVoid="ZodVoid",_.ZodArray="ZodArray",_.ZodObject="ZodObject",_.ZodUnion="ZodUnion",_.ZodDiscriminatedUnion="ZodDiscriminatedUnion",_.ZodIntersection="ZodIntersection",_.ZodTuple="ZodTuple",_.ZodRecord="ZodRecord",_.ZodMap="ZodMap",_.ZodSet="ZodSet",_.ZodFunction="ZodFunction",_.ZodLazy="ZodLazy",_.ZodLiteral="ZodLiteral",_.ZodEnum="ZodEnum",_.ZodEffects="ZodEffects",_.ZodNativeEnum="ZodNativeEnum",_.ZodOptional="ZodOptional",_.ZodNullable="ZodNullable",_.ZodDefault="ZodDefault",_.ZodCatch="ZodCatch",_.ZodPromise="ZodPromise",_.ZodBranded="ZodBranded",_.ZodPipeline="ZodPipeline",_.ZodReadonly="ZodReadonly"})(mt||(mt={}));const _x=(_,m={message:`Input not instance of ${_.name}`})=>gm(b=>b instanceof _,m),_m=ln.create,ym=Fa.create,yx=eh.create,xx=Ba.create,xm=Zl.create,vx=ks.create,bx=Ku.create,wx=Vl.create,Tx=Ul.create,Px=Co.create,Sx=Es.create,Mx=sa.create,Ix=Yu.create,Cx=cn.create,kx=Si.create,Ex=Si.strictCreate,Ax=$l.create,zx=Ju.create,Rx=Gl.create,Dx=Fn.create,Lx=ql.create,Fx=Qu.create,Bx=As.create,Ox=Eo.create,jx=Wl.create,Nx=Hl.create,Zx=Oa.create,Vx=Xl.create,Ux=Ao.create,vm=un.create,$x=Bn.create,Gx=ja.create,qx=un.createWithPreprocess,Wx=Jl.create;var zi=Object.freeze({__proto__:null,defaultErrorMap:Mo,setErrorMap:qy,getErrorMap:Wu,makeIssue:Hu,EMPTY_PATH:Wy,addIssueToContext:qe,ParseStatus:lr,INVALID:yt,DIRTY:Io,OK:xr,isAborted:Ud,isDirty:$d,isValid:Cs,isAsync:Ol,get util(){return Zt},get objectUtil(){return Vd},ZodParsedType:Je,getParsedType:aa,ZodType:zt,datetimeRegex:pm,ZodString:ln,ZodNumber:Fa,ZodBigInt:Ba,ZodBoolean:Zl,ZodDate:ks,ZodSymbol:Ku,ZodUndefined:Vl,ZodNull:Ul,ZodAny:Co,ZodUnknown:Es,ZodNever:sa,ZodVoid:Yu,ZodArray:cn,ZodObject:Si,ZodUnion:$l,ZodDiscriminatedUnion:Ju,ZodIntersection:Gl,ZodTuple:Fn,ZodRecord:ql,ZodMap:Qu,ZodSet:As,ZodFunction:Eo,ZodLazy:Wl,ZodLiteral:Hl,ZodEnum:Oa,ZodNativeEnum:Xl,ZodPromise:Ao,ZodEffects:un,ZodTransformer:un,ZodOptional:Bn,ZodNullable:ja,ZodDefault:Kl,ZodCatch:Yl,ZodNaN:eh,BRAND:mx,ZodBranded:Wd,ZodPipeline:Jl,ZodReadonly:Ql,custom:gm,Schema:zt,ZodSchema:zt,late:gx,get ZodFirstPartyTypeKind(){return mt},coerce:{string:_=>ln.create({..._,coerce:!0}),number:_=>Fa.create({..._,coerce:!0}),boolean:_=>Zl.create({..._,coerce:!0}),bigint:_=>Ba.create({..._,coerce:!0}),date:_=>ks.create({..._,coerce:!0})},any:Px,array:Cx,bigint:xx,boolean:xm,date:vx,discriminatedUnion:zx,effect:vm,enum:Zx,function:Ox,instanceof:_x,intersection:Rx,lazy:jx,literal:Nx,map:Fx,nan:yx,nativeEnum:Vx,never:Mx,null:Tx,nullable:Gx,number:ym,object:kx,oboolean:()=>xm().optional(),onumber:()=>ym().optional(),optional:$x,ostring:()=>_m().optional(),pipeline:Wx,preprocess:qx,promise:Ux,record:Lx,set:Bx,strictObject:Ex,string:_m,symbol:bx,transformer:vm,tuple:Dx,undefined:wx,union:Ax,unknown:Sx,void:Ix,NEVER:yt,ZodIssueCode:je,quotelessJson:Gy,ZodError:Lr});const Hx=zi.object({name:zi.literal("dark").or(zi.literal("light")),colors:zi.object({primary:zi.string().max(64),background:zi.string().max(64),text:zi.string().max(64)})}),Xx=zi.object({container:zi.string(),position:zi.object({center:zi.object({lat:zi.number(),lng:zi.number()}),zoom:zi.number()}),theme:Hx}),Kx=zi.object({id:zi.string(),index:zi.number(),lat:zi.number(),lng:zi.number(),width:zi.number(),height:zi.number()}),Yx=zi.array(Kx);var Jx=vo('<link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.gstatic.com"> <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Noto+Sans:ital,wght@0,100..900;1,100..900&amp;display=swap">',1),Qx=vo('<div class="popup svelte-14hole"><!></div>'),ev=vo('<div class="marker"><!> <!></div>'),tv=vo('<div class="container svelte-14hole"><div class="map svelte-14hole"></div> <div class="markers svelte-14hole"></div></div>');function bm(_,m){Cu(m,!0);let b,M,k=0,z=vi(!1);im(()=>{Xx.parse(m.options),P(),o()});function P(){const st=m.options.position;b=new Zd.Map({style:Mt(m.options.theme.name),center:{lat:st.center.lat,lng:st.center.lng},zoom:st.zoom,minZoom:G(),maxZoom:Bl,container:M,pitchWithRotate:!1,attributionControl:{compact:!1}})}function o(){b.on("load",ue),b.on("move",re),b.on("idle",ne),b.on("click",_e),b.dragRotate.disable(),b.keyboard.disable(),b.touchZoomRotate.disableRotation(),b.touchPitch.disable()}function ue(){ti(z,!0)}function re(){}function ne(){}function _e(st){}function ae(){ve(G())}function G(){const Ut=Math.ceil(Math.log2(k/Vu));return Math.max(So,Ut)}function ve(st){b==null||b.setMinZoom(st)}function Oe(){const st=b==null?void 0:b.getCenter();if(st)return{lat:st.lat,lng:st.lng}}function Ke(){const st=b==null?void 0:b.getBounds();if(st)return{sw:{lat:st.getSouthWest().lat,lng:st.getSouthWest().lng},ne:{lat:st.getNorthEast().lat,lng:st.getNorthEast().lng}}}function Qe(){return(b==null?void 0:b.getZoom())??m.options.position.zoom}function ct(){b==null||b.zoomIn()}function gt(){b==null||b.zoomOut()}let pt=vi(na(m.options.theme));yo(()=>{We(z)&&b.setStyle(Mt(We(pt).name))});function Mt(st){switch(st){case"light":return $y;case"dark":return Uy}}function kt(){return I_(We(pt))}function Et(st){ti(pt,st,!0),b.setStyle(Mt(We(pt).name),{diff:!0})}let wt,Mi,Wi,Hi=vi(na(new Array)),ut=vi(na(new Array));im(()=>{const st=async()=>{await Yt(),Mi=window.setTimeout(st,50)},Ut=()=>{Jt(),Wi=window.setTimeout(Ut,25)};return st(),Ut(),()=>{clearInterval(Mi),clearInterval(Wi)}});async function Yt(){if(!wt||!We(z)||We(Hi).length==0)return;const st=Ke(),Ut=Qe();if(!st)return;const Ii=We(Hi).filter(Gt=>!Gt.loaded);if(Ii.length==0)return;const li=Ii.filter(Gt=>{const ft=Gt.block;return!(Ut+Nd<ft.zs||ft.ne.lng<st.sw.lng||st.ne.lng<ft.sw.lng||ft.ne.lat<st.sw.lat||st.ne.lat<ft.sw.lat)});if(li.length!=0)try{const Gt=li.flatMap(Tt=>Tt.block.markers).map(Tt=>Tt.id),ft=await wt(Gt),Qt=new Map;for(let Tt=0;Tt<We(ut).length;Tt++){const Pt=We(ut)[Tt];Qt.set(Pt.marker.id,Pt)}for(let Tt=0;Tt<Gt.length;Tt++){const Pt=Gt[Tt],rt=ft[Tt],fi=Qt.get(Pt);if(!fi)throw new Error("Failed to find marker data.");fi.content=rt}li.forEach(Tt=>Tt.loaded=!0)}catch(Gt){console.error(Gt),li.forEach(ft=>ft.loaded=!1)}}function Jt(){var ft;if(!We(z)||We(ut).length==0)return;const st=b.getZoom();if(!st)return;const Ut=new Array,Ii=Vu,li=new om(b,-512,window.innerHeight+Ii,window.innerWidth+Ii,-512),Gt=new om(b,0,window.innerHeight,window.innerWidth,0);for(let Qt=0;Qt<We(ut).length;Qt++){const Tt=We(ut)[Qt],Pt=Tt.marker,rt=Tt.libreMarker;if(rt){if(Pt.zet<=st&&li.contains(Pt.lat,Pt.lng)){rt._map!=b&&rt.addTo(b),Ut.push(Tt);continue}if(Pt.zet<=st+nm&&Gt.contains(Pt.lat,Pt.lng)){rt._map!=b&&rt.addTo(b),Ut.push(Tt);continue}rt._map!=null&&rt.remove()}}for(let Qt=0;Qt<Ut.length;Qt++){const Tt=Ut[Qt],Pt=Tt.marker,rt=Tt.component,fi=Tt.circle;Tt.circleRendered||(Tt.circleRendered=!0),!Tt.componentRendered&&Tt.marker.zet<=st+Nd&&(Tt.componentRendered=!0),Pt.zet<=st+Nd?rt==null||rt.setDisplayed(!0):rt==null||rt.setDisplayed(!1),Pt.zet<=st&&rt!=null?(fi==null||fi.setCollapsed(!0),rt==null||rt.setCollapsed(!1),rt==null||rt.setAngle((ft=Pt.angs.findLast(bi=>bi[0]<=st))==null?void 0:ft[1])):(rt==null||rt.setCollapsed(!0),fi==null||fi.setCollapsed(!1),fi==null||fi.setDistance((Pt.zet-st)/nm))}}async function cr(st){wt=st}async function Dt(st){var Gt;if(!(await Yx.safeParseAsync(st)).success)throw new Error("Invalid markers input");for(let ft=0;ft<We(ut).length;ft++)(Gt=We(ut)[ft].libreMarker)==null||Gt.remove();We(ut).length=0;const Ii=await By(st),li=Ii.flatMap(ft=>ft.markers).toSorted((ft,Qt)=>ft.zet-Qt.zet);ti(Hi,Ii.map(ft=>new Fy(ft)),!0),ti(ut,li.map(ft=>new Vy(ft)),!0),await K_();for(let ft=0;ft<We(ut).length;ft++){const Qt=We(ut)[ft],Tt=Qt.marker,Pt=Qt.element;if(!Pt)throw new Error("Failed to render marker element.");const rt=new Zd.Marker({element:Pt});rt.setLngLat([Tt.lng,Tt.lat]),Qt.libreMarker=rt}}var vr=tv();ny(st=>{var Ut=Jx();bo(st,Ut)}),ry("resize",Td,ae);var Fr=Ps(vr);Po(Fr,st=>M=st,()=>M);var hn=Md(Fr,2);return uy(hn,21,()=>We(ut),ly,(st,Ut,Ii)=>{var li=ev(),Gt=Ps(li);{var ft=Pt=>{Po(Cy(Pt,{}),(rt,fi)=>fi.circle=rt,rt=>rt==null?void 0:rt.circle,()=>[We(Ut)])};Hf(Gt,Pt=>{We(Ut).circleRendered&&Pt(ft)})}var Qt=Md(Gt,2);{var Tt=Pt=>{Po(My(Pt,{children:(rt,fi)=>{var bi=Qx(),Ci=Ps(bi);fy(Ci,()=>We(Ut).content),Al(()=>To(bi,`width: ${We(Ut).marker.width??""}px; height: ${We(Ut).marker.height??""}px;`)),bo(rt,bi)},$$slots:{default:!0}}),(rt,fi)=>fi.component=rt,rt=>rt==null?void 0:rt.component,()=>[We(Ut)])};Hf(Qt,Pt=>{We(Ut).componentRendered&&We(Ut).content&&Pt(Tt)})}Po(li,(Pt,rt)=>rt.element=Pt,Pt=>Pt==null?void 0:Pt.element,()=>[We(Ut)]),Al(()=>To(li,`z-index: ${We(ut).length-Ii};`)),bo(st,li)}),Al(()=>To(vr,`--primary: ${We(pt).colors.primary??""}; --background: ${We(pt).colors.background??""}; --text: ${We(pt).colors.text??""};`)),bo(_,vr),ku({getCenter:Oe,getBounds:Ke,getZoom:Qe,zoomIn:ct,zoomOut:gt,getTheme:kt,setTheme:Et,setPopupsContentCallback:cr,setPopups:Dt})}function iv(_){const m=document.getElementById(_.container);if(!m)throw new Error(`Container not found: ${_.container}`);return ay(bm,{target:m,props:{options:_}})}function rv(_){oy(_)}$t.Map=bm,$t.mountMap=iv,$t.unmountMap=rv,Object.defineProperty($t,Symbol.toStringTag,{value:"Module"})});
729
+ ${O.shaderPreludeCode.vertexSource}`,define:O.shaderDefine},defaultProjectionData:W},H=E.renderingMode?E.renderingMode:"2d";if(f.renderPass==="offscreen"){const K=E.prerender;K&&(f.setCustomLayerDefaults(),A.setColorMode(f.colorModeForRenderPass()),K.call(E,A.gl,q),A.setDirty(),f.setBaseState())}else if(f.renderPass==="translucent"){f.setCustomLayerDefaults(),A.setColorMode(f.colorModeForRenderPass()),A.setStencilMode(Rt.disabled);const K=H==="3d"?f.getDepthModeFor3D():f.getDepthModeForSublayer(0,vt.ReadOnly);A.setDepthMode(K),E.render(A.gl,q),A.setDirty(),f.setBaseState(),A.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?Xa:h.shaderVariantName}`+(this._showOverdrawInspector?"/overdraw":"")+(l?"/terrain":"");return this.cache[f]||(this.cache[f]=new Us(this.context,Nr[e],i,bc[e],this._showOverdrawInspector,l,s?Nr.projectionMercator:h.shaderPreludeCode,s?_n: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 wt(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 Fc(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(...y)=>(s=!0,h=this,i=y,l||f(),l)}class Bc{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=Fc(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,y=Math.round(i.lat*h)/h,v=this._map.getBearing(),T=this._map.getPitch();let C="";if(C+=e?`/${f}/${y}/${s}`:`${s}/${y}/${f}`,(v||T)&&(C+="/"+Math.round(10*v)/10),T&&(C+=`/${Math.round(T)}`),this._hashName){const A=this._hashName;let E=!1;const O=window.location.hash.slice(1).split("&").map(Z=>{const W=Z.split("=")[0];return W===A?(E=!0,`${W}=${C}`):Z}).filter(Z=>Z);return E||O.push(`${A}=${C}`),`#${O.join("&")}`}return`#${C}`}_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 ds={linearity:.3,easing:o.c9(0,0,.3,1)},ba=o.e({deceleration:2500,maxSpeed:1400},ds),Nh=o.e({deceleration:20,maxSpeed:1400},ds),Zh=o.e({deceleration:1e3,maxSpeed:360},ds),Vh=o.e({deceleration:1e3,maxSpeed:90},ds),Uh=o.e({deceleration:1e3,maxSpeed:360},ds);class $h{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:ae.now(),settings:e})}_drainInertiaBuffer(){const e=this._inertiaBuffer,i=ae.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=fs(i.pan.mag(),s,o.e({},ba,e||{})),f=i.pan.mult(h.amount/i.pan.mag()),y=this._map.cameraHelper.handlePanInertia(f,this._map.transform);l.center=y.easingCenter,l.offset=y.easingOffset,ps(l,h)}if(i.zoom){const h=fs(i.zoom,s,Nh);l.zoom=this._map.transform.zoom+h.amount,ps(l,h)}if(i.bearing){const h=fs(i.bearing,s,Zh);l.bearing=this._map.transform.bearing+o.ae(h.amount,-179,179),ps(l,h)}if(i.pitch){const h=fs(i.pitch,s,Vh);l.pitch=this._map.transform.pitch+h.amount,ps(l,h)}if(i.roll){const h=fs(i.roll,s,Uh);l.roll=this._map.transform.roll+o.ae(h.amount,-179,179),ps(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 ps(u,e){(!u.duration||u.duration<e.duration)&&(u.duration=e.duration,u.easing=e.easing)}function fs(u,e,i){const{maxSpeed:s,linearity:l,deceleration:h}=i,f=o.ae(u*l/(e/1e3),-s,s),y=Math.abs(f)/(h*l);return{easing:i.easing,duration:1e3*y,amount:f*(y/2)}}class tr 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=G.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 ms 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=G.touchPos(i.getCanvasContainer(),l),f=h.map(v=>i.unproject(v)),y=h.reduce((v,T,C,A)=>v.add(T.div(A.length)),new o.P(0,0));super(e,{points:h,point:y,lngLats:f,lngLat:i.unproject(y),originalEvent:s}),this._defaultPrevented=!1}}class zr extends o.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,s){super(e,{originalEvent:s}),this._defaultPrevented=!1}}class tn{constructor(e,i){this._map=e,this._clickTolerance=i.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new zr(e.type,this._map,e))}mousedown(e,i){return this._mousedownPos=i,this._firePreventable(new tr(e.type,this._map,e))}mouseup(e){this._map.fire(new tr(e.type,this._map,e))}click(e,i){this._mousedownPos&&this._mousedownPos.dist(i)>=this._clickTolerance||this._map.fire(new tr(e.type,this._map,e))}dblclick(e){return this._firePreventable(new tr(e.type,this._map,e))}mouseover(e){this._map.fire(new tr(e.type,this._map,e))}mouseout(e){this._map.fire(new tr(e.type,this._map,e))}touchstart(e){return this._firePreventable(new ms(e.type,this._map,e))}touchmove(e){this._map.fire(new ms(e.type,this._map,e))}touchend(e){this._map.fire(new ms(e.type,this._map,e))}touchcancel(e){this._map.fire(new ms(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Gh{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new tr(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new tr("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new tr(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class pr{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 wa{constructor(e,i){this._map=e,this._tr=new pr(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&&(G.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=G.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),y=Math.min(l.y,s.y),v=Math.max(l.y,s.y);G.setTransform(this._box,`translate(${h}px,${y}px)`),this._box.style.width=f-h+"px",this._box.style.height=v-y+"px"}mouseupWindow(e,i){if(!this._active||e.button!==0)return;const s=this._startPos,l=i;if(this.reset(),G.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&&(G.remove(this._box),this._box=null),G.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,i){return this._map.fire(new o.l(e,{originalEvent:i}))}}function Oc(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 dp{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=Oc(s,i)))}touchmove(e,i,s){if(this.aborted||!this.centroid)return;const l=Oc(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 jc{constructor(e){this.singleTap=new dp(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 pp{constructor(e){this._tr=new pr(e),this._zoomIn=new jc({numTouches:1,numTaps:2}),this._zoomOut=new jc({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:y=>y.easeTo({duration:300,zoom:f.zoom+1,around:f.unproject(l)},{originalEvent:e})}):h?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:y=>y.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 gs{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&&G.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 Js={0:1,2:2};class br{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){const i=G.mouseButton(e);this._eventButton=i}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){return!function(i,s){const l=Js[s];return i.buttons===void 0||(i.buttons&l)!==l}(e,this._eventButton)}isValidEndEvent(e){return G.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 qh{constructor(e=new br({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 _s=u=>{u.mousedown=u.dragStart,u.mousemoveWindow=u.dragMove,u.mouseup=u.dragEnd,u.contextmenu=e=>{e.preventDefault()}};class Wh{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=Oc(s,i),h=new o.P(0,0),f=new o.P(0,0);let y=0;for(const T in l){const C=l[T],A=this._touches[T];A&&(h._add(C),f._add(C.sub(A)),y++,l[T]=C)}if(this._touches=l,this._shouldBePrevented(y)||!f.mag())return;const v=f.div(y);return this._sum._add(v),this._sum.mag()<this._clickTolerance?void 0:{around:h.div(y),panDelta:v}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ta{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=qn(s,i,l),y=qn(s,i,h);if(!f||!y)return;const v=this._aroundCenter?null:f.add(y).div(2);return this._move([f,y],v,e)}touchend(e,i,s){if(!this._firstTwoTouches)return;const[l,h]=this._firstTwoTouches,f=qn(s,i,l),y=qn(s,i,h);f&&y||(this._active&&G.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 qn(u,e,i){for(let s=0;s<u.length;s++)if(u[s].identifier===i)return e[s]}function Nc(u,e){return Math.log(u/e)/Math.LN2}class Ct extends Ta{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(Nc(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Nc(this._distance,s),pinchAround:i}}}function ll(u,e){return 180*u.angleWith(e)/Math.PI}class Hh extends Ta{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:ll(this._vector,l),pinchAround:i}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());const i=25/(Math.PI*this._minDiameter)*360,s=ll(e,this._startVector);return Math.abs(s)<i}}function Qs(u){return Math.abs(u.y)>Math.abs(u.x)}class Xh extends Ta{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,Qs(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 Qs(e)&&Qs(i)&&f}}const fp={panStep:100,bearingStep:15,pitchStep:10};class Zc{constructor(e){this._tr=new pr(e);const i=fp;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:y=>{const v=this._tr;y.easeTo({duration:300,easeId:"keyboardHandler",easing:Vc,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 Vc(u){return u*(2-u)}const Uc=4.000244140625;class Kh{constructor(e,i){this._onTimeout=s=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(s)},this._map=e,this._tr=new pr(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=ae.now(),l=s-(this._lastWheelEventTime||0);this._lastWheelEventTime=s,i!==0&&i%Uc==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=G.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 y=e.zoom-this._lastExpectedZoom;typeof this._startZoom=="number"&&(this._startZoom+=y),typeof this._targetZoom=="number"&&(this._targetZoom+=y)}if(this._delta!==0){const y=this._type==="wheel"&&Math.abs(this._delta)>Uc?this._wheelZoomRate:this._defaultZoomRate;let v=2/(1+Math.exp(-Math.abs(this._delta*y)));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 y=ae.now()-this._lastWheelEventTime,v=Math.min((y+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=(ae.now()-s.start)/s.duration,h=s.easing(l+.01)-s.easing(l),f=.27/Math.sqrt(h*h+1e-4)*.01,y=Math.sqrt(.0729-f*f);i=o.c9(f,y,.25,1)}return this._prevEase={start:ae.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 $c{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 mp{constructor(e){this._tr=new pr(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 gp{constructor(){this._tap=new jc({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 vn{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 ni{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 eo{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 cl{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=G.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&&(G.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 to=u=>u.zoom||u.drag||u.roll||u.pitch||u.rotate;class Yh extends o.l{}function ul(u){return u.panDelta&&u.panDelta.mag()||u.zoomDelta||u.bearingDelta||u.pitchDelta||u.rollDelta}class _p{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,y={needsRenderFrame:!1},v={},T={};for(const{handlerName:E,handler:O,allowed:Z}of this._handlers){if(!O.isEnabled())continue;let W;if(this._blockedByActive(T,Z,E))O.reset();else if(O[h||l.type]){if(o.cc(l,h||l.type)){const q=G.mousePos(this._map.getCanvas(),l);W=O[h||l.type](l,q)}else if(o.cd(l,h||l.type)){const q=this._getMapTouches(l.touches),H=G.touchPos(this._map.getCanvas(),q);W=O[h||l.type](l,H,q)}else o.ce(h||l.type)||(W=O[h||l.type](l));this.mergeHandlerResult(y,v,W,E,f),W&&W.needsRenderFrame&&this._triggerRenderFrame()}(W||O.isActive())&&(T[E]=O)}const C={};for(const E in this._previousActiveHandlers)T[E]||(C[E]=f);this._previousActiveHandlers=T,(Object.keys(C).length||ul(y))&&(this._changes.push([y,v,C]),this._triggerRenderFrame()),(Object.keys(T).length||ul(y))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:A}=y;A&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],A(this._map))},this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new $h(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)G.addEventListener(l,h,l===document?this.handleWindowEvent:this.handleEvent,f)}destroy(){for(const[e,i,s]of this._listeners)G.removeEventListener(e,i,e===document?this.handleWindowEvent:this.handleEvent,s)}_addDefaultHandlers(e){const i=this._map,s=i.getCanvasContainer();this._add("mapEvent",new tn(i,e));const l=i.boxZoom=new wa(i,e);this._add("boxZoom",l),e.interactive&&e.boxZoom&&l.enable();const h=i.cooperativeGestures=new cl(i,e.cooperativeGestures);this._add("cooperativeGestures",h),e.cooperativeGestures&&h.enable();const f=new pp(i),y=new mp(i);i.doubleClickZoom=new $c(y,f),this._add("tapZoom",f),this._add("clickZoom",y),e.interactive&&e.doubleClickZoom&&i.doubleClickZoom.enable();const v=new gp;this._add("tapDragZoom",v);const T=i.touchPitch=new Xh(i);this._add("touchPitch",T),e.interactive&&e.touchPitch&&i.touchPitch.enable(e.touchPitch);const C=()=>i.project(i.getCenter()),A=function({enable:te,clickTolerance:ie,aroundCenter:he=!0,minPixelCenterThreshold:se=100,rotateDegreesPerPixelMoved:ye=.8},ge){const Ie=new br({checkCorrectEvent:ke=>G.mouseButton(ke)===0&&ke.ctrlKey||G.mouseButton(ke)===2&&!ke.ctrlKey});return new gs({clickTolerance:ie,move:(ke,Se)=>{const Ne=ge();if(he&&Math.abs(Ne.y-ke.y)>se)return{bearingDelta:o.ca(new o.P(ke.x,Se.y),Se,Ne)};let Be=(Se.x-ke.x)*ye;return he&&Se.y<Ne.y&&(Be=-Be),{bearingDelta:Be}},moveStateManager:Ie,enable:te,assignEvents:_s})}(e,C),E=function({enable:te,clickTolerance:ie,pitchDegreesPerPixelMoved:he=-.5}){const se=new br({checkCorrectEvent:ye=>G.mouseButton(ye)===0&&ye.ctrlKey||G.mouseButton(ye)===2});return new gs({clickTolerance:ie,move:(ye,ge)=>({pitchDelta:(ge.y-ye.y)*he}),moveStateManager:se,enable:te,assignEvents:_s})}(e),O=function({enable:te,clickTolerance:ie,rollDegreesPerPixelMoved:he=.3},se){const ye=new br({checkCorrectEvent:ge=>G.mouseButton(ge)===2&&ge.ctrlKey});return new gs({clickTolerance:ie,move:(ge,Ie)=>{const ke=se();let Se=(Ie.x-ge.x)*he;return Ie.y<ke.y&&(Se=-Se),{rollDelta:Se}},moveStateManager:ye,enable:te,assignEvents:_s})}(e,C);i.dragRotate=new ni(e,A,E,O),this._add("mouseRotate",A,["mousePitch"]),this._add("mousePitch",E,["mouseRotate","mouseRoll"]),this._add("mouseRoll",O,["mousePitch"]),e.interactive&&e.dragRotate&&i.dragRotate.enable();const Z=function({enable:te,clickTolerance:ie}){const he=new br({checkCorrectEvent:se=>G.mouseButton(se)===0&&!se.ctrlKey});return new gs({clickTolerance:ie,move:(se,ye)=>({around:ye,panDelta:ye.sub(se)}),activateOnStart:!0,moveStateManager:he,enable:te,assignEvents:_s})}(e),W=new Wh(e,i);i.dragPan=new vn(s,Z,W),this._add("mousePan",Z),this._add("touchPan",W,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&i.dragPan.enable(e.dragPan);const q=new Hh,H=new Ct;i.touchZoomRotate=new eo(s,H,q,v),this._add("touchRotate",q,["touchPan","touchZoom"]),this._add("touchZoom",H,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&i.touchZoomRotate.enable(e.touchZoomRotate);const K=i.scrollZoom=new Kh(i,()=>this._triggerRenderFrame());this._add("scrollZoom",K,["mousePan"]),e.interactive&&e.scrollZoom&&i.scrollZoom.enable(e.scrollZoom);const ee=i.keyboard=new Zc(i);this._add("keyboard",ee),e.interactive&&e.keyboard&&i.keyboard.enable(),this._add("blockableMapEvent",new Gh(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!!to(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(!(ul(e)||f&&this._terrainMovement))return this._fireEvents(i,s,!0);l._stop(!0);let{panDelta:y,zoomDelta:v,bearingDelta:T,pitchDelta:C,rollDelta:A,around:E,pinchAround:O}=e;O!==void 0&&(E=O),E=E||l.transform.centerPoint,f&&!h.isPointOnMapSurface(E)&&(E=h.centerPoint);const Z={panDelta:y,zoomDelta:v,rollDelta:A,pitchDelta:C,bearingDelta:T,around:E};this._map.cameraHelper.useGlobeControls&&!h.isPointOnMapSurface(E)&&(E=h.centerPoint);const W=E.distSqr(h.centerPoint)<.01?h.center:h.screenPointToLocation(y?E.sub(y):E);f?(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(Z,h),this._terrainMovement||!i.drag&&!i.zoom?i.drag&&this._terrainMovement?h.setCenter(h.screenPointToLocation(h.centerPoint.sub(y))):this._map.cameraHelper.handleMapControlsPan(Z,h,W):(this._terrainMovement=!0,this._map._elevationFreeze=!0,this._map.cameraHelper.handleMapControlsPan(Z,h,W))):(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(Z,h),this._map.cameraHelper.handleMapControlsPan(Z,h,W)),l._applyUpdatedTransform(h),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(i,s,!0)}_fireEvents(e,i,s){const l=to(this._eventsInProgress),h=to(e),f={};for(const A in e){const{originalEvent:E}=e[A];this._eventsInProgress[A]||(f[`${A}start`]=E),this._eventsInProgress[A]=e[A]}!l&&h&&this._fireEvent("movestart",h.originalEvent);for(const A in f)this._fireEvent(A,f[A]);h&&this._fireEvent("move",h.originalEvent);for(const A in e){const{originalEvent:E}=e[A];this._fireEvent(A,E)}const y={};let v;for(const A in this._eventsInProgress){const{handlerName:E,originalEvent:O}=this._eventsInProgress[A];this._handlersById[E].isActive()||(delete this._eventsInProgress[A],v=i[E]||O,y[`${A}end`]=v)}for(const A in y)this._fireEvent(A,y[A]);const T=to(this._eventsInProgress),C=(l||h)&&!T;if(C&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const A=this._map._getTransformForUpdate();this._map.getCenterClampedToGround()&&A.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(A)}if(s&&C){this._updatingCamera=!0;const A=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),E=O=>O!==0&&-this._bearingSnap<O&&O<this._bearingSnap;!A||!A.essential&&ae.prefersReducedMotion?(this._map.fire(new o.l("moveend",{originalEvent:v})),E(this._map.getBearing())&&this._map.resetNorth()):(E(A.bearing||this._map.getBearing())&&(A.bearing=0),A.freezeElevation=!0,this._map.easeTo(A,{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 Yh("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class rn extends o.E{constructor(e,i,s){super(),this._renderFrameCallback=()=>{const l=Math.min((ae.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=wi.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 y=this.transform,v=new wi(e,i);return this.cameraHelper.cameraForBoxAndBearing(l,f,v,s,y)}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 y=s.zoom;this.cameraHelper.handleJumpToCenterZoom(s,e);const v=s.zoom!==y;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),y=f.x-h.x,v=f.y-h.y,T=f.z-h.z,C=Math.hypot(y,v,T);if(C===0)throw new Error("Can't calculate camera options with same From and To");const A=Math.hypot(y,v),E=o.ab(this.transform.cameraToCenterDistance/C/this.transform.tileSize),O=180*Math.atan2(y,-v)/Math.PI;let Z=180*Math.acos(A/C)/Math.PI;return Z=T<0?90-Z:90+Z,{center:f.toLngLat(),elevation:l,zoom:E,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&&ae.prefersReducedMotion)&&(e.duration=0);const s=this._getTransformForUpdate(),l=this.getBearing(),h=s.pitch,f=s.roll,y="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,C="padding"in e?e.padding:s.padding,A=o.P.convert(e.offset);let E,O;e.around&&(E=o.Q.convert(e.around),O=s.locationToScreenPoint(E));const Z={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},W=this.cameraHelper.handleEaseTo(s,{bearing:y,pitch:v,roll:T,padding:C,around:E,aroundPoint:O,offsetAsPoint:A,offset:e.offset,zoom:e.zoom,center:e.center});return this._rotating=this._rotating||l!==y,this._pitching=this._pitching||v!==h,this._rolling=this._rolling||T!==f,this._padding=!s.isPaddingEqual(C),this._zooming=this._zooming||W.isZooming,this._easeId=e.easeId,this._prepareEase(i,e.noMoveStart,Z),this.terrain&&this._prepareElevation(W.elevationCenter),this._ease(q=>{W.easeFunc(q),this.terrain&&!e.freezeElevation&&this._updateElevation(q),this._applyUpdatedTransform(s),this._fireMoveEvents(i)},q=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(i,q)},e),this}_prepareEase(e,i,s={}){this._moving=!0,i||s.moving||this.fire(new o.l("movestart",e)),this._zooming&&!s.zooming&&this.fire(new o.l("zoomstart",e)),this._rotating&&!s.rotating&&this.fire(new o.l("rotatestart",e)),this._pitching&&!s.pitching&&this.fire(new o.l("pitchstart",e)),this._rolling&&!s.rolling&&this.fire(new o.l("rollstart",e))}_prepareElevation(e){this._elevationCenter=e,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(e,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(e){this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));const i=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(e<1&&i!==this._elevationTarget){const s=this._elevationTarget-this._elevationStart;this._elevationStart+=e*(s-(i-(s*e+this._elevationStart))/(1-e)),this._elevationTarget=i}this.transform.setElevation(o.B.number(this._elevationStart,this._elevationTarget,e))}_finalizeElevation(){this._elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(e){if(!this.terrain&&e.elevation>=0&&e.pitch<=90)return{};const i=e.getCameraLngLat(),s=e.getCameraAltitude(),l=this.terrain?this.terrain.getElevationForLngLatZoom(i,e.zoom):0;if(s<l){const h=this.calculateCameraOptionsFromTo(i,l,e.center,e.elevation);return{pitch:h.pitch,zoom:h.zoom}}return{}}_applyUpdatedTransform(e){const i=[];if(i.push(l=>this._elevateCameraIfInsideTerrain(l)),this.transformCameraUpdate&&i.push(l=>this.transformCameraUpdate(l)),!i.length)return;const s=e.clone();for(const l of i){const h=s.clone(),{center:f,zoom:y,roll:v,pitch:T,bearing:C,elevation:A}=l(h);f&&h.setCenter(f),A!==void 0&&h.setElevation(A),y!==void 0&&h.setZoom(y),v!==void 0&&h.setRoll(v),T!==void 0&&h.setPitch(T),C!==void 0&&h.setBearing(C),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&&ae.prefersReducedMotion){const Se=o.O(e,["center","zoom","bearing","pitch","roll","elevation"]);return this.jumpTo(Se,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,y=s.padding,v="bearing"in e?this._normalizeBearing(e.bearing,l):l,T="pitch"in e?+e.pitch:h,C="roll"in e?this._normalizeBearing(e.roll,f):f,A="padding"in e?e.padding:s.padding,E=o.P.convert(e.offset);let O=s.centerPoint.add(E);const Z=s.screenPointToLocation(O),W=this.cameraHelper.handleFlyTo(s,{bearing:v,pitch:T,roll:C,padding:A,locationAtOffset:Z,offsetAsPoint:E,center:e.center,minZoom:e.minZoom,zoom:e.zoom});let q=e.curve;const H=Math.max(s.width,s.height),K=H/W.scaleOfZoom,ee=W.pixelPathLength;typeof W.scaleOfMinZoom=="number"&&(q=Math.sqrt(H/W.scaleOfMinZoom/ee*2));const te=q*q;function ie(Se){const Ne=(K*K-H*H+(Se?-1:1)*te*te*ee*ee)/(2*(Se?K:H)*te*ee);return Math.log(Math.sqrt(Ne*Ne+1)-Ne)}function he(Se){return(Math.exp(Se)-Math.exp(-Se))/2}function se(Se){return(Math.exp(Se)+Math.exp(-Se))/2}const ye=ie(!1);let ge=function(Se){return se(ye)/se(ye+q*Se)},Ie=function(Se){return H*((se(ye)*(he(Ne=ye+q*Se)/se(Ne))-he(ye))/te)/ee;var Ne},ke=(ie(!0)-ye)/q;if(Math.abs(ee)<2e-6||!isFinite(ke)){if(Math.abs(H-K)<1e-6)return this.easeTo(e,i);const Se=K<H?-1:1;ke=Math.abs(Math.log(K/H))/q,Ie=()=>0,ge=Ne=>Math.exp(Se*q*Ne)}return e.duration="duration"in e?+e.duration:1e3*ke/("screenSpeed"in e?+e.screenSpeed/q:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=l!==v,this._pitching=T!==h,this._rolling=C!==f,this._padding=!s.isPaddingEqual(A),this._prepareEase(i,!1),this.terrain&&this._prepareElevation(W.targetCenter),this._ease(Se=>{const Ne=Se*ke,Be=1/ge(Ne),Ee=Ie(Ne);this._rotating&&s.setBearing(o.B.number(l,v,Se)),this._pitching&&s.setPitch(o.B.number(h,T,Se)),this._rolling&&s.setRoll(o.B.number(f,C,Se)),this._padding&&(s.interpolatePadding(y,A,Se),O=s.centerPoint.add(E)),W.easeFunc(Se,Be,Ee,O),this.terrain&&!e.freezeElevation&&this._updateElevation(Se),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=ae.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 io={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class et{constructor(e=io){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=G.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=G.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=G.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(){G.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=G.sanitize(s),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class ot{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=G.create("div","maplibregl-ctrl");const i=G.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(){G.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class hl{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 Gc=o.aD([{name:"a_pos3d",type:"Int16",components:3}]);class qc extends o.E{constructor(e){super(),this._lastTilesetChange=ae.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 pe(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 Yr(l,this.tileSize),this._lastTilesetChange=ae.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 y=l.canonical.z-e.canonical.z,v=l.canonical.x-(l.canonical.x>>y<<y),T=l.canonical.y-(l.canonical.y>>y<<y),C=o.Z>>y;o.bO(f,0,C,C,0,0,1),o.L(f,f,[-v*C,-T*C,0])}else{if(!e.canonical.isChildOf(l.canonical))continue;{const y=e.canonical.z-l.canonical.z,v=e.canonical.x-(e.canonical.x>>y<<y),T=e.canonical.y-(e.canonical.y>>y<<y),C=o.Z>>y;o.bO(f,0,o.Z,o.Z,0,0,1),o.L(f,f,[v*C,T*C,0]),o.M(f,f,[1/2**y,1/2**y,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(),y=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(y,0,o.Z,o.Z,0,0,1),o.L(y,y,[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),C=h.canonical.y-(h.canonical.y>>v<<v),A=e.canonical.x-(h.canonical.x>>v),E=e.canonical.y-(h.canonical.y>>v),O=o.Z>>v;o.bO(y,0,O,O,0,0,1),o.L(y,y,[-T*O+A*o.Z,-C*O+E*o.Z,0])}else{const v=e.canonical.z-h.canonical.z,T=e.canonical.x-(e.canonical.x>>v<<v),C=e.canonical.y-(e.canonical.y>>v<<v),A=(e.canonical.x>>v)-h.canonical.x,E=(e.canonical.y>>v)-h.canonical.y,O=o.Z<<v;o.bO(y,0,O,O,0,0,1),o.L(y,y,[T*o.Z+A*O,C*o.Z+E*O,0])}f.terrainRttPosMatrix32f=new Float32Array(y),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 fr{constructor(e,i,s){this._meshCache={},this.painter=e,this.sourceCache=new qc(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),y=(h=f.tile)===null||h===void 0?void 0:h.dem;if(!y)return 0;const v=o.cf([],[i/l*o.Z,s/l*o.Z],f.u_terrain_matrix),T=[v[0]*y.dim,v[1]*y.dim],C=Math.floor(T[0]),A=Math.floor(T[1]),E=T[0]-C,O=T[1]-A;return y.get(C,A)*(1-E)*(1-O)+y.get(C+1,A)*E*(1-O)+y.get(C,A+1)*(1-E)*O+y.get(C+1,A+1)*E*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 wt(l,h,l.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new wt(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 wt(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),y=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,y*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 wt(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 wt(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 y=0;y<this._coordsTextureSize;y++,f+=4)i[f+0]=255&y,i[f+1]=255&h,i[f+2]=y>>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 wt(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),y=Math.round(this.painter.height/devicePixelRatio);s.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),l.readPixels(h,y-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),C=this.coordsIndex[255-i[3]],A=C&&this.sourceCache.getTileByID(C);if(!A)return null;const E=this._coordsTextureSize,O=(1<<A.tileID.canonical.z)*E;return new o.$((A.tileID.canonical.x*E+v)/O+A.tileID.wrap,(A.tileID.canonical.y*E+T)/O,this.getElevation(A.tileID,v,T,E))}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 y=this.painter.context,v=new o.ci,T=new o.aH,C=this.meshSize,A=o.Z/C,E=C*C;for(let se=0;se<=C;se++)for(let ye=0;ye<=C;ye++)v.emplaceBack(ye*A,se*A,0);for(let se=0;se<E;se+=C+1)for(let ye=0;ye<C;ye++)T.emplaceBack(ye+se,C+ye+se+1,C+ye+se+2),T.emplaceBack(ye+se,C+ye+se+2,ye+se+1);const O=v.length,Z=O+(C+1),W=(C+1)*C,q=l?o.b9:0,H=l?0:1,K=h?o.ba:o.Z,ee=h?0:1;for(let se=0;se<=C;se++)v.emplaceBack(se*A,q,H);for(let se=0;se<=C;se++)v.emplaceBack(se*A,K,ee);for(let se=0;se<C;se++)T.emplaceBack(W+se,Z+se,Z+se+1),T.emplaceBack(W+se,Z+se+1,W+se+1),T.emplaceBack(0+se,O+se+1,O+se),T.emplaceBack(0+se,0+se+1,O+se+1);const te=v.length,ie=te+2*(C+1);for(const se of[0,1])for(let ye=0;ye<=C;ye++)for(const ge of[0,1])v.emplaceBack(se*o.Z,ye*A,ge);for(let se=0;se<2*C;se+=2)T.emplaceBack(te+se,te+se+1,te+se+3),T.emplaceBack(te+se,te+se+3,te+se+2),T.emplaceBack(ie+se,ie+se+3,ie+se+1),T.emplaceBack(ie+se,ie+se+2,ie+se+3);const he=new pa(y.createVertexBuffer(v,Gc.members),y.createIndexBuffer(T),o.aG.simpleSegment(0,0,v.length,T.length));return this._meshCache[f]=he,he}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,y=Math.floor(h/o.Z),v=Math.floor(f/o.Z);return{tileID:new o.Y(i,0,i,y,v),mercatorX:h,mercatorY:f}}}class Jh{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 wt(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 sr={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class yp{constructor(e,i){this.painter=e,this.terrain=i,this.pool=new Jh(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 Or?h.terrainTileRanges:null;for(const y of l){const v=this.terrain.sourceCache.getTerrainCoords(y,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(sr[l.type]&&!this._coordsAscendingStr[h]){this._coordsAscendingStr[h]={};for(const f in this._coordsAscending[h])this._coordsAscendingStr[h][f]=this._coordsAscending[h][f].map(y=>y.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(sr[l]&&(this._prevType&&sr[this._prevType]||this._stacks.push([]),this._prevType=l,this._stacks[this._stacks.length-1].push(e.id),!f))return!0;if(sr[this._prevType]||sr[l]&&f){this._prevType=l;const y=this._stacks.length-1,v=this._stacks[y]||[];for(const T of this._renderableTiles){if(this.pool.isFull()&&(ol(this.painter,this.terrain,this._rttTiles,s),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(T),T.rtt[y]){const A=this.pool.getObjectForId(T.rtt[y].id);if(A.stamp===T.rtt[y].stamp){this.pool.useObject(A);continue}}const C=this.pool.getOrCreateFreeObject();this.pool.useObject(C),this.pool.stampObject(C),T.rtt[y]={id:C.id,stamp:C.stamp},h.context.bindFramebuffer.set(C.fbo.framebuffer),h.context.clear({color:o.b7.transparent,stencil:0}),h.currentStencilSource=void 0;for(let A=0;A<v.length;A++){const E=h.style._layers[v[A]],O=E.source?this._coordsAscending[E.source][T.tileID.key]:[T.tileID];h.context.viewport.set([0,0,C.fbo.width,C.fbo.height]),h._renderTileClippingMasks(E,O,!0),h.renderLayer(h,h.style.sourceCaches[E.source],E,O,s),E.source&&(T.rttCoords[E.source]=this._coordsAscendingStr[E.source][T.tileID.key])}}return ol(this.painter,this.terrain,this._rttTiles,s),this._rttTiles=[],this.pool.freeAllObjects(),sr[l]}return!1}}const ro={"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=ue,Pi={hash:!1,interactive:!0,bearingSnap:7,attributionControl:io,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},Qh={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};class no{constructor(e,i,s=!1){this.mousedown=h=>{this.startMove(h,G.mousePos(this.element,h)),G.addEventListener(window,"mousemove",this.mousemove),G.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=h=>{this.move(h,G.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=G.touchPos(this.element,h.targetTouches)[0],this.startMove(h,this._startPos),G.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),G.addEventListener(window,"touchend",this.touchend))},this.touchmove=h=>{h.targetTouches.length!==1?this.reset():(this._lastPos=G.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 qh;this._rotatePitchHanlder=new gs({clickTolerance:3,move:(h,f)=>{const y=i.getBoundingClientRect(),v=new o.P((y.bottom-y.top)/2,(y.right-y.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,G.addEventListener(i,"mousedown",this.mousedown),G.addEventListener(i,"touchstart",this.touchstart,{passive:!1}),G.addEventListener(i,"touchcancel",this.reset)}startMove(e,i){this._rotatePitchHanlder.dragStart(e,i),G.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;G.removeEventListener(e,"mousedown",this.mousedown),G.removeEventListener(e,"touchstart",this.touchstart,{passive:!1}),G.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),G.removeEventListener(window,"touchend",this.touchend),G.removeEventListener(e,"touchcancel",this.reset),this.offTemp()}offTemp(){G.enableDrag(),G.removeEventListener(window,"mousemove",this.mousemove),G.removeEventListener(window,"mouseup",this.mouseup),G.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),G.removeEventListener(window,"touchend",this.touchend)}}let nn;function dl(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 ao={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 pl(u,e,i){const s=u.classList;for(const l in ao)s.remove(`maplibregl-${i}-anchor-${l}`);s.add(`maplibregl-${i}-anchor-${e}`)}class Pa 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?dl(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()),G.setTransform(this._element,`${ao[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${f} ${h}`),ae.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=G.create("div");const i=G.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=G.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=G.createNS("http://www.w3.org/2000/svg","g");f.setAttributeNS(null,"fill-rule","nonzero");const y=G.createNS("http://www.w3.org/2000/svg","g");y.setAttributeNS(null,"transform","translate(3.0, 29.0)"),y.setAttributeNS(null,"fill","#000000");const v=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const H of v){const K=G.createNS("http://www.w3.org/2000/svg","ellipse");K.setAttributeNS(null,"opacity","0.04"),K.setAttributeNS(null,"cx","10.5"),K.setAttributeNS(null,"cy","5.80029008"),K.setAttributeNS(null,"rx",H.rx),K.setAttributeNS(null,"ry",H.ry),y.appendChild(K)}const T=G.createNS("http://www.w3.org/2000/svg","g");T.setAttributeNS(null,"fill",this._color);const C=G.createNS("http://www.w3.org/2000/svg","path");C.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(C);const A=G.createNS("http://www.w3.org/2000/svg","g");A.setAttributeNS(null,"opacity","0.25"),A.setAttributeNS(null,"fill","#000000");const E=G.createNS("http://www.w3.org/2000/svg","path");E.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"),A.appendChild(E);const O=G.createNS("http://www.w3.org/2000/svg","g");O.setAttributeNS(null,"transform","translate(6.0, 7.0)"),O.setAttributeNS(null,"fill","#FFFFFF");const Z=G.createNS("http://www.w3.org/2000/svg","g");Z.setAttributeNS(null,"transform","translate(8.0, 8.0)");const W=G.createNS("http://www.w3.org/2000/svg","circle");W.setAttributeNS(null,"fill","#000000"),W.setAttributeNS(null,"opacity","0.25"),W.setAttributeNS(null,"cx","5.5"),W.setAttributeNS(null,"cy","5.5"),W.setAttributeNS(null,"r","5.4999962");const q=G.createNS("http://www.w3.org/2000/svg","circle");q.setAttributeNS(null,"fill","#FFFFFF"),q.setAttributeNS(null,"cx","5.5"),q.setAttributeNS(null,"cy","5.5"),q.setAttributeNS(null,"r","5.4999962"),Z.appendChild(W),Z.appendChild(q),f.appendChild(y),f.appendChild(T),f.appendChild(A),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()}),pl(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.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),G.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 A=this._map.transform.isLocationOccluded(this._lngLat)?this._opacityWhenCovered:this._opacity;return void(this._element.style.opacity!==A&&(this._element.style.opacity=A))}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 y=-this._offset.y/l.transform.pixelsPerMeter,v=Math.sin(l.getPitch()*Math.PI/180)*y,T=l.terrain.depthAtPoint(new o.P(this._pos.x,this._pos.y-this._offset.y)),C=l.transform.lngLatToCameraDepth(this._lngLat,f+v)-T>.006;!((s=this._popup)===null||s===void 0)&&s.isOpen()&&C&&this._popup.remove(),this._element.style.opacity=C?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 Wc={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let ys=0,Sa=!1;const Hc={maxWidth:100,unit:"metric"};function fl(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]),y=u.unproject([h+s/2,l]),v=Math.round(u.project(y).x-u.project(f).x),T=Math.min(s,v,u._container.clientWidth),C=f.distanceTo(y);if(i&&i.unit==="imperial"){const A=3.2808*C;A>5280?Ma(e,T,A/5280,u._getUIString("ScaleControl.Miles")):Ma(e,T,A,u._getUIString("ScaleControl.Feet"))}else i&&i.unit==="nautical"?Ma(e,T,C/1852,u._getUIString("ScaleControl.NauticalMiles")):C>=1e3?Ma(e,T,C/1e3,u._getUIString("ScaleControl.Kilometers")):Ma(e,T,C,u._getUIString("ScaleControl.Meters"))}function Ma(u,e,i,s){const l=function(h){const f=Math.pow(10,`${Math.floor(h)}`.length-1);let y=h/f;return y=y>=10?10:y>=5?5:y>=3?3:y>=2?2:y>=1?1:function(v){const T=Math.pow(10,Math.ceil(-Math.log(v)/Math.LN10));return Math.round(v*T)/T}(y),f*y}(i);u.style.width=e*(l/i)+"px",u.innerHTML=`${l}&nbsp;${s}`}const Xc={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0},Kc=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function so(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 so(new o.P(0,0))}const Yc=ue;P.AJAXError=o.cm,P.Event=o.l,P.Evented=o.E,P.LngLat=o.Q,P.MercatorCoordinate=o.$,P.Point=o.P,P.addProtocol=o.cn,P.config=o.a,P.removeProtocol=o.co,P.AttributionControl=et,P.BoxZoomHandler=wa,P.CanvasSource=Za,P.CooperativeGesturesHandler=cl,P.DoubleClickZoomHandler=$c,P.DragPanHandler=vn,P.DragRotateHandler=ni,P.EdgeInsets=ci,P.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=G.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){G.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const u=this._fullscreenButton=G.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);G.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()}},P.GeoJSONSource=jn,P.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=wi.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&&Sa)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=G.create("button","maplibregl-ctrl-geolocate",this._container),G.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=G.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Pa({element:this._dotElement}),this._circleElement=G.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Pa({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({},Wc,u)}onAdd(u){return this._map=u,this._container=G.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return o._(this,arguments,void 0,function*(e=!1){if(nn!==void 0&&!e)return nn;if(window.navigator.permissions===void 0)return nn=!!window.navigator.geolocation,nn;try{nn=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{nn=!!window.navigator.geolocation}return nn})}().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(),G.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,ys=0,Sa=!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":ys--,Sa=!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"),ys++,ys>1?(u={maximumAge:6e5,timeout:0},Sa=!0):(u=this.options.positionOptions,Sa=!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)}},P.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=G.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=G.create("button","maplibregl-ctrl-globe",this._container),G.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(){G.remove(this._container),this._map.off("styledata",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}},P.Hash=Bc,P.ImageSource=Or,P.KeyboardHandler=Zc,P.LngLatBounds=wi,P.LogoControl=ot,P.Map=class extends rn{constructor(u){var e,i;o.cj.mark(o.ck.create);const s=Object.assign(Object.assign(Object.assign({},Pi),u),{canvasContextAttributes:Object.assign(Object.assign({},Pi.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 ui,h=new dr;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 hl,this._controls=[],this._mapId=o.a4(),this._contextLost=y=>{y.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new o.l("webglcontextlost",{originalEvent:y}))},this._contextRestored=y=>{this._setupPainter(),this.resize(),this._update(),this.fire(new o.l("webglcontextrestored",{originalEvent:y}))},this._onMapScroll=y=>{if(y.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({},ro),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=pt.addThrottleControl(()=>this.isMoving()),this._requestManager=new Mt(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 y=!1;const v=Fc(T=>{this._trackResize&&!this._removed&&(this.resize(T),this.redraw())},50);this._resizeObserver=new ResizeObserver(T=>{y?v(T):y=!0}),this._resizeObserver.observe(this._container)}this.handlers=new _p(this,s),this._hash=s.hash&&new Bc(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 et(typeof s.attributionControl=="boolean"?void 0:s.attributionControl)),s.maplibreLogo&&this.addControl(new ot,s.logoPosition),this.on("style.load",()=>{if(f||this._resizeTransform(),this.transform.unmodified){const y=o.O(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(y)}}),this.on("data",y=>{this._update(y.dataType==="style"),this.fire(new o.l(`${y.dataType}data`,y))}),this.on("dataloading",y=>{this.fire(new o.l(`${y.dataType}dataloading`,y))}),this.on("dataabort",y=>{this.fire(new o.l("sourcedataabort",y))})}_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 y=this._getClampedPixelRatio(i,s);this._resizeCanvas(i,s,y),this.painter.resize(i,s,y)}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(wi.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)),y=f.length!==0?this.queryRenderedFeatures(h.point,{layers:f}):[];y.length?s||(s=!0,i.call(this,new tr(u,this,h.originalEvent,{features:y}))):s=!1},mouseout:()=>{s=!1}}}}if(u==="mouseleave"||u==="mouseout"){let s=!1;return{layers:e,listener:i,delegates:{mousemove:f=>{const y=e.filter(v=>this.getLayer(v));(y.length!==0?this.queryRenderedFeatures(f.point,{layers:y}):[]).length?s=!0:s&&(s=!1,i.call(this,new tr(u,this,f.originalEvent)))},mouseout:f=>{s&&(s=!1,i.call(this,new tr(u,this,f.originalEvent)))}}}}{const s=l=>{const h=e.filter(y=>this.getLayer(y)),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]=(...y)=>{this._removeDelegatedListener(u,s,i),f(...y)}}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 is(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 is(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 fr(this.painter,e,u),this.painter.renderToTexture=new yp(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:y,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:C,height:A,data:E}=e,O=e;return this.style.addImage(u,{data:new o.R({width:C,height:A},new Uint8Array(E)),pixelRatio:s,stretchX:h,stretchY:f,content:y,textFitWidth:v,textFitHeight:T,sdf:l,version:0,userImage:O}),O.onAdd&&O.onAdd(this,u),this}}{const{width:C,height:A,data:E}=ae.getImageData(e);this.style.addImage(u,{data:new o.R({width:C,height:A},E),pixelRatio:s,stretchX:h,stretchY:f,content:y,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)?ae.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 y=!(e instanceof HTMLImageElement||o.b(e));return i.data.replace(f,y),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 pt.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=G.create("div","maplibregl-canvas-container",u);this._interactive&&e.classList.add("maplibregl-interactive"),this._canvas=G.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=G.create("div","maplibregl-control-container",u),h=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(f=>{h[f]=G.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 jh(i,this.transform),ve.testSupport(i)}migrateProjection(u,e){super.migrateProjection(u,e),this.painter.transform=u,this.fire(new o.l("projectiontransition",{newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(u){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||u,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(u){return this._update(),this._renderTaskQueue.add(u)}_cancelRenderFrame(u){this._renderTaskQueue.remove(u)}_render(u){var e,i,s,l,h;const f=this._idleTriggered?this._fadeDuration:0,y=((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 A=this.transform.zoom,E=ae.now();this.style.zoomHistory.update(A,E);const O=new o.C(A,{now:E,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!==y;(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 C=this._sourcesDirty||this._styleDirty||this._placementDirty;return C||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new o.l("idle")),!this._loaded||this._fullyLoaded||C||(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),pt.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),G.remove(this._canvasContainer),G.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,ae.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===Dh}(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)}},P.MapMouseEvent=tr,P.MapTouchEvent=ms,P.MapWheelEvent=zr,P.Marker=Pa,P.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({},Qh,u),this._container=G.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})),G.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})),G.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=G.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 no(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){G.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=G.create("button",u,this._container);return i.type="button",i.addEventListener("click",e),i}},P.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&&G.remove(this._content),this._container&&(G.remove(this._container),delete this._container),this._closeButton&&this._closeButton.removeEventListener("click",this._onClose),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=G.create("div","maplibregl-popup",this._map.getContainer()),this._tip=G.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const y of this.options.className.split(" "))this._container.classList.add(y);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?dl(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=so(this.options.offset);if(!l){const y=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<y/2?T.push("left"):s.x>this._map.transform.width-y/2&&T.push("right"),l=T.length===0?"bottom":T.join("-")}let f=s.add(h[l]);this.options.subpixelPositioning||(f=f.round()),G.setTransform(this._container,`${ao[l]} translate(${f.x}px,${f.y}px)`),pl(this._container,l,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=o.e(Object.create(Xc),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=G.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=G.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(Kc);u&&u.focus()}},P.RasterDEMTileSource=On,P.RasterTileSource=Br,P.ScaleControl=class{constructor(u){this._onMove=()=>{fl(this._map,this._container,this.options)},this.setUnit=e=>{this.options.unit=e,fl(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Hc),u)}getDefaultPosition(){return"bottom-left"}onAdd(u){return this._map=u,this._container=G.create("div","maplibregl-ctrl maplibregl-ctrl-scale",u.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){G.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},P.ScrollZoomHandler=Kh,P.Style=is,P.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=G.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=G.create("button","maplibregl-ctrl-terrain",this._container),G.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(){G.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},P.TwoFingersTouchPitchHandler=Xh,P.TwoFingersTouchRotateHandler=Hh,P.TwoFingersTouchZoomHandler=Ct,P.TwoFingersTouchZoomRotateHandler=eo,P.VectorTileSource=ua,P.VideoSource=jr,P.addSourceType=(u,e)=>o._(void 0,void 0,void 0,function*(){if(Rs(u))throw new Error(`A source type called "${u}" already exists.`);((i,s)=>{Va[i]=s})(u,e)}),P.clearPrewarmedResources=function(){const u=Gt;u&&(u.isPreloaded()&&u.numActive()===1?(u.release(Ut),Gt=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()"))},P.createTileMesh=Oo,P.getMaxParallelImageRequests=function(){return o.a.MAX_PARALLEL_IMAGE_REQUESTS},P.getRTLTextPluginStatus=function(){return pn().getRTLTextPluginStatus()},P.getVersion=function(){return Yc},P.getWorkerCount=function(){return Ii.workerCount},P.getWorkerUrl=function(){return o.a.WORKER_URL},P.importScriptInWorkers=function(u){return Pt().broadcast("IS",u)},P.prewarm=function(){Qt().acquire(Ut)},P.setMaxParallelImageRequests=function(u){o.a.MAX_PARALLEL_IMAGE_REQUESTS=u},P.setRTLTextPlugin=function(u,e){return pn().setRTLTextPlugin(u,e)},P.setWorkerCount=function(u){Ii.workerCount=u},P.setWorkerUrl=function(u){o.a.WORKER_URL=u}});var z=b;return z})}(qu)),qu.exports}var Zy=Ny();const Zd=Oy(Zy);class Vy{constructor(m){ta(this,"marker");ta(this,"libreMarker");Mr(this,ic,vi());Mr(this,rc,vi());Mr(this,nc,vi());Mr(this,ac,vi(!1));Mr(this,sc,vi());Mr(this,oc,vi(!1));this.marker=m,this.libreMarker=void 0,this.content=void 0,this.element=void 0,this.component=void 0,this.componentRendered=!1,this.circle=void 0,this.circleRendered=!1}get element(){return We(Vt(this,ic))}set element(m){ti(Vt(this,ic),m,!0)}get content(){return We(Vt(this,rc))}set content(m){ti(Vt(this,rc),m,!0)}get component(){return We(Vt(this,nc))}set component(m){ti(Vt(this,nc),m,!0)}get componentRendered(){return We(Vt(this,ac))}set componentRendered(m){ti(Vt(this,ac),m,!0)}get circle(){return We(Vt(this,sc))}set circle(m){ti(Vt(this,sc),m,!0)}get circleRendered(){return We(Vt(this,oc))}set circleRendered(m){ti(Vt(this,oc),m,!0)}}ic=new WeakMap,rc=new WeakMap,nc=new WeakMap,ac=new WeakMap,sc=new WeakMap,oc=new WeakMap;class om{constructor(m,b,M,k,z){ta(this,"bounds1");ta(this,"bounds2");ta(this,"getBounds",(m,b,M,k)=>new Zd.LngLatBounds([m,b],[M,k]));ta(this,"contains",(m,b)=>this.bounds1.contains([b,m])||this.bounds2.contains([b,m]));const P=m.unproject([b,M]),o=m.unproject([k,z]);if(P.lng<-180){this.bounds1=this.getBounds(-180,P.lat,o.lng,o.lat),this.bounds2=this.getBounds(P.wrap().lng,P.lat,180,o.lat);return}if(o.lng>180){this.bounds1=this.getBounds(P.lng,P.lat,180,o.lat),this.bounds2=this.getBounds(-180,P.lat,o.wrap().lng,o.lat);return}this.bounds1=this.getBounds(P.lng,P.lat,o.lng,o.lat),this.bounds2=this.getBounds(0,0,0,0)}}const Uy={version:8,sources:{openmaptiles:{type:"vector",url:"https://tiles.openfreemap.org/planet"}},glyphs:"https://tiles.openfreemap.org/fonts/{fontstack}/{range}.pbf",layers:[{id:"background",type:"background",paint:{"background-color":"rgba(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}}]},$y={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 Zt;(function(_){_.assertEqual=k=>k;function m(k){}_.assertIs=m;function b(k){throw new Error}_.assertNever=b,_.arrayToEnum=k=>{const z={};for(const P of k)z[P]=P;return z},_.getValidEnumValues=k=>{const z=_.objectKeys(k).filter(o=>typeof k[k[o]]!="number"),P={};for(const o of z)P[o]=k[o];return _.objectValues(P)},_.objectValues=k=>_.objectKeys(k).map(function(z){return k[z]}),_.objectKeys=typeof Object.keys=="function"?k=>Object.keys(k):k=>{const z=[];for(const P in k)Object.prototype.hasOwnProperty.call(k,P)&&z.push(P);return z},_.find=(k,z)=>{for(const P of k)if(z(P))return P},_.isInteger=typeof Number.isInteger=="function"?k=>Number.isInteger(k):k=>typeof k=="number"&&isFinite(k)&&Math.floor(k)===k;function M(k,z=" | "){return k.map(P=>typeof P=="string"?`'${P}'`:P).join(z)}_.joinValues=M,_.jsonStringifyReplacer=(k,z)=>typeof z=="bigint"?z.toString():z})(Zt||(Zt={}));var Vd;(function(_){_.mergeShapes=(m,b)=>({...m,...b})})(Vd||(Vd={}));const Je=Zt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),aa=_=>{switch(typeof _){case"undefined":return Je.undefined;case"string":return Je.string;case"number":return isNaN(_)?Je.nan:Je.number;case"boolean":return Je.boolean;case"function":return Je.function;case"bigint":return Je.bigint;case"symbol":return Je.symbol;case"object":return Array.isArray(_)?Je.array:_===null?Je.null:_.then&&typeof _.then=="function"&&_.catch&&typeof _.catch=="function"?Je.promise:typeof Map<"u"&&_ instanceof Map?Je.map:typeof Set<"u"&&_ instanceof Set?Je.set:typeof Date<"u"&&_ instanceof Date?Je.date:Je.object;default:return Je.unknown}},je=Zt.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"]),Gy=_=>JSON.stringify(_,null,2).replace(/"([^"]+)":/g,"$1:");class Lr extends Error{get errors(){return this.issues}constructor(m){super(),this.issues=[],this.addIssue=M=>{this.issues=[...this.issues,M]},this.addIssues=(M=[])=>{this.issues=[...this.issues,...M]};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(z){return z.message},M={_errors:[]},k=z=>{for(const P of z.issues)if(P.code==="invalid_union")P.unionErrors.map(k);else if(P.code==="invalid_return_type")k(P.returnTypeError);else if(P.code==="invalid_arguments")k(P.argumentsError);else if(P.path.length===0)M._errors.push(b(P));else{let o=M,ue=0;for(;ue<P.path.length;){const re=P.path[ue];ue===P.path.length-1?(o[re]=o[re]||{_errors:[]},o[re]._errors.push(b(P))):o[re]=o[re]||{_errors:[]},o=o[re],ue++}}};return k(this),M}static assert(m){if(!(m instanceof Lr))throw new Error(`Not a ZodError: ${m}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Zt.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(m=b=>b.message){const b={},M=[];for(const k of this.issues)k.path.length>0?(b[k.path[0]]=b[k.path[0]]||[],b[k.path[0]].push(m(k))):M.push(m(k));return{formErrors:M,fieldErrors:b}}get formErrors(){return this.flatten()}}Lr.create=_=>new Lr(_);const Mo=(_,m)=>{let b;switch(_.code){case je.invalid_type:_.received===Je.undefined?b="Required":b=`Expected ${_.expected}, received ${_.received}`;break;case je.invalid_literal:b=`Invalid literal value, expected ${JSON.stringify(_.expected,Zt.jsonStringifyReplacer)}`;break;case je.unrecognized_keys:b=`Unrecognized key(s) in object: ${Zt.joinValues(_.keys,", ")}`;break;case je.invalid_union:b="Invalid input";break;case je.invalid_union_discriminator:b=`Invalid discriminator value. Expected ${Zt.joinValues(_.options)}`;break;case je.invalid_enum_value:b=`Invalid enum value. Expected ${Zt.joinValues(_.options)}, received '${_.received}'`;break;case je.invalid_arguments:b="Invalid function arguments";break;case je.invalid_return_type:b="Invalid function return type";break;case je.invalid_date:b="Invalid date";break;case je.invalid_string:typeof _.validation=="object"?"includes"in _.validation?(b=`Invalid input: must include "${_.validation.includes}"`,typeof _.validation.position=="number"&&(b=`${b} at one or more positions greater than or equal to ${_.validation.position}`)):"startsWith"in _.validation?b=`Invalid input: must start with "${_.validation.startsWith}"`:"endsWith"in _.validation?b=`Invalid input: must end with "${_.validation.endsWith}"`:Zt.assertNever(_.validation):_.validation!=="regex"?b=`Invalid ${_.validation}`:b="Invalid";break;case je.too_small:_.type==="array"?b=`Array must contain ${_.exact?"exactly":_.inclusive?"at least":"more than"} ${_.minimum} element(s)`:_.type==="string"?b=`String must contain ${_.exact?"exactly":_.inclusive?"at least":"over"} ${_.minimum} character(s)`:_.type==="number"?b=`Number must be ${_.exact?"exactly equal to ":_.inclusive?"greater than or equal to ":"greater than "}${_.minimum}`:_.type==="date"?b=`Date must be ${_.exact?"exactly equal to ":_.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(_.minimum))}`:b="Invalid input";break;case je.too_big:_.type==="array"?b=`Array must contain ${_.exact?"exactly":_.inclusive?"at most":"less than"} ${_.maximum} element(s)`:_.type==="string"?b=`String must contain ${_.exact?"exactly":_.inclusive?"at most":"under"} ${_.maximum} character(s)`:_.type==="number"?b=`Number must be ${_.exact?"exactly":_.inclusive?"less than or equal to":"less than"} ${_.maximum}`:_.type==="bigint"?b=`BigInt must be ${_.exact?"exactly":_.inclusive?"less than or equal to":"less than"} ${_.maximum}`:_.type==="date"?b=`Date must be ${_.exact?"exactly":_.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(_.maximum))}`:b="Invalid input";break;case je.custom:b="Invalid input";break;case je.invalid_intersection_types:b="Intersection results could not be merged";break;case je.not_multiple_of:b=`Number must be a multiple of ${_.multipleOf}`;break;case je.not_finite:b="Number must be finite";break;default:b=m.defaultError,Zt.assertNever(_)}return{message:b}};let lm=Mo;function qy(_){lm=_}function Wu(){return lm}const Hu=_=>{const{data:m,path:b,errorMaps:M,issueData:k}=_,z=[...b,...k.path||[]],P={...k,path:z};if(k.message!==void 0)return{...k,path:z,message:k.message};let o="";const ue=M.filter(re=>!!re).slice().reverse();for(const re of ue)o=re(P,{data:m,defaultError:o}).message;return{...k,path:z,message:o}},Wy=[];function qe(_,m){const b=Wu(),M=Hu({issueData:m,data:_.data,path:_.path,errorMaps:[_.common.contextualErrorMap,_.schemaErrorMap,b,b===Mo?void 0:Mo].filter(k=>!!k)});_.common.issues.push(M)}class lr{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(m,b){const M=[];for(const k of b){if(k.status==="aborted")return yt;k.status==="dirty"&&m.dirty(),M.push(k.value)}return{status:m.value,value:M}}static async mergeObjectAsync(m,b){const M=[];for(const k of b){const z=await k.key,P=await k.value;M.push({key:z,value:P})}return lr.mergeObjectSync(m,M)}static mergeObjectSync(m,b){const M={};for(const k of b){const{key:z,value:P}=k;if(z.status==="aborted"||P.status==="aborted")return yt;z.status==="dirty"&&m.dirty(),P.status==="dirty"&&m.dirty(),z.value!=="__proto__"&&(typeof P.value<"u"||k.alwaysSet)&&(M[z.value]=P.value)}return{status:m.value,value:M}}}const yt=Object.freeze({status:"aborted"}),Io=_=>({status:"dirty",value:_}),xr=_=>({status:"valid",value:_}),Ud=_=>_.status==="aborted",$d=_=>_.status==="dirty",Cs=_=>_.status==="valid",Ol=_=>typeof Promise<"u"&&_ instanceof Promise;function Xu(_,m,b,M){if(typeof m=="function"?_!==m||!0:!m.has(_))throw new TypeError("Cannot read private member from an object whose class did not declare it");return m.get(_)}function cm(_,m,b,M,k){if(typeof m=="function"?_!==m||!0:!m.has(_))throw new TypeError("Cannot write private member to an object whose class did not declare it");return m.set(_,b),b}typeof SuppressedError=="function"&&SuppressedError;var at;(function(_){_.errToObj=m=>typeof m=="string"?{message:m}:m||{},_.toString=m=>typeof m=="string"?m:m==null?void 0:m.message})(at||(at={}));var jl,Nl;class Ln{constructor(m,b,M,k){this._cachedPath=[],this.parent=m,this.data=b,this._path=M,this._key=k}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 um=(_,m)=>{if(Cs(m))return{success:!0,data:m.value};if(!_.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 Lr(_.common.issues);return this._error=b,this._error}}};function St(_){if(!_)return{};const{errorMap:m,invalid_type_error:b,required_error:M,description:k}=_;if(m&&(b||M))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return m?{errorMap:m,description:k}:{errorMap:(P,o)=>{var ue,re;const{message:ne}=_;return P.code==="invalid_enum_value"?{message:ne??o.defaultError}:typeof o.data>"u"?{message:(ue=ne??M)!==null&&ue!==void 0?ue:o.defaultError}:P.code!=="invalid_type"?{message:o.defaultError}:{message:(re=ne??b)!==null&&re!==void 0?re:o.defaultError}},description:k}}class zt{get description(){return this._def.description}_getType(m){return aa(m.data)}_getOrReturnCtx(m,b){return b||{common:m.parent.common,data:m.data,parsedType:aa(m.data),schemaErrorMap:this._def.errorMap,path:m.path,parent:m.parent}}_processInputParams(m){return{status:new lr,ctx:{common:m.parent.common,data:m.data,parsedType:aa(m.data),schemaErrorMap:this._def.errorMap,path:m.path,parent:m.parent}}}_parseSync(m){const b=this._parse(m);if(Ol(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 M=this.safeParse(m,b);if(M.success)return M.data;throw M.error}safeParse(m,b){var M;const k={common:{issues:[],async:(M=b==null?void 0:b.async)!==null&&M!==void 0?M:!1,contextualErrorMap:b==null?void 0:b.errorMap},path:(b==null?void 0:b.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:m,parsedType:aa(m)},z=this._parseSync({data:m,path:k.path,parent:k});return um(k,z)}"~validate"(m){var b,M;const k={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:m,parsedType:aa(m)};if(!this["~standard"].async)try{const z=this._parseSync({data:m,path:[],parent:k});return Cs(z)?{value:z.value}:{issues:k.common.issues}}catch(z){!((M=(b=z==null?void 0:z.message)===null||b===void 0?void 0:b.toLowerCase())===null||M===void 0)&&M.includes("encountered")&&(this["~standard"].async=!0),k.common={issues:[],async:!0}}return this._parseAsync({data:m,path:[],parent:k}).then(z=>Cs(z)?{value:z.value}:{issues:k.common.issues})}async parseAsync(m,b){const M=await this.safeParseAsync(m,b);if(M.success)return M.data;throw M.error}async safeParseAsync(m,b){const M={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:aa(m)},k=this._parse({data:m,path:M.path,parent:M}),z=await(Ol(k)?k:Promise.resolve(k));return um(M,z)}refine(m,b){const M=k=>typeof b=="string"||typeof b>"u"?{message:b}:typeof b=="function"?b(k):b;return this._refinement((k,z)=>{const P=m(k),o=()=>z.addIssue({code:je.custom,...M(k)});return typeof Promise<"u"&&P instanceof Promise?P.then(ue=>ue?!0:(o(),!1)):P?!0:(o(),!1)})}refinement(m,b){return this._refinement((M,k)=>m(M)?!0:(k.addIssue(typeof b=="function"?b(M,k):b),!1))}_refinement(m){return new un({schema:this,typeName:mt.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 Bn.create(this,this._def)}nullable(){return ja.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return cn.create(this)}promise(){return Ao.create(this,this._def)}or(m){return $l.create([this,m],this._def)}and(m){return Gl.create(this,m,this._def)}transform(m){return new un({...St(this._def),schema:this,typeName:mt.ZodEffects,effect:{type:"transform",transform:m}})}default(m){const b=typeof m=="function"?m:()=>m;return new Kl({...St(this._def),innerType:this,defaultValue:b,typeName:mt.ZodDefault})}brand(){return new Wd({typeName:mt.ZodBranded,type:this,...St(this._def)})}catch(m){const b=typeof m=="function"?m:()=>m;return new Yl({...St(this._def),innerType:this,catchValue:b,typeName:mt.ZodCatch})}describe(m){const b=this.constructor;return new b({...this._def,description:m})}pipe(m){return Jl.create(this,m)}readonly(){return Ql.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Hy=/^c[^\s-]{8,}$/i,Xy=/^[0-9a-z]+$/,Ky=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Yy=/^[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,Jy=/^[a-z0-9_-]{21}$/i,Qy=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,ex=/^[-+]?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)?)??$/,tx=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ix="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Gd;const rx=/^(?:(?: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])$/,nx=/^(?:(?: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])$/,ax=/^(([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]))$/,sx=/^(([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])$/,ox=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,lx=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,hm="((\\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])))",cx=new RegExp(`^${hm}$`);function dm(_){let m="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return _.precision?m=`${m}\\.\\d{${_.precision}}`:_.precision==null&&(m=`${m}(\\.\\d+)?`),m}function ux(_){return new RegExp(`^${dm(_)}$`)}function pm(_){let m=`${hm}T${dm(_)}`;const b=[];return b.push(_.local?"Z?":"Z"),_.offset&&b.push("([+-]\\d{2}:?\\d{2})"),m=`${m}(${b.join("|")})`,new RegExp(`^${m}$`)}function hx(_,m){return!!((m==="v4"||!m)&&rx.test(_)||(m==="v6"||!m)&&ax.test(_))}function dx(_,m){if(!Qy.test(_))return!1;try{const[b]=_.split("."),M=b.replace(/-/g,"+").replace(/_/g,"/").padEnd(b.length+(4-b.length%4)%4,"="),k=JSON.parse(atob(M));return!(typeof k!="object"||k===null||!k.typ||!k.alg||m&&k.alg!==m)}catch{return!1}}function px(_,m){return!!((m==="v4"||!m)&&nx.test(_)||(m==="v6"||!m)&&sx.test(_))}class ln extends zt{_parse(m){if(this._def.coerce&&(m.data=String(m.data)),this._getType(m)!==Je.string){const z=this._getOrReturnCtx(m);return qe(z,{code:je.invalid_type,expected:Je.string,received:z.parsedType}),yt}const M=new lr;let k;for(const z of this._def.checks)if(z.kind==="min")m.data.length<z.value&&(k=this._getOrReturnCtx(m,k),qe(k,{code:je.too_small,minimum:z.value,type:"string",inclusive:!0,exact:!1,message:z.message}),M.dirty());else if(z.kind==="max")m.data.length>z.value&&(k=this._getOrReturnCtx(m,k),qe(k,{code:je.too_big,maximum:z.value,type:"string",inclusive:!0,exact:!1,message:z.message}),M.dirty());else if(z.kind==="length"){const P=m.data.length>z.value,o=m.data.length<z.value;(P||o)&&(k=this._getOrReturnCtx(m,k),P?qe(k,{code:je.too_big,maximum:z.value,type:"string",inclusive:!0,exact:!0,message:z.message}):o&&qe(k,{code:je.too_small,minimum:z.value,type:"string",inclusive:!0,exact:!0,message:z.message}),M.dirty())}else if(z.kind==="email")tx.test(m.data)||(k=this._getOrReturnCtx(m,k),qe(k,{validation:"email",code:je.invalid_string,message:z.message}),M.dirty());else if(z.kind==="emoji")Gd||(Gd=new RegExp(ix,"u")),Gd.test(m.data)||(k=this._getOrReturnCtx(m,k),qe(k,{validation:"emoji",code:je.invalid_string,message:z.message}),M.dirty());else if(z.kind==="uuid")Yy.test(m.data)||(k=this._getOrReturnCtx(m,k),qe(k,{validation:"uuid",code:je.invalid_string,message:z.message}),M.dirty());else if(z.kind==="nanoid")Jy.test(m.data)||(k=this._getOrReturnCtx(m,k),qe(k,{validation:"nanoid",code:je.invalid_string,message:z.message}),M.dirty());else if(z.kind==="cuid")Hy.test(m.data)||(k=this._getOrReturnCtx(m,k),qe(k,{validation:"cuid",code:je.invalid_string,message:z.message}),M.dirty());else if(z.kind==="cuid2")Xy.test(m.data)||(k=this._getOrReturnCtx(m,k),qe(k,{validation:"cuid2",code:je.invalid_string,message:z.message}),M.dirty());else if(z.kind==="ulid")Ky.test(m.data)||(k=this._getOrReturnCtx(m,k),qe(k,{validation:"ulid",code:je.invalid_string,message:z.message}),M.dirty());else if(z.kind==="url")try{new URL(m.data)}catch{k=this._getOrReturnCtx(m,k),qe(k,{validation:"url",code:je.invalid_string,message:z.message}),M.dirty()}else z.kind==="regex"?(z.regex.lastIndex=0,z.regex.test(m.data)||(k=this._getOrReturnCtx(m,k),qe(k,{validation:"regex",code:je.invalid_string,message:z.message}),M.dirty())):z.kind==="trim"?m.data=m.data.trim():z.kind==="includes"?m.data.includes(z.value,z.position)||(k=this._getOrReturnCtx(m,k),qe(k,{code:je.invalid_string,validation:{includes:z.value,position:z.position},message:z.message}),M.dirty()):z.kind==="toLowerCase"?m.data=m.data.toLowerCase():z.kind==="toUpperCase"?m.data=m.data.toUpperCase():z.kind==="startsWith"?m.data.startsWith(z.value)||(k=this._getOrReturnCtx(m,k),qe(k,{code:je.invalid_string,validation:{startsWith:z.value},message:z.message}),M.dirty()):z.kind==="endsWith"?m.data.endsWith(z.value)||(k=this._getOrReturnCtx(m,k),qe(k,{code:je.invalid_string,validation:{endsWith:z.value},message:z.message}),M.dirty()):z.kind==="datetime"?pm(z).test(m.data)||(k=this._getOrReturnCtx(m,k),qe(k,{code:je.invalid_string,validation:"datetime",message:z.message}),M.dirty()):z.kind==="date"?cx.test(m.data)||(k=this._getOrReturnCtx(m,k),qe(k,{code:je.invalid_string,validation:"date",message:z.message}),M.dirty()):z.kind==="time"?ux(z).test(m.data)||(k=this._getOrReturnCtx(m,k),qe(k,{code:je.invalid_string,validation:"time",message:z.message}),M.dirty()):z.kind==="duration"?ex.test(m.data)||(k=this._getOrReturnCtx(m,k),qe(k,{validation:"duration",code:je.invalid_string,message:z.message}),M.dirty()):z.kind==="ip"?hx(m.data,z.version)||(k=this._getOrReturnCtx(m,k),qe(k,{validation:"ip",code:je.invalid_string,message:z.message}),M.dirty()):z.kind==="jwt"?dx(m.data,z.alg)||(k=this._getOrReturnCtx(m,k),qe(k,{validation:"jwt",code:je.invalid_string,message:z.message}),M.dirty()):z.kind==="cidr"?px(m.data,z.version)||(k=this._getOrReturnCtx(m,k),qe(k,{validation:"cidr",code:je.invalid_string,message:z.message}),M.dirty()):z.kind==="base64"?ox.test(m.data)||(k=this._getOrReturnCtx(m,k),qe(k,{validation:"base64",code:je.invalid_string,message:z.message}),M.dirty()):z.kind==="base64url"?lx.test(m.data)||(k=this._getOrReturnCtx(m,k),qe(k,{validation:"base64url",code:je.invalid_string,message:z.message}),M.dirty()):Zt.assertNever(z);return{status:M.value,value:m.data}}_regex(m,b,M){return this.refinement(k=>m.test(k),{validation:b,code:je.invalid_string,...at.errToObj(M)})}_addCheck(m){return new ln({...this._def,checks:[...this._def.checks,m]})}email(m){return this._addCheck({kind:"email",...at.errToObj(m)})}url(m){return this._addCheck({kind:"url",...at.errToObj(m)})}emoji(m){return this._addCheck({kind:"emoji",...at.errToObj(m)})}uuid(m){return this._addCheck({kind:"uuid",...at.errToObj(m)})}nanoid(m){return this._addCheck({kind:"nanoid",...at.errToObj(m)})}cuid(m){return this._addCheck({kind:"cuid",...at.errToObj(m)})}cuid2(m){return this._addCheck({kind:"cuid2",...at.errToObj(m)})}ulid(m){return this._addCheck({kind:"ulid",...at.errToObj(m)})}base64(m){return this._addCheck({kind:"base64",...at.errToObj(m)})}base64url(m){return this._addCheck({kind:"base64url",...at.errToObj(m)})}jwt(m){return this._addCheck({kind:"jwt",...at.errToObj(m)})}ip(m){return this._addCheck({kind:"ip",...at.errToObj(m)})}cidr(m){return this._addCheck({kind:"cidr",...at.errToObj(m)})}datetime(m){var b,M;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:(M=m==null?void 0:m.local)!==null&&M!==void 0?M:!1,...at.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,...at.errToObj(m==null?void 0:m.message)})}duration(m){return this._addCheck({kind:"duration",...at.errToObj(m)})}regex(m,b){return this._addCheck({kind:"regex",regex:m,...at.errToObj(b)})}includes(m,b){return this._addCheck({kind:"includes",value:m,position:b==null?void 0:b.position,...at.errToObj(b==null?void 0:b.message)})}startsWith(m,b){return this._addCheck({kind:"startsWith",value:m,...at.errToObj(b)})}endsWith(m,b){return this._addCheck({kind:"endsWith",value:m,...at.errToObj(b)})}min(m,b){return this._addCheck({kind:"min",value:m,...at.errToObj(b)})}max(m,b){return this._addCheck({kind:"max",value:m,...at.errToObj(b)})}length(m,b){return this._addCheck({kind:"length",value:m,...at.errToObj(b)})}nonempty(m){return this.min(1,at.errToObj(m))}trim(){return new ln({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ln({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ln({...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}}ln.create=_=>{var m;return new ln({checks:[],typeName:mt.ZodString,coerce:(m=_==null?void 0:_.coerce)!==null&&m!==void 0?m:!1,...St(_)})};function fx(_,m){const b=(_.toString().split(".")[1]||"").length,M=(m.toString().split(".")[1]||"").length,k=b>M?b:M,z=parseInt(_.toFixed(k).replace(".","")),P=parseInt(m.toFixed(k).replace(".",""));return z%P/Math.pow(10,k)}class Fa extends zt{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)!==Je.number){const z=this._getOrReturnCtx(m);return qe(z,{code:je.invalid_type,expected:Je.number,received:z.parsedType}),yt}let M;const k=new lr;for(const z of this._def.checks)z.kind==="int"?Zt.isInteger(m.data)||(M=this._getOrReturnCtx(m,M),qe(M,{code:je.invalid_type,expected:"integer",received:"float",message:z.message}),k.dirty()):z.kind==="min"?(z.inclusive?m.data<z.value:m.data<=z.value)&&(M=this._getOrReturnCtx(m,M),qe(M,{code:je.too_small,minimum:z.value,type:"number",inclusive:z.inclusive,exact:!1,message:z.message}),k.dirty()):z.kind==="max"?(z.inclusive?m.data>z.value:m.data>=z.value)&&(M=this._getOrReturnCtx(m,M),qe(M,{code:je.too_big,maximum:z.value,type:"number",inclusive:z.inclusive,exact:!1,message:z.message}),k.dirty()):z.kind==="multipleOf"?fx(m.data,z.value)!==0&&(M=this._getOrReturnCtx(m,M),qe(M,{code:je.not_multiple_of,multipleOf:z.value,message:z.message}),k.dirty()):z.kind==="finite"?Number.isFinite(m.data)||(M=this._getOrReturnCtx(m,M),qe(M,{code:je.not_finite,message:z.message}),k.dirty()):Zt.assertNever(z);return{status:k.value,value:m.data}}gte(m,b){return this.setLimit("min",m,!0,at.toString(b))}gt(m,b){return this.setLimit("min",m,!1,at.toString(b))}lte(m,b){return this.setLimit("max",m,!0,at.toString(b))}lt(m,b){return this.setLimit("max",m,!1,at.toString(b))}setLimit(m,b,M,k){return new Fa({...this._def,checks:[...this._def.checks,{kind:m,value:b,inclusive:M,message:at.toString(k)}]})}_addCheck(m){return new Fa({...this._def,checks:[...this._def.checks,m]})}int(m){return this._addCheck({kind:"int",message:at.toString(m)})}positive(m){return this._addCheck({kind:"min",value:0,inclusive:!1,message:at.toString(m)})}negative(m){return this._addCheck({kind:"max",value:0,inclusive:!1,message:at.toString(m)})}nonpositive(m){return this._addCheck({kind:"max",value:0,inclusive:!0,message:at.toString(m)})}nonnegative(m){return this._addCheck({kind:"min",value:0,inclusive:!0,message:at.toString(m)})}multipleOf(m,b){return this._addCheck({kind:"multipleOf",value:m,message:at.toString(b)})}finite(m){return this._addCheck({kind:"finite",message:at.toString(m)})}safe(m){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:at.toString(m)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:at.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"&&Zt.isInteger(m.value))}get isFinite(){let m=null,b=null;for(const M of this._def.checks){if(M.kind==="finite"||M.kind==="int"||M.kind==="multipleOf")return!0;M.kind==="min"?(b===null||M.value>b)&&(b=M.value):M.kind==="max"&&(m===null||M.value<m)&&(m=M.value)}return Number.isFinite(b)&&Number.isFinite(m)}}Fa.create=_=>new Fa({checks:[],typeName:mt.ZodNumber,coerce:(_==null?void 0:_.coerce)||!1,...St(_)});class Ba extends zt{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)!==Je.bigint)return this._getInvalidInput(m);let M;const k=new lr;for(const z of this._def.checks)z.kind==="min"?(z.inclusive?m.data<z.value:m.data<=z.value)&&(M=this._getOrReturnCtx(m,M),qe(M,{code:je.too_small,type:"bigint",minimum:z.value,inclusive:z.inclusive,message:z.message}),k.dirty()):z.kind==="max"?(z.inclusive?m.data>z.value:m.data>=z.value)&&(M=this._getOrReturnCtx(m,M),qe(M,{code:je.too_big,type:"bigint",maximum:z.value,inclusive:z.inclusive,message:z.message}),k.dirty()):z.kind==="multipleOf"?m.data%z.value!==BigInt(0)&&(M=this._getOrReturnCtx(m,M),qe(M,{code:je.not_multiple_of,multipleOf:z.value,message:z.message}),k.dirty()):Zt.assertNever(z);return{status:k.value,value:m.data}}_getInvalidInput(m){const b=this._getOrReturnCtx(m);return qe(b,{code:je.invalid_type,expected:Je.bigint,received:b.parsedType}),yt}gte(m,b){return this.setLimit("min",m,!0,at.toString(b))}gt(m,b){return this.setLimit("min",m,!1,at.toString(b))}lte(m,b){return this.setLimit("max",m,!0,at.toString(b))}lt(m,b){return this.setLimit("max",m,!1,at.toString(b))}setLimit(m,b,M,k){return new Ba({...this._def,checks:[...this._def.checks,{kind:m,value:b,inclusive:M,message:at.toString(k)}]})}_addCheck(m){return new Ba({...this._def,checks:[...this._def.checks,m]})}positive(m){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:at.toString(m)})}negative(m){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:at.toString(m)})}nonpositive(m){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:at.toString(m)})}nonnegative(m){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:at.toString(m)})}multipleOf(m,b){return this._addCheck({kind:"multipleOf",value:m,message:at.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}}Ba.create=_=>{var m;return new Ba({checks:[],typeName:mt.ZodBigInt,coerce:(m=_==null?void 0:_.coerce)!==null&&m!==void 0?m:!1,...St(_)})};class Zl extends zt{_parse(m){if(this._def.coerce&&(m.data=!!m.data),this._getType(m)!==Je.boolean){const M=this._getOrReturnCtx(m);return qe(M,{code:je.invalid_type,expected:Je.boolean,received:M.parsedType}),yt}return xr(m.data)}}Zl.create=_=>new Zl({typeName:mt.ZodBoolean,coerce:(_==null?void 0:_.coerce)||!1,...St(_)});class ks extends zt{_parse(m){if(this._def.coerce&&(m.data=new Date(m.data)),this._getType(m)!==Je.date){const z=this._getOrReturnCtx(m);return qe(z,{code:je.invalid_type,expected:Je.date,received:z.parsedType}),yt}if(isNaN(m.data.getTime())){const z=this._getOrReturnCtx(m);return qe(z,{code:je.invalid_date}),yt}const M=new lr;let k;for(const z of this._def.checks)z.kind==="min"?m.data.getTime()<z.value&&(k=this._getOrReturnCtx(m,k),qe(k,{code:je.too_small,message:z.message,inclusive:!0,exact:!1,minimum:z.value,type:"date"}),M.dirty()):z.kind==="max"?m.data.getTime()>z.value&&(k=this._getOrReturnCtx(m,k),qe(k,{code:je.too_big,message:z.message,inclusive:!0,exact:!1,maximum:z.value,type:"date"}),M.dirty()):Zt.assertNever(z);return{status:M.value,value:new Date(m.data.getTime())}}_addCheck(m){return new ks({...this._def,checks:[...this._def.checks,m]})}min(m,b){return this._addCheck({kind:"min",value:m.getTime(),message:at.toString(b)})}max(m,b){return this._addCheck({kind:"max",value:m.getTime(),message:at.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}}ks.create=_=>new ks({checks:[],coerce:(_==null?void 0:_.coerce)||!1,typeName:mt.ZodDate,...St(_)});class Ku extends zt{_parse(m){if(this._getType(m)!==Je.symbol){const M=this._getOrReturnCtx(m);return qe(M,{code:je.invalid_type,expected:Je.symbol,received:M.parsedType}),yt}return xr(m.data)}}Ku.create=_=>new Ku({typeName:mt.ZodSymbol,...St(_)});class Vl extends zt{_parse(m){if(this._getType(m)!==Je.undefined){const M=this._getOrReturnCtx(m);return qe(M,{code:je.invalid_type,expected:Je.undefined,received:M.parsedType}),yt}return xr(m.data)}}Vl.create=_=>new Vl({typeName:mt.ZodUndefined,...St(_)});class Ul extends zt{_parse(m){if(this._getType(m)!==Je.null){const M=this._getOrReturnCtx(m);return qe(M,{code:je.invalid_type,expected:Je.null,received:M.parsedType}),yt}return xr(m.data)}}Ul.create=_=>new Ul({typeName:mt.ZodNull,...St(_)});class Co extends zt{constructor(){super(...arguments),this._any=!0}_parse(m){return xr(m.data)}}Co.create=_=>new Co({typeName:mt.ZodAny,...St(_)});class Es extends zt{constructor(){super(...arguments),this._unknown=!0}_parse(m){return xr(m.data)}}Es.create=_=>new Es({typeName:mt.ZodUnknown,...St(_)});class sa extends zt{_parse(m){const b=this._getOrReturnCtx(m);return qe(b,{code:je.invalid_type,expected:Je.never,received:b.parsedType}),yt}}sa.create=_=>new sa({typeName:mt.ZodNever,...St(_)});class Yu extends zt{_parse(m){if(this._getType(m)!==Je.undefined){const M=this._getOrReturnCtx(m);return qe(M,{code:je.invalid_type,expected:Je.void,received:M.parsedType}),yt}return xr(m.data)}}Yu.create=_=>new Yu({typeName:mt.ZodVoid,...St(_)});class cn extends zt{_parse(m){const{ctx:b,status:M}=this._processInputParams(m),k=this._def;if(b.parsedType!==Je.array)return qe(b,{code:je.invalid_type,expected:Je.array,received:b.parsedType}),yt;if(k.exactLength!==null){const P=b.data.length>k.exactLength.value,o=b.data.length<k.exactLength.value;(P||o)&&(qe(b,{code:P?je.too_big:je.too_small,minimum:o?k.exactLength.value:void 0,maximum:P?k.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:k.exactLength.message}),M.dirty())}if(k.minLength!==null&&b.data.length<k.minLength.value&&(qe(b,{code:je.too_small,minimum:k.minLength.value,type:"array",inclusive:!0,exact:!1,message:k.minLength.message}),M.dirty()),k.maxLength!==null&&b.data.length>k.maxLength.value&&(qe(b,{code:je.too_big,maximum:k.maxLength.value,type:"array",inclusive:!0,exact:!1,message:k.maxLength.message}),M.dirty()),b.common.async)return Promise.all([...b.data].map((P,o)=>k.type._parseAsync(new Ln(b,P,b.path,o)))).then(P=>lr.mergeArray(M,P));const z=[...b.data].map((P,o)=>k.type._parseSync(new Ln(b,P,b.path,o)));return lr.mergeArray(M,z)}get element(){return this._def.type}min(m,b){return new cn({...this._def,minLength:{value:m,message:at.toString(b)}})}max(m,b){return new cn({...this._def,maxLength:{value:m,message:at.toString(b)}})}length(m,b){return new cn({...this._def,exactLength:{value:m,message:at.toString(b)}})}nonempty(m){return this.min(1,m)}}cn.create=(_,m)=>new cn({type:_,minLength:null,maxLength:null,exactLength:null,typeName:mt.ZodArray,...St(m)});function ko(_){if(_ instanceof Si){const m={};for(const b in _.shape){const M=_.shape[b];m[b]=Bn.create(ko(M))}return new Si({..._._def,shape:()=>m})}else return _ instanceof cn?new cn({..._._def,type:ko(_.element)}):_ instanceof Bn?Bn.create(ko(_.unwrap())):_ instanceof ja?ja.create(ko(_.unwrap())):_ instanceof Fn?Fn.create(_.items.map(m=>ko(m))):_}class Si extends zt{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=Zt.objectKeys(m);return this._cached={shape:m,keys:b}}_parse(m){if(this._getType(m)!==Je.object){const re=this._getOrReturnCtx(m);return qe(re,{code:je.invalid_type,expected:Je.object,received:re.parsedType}),yt}const{status:M,ctx:k}=this._processInputParams(m),{shape:z,keys:P}=this._getCached(),o=[];if(!(this._def.catchall instanceof sa&&this._def.unknownKeys==="strip"))for(const re in k.data)P.includes(re)||o.push(re);const ue=[];for(const re of P){const ne=z[re],_e=k.data[re];ue.push({key:{status:"valid",value:re},value:ne._parse(new Ln(k,_e,k.path,re)),alwaysSet:re in k.data})}if(this._def.catchall instanceof sa){const re=this._def.unknownKeys;if(re==="passthrough")for(const ne of o)ue.push({key:{status:"valid",value:ne},value:{status:"valid",value:k.data[ne]}});else if(re==="strict")o.length>0&&(qe(k,{code:je.unrecognized_keys,keys:o}),M.dirty());else if(re!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const re=this._def.catchall;for(const ne of o){const _e=k.data[ne];ue.push({key:{status:"valid",value:ne},value:re._parse(new Ln(k,_e,k.path,ne)),alwaysSet:ne in k.data})}}return k.common.async?Promise.resolve().then(async()=>{const re=[];for(const ne of ue){const _e=await ne.key,ae=await ne.value;re.push({key:_e,value:ae,alwaysSet:ne.alwaysSet})}return re}).then(re=>lr.mergeObjectSync(M,re)):lr.mergeObjectSync(M,ue)}get shape(){return this._def.shape()}strict(m){return at.errToObj,new Si({...this._def,unknownKeys:"strict",...m!==void 0?{errorMap:(b,M)=>{var k,z,P,o;const ue=(P=(z=(k=this._def).errorMap)===null||z===void 0?void 0:z.call(k,b,M).message)!==null&&P!==void 0?P:M.defaultError;return b.code==="unrecognized_keys"?{message:(o=at.errToObj(m).message)!==null&&o!==void 0?o:ue}:{message:ue}}}:{}})}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:mt.ZodObject})}setKey(m,b){return this.augment({[m]:b})}catchall(m){return new Si({...this._def,catchall:m})}pick(m){const b={};return Zt.objectKeys(m).forEach(M=>{m[M]&&this.shape[M]&&(b[M]=this.shape[M])}),new Si({...this._def,shape:()=>b})}omit(m){const b={};return Zt.objectKeys(this.shape).forEach(M=>{m[M]||(b[M]=this.shape[M])}),new Si({...this._def,shape:()=>b})}deepPartial(){return ko(this)}partial(m){const b={};return Zt.objectKeys(this.shape).forEach(M=>{const k=this.shape[M];m&&!m[M]?b[M]=k:b[M]=k.optional()}),new Si({...this._def,shape:()=>b})}required(m){const b={};return Zt.objectKeys(this.shape).forEach(M=>{if(m&&!m[M])b[M]=this.shape[M];else{let z=this.shape[M];for(;z instanceof Bn;)z=z._def.innerType;b[M]=z}}),new Si({...this._def,shape:()=>b})}keyof(){return fm(Zt.objectKeys(this.shape))}}Si.create=(_,m)=>new Si({shape:()=>_,unknownKeys:"strip",catchall:sa.create(),typeName:mt.ZodObject,...St(m)}),Si.strictCreate=(_,m)=>new Si({shape:()=>_,unknownKeys:"strict",catchall:sa.create(),typeName:mt.ZodObject,...St(m)}),Si.lazycreate=(_,m)=>new Si({shape:_,unknownKeys:"strip",catchall:sa.create(),typeName:mt.ZodObject,...St(m)});class $l extends zt{_parse(m){const{ctx:b}=this._processInputParams(m),M=this._def.options;function k(z){for(const o of z)if(o.result.status==="valid")return o.result;for(const o of z)if(o.result.status==="dirty")return b.common.issues.push(...o.ctx.common.issues),o.result;const P=z.map(o=>new Lr(o.ctx.common.issues));return qe(b,{code:je.invalid_union,unionErrors:P}),yt}if(b.common.async)return Promise.all(M.map(async z=>{const P={...b,common:{...b.common,issues:[]},parent:null};return{result:await z._parseAsync({data:b.data,path:b.path,parent:P}),ctx:P}})).then(k);{let z;const P=[];for(const ue of M){const re={...b,common:{...b.common,issues:[]},parent:null},ne=ue._parseSync({data:b.data,path:b.path,parent:re});if(ne.status==="valid")return ne;ne.status==="dirty"&&!z&&(z={result:ne,ctx:re}),re.common.issues.length&&P.push(re.common.issues)}if(z)return b.common.issues.push(...z.ctx.common.issues),z.result;const o=P.map(ue=>new Lr(ue));return qe(b,{code:je.invalid_union,unionErrors:o}),yt}}get options(){return this._def.options}}$l.create=(_,m)=>new $l({options:_,typeName:mt.ZodUnion,...St(m)});const oa=_=>_ instanceof Wl?oa(_.schema):_ instanceof un?oa(_.innerType()):_ instanceof Hl?[_.value]:_ instanceof Oa?_.options:_ instanceof Xl?Zt.objectValues(_.enum):_ instanceof Kl?oa(_._def.innerType):_ instanceof Vl?[void 0]:_ instanceof Ul?[null]:_ instanceof Bn?[void 0,...oa(_.unwrap())]:_ instanceof ja?[null,...oa(_.unwrap())]:_ instanceof Wd||_ instanceof Ql?oa(_.unwrap()):_ instanceof Yl?oa(_._def.innerType):[];class Ju extends zt{_parse(m){const{ctx:b}=this._processInputParams(m);if(b.parsedType!==Je.object)return qe(b,{code:je.invalid_type,expected:Je.object,received:b.parsedType}),yt;const M=this.discriminator,k=b.data[M],z=this.optionsMap.get(k);return z?b.common.async?z._parseAsync({data:b.data,path:b.path,parent:b}):z._parseSync({data:b.data,path:b.path,parent:b}):(qe(b,{code:je.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[M]}),yt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(m,b,M){const k=new Map;for(const z of b){const P=oa(z.shape[m]);if(!P.length)throw new Error(`A discriminator value for key \`${m}\` could not be extracted from all schema options`);for(const o of P){if(k.has(o))throw new Error(`Discriminator property ${String(m)} has duplicate value ${String(o)}`);k.set(o,z)}}return new Ju({typeName:mt.ZodDiscriminatedUnion,discriminator:m,options:b,optionsMap:k,...St(M)})}}function qd(_,m){const b=aa(_),M=aa(m);if(_===m)return{valid:!0,data:_};if(b===Je.object&&M===Je.object){const k=Zt.objectKeys(m),z=Zt.objectKeys(_).filter(o=>k.indexOf(o)!==-1),P={..._,...m};for(const o of z){const ue=qd(_[o],m[o]);if(!ue.valid)return{valid:!1};P[o]=ue.data}return{valid:!0,data:P}}else if(b===Je.array&&M===Je.array){if(_.length!==m.length)return{valid:!1};const k=[];for(let z=0;z<_.length;z++){const P=_[z],o=m[z],ue=qd(P,o);if(!ue.valid)return{valid:!1};k.push(ue.data)}return{valid:!0,data:k}}else return b===Je.date&&M===Je.date&&+_==+m?{valid:!0,data:_}:{valid:!1}}class Gl extends zt{_parse(m){const{status:b,ctx:M}=this._processInputParams(m),k=(z,P)=>{if(Ud(z)||Ud(P))return yt;const o=qd(z.value,P.value);return o.valid?(($d(z)||$d(P))&&b.dirty(),{status:b.value,value:o.data}):(qe(M,{code:je.invalid_intersection_types}),yt)};return M.common.async?Promise.all([this._def.left._parseAsync({data:M.data,path:M.path,parent:M}),this._def.right._parseAsync({data:M.data,path:M.path,parent:M})]).then(([z,P])=>k(z,P)):k(this._def.left._parseSync({data:M.data,path:M.path,parent:M}),this._def.right._parseSync({data:M.data,path:M.path,parent:M}))}}Gl.create=(_,m,b)=>new Gl({left:_,right:m,typeName:mt.ZodIntersection,...St(b)});class Fn extends zt{_parse(m){const{status:b,ctx:M}=this._processInputParams(m);if(M.parsedType!==Je.array)return qe(M,{code:je.invalid_type,expected:Je.array,received:M.parsedType}),yt;if(M.data.length<this._def.items.length)return qe(M,{code:je.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),yt;!this._def.rest&&M.data.length>this._def.items.length&&(qe(M,{code:je.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),b.dirty());const z=[...M.data].map((P,o)=>{const ue=this._def.items[o]||this._def.rest;return ue?ue._parse(new Ln(M,P,M.path,o)):null}).filter(P=>!!P);return M.common.async?Promise.all(z).then(P=>lr.mergeArray(b,P)):lr.mergeArray(b,z)}get items(){return this._def.items}rest(m){return new Fn({...this._def,rest:m})}}Fn.create=(_,m)=>{if(!Array.isArray(_))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Fn({items:_,typeName:mt.ZodTuple,rest:null,...St(m)})};class ql extends zt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(m){const{status:b,ctx:M}=this._processInputParams(m);if(M.parsedType!==Je.object)return qe(M,{code:je.invalid_type,expected:Je.object,received:M.parsedType}),yt;const k=[],z=this._def.keyType,P=this._def.valueType;for(const o in M.data)k.push({key:z._parse(new Ln(M,o,M.path,o)),value:P._parse(new Ln(M,M.data[o],M.path,o)),alwaysSet:o in M.data});return M.common.async?lr.mergeObjectAsync(b,k):lr.mergeObjectSync(b,k)}get element(){return this._def.valueType}static create(m,b,M){return b instanceof zt?new ql({keyType:m,valueType:b,typeName:mt.ZodRecord,...St(M)}):new ql({keyType:ln.create(),valueType:m,typeName:mt.ZodRecord,...St(b)})}}class Qu extends zt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(m){const{status:b,ctx:M}=this._processInputParams(m);if(M.parsedType!==Je.map)return qe(M,{code:je.invalid_type,expected:Je.map,received:M.parsedType}),yt;const k=this._def.keyType,z=this._def.valueType,P=[...M.data.entries()].map(([o,ue],re)=>({key:k._parse(new Ln(M,o,M.path,[re,"key"])),value:z._parse(new Ln(M,ue,M.path,[re,"value"]))}));if(M.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const ue of P){const re=await ue.key,ne=await ue.value;if(re.status==="aborted"||ne.status==="aborted")return yt;(re.status==="dirty"||ne.status==="dirty")&&b.dirty(),o.set(re.value,ne.value)}return{status:b.value,value:o}})}else{const o=new Map;for(const ue of P){const re=ue.key,ne=ue.value;if(re.status==="aborted"||ne.status==="aborted")return yt;(re.status==="dirty"||ne.status==="dirty")&&b.dirty(),o.set(re.value,ne.value)}return{status:b.value,value:o}}}}Qu.create=(_,m,b)=>new Qu({valueType:m,keyType:_,typeName:mt.ZodMap,...St(b)});class As extends zt{_parse(m){const{status:b,ctx:M}=this._processInputParams(m);if(M.parsedType!==Je.set)return qe(M,{code:je.invalid_type,expected:Je.set,received:M.parsedType}),yt;const k=this._def;k.minSize!==null&&M.data.size<k.minSize.value&&(qe(M,{code:je.too_small,minimum:k.minSize.value,type:"set",inclusive:!0,exact:!1,message:k.minSize.message}),b.dirty()),k.maxSize!==null&&M.data.size>k.maxSize.value&&(qe(M,{code:je.too_big,maximum:k.maxSize.value,type:"set",inclusive:!0,exact:!1,message:k.maxSize.message}),b.dirty());const z=this._def.valueType;function P(ue){const re=new Set;for(const ne of ue){if(ne.status==="aborted")return yt;ne.status==="dirty"&&b.dirty(),re.add(ne.value)}return{status:b.value,value:re}}const o=[...M.data.values()].map((ue,re)=>z._parse(new Ln(M,ue,M.path,re)));return M.common.async?Promise.all(o).then(ue=>P(ue)):P(o)}min(m,b){return new As({...this._def,minSize:{value:m,message:at.toString(b)}})}max(m,b){return new As({...this._def,maxSize:{value:m,message:at.toString(b)}})}size(m,b){return this.min(m,b).max(m,b)}nonempty(m){return this.min(1,m)}}As.create=(_,m)=>new As({valueType:_,minSize:null,maxSize:null,typeName:mt.ZodSet,...St(m)});class Eo extends zt{constructor(){super(...arguments),this.validate=this.implement}_parse(m){const{ctx:b}=this._processInputParams(m);if(b.parsedType!==Je.function)return qe(b,{code:je.invalid_type,expected:Je.function,received:b.parsedType}),yt;function M(o,ue){return Hu({data:o,path:b.path,errorMaps:[b.common.contextualErrorMap,b.schemaErrorMap,Wu(),Mo].filter(re=>!!re),issueData:{code:je.invalid_arguments,argumentsError:ue}})}function k(o,ue){return Hu({data:o,path:b.path,errorMaps:[b.common.contextualErrorMap,b.schemaErrorMap,Wu(),Mo].filter(re=>!!re),issueData:{code:je.invalid_return_type,returnTypeError:ue}})}const z={errorMap:b.common.contextualErrorMap},P=b.data;if(this._def.returns instanceof Ao){const o=this;return xr(async function(...ue){const re=new Lr([]),ne=await o._def.args.parseAsync(ue,z).catch(G=>{throw re.addIssue(M(ue,G)),re}),_e=await Reflect.apply(P,this,ne);return await o._def.returns._def.type.parseAsync(_e,z).catch(G=>{throw re.addIssue(k(_e,G)),re})})}else{const o=this;return xr(function(...ue){const re=o._def.args.safeParse(ue,z);if(!re.success)throw new Lr([M(ue,re.error)]);const ne=Reflect.apply(P,this,re.data),_e=o._def.returns.safeParse(ne,z);if(!_e.success)throw new Lr([k(ne,_e.error)]);return _e.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...m){return new Eo({...this._def,args:Fn.create(m).rest(Es.create())})}returns(m){return new Eo({...this._def,returns:m})}implement(m){return this.parse(m)}strictImplement(m){return this.parse(m)}static create(m,b,M){return new Eo({args:m||Fn.create([]).rest(Es.create()),returns:b||Es.create(),typeName:mt.ZodFunction,...St(M)})}}class Wl extends zt{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})}}Wl.create=(_,m)=>new Wl({getter:_,typeName:mt.ZodLazy,...St(m)});class Hl extends zt{_parse(m){if(m.data!==this._def.value){const b=this._getOrReturnCtx(m);return qe(b,{received:b.data,code:je.invalid_literal,expected:this._def.value}),yt}return{status:"valid",value:m.data}}get value(){return this._def.value}}Hl.create=(_,m)=>new Hl({value:_,typeName:mt.ZodLiteral,...St(m)});function fm(_,m){return new Oa({values:_,typeName:mt.ZodEnum,...St(m)})}class Oa extends zt{constructor(){super(...arguments),jl.set(this,void 0)}_parse(m){if(typeof m.data!="string"){const b=this._getOrReturnCtx(m),M=this._def.values;return qe(b,{expected:Zt.joinValues(M),received:b.parsedType,code:je.invalid_type}),yt}if(Xu(this,jl)||cm(this,jl,new Set(this._def.values)),!Xu(this,jl).has(m.data)){const b=this._getOrReturnCtx(m),M=this._def.values;return qe(b,{received:b.data,code:je.invalid_enum_value,options:M}),yt}return xr(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 Oa.create(m,{...this._def,...b})}exclude(m,b=this._def){return Oa.create(this.options.filter(M=>!m.includes(M)),{...this._def,...b})}}jl=new WeakMap,Oa.create=fm;class Xl extends zt{constructor(){super(...arguments),Nl.set(this,void 0)}_parse(m){const b=Zt.getValidEnumValues(this._def.values),M=this._getOrReturnCtx(m);if(M.parsedType!==Je.string&&M.parsedType!==Je.number){const k=Zt.objectValues(b);return qe(M,{expected:Zt.joinValues(k),received:M.parsedType,code:je.invalid_type}),yt}if(Xu(this,Nl)||cm(this,Nl,new Set(Zt.getValidEnumValues(this._def.values))),!Xu(this,Nl).has(m.data)){const k=Zt.objectValues(b);return qe(M,{received:M.data,code:je.invalid_enum_value,options:k}),yt}return xr(m.data)}get enum(){return this._def.values}}Nl=new WeakMap,Xl.create=(_,m)=>new Xl({values:_,typeName:mt.ZodNativeEnum,...St(m)});class Ao extends zt{unwrap(){return this._def.type}_parse(m){const{ctx:b}=this._processInputParams(m);if(b.parsedType!==Je.promise&&b.common.async===!1)return qe(b,{code:je.invalid_type,expected:Je.promise,received:b.parsedType}),yt;const M=b.parsedType===Je.promise?b.data:Promise.resolve(b.data);return xr(M.then(k=>this._def.type.parseAsync(k,{path:b.path,errorMap:b.common.contextualErrorMap})))}}Ao.create=(_,m)=>new Ao({type:_,typeName:mt.ZodPromise,...St(m)});class un extends zt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===mt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(m){const{status:b,ctx:M}=this._processInputParams(m),k=this._def.effect||null,z={addIssue:P=>{qe(M,P),P.fatal?b.abort():b.dirty()},get path(){return M.path}};if(z.addIssue=z.addIssue.bind(z),k.type==="preprocess"){const P=k.transform(M.data,z);if(M.common.async)return Promise.resolve(P).then(async o=>{if(b.value==="aborted")return yt;const ue=await this._def.schema._parseAsync({data:o,path:M.path,parent:M});return ue.status==="aborted"?yt:ue.status==="dirty"||b.value==="dirty"?Io(ue.value):ue});{if(b.value==="aborted")return yt;const o=this._def.schema._parseSync({data:P,path:M.path,parent:M});return o.status==="aborted"?yt:o.status==="dirty"||b.value==="dirty"?Io(o.value):o}}if(k.type==="refinement"){const P=o=>{const ue=k.refinement(o,z);if(M.common.async)return Promise.resolve(ue);if(ue instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(M.common.async===!1){const o=this._def.schema._parseSync({data:M.data,path:M.path,parent:M});return o.status==="aborted"?yt:(o.status==="dirty"&&b.dirty(),P(o.value),{status:b.value,value:o.value})}else return this._def.schema._parseAsync({data:M.data,path:M.path,parent:M}).then(o=>o.status==="aborted"?yt:(o.status==="dirty"&&b.dirty(),P(o.value).then(()=>({status:b.value,value:o.value}))))}if(k.type==="transform")if(M.common.async===!1){const P=this._def.schema._parseSync({data:M.data,path:M.path,parent:M});if(!Cs(P))return P;const o=k.transform(P.value,z);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:M.data,path:M.path,parent:M}).then(P=>Cs(P)?Promise.resolve(k.transform(P.value,z)).then(o=>({status:b.value,value:o})):P);Zt.assertNever(k)}}un.create=(_,m,b)=>new un({schema:_,typeName:mt.ZodEffects,effect:m,...St(b)}),un.createWithPreprocess=(_,m,b)=>new un({schema:m,effect:{type:"preprocess",transform:_},typeName:mt.ZodEffects,...St(b)});class Bn extends zt{_parse(m){return this._getType(m)===Je.undefined?xr(void 0):this._def.innerType._parse(m)}unwrap(){return this._def.innerType}}Bn.create=(_,m)=>new Bn({innerType:_,typeName:mt.ZodOptional,...St(m)});class ja extends zt{_parse(m){return this._getType(m)===Je.null?xr(null):this._def.innerType._parse(m)}unwrap(){return this._def.innerType}}ja.create=(_,m)=>new ja({innerType:_,typeName:mt.ZodNullable,...St(m)});class Kl extends zt{_parse(m){const{ctx:b}=this._processInputParams(m);let M=b.data;return b.parsedType===Je.undefined&&(M=this._def.defaultValue()),this._def.innerType._parse({data:M,path:b.path,parent:b})}removeDefault(){return this._def.innerType}}Kl.create=(_,m)=>new Kl({innerType:_,typeName:mt.ZodDefault,defaultValue:typeof m.default=="function"?m.default:()=>m.default,...St(m)});class Yl extends zt{_parse(m){const{ctx:b}=this._processInputParams(m),M={...b,common:{...b.common,issues:[]}},k=this._def.innerType._parse({data:M.data,path:M.path,parent:{...M}});return Ol(k)?k.then(z=>({status:"valid",value:z.status==="valid"?z.value:this._def.catchValue({get error(){return new Lr(M.common.issues)},input:M.data})})):{status:"valid",value:k.status==="valid"?k.value:this._def.catchValue({get error(){return new Lr(M.common.issues)},input:M.data})}}removeCatch(){return this._def.innerType}}Yl.create=(_,m)=>new Yl({innerType:_,typeName:mt.ZodCatch,catchValue:typeof m.catch=="function"?m.catch:()=>m.catch,...St(m)});class eh extends zt{_parse(m){if(this._getType(m)!==Je.nan){const M=this._getOrReturnCtx(m);return qe(M,{code:je.invalid_type,expected:Je.nan,received:M.parsedType}),yt}return{status:"valid",value:m.data}}}eh.create=_=>new eh({typeName:mt.ZodNaN,...St(_)});const mx=Symbol("zod_brand");class Wd extends zt{_parse(m){const{ctx:b}=this._processInputParams(m),M=b.data;return this._def.type._parse({data:M,path:b.path,parent:b})}unwrap(){return this._def.type}}class Jl extends zt{_parse(m){const{status:b,ctx:M}=this._processInputParams(m);if(M.common.async)return(async()=>{const z=await this._def.in._parseAsync({data:M.data,path:M.path,parent:M});return z.status==="aborted"?yt:z.status==="dirty"?(b.dirty(),Io(z.value)):this._def.out._parseAsync({data:z.value,path:M.path,parent:M})})();{const k=this._def.in._parseSync({data:M.data,path:M.path,parent:M});return k.status==="aborted"?yt:k.status==="dirty"?(b.dirty(),{status:"dirty",value:k.value}):this._def.out._parseSync({data:k.value,path:M.path,parent:M})}}static create(m,b){return new Jl({in:m,out:b,typeName:mt.ZodPipeline})}}class Ql extends zt{_parse(m){const b=this._def.innerType._parse(m),M=k=>(Cs(k)&&(k.value=Object.freeze(k.value)),k);return Ol(b)?b.then(k=>M(k)):M(b)}unwrap(){return this._def.innerType}}Ql.create=(_,m)=>new Ql({innerType:_,typeName:mt.ZodReadonly,...St(m)});function mm(_,m){const b=typeof _=="function"?_(m):typeof _=="string"?{message:_}:_;return typeof b=="string"?{message:b}:b}function gm(_,m={},b){return _?Co.create().superRefine((M,k)=>{var z,P;const o=_(M);if(o instanceof Promise)return o.then(ue=>{var re,ne;if(!ue){const _e=mm(m,M),ae=(ne=(re=_e.fatal)!==null&&re!==void 0?re:b)!==null&&ne!==void 0?ne:!0;k.addIssue({code:"custom",..._e,fatal:ae})}});if(!o){const ue=mm(m,M),re=(P=(z=ue.fatal)!==null&&z!==void 0?z:b)!==null&&P!==void 0?P:!0;k.addIssue({code:"custom",...ue,fatal:re})}}):Co.create()}const gx={object:Si.lazycreate};var mt;(function(_){_.ZodString="ZodString",_.ZodNumber="ZodNumber",_.ZodNaN="ZodNaN",_.ZodBigInt="ZodBigInt",_.ZodBoolean="ZodBoolean",_.ZodDate="ZodDate",_.ZodSymbol="ZodSymbol",_.ZodUndefined="ZodUndefined",_.ZodNull="ZodNull",_.ZodAny="ZodAny",_.ZodUnknown="ZodUnknown",_.ZodNever="ZodNever",_.ZodVoid="ZodVoid",_.ZodArray="ZodArray",_.ZodObject="ZodObject",_.ZodUnion="ZodUnion",_.ZodDiscriminatedUnion="ZodDiscriminatedUnion",_.ZodIntersection="ZodIntersection",_.ZodTuple="ZodTuple",_.ZodRecord="ZodRecord",_.ZodMap="ZodMap",_.ZodSet="ZodSet",_.ZodFunction="ZodFunction",_.ZodLazy="ZodLazy",_.ZodLiteral="ZodLiteral",_.ZodEnum="ZodEnum",_.ZodEffects="ZodEffects",_.ZodNativeEnum="ZodNativeEnum",_.ZodOptional="ZodOptional",_.ZodNullable="ZodNullable",_.ZodDefault="ZodDefault",_.ZodCatch="ZodCatch",_.ZodPromise="ZodPromise",_.ZodBranded="ZodBranded",_.ZodPipeline="ZodPipeline",_.ZodReadonly="ZodReadonly"})(mt||(mt={}));const _x=(_,m={message:`Input not instance of ${_.name}`})=>gm(b=>b instanceof _,m),_m=ln.create,ym=Fa.create,yx=eh.create,xx=Ba.create,xm=Zl.create,vx=ks.create,bx=Ku.create,wx=Vl.create,Tx=Ul.create,Px=Co.create,Sx=Es.create,Mx=sa.create,Ix=Yu.create,Cx=cn.create,kx=Si.create,Ex=Si.strictCreate,Ax=$l.create,zx=Ju.create,Rx=Gl.create,Dx=Fn.create,Lx=ql.create,Fx=Qu.create,Bx=As.create,Ox=Eo.create,jx=Wl.create,Nx=Hl.create,Zx=Oa.create,Vx=Xl.create,Ux=Ao.create,vm=un.create,$x=Bn.create,Gx=ja.create,qx=un.createWithPreprocess,Wx=Jl.create;var zi=Object.freeze({__proto__:null,defaultErrorMap:Mo,setErrorMap:qy,getErrorMap:Wu,makeIssue:Hu,EMPTY_PATH:Wy,addIssueToContext:qe,ParseStatus:lr,INVALID:yt,DIRTY:Io,OK:xr,isAborted:Ud,isDirty:$d,isValid:Cs,isAsync:Ol,get util(){return Zt},get objectUtil(){return Vd},ZodParsedType:Je,getParsedType:aa,ZodType:zt,datetimeRegex:pm,ZodString:ln,ZodNumber:Fa,ZodBigInt:Ba,ZodBoolean:Zl,ZodDate:ks,ZodSymbol:Ku,ZodUndefined:Vl,ZodNull:Ul,ZodAny:Co,ZodUnknown:Es,ZodNever:sa,ZodVoid:Yu,ZodArray:cn,ZodObject:Si,ZodUnion:$l,ZodDiscriminatedUnion:Ju,ZodIntersection:Gl,ZodTuple:Fn,ZodRecord:ql,ZodMap:Qu,ZodSet:As,ZodFunction:Eo,ZodLazy:Wl,ZodLiteral:Hl,ZodEnum:Oa,ZodNativeEnum:Xl,ZodPromise:Ao,ZodEffects:un,ZodTransformer:un,ZodOptional:Bn,ZodNullable:ja,ZodDefault:Kl,ZodCatch:Yl,ZodNaN:eh,BRAND:mx,ZodBranded:Wd,ZodPipeline:Jl,ZodReadonly:Ql,custom:gm,Schema:zt,ZodSchema:zt,late:gx,get ZodFirstPartyTypeKind(){return mt},coerce:{string:_=>ln.create({..._,coerce:!0}),number:_=>Fa.create({..._,coerce:!0}),boolean:_=>Zl.create({..._,coerce:!0}),bigint:_=>Ba.create({..._,coerce:!0}),date:_=>ks.create({..._,coerce:!0})},any:Px,array:Cx,bigint:xx,boolean:xm,date:vx,discriminatedUnion:zx,effect:vm,enum:Zx,function:Ox,instanceof:_x,intersection:Rx,lazy:jx,literal:Nx,map:Fx,nan:yx,nativeEnum:Vx,never:Mx,null:Tx,nullable:Gx,number:ym,object:kx,oboolean:()=>xm().optional(),onumber:()=>ym().optional(),optional:$x,ostring:()=>_m().optional(),pipeline:Wx,preprocess:qx,promise:Ux,record:Lx,set:Bx,strictObject:Ex,string:_m,symbol:bx,transformer:vm,tuple:Dx,undefined:wx,union:Ax,unknown:Sx,void:Ix,NEVER:yt,ZodIssueCode:je,quotelessJson:Gy,ZodError:Lr});const Hx=zi.object({name:zi.literal("dark").or(zi.literal("light")),colors:zi.object({primary:zi.string().max(64),background:zi.string().max(64),text:zi.string().max(64)})}),Xx=zi.object({container:zi.string(),position:zi.object({center:zi.object({lat:zi.number(),lng:zi.number()}),zoom:zi.number()}),theme:Hx}),Kx=zi.object({id:zi.string(),index:zi.number(),lat:zi.number(),lng:zi.number(),width:zi.number(),height:zi.number()}),Yx=zi.array(Kx);var Jx=vo('<link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.gstatic.com"> <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Noto+Sans:ital,wght@0,100..900;1,100..900&amp;display=swap">',1),Qx=vo('<div class="popup svelte-65wq48"><!></div>'),ev=vo('<div class="marker"><!> <!></div>'),tv=vo('<div class="container svelte-65wq48"><div class="map svelte-65wq48"></div> <div class="markers svelte-65wq48"></div></div>');function bm(_,m){Cu(m,!0);let b,M,k=0,z=vi(!1);im(()=>{Xx.parse(m.options),P(),o()});function P(){const st=m.options.position;b=new Zd.Map({style:Mt(m.options.theme.name),center:{lat:st.center.lat,lng:st.center.lng},zoom:st.zoom,minZoom:G(),maxZoom:Bl,container:M,pitchWithRotate:!1,attributionControl:{compact:!1}})}function o(){b.on("load",ue),b.on("move",re),b.on("idle",ne),b.on("click",_e),b.dragRotate.disable(),b.keyboard.disable(),b.touchZoomRotate.disableRotation(),b.touchPitch.disable()}function ue(){ti(z,!0)}function re(){}function ne(){}function _e(st){}function ae(){ve(G())}function G(){const Ut=Math.ceil(Math.log2(k/Vu));return Math.max(So,Ut)}function ve(st){b==null||b.setMinZoom(st)}function Oe(){const st=b==null?void 0:b.getCenter();if(st)return{lat:st.lat,lng:st.lng}}function Ke(){const st=b==null?void 0:b.getBounds();if(st)return{sw:{lat:st.getSouthWest().lat,lng:st.getSouthWest().lng},ne:{lat:st.getNorthEast().lat,lng:st.getNorthEast().lng}}}function Qe(){return(b==null?void 0:b.getZoom())??m.options.position.zoom}function ct(){b==null||b.zoomIn()}function gt(){b==null||b.zoomOut()}let pt=vi(na(m.options.theme));yo(()=>{We(z)&&b.setStyle(Mt(We(pt).name))});function Mt(st){switch(st){case"light":return $y;case"dark":return Uy}}function kt(){return I_(We(pt))}function Et(st){ti(pt,st,!0),b.setStyle(Mt(We(pt).name),{diff:!0})}let wt,Mi,Wi,Hi=vi(na(new Array)),ut=vi(na(new Array));im(()=>{const st=async()=>{await Yt(),Mi=window.setTimeout(st,50)},Ut=()=>{Jt(),Wi=window.setTimeout(Ut,25)};return st(),Ut(),()=>{clearInterval(Mi),clearInterval(Wi)}});async function Yt(){if(!wt||!We(z)||We(Hi).length==0)return;const st=Ke(),Ut=Qe();if(!st)return;const Ii=We(Hi).filter(Gt=>!Gt.loaded);if(Ii.length==0)return;const li=Ii.filter(Gt=>{const ft=Gt.block;return!(Ut+Nd<ft.zs||ft.ne.lng<st.sw.lng||st.ne.lng<ft.sw.lng||ft.ne.lat<st.sw.lat||st.ne.lat<ft.sw.lat)});if(li.length!=0)try{const Gt=li.flatMap(Tt=>Tt.block.markers).map(Tt=>Tt.id),ft=await wt(Gt),Qt=new Map;for(let Tt=0;Tt<We(ut).length;Tt++){const Pt=We(ut)[Tt];Qt.set(Pt.marker.id,Pt)}for(let Tt=0;Tt<Gt.length;Tt++){const Pt=Gt[Tt],rt=ft[Tt],fi=Qt.get(Pt);if(!fi)throw new Error("Failed to find marker data.");fi.content=rt}li.forEach(Tt=>Tt.loaded=!0)}catch(Gt){console.error(Gt),li.forEach(ft=>ft.loaded=!1)}}function Jt(){var ft;if(!We(z)||We(ut).length==0)return;const st=b.getZoom();if(!st)return;const Ut=new Array,Ii=Vu,li=new om(b,-512,window.innerHeight+Ii,window.innerWidth+Ii,-512),Gt=new om(b,0,window.innerHeight,window.innerWidth,0);for(let Qt=0;Qt<We(ut).length;Qt++){const Tt=We(ut)[Qt],Pt=Tt.marker,rt=Tt.libreMarker;if(rt){if(Pt.zet<=st&&li.contains(Pt.lat,Pt.lng)){rt._map!=b&&rt.addTo(b),Ut.push(Tt);continue}if(Pt.zet<=st+nm&&Gt.contains(Pt.lat,Pt.lng)){rt._map!=b&&rt.addTo(b),Ut.push(Tt);continue}rt._map!=null&&rt.remove()}}for(let Qt=0;Qt<Ut.length;Qt++){const Tt=Ut[Qt],Pt=Tt.marker,rt=Tt.component,fi=Tt.circle;Tt.circleRendered||(Tt.circleRendered=!0),!Tt.componentRendered&&Tt.marker.zet<=st+Nd&&(Tt.componentRendered=!0),Pt.zet<=st+Nd?rt==null||rt.setDisplayed(!0):rt==null||rt.setDisplayed(!1),Pt.zet<=st&&rt!=null?(fi==null||fi.setCollapsed(!0),rt==null||rt.setCollapsed(!1),rt==null||rt.setAngle((ft=Pt.angs.findLast(bi=>bi[0]<=st))==null?void 0:ft[1])):(rt==null||rt.setCollapsed(!0),fi==null||fi.setCollapsed(!1),fi==null||fi.setDistance((Pt.zet-st)/nm))}}async function cr(st){wt=st}async function Dt(st){var Gt;if(!(await Yx.safeParseAsync(st)).success)throw new Error("Invalid markers input");for(let ft=0;ft<We(ut).length;ft++)(Gt=We(ut)[ft].libreMarker)==null||Gt.remove();We(ut).length=0;const Ii=await By(st),li=Ii.flatMap(ft=>ft.markers).toSorted((ft,Qt)=>ft.zet-Qt.zet);ti(Hi,Ii.map(ft=>new Fy(ft)),!0),ti(ut,li.map(ft=>new Vy(ft)),!0),await K_();for(let ft=0;ft<We(ut).length;ft++){const Qt=We(ut)[ft],Tt=Qt.marker,Pt=Qt.element;if(!Pt)throw new Error("Failed to render marker element.");const rt=new Zd.Marker({element:Pt});rt.setLngLat([Tt.lng,Tt.lat]),Qt.libreMarker=rt}}var vr=tv();ny(st=>{var Ut=Jx();bo(st,Ut)}),ry("resize",Td,ae);var Fr=Ps(vr);Po(Fr,st=>M=st,()=>M);var hn=Md(Fr,2);return uy(hn,21,()=>We(ut),ly,(st,Ut,Ii)=>{var li=ev(),Gt=Ps(li);{var ft=Pt=>{Po(Cy(Pt,{}),(rt,fi)=>fi.circle=rt,rt=>rt==null?void 0:rt.circle,()=>[We(Ut)])};Hf(Gt,Pt=>{We(Ut).circleRendered&&Pt(ft)})}var Qt=Md(Gt,2);{var Tt=Pt=>{Po(My(Pt,{children:(rt,fi)=>{var bi=Qx(),Ci=Ps(bi);fy(Ci,()=>We(Ut).content),Al(()=>To(bi,`width: ${We(Ut).marker.width??""}px; height: ${We(Ut).marker.height??""}px;`)),bo(rt,bi)},$$slots:{default:!0}}),(rt,fi)=>fi.component=rt,rt=>rt==null?void 0:rt.component,()=>[We(Ut)])};Hf(Qt,Pt=>{We(Ut).componentRendered&&We(Ut).content&&Pt(Tt)})}Po(li,(Pt,rt)=>rt.element=Pt,Pt=>Pt==null?void 0:Pt.element,()=>[We(Ut)]),Al(()=>To(li,`z-index: ${We(ut).length-Ii};`)),bo(st,li)}),Al(()=>To(vr,`--primary: ${We(pt).colors.primary??""}; --background: ${We(pt).colors.background??""}; --text: ${We(pt).colors.text??""};`)),bo(_,vr),ku({getCenter:Oe,getBounds:Ke,getZoom:Qe,zoomIn:ct,zoomOut:gt,getTheme:kt,setTheme:Et,setPopupsContentCallback:cr,setPopups:Dt})}function iv(_){const m=document.getElementById(_.container);if(!m)throw new Error(`Container not found: ${_.container}`);return ay(bm,{target:m,props:{options:_}})}function rv(_){oy(_)}$t.Map=bm,$t.mountMap=iv,$t.unmountMap=rv,Object.defineProperty($t,Symbol.toStringTag,{value:"Module"})});