mobility-toolbox-js 2.0.0-beta.48 → 2.0.0-beta.50

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/mbt.min.js CHANGED
@@ -1072,12 +1072,12 @@ uniform ${se} ${pe} u_${ve};
1072
1072
  `),mt=W.createShader(W.FRAGMENT_SHADER);if(W.isContextLost())return void(this.failedToCreate=!0);W.shaderSource(mt,ht),W.compileShader(mt),W.attachShader(this.program,mt);let pt=W.createShader(W.VERTEX_SHADER);if(W.isContextLost())return void(this.failedToCreate=!0);W.shaderSource(pt,je),W.compileShader(pt),W.attachShader(this.program,pt),this.attributes={};let vt={};this.numAttributes=pe.length;for(let Et=0;Et<this.numAttributes;Et++)pe[Et]&&(W.bindAttribLocation(this.program,Et,pe[Et]),this.attributes[pe[Et]]=Et);W.linkProgram(this.program),W.deleteShader(pt),W.deleteShader(mt);for(let Et=0;Et<tt.length;Et++){let zt=tt[Et];if(zt&&!vt[zt]){let xt=W.getUniformLocation(this.program,zt);xt&&(vt[zt]=xt)}}this.fixedUniforms=M(i,vt),this.terrainUniforms=((Et,zt)=>({u_depth:new s.Uniform1i(Et,zt.u_depth),u_terrain:new s.Uniform1i(Et,zt.u_terrain),u_terrain_dim:new s.Uniform1f(Et,zt.u_terrain_dim),u_terrain_matrix:new s.UniformMatrix4f(Et,zt.u_terrain_matrix),u_terrain_unpack:new s.Uniform4f(Et,zt.u_terrain_unpack),u_terrain_offset:new s.Uniform1f(Et,zt.u_terrain_offset),u_terrain_exaggeration:new s.Uniform1f(Et,zt.u_terrain_exaggeration)}))(i,vt),this.binderUniforms=T?T.getUniforms(i,vt):[]}draw(i,d,x,T,M,U,q,W,Y,se,pe,ve,Ne,ze,Be,tt,st,ht){let je=i.gl;if(this.failedToCreate)return;if(i.program.set(this.program),i.setDepthMode(x),i.setStencilMode(T),i.setColorMode(M),i.setCullFace(U),W){i.activeTexture.set(je.TEXTURE2),je.bindTexture(je.TEXTURE_2D,W.depthTexture),i.activeTexture.set(je.TEXTURE3),je.bindTexture(je.TEXTURE_2D,W.texture);for(let pt in this.terrainUniforms)this.terrainUniforms[pt].set(W[pt])}for(let pt in this.fixedUniforms)this.fixedUniforms[pt].set(q[pt]);Be&&Be.setUniforms(i,this.binderUniforms,Ne,{zoom:ze});let mt=0;switch(d){case je.LINES:mt=2;break;case je.TRIANGLES:mt=3;break;case je.LINE_STRIP:mt=1}for(let pt of ve.get()){let vt=pt.vaos||(pt.vaos={});(vt[Y]||(vt[Y]=new Cs)).bind(i,this,se,Be?Be.getPaintVertexBuffers():[],pe,pt.vertexOffset,tt,st,ht),je.drawElements(d,pt.primitiveLength*mt,je.UNSIGNED_SHORT,pt.primitiveOffset*mt*2)}}}function Kn(E,i,d){let x=1/te(d,1,i.transform.tileZoom),T=Math.pow(2,d.tileID.overscaledZ),M=d.tileSize*Math.pow(2,i.transform.tileZoom)/T,U=M*(d.tileID.canonical.x+d.tileID.wrap*T),q=M*d.tileID.canonical.y;return{u_image:0,u_texsize:d.imageAtlasTexture.size,u_scale:[x,E.fromScale,E.toScale],u_fade:E.t,u_pixel_coord_upper:[U>>16,q>>16],u_pixel_coord_lower:[65535&U,65535&q]}}let yn=(E,i,d,x)=>{let T=i.style.light,M=T.properties.get("position"),U=[M.x,M.y,M.z],q=s.create$1();T.properties.get("anchor")==="viewport"&&s.fromRotation(q,-i.transform.angle),s.transformMat3(U,U,q);let W=T.properties.get("color");return{u_matrix:E,u_lightpos:U,u_lightintensity:T.properties.get("intensity"),u_lightcolor:[W.r,W.g,W.b],u_vertical_gradient:+d,u_opacity:x}},qo=(E,i,d,x,T,M,U)=>s.extend(yn(E,i,d,x),Kn(M,i,U),{u_height_factor:-Math.pow(2,T.overscaledZ)/U.tileSize/8}),Ti=E=>({u_matrix:E}),Lo=(E,i,d,x)=>s.extend(Ti(E),Kn(d,i,x)),wo=(E,i)=>({u_matrix:E,u_world:i}),ku=(E,i,d,x,T)=>s.extend(Lo(E,i,d,x),{u_world:T}),Ro=(E,i,d,x)=>{let T=E.transform,M,U;if(x.paint.get("circle-pitch-alignment")==="map"){let q=te(d,1,T.zoom);M=!0,U=[q,q]}else M=!1,U=T.pixelsToGLUnits;return{u_camera_to_center_distance:T.cameraToCenterDistance,u_scale_with_map:+(x.paint.get("circle-pitch-scale")==="map"),u_matrix:E.translatePosMatrix(i.posMatrix,d,x.paint.get("circle-translate"),x.paint.get("circle-translate-anchor")),u_pitch_with_map:+M,u_device_pixel_ratio:E.pixelRatio,u_extrude_scale:U}},As=(E,i,d)=>{let x=te(d,1,i.zoom),T=Math.pow(2,i.zoom-d.tileID.overscaledZ),M=d.tileID.overscaleFactor();return{u_matrix:E,u_camera_to_center_distance:i.cameraToCenterDistance,u_pixels_to_tile_units:x,u_extrude_scale:[i.pixelsToGLUnits[0]/(x*T),i.pixelsToGLUnits[1]/(x*T)],u_overscale_factor:M}},zo=(E,i,d=1)=>({u_matrix:E,u_color:i,u_overlay:0,u_overlay_scale:d}),un=E=>({u_matrix:E}),Do=(E,i,d,x)=>({u_matrix:E,u_extrude_scale:te(i,1,d),u_intensity:x});function Ln(E,i){let d=Math.pow(2,i.canonical.z),x=i.canonical.y;return[new s.MercatorCoordinate(0,x/d).toLngLat().lat,new s.MercatorCoordinate(0,(x+1)/d).toLngLat().lat]}let Zo=(E,i,d,x)=>{let T=E.transform;return{u_matrix:Js(E,i,d,x),u_ratio:1/te(i,1,T.zoom),u_device_pixel_ratio:E.pixelRatio,u_units_to_pixels:[1/T.pixelsToGLUnits[0],1/T.pixelsToGLUnits[1]]}},Lu=(E,i,d,x,T)=>s.extend(Zo(E,i,d,T),{u_image:0,u_image_height:x}),Hl=(E,i,d,x,T)=>{let M=E.transform,U=Hi(i,M);return{u_matrix:Js(E,i,d,T),u_texsize:i.imageAtlasTexture.size,u_ratio:1/te(i,1,M.zoom),u_device_pixel_ratio:E.pixelRatio,u_image:0,u_scale:[U,x.fromScale,x.toScale],u_fade:x.t,u_units_to_pixels:[1/M.pixelsToGLUnits[0],1/M.pixelsToGLUnits[1]]}},Ps=(E,i,d,x,T,M)=>{let U=E.lineAtlas,q=Hi(i,E.transform),W=d.layout.get("line-cap")==="round",Y=U.getDash(x.from,W),se=U.getDash(x.to,W),pe=Y.width*T.fromScale,ve=se.width*T.toScale;return s.extend(Zo(E,i,d,M),{u_patternscale_a:[q/pe,-Y.height/2],u_patternscale_b:[q/ve,-se.height/2],u_sdfgamma:U.width/(256*Math.min(pe,ve)*E.pixelRatio)/2,u_image:0,u_tex_y_a:Y.y,u_tex_y_b:se.y,u_mix:T.t})};function Hi(E,i){return 1/te(E,1,i.tileZoom)}function Js(E,i,d,x){return E.translatePosMatrix(x?x.posMatrix:i.tileID.posMatrix,i,d.paint.get("line-translate"),d.paint.get("line-translate-anchor"))}let vc=(E,i,d,x,T)=>{return{u_matrix:E,u_tl_parent:i,u_scale_parent:d,u_buffer_scale:1,u_fade_t:x.mix,u_opacity:x.opacity*T.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:T.paint.get("raster-brightness-min"),u_brightness_high:T.paint.get("raster-brightness-max"),u_saturation_factor:(U=T.paint.get("raster-saturation"),U>0?1-1/(1.001-U):-U),u_contrast_factor:(M=T.paint.get("raster-contrast"),M>0?1/(1-M):1+M),u_spin_weights:Ru(T.paint.get("raster-hue-rotate"))};var M,U};function Ru(E){E*=Math.PI/180;let i=Math.sin(E),d=Math.cos(E);return[(2*d+1)/3,(-Math.sqrt(3)*i-d+1)/3,(Math.sqrt(3)*i-d+1)/3]}let Kl=(E,i,d,x,T,M,U,q,W,Y)=>{let se=T.transform;return{u_is_size_zoom_constant:+(E==="constant"||E==="source"),u_is_size_feature_constant:+(E==="constant"||E==="camera"),u_size_t:i?i.uSizeT:0,u_size:i?i.uSize:0,u_camera_to_center_distance:se.cameraToCenterDistance,u_pitch:se.pitch/360*2*Math.PI,u_rotate_symbol:+d,u_aspect_ratio:se.width/se.height,u_fade_change:T.options.fadeDuration?T.symbolFadeChange:1,u_matrix:M,u_label_plane_matrix:U,u_coord_matrix:q,u_is_text:+W,u_pitch_with_map:+x,u_texsize:Y,u_texture:0}},Da=(E,i,d,x,T,M,U,q,W,Y,se)=>{let pe=T.transform;return s.extend(Kl(E,i,d,x,T,M,U,q,W,Y),{u_gamma_scale:x?Math.cos(pe._pitch)*pe.cameraToCenterDistance:1,u_device_pixel_ratio:T.pixelRatio,u_is_halo:+se})},Yl=(E,i,d,x,T,M,U,q,W,Y)=>s.extend(Da(E,i,d,x,T,M,U,q,!0,W,!0),{u_texsize_icon:Y,u_texture_icon:1}),wl=(E,i,d)=>({u_matrix:E,u_opacity:i,u_color:d}),xc=(E,i,d,x,T,M)=>s.extend(function(U,q,W,Y){let se=W.imageManager.getPattern(U.from.toString()),pe=W.imageManager.getPattern(U.to.toString()),{width:ve,height:Ne}=W.imageManager.getPixelSize(),ze=Math.pow(2,Y.tileID.overscaledZ),Be=Y.tileSize*Math.pow(2,W.transform.tileZoom)/ze,tt=Be*(Y.tileID.canonical.x+Y.tileID.wrap*ze),st=Be*Y.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:se.tl,u_pattern_br_a:se.br,u_pattern_tl_b:pe.tl,u_pattern_br_b:pe.br,u_texsize:[ve,Ne],u_mix:q.t,u_pattern_size_a:se.displaySize,u_pattern_size_b:pe.displaySize,u_scale_a:q.fromScale,u_scale_b:q.toScale,u_tile_units_to_pixels:1/te(Y,1,W.transform.tileZoom),u_pixel_coord_upper:[tt>>16,st>>16],u_pixel_coord_lower:[65535&tt,65535&st]}}(x,M,d,T),{u_matrix:E,u_opacity:i}),Qs={fillExtrusion:(E,i)=>({u_matrix:new s.UniformMatrix4f(E,i.u_matrix),u_lightpos:new s.Uniform3f(E,i.u_lightpos),u_lightintensity:new s.Uniform1f(E,i.u_lightintensity),u_lightcolor:new s.Uniform3f(E,i.u_lightcolor),u_vertical_gradient:new s.Uniform1f(E,i.u_vertical_gradient),u_opacity:new s.Uniform1f(E,i.u_opacity)}),fillExtrusionPattern:(E,i)=>({u_matrix:new s.UniformMatrix4f(E,i.u_matrix),u_lightpos:new s.Uniform3f(E,i.u_lightpos),u_lightintensity:new s.Uniform1f(E,i.u_lightintensity),u_lightcolor:new s.Uniform3f(E,i.u_lightcolor),u_vertical_gradient:new s.Uniform1f(E,i.u_vertical_gradient),u_height_factor:new s.Uniform1f(E,i.u_height_factor),u_image:new s.Uniform1i(E,i.u_image),u_texsize:new s.Uniform2f(E,i.u_texsize),u_pixel_coord_upper:new s.Uniform2f(E,i.u_pixel_coord_upper),u_pixel_coord_lower:new s.Uniform2f(E,i.u_pixel_coord_lower),u_scale:new s.Uniform3f(E,i.u_scale),u_fade:new s.Uniform1f(E,i.u_fade),u_opacity:new s.Uniform1f(E,i.u_opacity)}),fill:(E,i)=>({u_matrix:new s.UniformMatrix4f(E,i.u_matrix)}),fillPattern:(E,i)=>({u_matrix:new s.UniformMatrix4f(E,i.u_matrix),u_image:new s.Uniform1i(E,i.u_image),u_texsize:new s.Uniform2f(E,i.u_texsize),u_pixel_coord_upper:new s.Uniform2f(E,i.u_pixel_coord_upper),u_pixel_coord_lower:new s.Uniform2f(E,i.u_pixel_coord_lower),u_scale:new s.Uniform3f(E,i.u_scale),u_fade:new s.Uniform1f(E,i.u_fade)}),fillOutline:(E,i)=>({u_matrix:new s.UniformMatrix4f(E,i.u_matrix),u_world:new s.Uniform2f(E,i.u_world)}),fillOutlinePattern:(E,i)=>({u_matrix:new s.UniformMatrix4f(E,i.u_matrix),u_world:new s.Uniform2f(E,i.u_world),u_image:new s.Uniform1i(E,i.u_image),u_texsize:new s.Uniform2f(E,i.u_texsize),u_pixel_coord_upper:new s.Uniform2f(E,i.u_pixel_coord_upper),u_pixel_coord_lower:new s.Uniform2f(E,i.u_pixel_coord_lower),u_scale:new s.Uniform3f(E,i.u_scale),u_fade:new s.Uniform1f(E,i.u_fade)}),circle:(E,i)=>({u_camera_to_center_distance:new s.Uniform1f(E,i.u_camera_to_center_distance),u_scale_with_map:new s.Uniform1i(E,i.u_scale_with_map),u_pitch_with_map:new s.Uniform1i(E,i.u_pitch_with_map),u_extrude_scale:new s.Uniform2f(E,i.u_extrude_scale),u_device_pixel_ratio:new s.Uniform1f(E,i.u_device_pixel_ratio),u_matrix:new s.UniformMatrix4f(E,i.u_matrix)}),collisionBox:(E,i)=>({u_matrix:new s.UniformMatrix4f(E,i.u_matrix),u_camera_to_center_distance:new s.Uniform1f(E,i.u_camera_to_center_distance),u_pixels_to_tile_units:new s.Uniform1f(E,i.u_pixels_to_tile_units),u_extrude_scale:new s.Uniform2f(E,i.u_extrude_scale),u_overscale_factor:new s.Uniform1f(E,i.u_overscale_factor)}),collisionCircle:(E,i)=>({u_matrix:new s.UniformMatrix4f(E,i.u_matrix),u_inv_matrix:new s.UniformMatrix4f(E,i.u_inv_matrix),u_camera_to_center_distance:new s.Uniform1f(E,i.u_camera_to_center_distance),u_viewport_size:new s.Uniform2f(E,i.u_viewport_size)}),debug:(E,i)=>({u_color:new s.UniformColor(E,i.u_color),u_matrix:new s.UniformMatrix4f(E,i.u_matrix),u_overlay:new s.Uniform1i(E,i.u_overlay),u_overlay_scale:new s.Uniform1f(E,i.u_overlay_scale)}),clippingMask:(E,i)=>({u_matrix:new s.UniformMatrix4f(E,i.u_matrix)}),heatmap:(E,i)=>({u_extrude_scale:new s.Uniform1f(E,i.u_extrude_scale),u_intensity:new s.Uniform1f(E,i.u_intensity),u_matrix:new s.UniformMatrix4f(E,i.u_matrix)}),heatmapTexture:(E,i)=>({u_matrix:new s.UniformMatrix4f(E,i.u_matrix),u_world:new s.Uniform2f(E,i.u_world),u_image:new s.Uniform1i(E,i.u_image),u_color_ramp:new s.Uniform1i(E,i.u_color_ramp),u_opacity:new s.Uniform1f(E,i.u_opacity)}),hillshade:(E,i)=>({u_matrix:new s.UniformMatrix4f(E,i.u_matrix),u_image:new s.Uniform1i(E,i.u_image),u_latrange:new s.Uniform2f(E,i.u_latrange),u_light:new s.Uniform2f(E,i.u_light),u_shadow:new s.UniformColor(E,i.u_shadow),u_highlight:new s.UniformColor(E,i.u_highlight),u_accent:new s.UniformColor(E,i.u_accent)}),hillshadePrepare:(E,i)=>({u_matrix:new s.UniformMatrix4f(E,i.u_matrix),u_image:new s.Uniform1i(E,i.u_image),u_dimension:new s.Uniform2f(E,i.u_dimension),u_zoom:new s.Uniform1f(E,i.u_zoom),u_unpack:new s.Uniform4f(E,i.u_unpack)}),line:(E,i)=>({u_matrix:new s.UniformMatrix4f(E,i.u_matrix),u_ratio:new s.Uniform1f(E,i.u_ratio),u_device_pixel_ratio:new s.Uniform1f(E,i.u_device_pixel_ratio),u_units_to_pixels:new s.Uniform2f(E,i.u_units_to_pixels)}),lineGradient:(E,i)=>({u_matrix:new s.UniformMatrix4f(E,i.u_matrix),u_ratio:new s.Uniform1f(E,i.u_ratio),u_device_pixel_ratio:new s.Uniform1f(E,i.u_device_pixel_ratio),u_units_to_pixels:new s.Uniform2f(E,i.u_units_to_pixels),u_image:new s.Uniform1i(E,i.u_image),u_image_height:new s.Uniform1f(E,i.u_image_height)}),linePattern:(E,i)=>({u_matrix:new s.UniformMatrix4f(E,i.u_matrix),u_texsize:new s.Uniform2f(E,i.u_texsize),u_ratio:new s.Uniform1f(E,i.u_ratio),u_device_pixel_ratio:new s.Uniform1f(E,i.u_device_pixel_ratio),u_image:new s.Uniform1i(E,i.u_image),u_units_to_pixels:new s.Uniform2f(E,i.u_units_to_pixels),u_scale:new s.Uniform3f(E,i.u_scale),u_fade:new s.Uniform1f(E,i.u_fade)}),lineSDF:(E,i)=>({u_matrix:new s.UniformMatrix4f(E,i.u_matrix),u_ratio:new s.Uniform1f(E,i.u_ratio),u_device_pixel_ratio:new s.Uniform1f(E,i.u_device_pixel_ratio),u_units_to_pixels:new s.Uniform2f(E,i.u_units_to_pixels),u_patternscale_a:new s.Uniform2f(E,i.u_patternscale_a),u_patternscale_b:new s.Uniform2f(E,i.u_patternscale_b),u_sdfgamma:new s.Uniform1f(E,i.u_sdfgamma),u_image:new s.Uniform1i(E,i.u_image),u_tex_y_a:new s.Uniform1f(E,i.u_tex_y_a),u_tex_y_b:new s.Uniform1f(E,i.u_tex_y_b),u_mix:new s.Uniform1f(E,i.u_mix)}),raster:(E,i)=>({u_matrix:new s.UniformMatrix4f(E,i.u_matrix),u_tl_parent:new s.Uniform2f(E,i.u_tl_parent),u_scale_parent:new s.Uniform1f(E,i.u_scale_parent),u_buffer_scale:new s.Uniform1f(E,i.u_buffer_scale),u_fade_t:new s.Uniform1f(E,i.u_fade_t),u_opacity:new s.Uniform1f(E,i.u_opacity),u_image0:new s.Uniform1i(E,i.u_image0),u_image1:new s.Uniform1i(E,i.u_image1),u_brightness_low:new s.Uniform1f(E,i.u_brightness_low),u_brightness_high:new s.Uniform1f(E,i.u_brightness_high),u_saturation_factor:new s.Uniform1f(E,i.u_saturation_factor),u_contrast_factor:new s.Uniform1f(E,i.u_contrast_factor),u_spin_weights:new s.Uniform3f(E,i.u_spin_weights)}),symbolIcon:(E,i)=>({u_is_size_zoom_constant:new s.Uniform1i(E,i.u_is_size_zoom_constant),u_is_size_feature_constant:new s.Uniform1i(E,i.u_is_size_feature_constant),u_size_t:new s.Uniform1f(E,i.u_size_t),u_size:new s.Uniform1f(E,i.u_size),u_camera_to_center_distance:new s.Uniform1f(E,i.u_camera_to_center_distance),u_pitch:new s.Uniform1f(E,i.u_pitch),u_rotate_symbol:new s.Uniform1i(E,i.u_rotate_symbol),u_aspect_ratio:new s.Uniform1f(E,i.u_aspect_ratio),u_fade_change:new s.Uniform1f(E,i.u_fade_change),u_matrix:new s.UniformMatrix4f(E,i.u_matrix),u_label_plane_matrix:new s.UniformMatrix4f(E,i.u_label_plane_matrix),u_coord_matrix:new s.UniformMatrix4f(E,i.u_coord_matrix),u_is_text:new s.Uniform1i(E,i.u_is_text),u_pitch_with_map:new s.Uniform1i(E,i.u_pitch_with_map),u_texsize:new s.Uniform2f(E,i.u_texsize),u_texture:new s.Uniform1i(E,i.u_texture)}),symbolSDF:(E,i)=>({u_is_size_zoom_constant:new s.Uniform1i(E,i.u_is_size_zoom_constant),u_is_size_feature_constant:new s.Uniform1i(E,i.u_is_size_feature_constant),u_size_t:new s.Uniform1f(E,i.u_size_t),u_size:new s.Uniform1f(E,i.u_size),u_camera_to_center_distance:new s.Uniform1f(E,i.u_camera_to_center_distance),u_pitch:new s.Uniform1f(E,i.u_pitch),u_rotate_symbol:new s.Uniform1i(E,i.u_rotate_symbol),u_aspect_ratio:new s.Uniform1f(E,i.u_aspect_ratio),u_fade_change:new s.Uniform1f(E,i.u_fade_change),u_matrix:new s.UniformMatrix4f(E,i.u_matrix),u_label_plane_matrix:new s.UniformMatrix4f(E,i.u_label_plane_matrix),u_coord_matrix:new s.UniformMatrix4f(E,i.u_coord_matrix),u_is_text:new s.Uniform1i(E,i.u_is_text),u_pitch_with_map:new s.Uniform1i(E,i.u_pitch_with_map),u_texsize:new s.Uniform2f(E,i.u_texsize),u_texture:new s.Uniform1i(E,i.u_texture),u_gamma_scale:new s.Uniform1f(E,i.u_gamma_scale),u_device_pixel_ratio:new s.Uniform1f(E,i.u_device_pixel_ratio),u_is_halo:new s.Uniform1i(E,i.u_is_halo)}),symbolTextAndIcon:(E,i)=>({u_is_size_zoom_constant:new s.Uniform1i(E,i.u_is_size_zoom_constant),u_is_size_feature_constant:new s.Uniform1i(E,i.u_is_size_feature_constant),u_size_t:new s.Uniform1f(E,i.u_size_t),u_size:new s.Uniform1f(E,i.u_size),u_camera_to_center_distance:new s.Uniform1f(E,i.u_camera_to_center_distance),u_pitch:new s.Uniform1f(E,i.u_pitch),u_rotate_symbol:new s.Uniform1i(E,i.u_rotate_symbol),u_aspect_ratio:new s.Uniform1f(E,i.u_aspect_ratio),u_fade_change:new s.Uniform1f(E,i.u_fade_change),u_matrix:new s.UniformMatrix4f(E,i.u_matrix),u_label_plane_matrix:new s.UniformMatrix4f(E,i.u_label_plane_matrix),u_coord_matrix:new s.UniformMatrix4f(E,i.u_coord_matrix),u_is_text:new s.Uniform1i(E,i.u_is_text),u_pitch_with_map:new s.Uniform1i(E,i.u_pitch_with_map),u_texsize:new s.Uniform2f(E,i.u_texsize),u_texsize_icon:new s.Uniform2f(E,i.u_texsize_icon),u_texture:new s.Uniform1i(E,i.u_texture),u_texture_icon:new s.Uniform1i(E,i.u_texture_icon),u_gamma_scale:new s.Uniform1f(E,i.u_gamma_scale),u_device_pixel_ratio:new s.Uniform1f(E,i.u_device_pixel_ratio),u_is_halo:new s.Uniform1i(E,i.u_is_halo)}),background:(E,i)=>({u_matrix:new s.UniformMatrix4f(E,i.u_matrix),u_opacity:new s.Uniform1f(E,i.u_opacity),u_color:new s.UniformColor(E,i.u_color)}),backgroundPattern:(E,i)=>({u_matrix:new s.UniformMatrix4f(E,i.u_matrix),u_opacity:new s.Uniform1f(E,i.u_opacity),u_image:new s.Uniform1i(E,i.u_image),u_pattern_tl_a:new s.Uniform2f(E,i.u_pattern_tl_a),u_pattern_br_a:new s.Uniform2f(E,i.u_pattern_br_a),u_pattern_tl_b:new s.Uniform2f(E,i.u_pattern_tl_b),u_pattern_br_b:new s.Uniform2f(E,i.u_pattern_br_b),u_texsize:new s.Uniform2f(E,i.u_texsize),u_mix:new s.Uniform1f(E,i.u_mix),u_pattern_size_a:new s.Uniform2f(E,i.u_pattern_size_a),u_pattern_size_b:new s.Uniform2f(E,i.u_pattern_size_b),u_scale_a:new s.Uniform1f(E,i.u_scale_a),u_scale_b:new s.Uniform1f(E,i.u_scale_b),u_pixel_coord_upper:new s.Uniform2f(E,i.u_pixel_coord_upper),u_pixel_coord_lower:new s.Uniform2f(E,i.u_pixel_coord_lower),u_tile_units_to_pixels:new s.Uniform1f(E,i.u_tile_units_to_pixels)}),terrain:(E,i)=>({u_matrix:new s.UniformMatrix4f(E,i.u_matrix),u_texture:new s.Uniform1i(E,i.u_texture)}),terrainDepth:(E,i)=>({u_matrix:new s.UniformMatrix4f(E,i.u_matrix)}),terrainCoords:(E,i)=>({u_matrix:new s.UniformMatrix4f(E,i.u_matrix),u_texture:new s.Uniform1i(E,i.u_texture),u_terrain_coords_id:new s.Uniform1f(E,i.u_terrain_coords_id)})};class Eo{constructor(i,d,x){this.context=i;let T=i.gl;this.buffer=T.createBuffer(),this.dynamicDraw=Boolean(x),this.context.unbindVAO(),i.bindElementBuffer.set(this.buffer),T.bufferData(T.ELEMENT_ARRAY_BUFFER,d.arrayBuffer,this.dynamicDraw?T.DYNAMIC_DRAW:T.STATIC_DRAW),this.dynamicDraw||delete d.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(i){let d=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),d.bufferSubData(d.ELEMENT_ARRAY_BUFFER,0,i.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}let xa={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class ba{constructor(i,d,x,T){this.length=d.length,this.attributes=x,this.itemSize=d.bytesPerElement,this.dynamicDraw=T,this.context=i;let M=i.gl;this.buffer=M.createBuffer(),i.bindVertexBuffer.set(this.buffer),M.bufferData(M.ARRAY_BUFFER,d.arrayBuffer,this.dynamicDraw?M.DYNAMIC_DRAW:M.STATIC_DRAW),this.dynamicDraw||delete d.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(i){if(i.length!==this.length)throw new Error(`Length of new data is ${i.length}, which doesn't match current length of ${this.length}`);let d=this.context.gl;this.bind(),d.bufferSubData(d.ARRAY_BUFFER,0,i.arrayBuffer)}enableAttributes(i,d){for(let x=0;x<this.attributes.length;x++){let T=d.attributes[this.attributes[x].name];T!==void 0&&i.enableVertexAttribArray(T)}}setVertexAttribPointers(i,d,x){for(let T=0;T<this.attributes.length;T++){let M=this.attributes[T],U=d.attributes[M.name];U!==void 0&&i.vertexAttribPointer(U,M.components,i[xa[M.type]],!1,this.itemSize,M.offset+this.itemSize*(x||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class ii{constructor(i){this.gl=i.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(i){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class Oa extends ii{getDefault(){return s.Color.transparent}set(i){let d=this.current;(i.r!==d.r||i.g!==d.g||i.b!==d.b||i.a!==d.a||this.dirty)&&(this.gl.clearColor(i.r,i.g,i.b,i.a),this.current=i,this.dirty=!1)}}class es extends ii{getDefault(){return 1}set(i){(i!==this.current||this.dirty)&&(this.gl.clearDepth(i),this.current=i,this.dirty=!1)}}class ts extends ii{getDefault(){return 0}set(i){(i!==this.current||this.dirty)&&(this.gl.clearStencil(i),this.current=i,this.dirty=!1)}}class Fn extends ii{getDefault(){return[!0,!0,!0,!0]}set(i){let d=this.current;(i[0]!==d[0]||i[1]!==d[1]||i[2]!==d[2]||i[3]!==d[3]||this.dirty)&&(this.gl.colorMask(i[0],i[1],i[2],i[3]),this.current=i,this.dirty=!1)}}class cn extends ii{getDefault(){return!0}set(i){(i!==this.current||this.dirty)&&(this.gl.depthMask(i),this.current=i,this.dirty=!1)}}class Bn extends ii{getDefault(){return 255}set(i){(i!==this.current||this.dirty)&&(this.gl.stencilMask(i),this.current=i,this.dirty=!1)}}class Jl extends ii{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(i){let d=this.current;(i.func!==d.func||i.ref!==d.ref||i.mask!==d.mask||this.dirty)&&(this.gl.stencilFunc(i.func,i.ref,i.mask),this.current=i,this.dirty=!1)}}class Ql extends ii{getDefault(){let i=this.gl;return[i.KEEP,i.KEEP,i.KEEP]}set(i){let d=this.current;(i[0]!==d[0]||i[1]!==d[1]||i[2]!==d[2]||this.dirty)&&(this.gl.stencilOp(i[0],i[1],i[2]),this.current=i,this.dirty=!1)}}class eu extends ii{getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;let d=this.gl;i?d.enable(d.STENCIL_TEST):d.disable(d.STENCIL_TEST),this.current=i,this.dirty=!1}}class El extends ii{getDefault(){return[0,1]}set(i){let d=this.current;(i[0]!==d[0]||i[1]!==d[1]||this.dirty)&&(this.gl.depthRange(i[0],i[1]),this.current=i,this.dirty=!1)}}class Tl extends ii{getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;let d=this.gl;i?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST),this.current=i,this.dirty=!1}}class el extends ii{getDefault(){return this.gl.LESS}set(i){(i!==this.current||this.dirty)&&(this.gl.depthFunc(i),this.current=i,this.dirty=!1)}}class Sl extends ii{getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;let d=this.gl;i?d.enable(d.BLEND):d.disable(d.BLEND),this.current=i,this.dirty=!1}}class tu extends ii{getDefault(){let i=this.gl;return[i.ONE,i.ZERO]}set(i){let d=this.current;(i[0]!==d[0]||i[1]!==d[1]||this.dirty)&&(this.gl.blendFunc(i[0],i[1]),this.current=i,this.dirty=!1)}}class Il extends ii{getDefault(){return s.Color.transparent}set(i){let d=this.current;(i.r!==d.r||i.g!==d.g||i.b!==d.b||i.a!==d.a||this.dirty)&&(this.gl.blendColor(i.r,i.g,i.b,i.a),this.current=i,this.dirty=!1)}}class bc extends ii{getDefault(){return this.gl.FUNC_ADD}set(i){(i!==this.current||this.dirty)&&(this.gl.blendEquation(i),this.current=i,this.dirty=!1)}}class tl extends ii{getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;let d=this.gl;i?d.enable(d.CULL_FACE):d.disable(d.CULL_FACE),this.current=i,this.dirty=!1}}class wa extends ii{getDefault(){return this.gl.BACK}set(i){(i!==this.current||this.dirty)&&(this.gl.cullFace(i),this.current=i,this.dirty=!1)}}class wc extends ii{getDefault(){return this.gl.CCW}set(i){(i!==this.current||this.dirty)&&(this.gl.frontFace(i),this.current=i,this.dirty=!1)}}class Un extends ii{getDefault(){return null}set(i){(i!==this.current||this.dirty)&&(this.gl.useProgram(i),this.current=i,this.dirty=!1)}}class zu extends ii{getDefault(){return this.gl.TEXTURE0}set(i){(i!==this.current||this.dirty)&&(this.gl.activeTexture(i),this.current=i,this.dirty=!1)}}class rs extends ii{getDefault(){let i=this.gl;return[0,0,i.drawingBufferWidth,i.drawingBufferHeight]}set(i){let d=this.current;(i[0]!==d[0]||i[1]!==d[1]||i[2]!==d[2]||i[3]!==d[3]||this.dirty)&&(this.gl.viewport(i[0],i[1],i[2],i[3]),this.current=i,this.dirty=!1)}}class is extends ii{getDefault(){return null}set(i){if(i===this.current&&!this.dirty)return;let d=this.gl;d.bindFramebuffer(d.FRAMEBUFFER,i),this.current=i,this.dirty=!1}}class Ms extends ii{getDefault(){return null}set(i){if(i===this.current&&!this.dirty)return;let d=this.gl;d.bindRenderbuffer(d.RENDERBUFFER,i),this.current=i,this.dirty=!1}}class Fa extends ii{getDefault(){return null}set(i){if(i===this.current&&!this.dirty)return;let d=this.gl;d.bindTexture(d.TEXTURE_2D,i),this.current=i,this.dirty=!1}}class na extends ii{getDefault(){return null}set(i){if(i===this.current&&!this.dirty)return;let d=this.gl;d.bindBuffer(d.ARRAY_BUFFER,i),this.current=i,this.dirty=!1}}class Ba extends ii{getDefault(){return null}set(i){let d=this.gl;d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,i),this.current=i,this.dirty=!1}}class Ua extends ii{constructor(i){super(i),this.vao=i.extVertexArrayObject}getDefault(){return null}set(i){this.vao&&(i!==this.current||this.dirty)&&(this.vao.bindVertexArrayOES(i),this.current=i,this.dirty=!1)}}class Oo extends ii{getDefault(){return 4}set(i){if(i===this.current&&!this.dirty)return;let d=this.gl;d.pixelStorei(d.UNPACK_ALIGNMENT,i),this.current=i,this.dirty=!1}}class Du extends ii{getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;let d=this.gl;d.pixelStorei(d.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i),this.current=i,this.dirty=!1}}class Ou extends ii{getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;let d=this.gl;d.pixelStorei(d.UNPACK_FLIP_Y_WEBGL,i),this.current=i,this.dirty=!1}}class ci extends ii{constructor(i,d){super(i),this.context=i,this.parent=d}getDefault(){return null}}class ks extends ci{setDirty(){this.dirty=!0}set(i){if(i===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let d=this.gl;d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,d.TEXTURE_2D,i,0),this.current=i,this.dirty=!1}}class Cl extends ci{set(i){if(i===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let d=this.gl;d.framebufferRenderbuffer(d.FRAMEBUFFER,d.DEPTH_ATTACHMENT,d.RENDERBUFFER,i),this.current=i,this.dirty=!1}}class Ls{constructor(i,d,x,T){this.context=i,this.width=d,this.height=x;let M=i.gl,U=this.framebuffer=M.createFramebuffer();if(this.colorAttachment=new ks(i,U),T&&(this.depthAttachment=new Cl(i,U)),M.checkFramebufferStatus(M.FRAMEBUFFER)!==M.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer is not complete")}destroy(){let i=this.context.gl,d=this.colorAttachment.get();if(d&&i.deleteTexture(d),this.depthAttachment){let x=this.depthAttachment.get();x&&i.deleteRenderbuffer(x)}i.deleteFramebuffer(this.framebuffer)}}class Fi{constructor(i,d,x){this.blendFunction=i,this.blendColor=d,this.mask=x}}Fi.Replace=[1,0],Fi.disabled=new Fi(Fi.Replace,s.Color.transparent,[!1,!1,!1,!1]),Fi.unblended=new Fi(Fi.Replace,s.Color.transparent,[!0,!0,!0,!0]),Fi.alphaBlended=new Fi([1,771],s.Color.transparent,[!0,!0,!0,!0]);class Fu{constructor(i){this.gl=i,this.extVertexArrayObject=this.gl.getExtension("OES_vertex_array_object"),this.clearColor=new Oa(this),this.clearDepth=new es(this),this.clearStencil=new ts(this),this.colorMask=new Fn(this),this.depthMask=new cn(this),this.stencilMask=new Bn(this),this.stencilFunc=new Jl(this),this.stencilOp=new Ql(this),this.stencilTest=new eu(this),this.depthRange=new El(this),this.depthTest=new Tl(this),this.depthFunc=new el(this),this.blend=new Sl(this),this.blendFunc=new tu(this),this.blendColor=new Il(this),this.blendEquation=new bc(this),this.cullFace=new tl(this),this.cullFaceSide=new wa(this),this.frontFace=new wc(this),this.program=new Un(this),this.activeTexture=new zu(this),this.viewport=new rs(this),this.bindFramebuffer=new is(this),this.bindRenderbuffer=new Ms(this),this.bindTexture=new Fa(this),this.bindVertexBuffer=new na(this),this.bindElementBuffer=new Ba(this),this.bindVertexArrayOES=this.extVertexArrayObject&&new Ua(this),this.pixelStoreUnpack=new Oo(this),this.pixelStoreUnpackPremultiplyAlpha=new Du(this),this.pixelStoreUnpackFlipY=new Ou(this),this.extTextureFilterAnisotropic=i.getExtension("EXT_texture_filter_anisotropic")||i.getExtension("MOZ_EXT_texture_filter_anisotropic")||i.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=i.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.extTextureHalfFloat=i.getExtension("OES_texture_half_float"),this.extTextureHalfFloat&&(i.getExtension("OES_texture_half_float_linear"),this.extRenderToTextureHalfFloat=i.getExtension("EXT_color_buffer_half_float")),this.extTimerQuery=i.getExtension("EXT_disjoint_timer_query"),this.maxTextureSize=i.getParameter(i.MAX_TEXTURE_SIZE)}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.extVertexArrayObject&&(this.bindVertexArrayOES.dirty=!0),this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(i,d){return new Eo(this,i,d)}createVertexBuffer(i,d,x){return new ba(this,i,d,x)}createRenderbuffer(i,d,x){let T=this.gl,M=T.createRenderbuffer();return this.bindRenderbuffer.set(M),T.renderbufferStorage(T.RENDERBUFFER,i,d,x),this.bindRenderbuffer.set(null),M}createFramebuffer(i,d,x){return new Ls(this,i,d,x)}clear({color:i,depth:d}){let x=this.gl,T=0;i&&(T|=x.COLOR_BUFFER_BIT,this.clearColor.set(i),this.colorMask.set([!0,!0,!0,!0])),d!==void 0&&(T|=x.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(d),this.depthMask.set(!0)),x.clear(T)}setCullFace(i){i.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(i.mode),this.frontFace.set(i.frontFace))}setDepthMode(i){i.func!==this.gl.ALWAYS||i.mask?(this.depthTest.set(!0),this.depthFunc.set(i.func),this.depthMask.set(i.mask),this.depthRange.set(i.range)):this.depthTest.set(!1)}setStencilMode(i){i.test.func!==this.gl.ALWAYS||i.mask?(this.stencilTest.set(!0),this.stencilMask.set(i.mask),this.stencilOp.set([i.fail,i.depthFail,i.pass]),this.stencilFunc.set({func:i.test.func,ref:i.ref,mask:i.test.mask})):this.stencilTest.set(!1)}setColorMode(i){N(i.blendFunction,Fi.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(i.blendFunction),this.blendColor.set(i.blendColor)),this.colorMask.set(i.mask)}unbindVAO(){this.extVertexArrayObject&&this.bindVertexArrayOES.set(null)}}class ti{constructor(i,d,x){this.func=i,this.mask=d,this.range=x}}ti.ReadOnly=!1,ti.ReadWrite=!0,ti.disabled=new ti(519,ti.ReadOnly,[0,1]);let ni=7680;class hi{constructor(i,d,x,T,M,U){this.test=i,this.ref=d,this.mask=x,this.fail=T,this.depthFail=M,this.pass=U}}hi.disabled=new hi({func:519,mask:0},0,0,ni,ni,ni);class Ei{constructor(i,d,x){this.enable=i,this.mode=d,this.frontFace=x}}let rl;function Rs(E,i,d,x,T,M,U){let q=E.context,W=q.gl,Y=E.useProgram("collisionBox"),se=[],pe=0,ve=0;for(let je=0;je<x.length;je++){let mt=x[je],pt=i.getTile(mt),vt=pt.getBucket(d);if(!vt)continue;let Et=mt.posMatrix;T[0]===0&&T[1]===0||(Et=E.translatePosMatrix(mt.posMatrix,pt,T,M));let zt=U?vt.textCollisionBox:vt.iconCollisionBox,xt=vt.collisionCircleArray;if(xt.length>0){let rr=s.create(),p=Et;s.mul(rr,vt.placementInvProjMatrix,E.transform.glCoordMatrix),s.mul(rr,rr,vt.placementViewportMatrix),se.push({circleArray:xt,circleOffset:ve,transform:p,invTransform:rr,coord:mt}),pe+=xt.length/4,ve=pe}zt&&Y.draw(q,W.LINES,ti.disabled,hi.disabled,E.colorModeForRenderPass(),Ei.disabled,As(Et,E.transform,pt),E.style.terrain&&E.style.terrain.getTerrainData(mt),d.id,zt.layoutVertexBuffer,zt.indexBuffer,zt.segments,null,E.transform.zoom,null,null,zt.collisionVertexBuffer)}if(!U||!se.length)return;let Ne=E.useProgram("collisionCircle"),ze=new s.CollisionCircleLayoutArray;ze.resize(4*pe),ze._trim();let Be=0;for(let je of se)for(let mt=0;mt<je.circleArray.length/4;mt++){let pt=4*mt,vt=je.circleArray[pt+0],Et=je.circleArray[pt+1],zt=je.circleArray[pt+2],xt=je.circleArray[pt+3];ze.emplace(Be++,vt,Et,zt,xt,0),ze.emplace(Be++,vt,Et,zt,xt,1),ze.emplace(Be++,vt,Et,zt,xt,2),ze.emplace(Be++,vt,Et,zt,xt,3)}(!rl||rl.length<2*pe)&&(rl=function(je){let mt=2*je,pt=new s.QuadTriangleArray;pt.resize(mt),pt._trim();for(let vt=0;vt<mt;vt++){let Et=6*vt;pt.uint16[Et+0]=4*vt+0,pt.uint16[Et+1]=4*vt+1,pt.uint16[Et+2]=4*vt+2,pt.uint16[Et+3]=4*vt+2,pt.uint16[Et+4]=4*vt+3,pt.uint16[Et+5]=4*vt+0}return pt}(pe));let tt=q.createIndexBuffer(rl,!0),st=q.createVertexBuffer(ze,s.collisionCircleLayout.members,!0);for(let je of se){let mt={u_matrix:je.transform,u_inv_matrix:je.invTransform,u_camera_to_center_distance:(ht=E.transform).cameraToCenterDistance,u_viewport_size:[ht.width,ht.height]};Ne.draw(q,W.TRIANGLES,ti.disabled,hi.disabled,E.colorModeForRenderPass(),Ei.disabled,mt,E.style.terrain&&E.style.terrain.getTerrainData(je.coord),d.id,st,tt,s.SegmentVector.simpleSegment(0,2*je.circleOffset,je.circleArray.length,je.circleArray.length/2),null,E.transform.zoom,null,null,null)}var ht;st.destroy(),tt.destroy()}Ei.disabled=new Ei(!1,1029,2305),Ei.backCCW=new Ei(!0,1029,2305);let Bu=s.identity(new Float32Array(16));function zs(E,i,d,x,T,M){let{horizontalAlign:U,verticalAlign:q}=s.getAnchorAlignment(E),W=-(U-.5)*i,Y=-(q-.5)*d,se=s.evaluateVariableOffset(E,x);return new s.pointGeometry((W/T+se[0])*M,(Y/T+se[1])*M)}function Uu(E,i,d,x,T,M,U,q,W,Y,se){let pe=E.text.placedSymbolArray,ve=E.text.dynamicLayoutVertexArray,Ne=E.icon.dynamicLayoutVertexArray,ze={};ve.clear();for(let Be=0;Be<pe.length;Be++){let tt=pe.get(Be),st=E.allowVerticalPlacement&&!tt.placedOrientation,ht=tt.hidden||!tt.crossTileID||st?null:x[tt.crossTileID];if(ht){let je=new s.pointGeometry(tt.anchorX,tt.anchorY),mt=Xr(je,d?U:M,se),pt=Mn(T.cameraToCenterDistance,mt.signedDistanceFromCamera),vt=s.evaluateSizeForFeature(E.textSizeData,W,tt)*pt/s.ONE_EM;d&&(vt*=E.tilePixelRatio/q);let{width:Et,height:zt,anchor:xt,textOffset:rr,textBoxScale:p}=ht,m=zs(xt,Et,zt,rr,p,vt),f=d?Xr(je.add(m),M,se).point:mt.point.add(i?m.rotate(-T.angle):m),v=E.allowVerticalPlacement&&tt.placedOrientation===s.WritingMode.vertical?Math.PI/2:0;for(let I=0;I<tt.numGlyphs;I++)s.addDynamicAttributes(ve,f,v);Y&&tt.associatedIconIndex>=0&&(ze[tt.associatedIconIndex]={shiftedAnchor:f,angle:v})}else Ar(tt.numGlyphs,ve)}if(Y){Ne.clear();let Be=E.icon.placedSymbolArray;for(let tt=0;tt<Be.length;tt++){let st=Be.get(tt);if(st.hidden)Ar(st.numGlyphs,Ne);else{let ht=ze[tt];if(ht)for(let je=0;je<st.numGlyphs;je++)s.addDynamicAttributes(Ne,ht.shiftedAnchor,ht.angle);else Ar(st.numGlyphs,Ne)}}E.icon.dynamicLayoutVertexBuffer.updateData(Ne)}E.text.dynamicLayoutVertexBuffer.updateData(ve)}function Ds(E,i,d){return d.iconsInText&&i?"symbolTextAndIcon":E?"symbolSDF":"symbolIcon"}function Ea(E,i,d,x,T,M,U,q,W,Y,se,pe){let ve=E.context,Ne=ve.gl,ze=E.transform,Be=q==="map",tt=W==="map",st=q!=="viewport"&&d.layout.get("symbol-placement")!=="point",ht=Be&&!tt&&!st,je=!d.layout.get("symbol-sort-key").isConstant(),mt=!1,pt=E.depthModeForSublayer(0,ti.ReadOnly),vt=d.layout.get("text-variable-anchor"),Et=[];for(let zt of x){let xt=i.getTile(zt),rr=xt.getBucket(d);if(!rr)continue;let p=T?rr.text:rr.icon;if(!p||!p.segments.get().length)continue;let m=p.programConfigurations.get(d.id),f=T||rr.sdfIcons,v=T?rr.textSizeData:rr.iconSizeData,I=tt||ze.pitch!==0,L=E.useProgram(Ds(f,T,rr),m),D=s.evaluateSizeForZoom(v,ze.zoom),G=E.style.terrain&&E.style.terrain.getTerrainData(zt),H,ne,ye,xe,Ee=[0,0],Fe=null;if(T){if(ne=xt.glyphAtlasTexture,ye=Ne.LINEAR,H=xt.glyphAtlasTexture.size,rr.iconsInText){Ee=xt.imageAtlasTexture.size,Fe=xt.imageAtlasTexture;let kt=v.kind==="composite"||v.kind==="camera";xe=I||E.options.rotating||E.options.zooming||kt?Ne.LINEAR:Ne.NEAREST}}else{let kt=d.layout.get("icon-size").constantOr(0)!==1||rr.iconsNeedLinear;ne=xt.imageAtlasTexture,ye=f||E.options.rotating||E.options.zooming||kt||I?Ne.LINEAR:Ne.NEAREST,H=xt.imageAtlasTexture.size}let De=te(xt,1,E.transform.zoom),Ze=co(zt.posMatrix,tt,Be,E.transform,De),Me=gn(zt.posMatrix,tt,Be,E.transform,De),Xe=vt&&rr.hasTextData(),Qe=d.layout.get("icon-text-fit")!=="none"&&Xe&&rr.hasIconData();if(st){let kt=E.style.terrain?(fr,dr)=>E.style.terrain.getElevation(zt,fr,dr):null,Kt=d.layout.get("text-rotation-alignment")==="map";fn(rr,zt.posMatrix,E,T,Ze,Me,tt,Y,Kt,kt)}let it=E.translatePosMatrix(zt.posMatrix,xt,M,U),at=st||T&&vt||Qe?Bu:Ze,lt=E.translatePosMatrix(Me,xt,M,U,!0),ft=f&&d.paint.get(T?"text-halo-width":"icon-halo-width").constantOr(1)!==0,bt;bt=f?rr.iconsInText?Yl(v.kind,D,ht,tt,E,it,at,lt,H,Ee):Da(v.kind,D,ht,tt,E,it,at,lt,T,H,!0):Kl(v.kind,D,ht,tt,E,it,at,lt,T,H);let It={program:L,buffers:p,uniformValues:bt,atlasTexture:ne,atlasTextureIcon:Fe,atlasInterpolation:ye,atlasInterpolationIcon:xe,isSDF:f,hasHalo:ft};if(je&&rr.canOverlap){mt=!0;let kt=p.segments.get();for(let Kt of kt)Et.push({segments:new s.SegmentVector([Kt]),sortKey:Kt.sortKey,state:It,terrainData:G})}else Et.push({segments:p.segments,sortKey:0,state:It,terrainData:G})}mt&&Et.sort((zt,xt)=>zt.sortKey-xt.sortKey);for(let zt of Et){let xt=zt.state;if(ve.activeTexture.set(Ne.TEXTURE0),xt.atlasTexture.bind(xt.atlasInterpolation,Ne.CLAMP_TO_EDGE),xt.atlasTextureIcon&&(ve.activeTexture.set(Ne.TEXTURE1),xt.atlasTextureIcon&&xt.atlasTextureIcon.bind(xt.atlasInterpolationIcon,Ne.CLAMP_TO_EDGE)),xt.isSDF){let rr=xt.uniformValues;xt.hasHalo&&(rr.u_is_halo=1,il(xt.buffers,zt.segments,d,E,xt.program,pt,se,pe,rr,zt.terrainData)),rr.u_is_halo=0}il(xt.buffers,zt.segments,d,E,xt.program,pt,se,pe,xt.uniformValues,zt.terrainData)}}function il(E,i,d,x,T,M,U,q,W,Y){let se=x.context;T.draw(se,se.gl.TRIANGLES,M,U,q,Ei.disabled,W,Y,d.id,E.layoutVertexBuffer,E.indexBuffer,i,d.paint,x.transform.zoom,E.programConfigurations.get(d.id),E.dynamicLayoutVertexBuffer,E.opacityVertexBuffer)}function Na(E,i,d,x,T,M,U){let q=E.context.gl,W=d.paint.get("fill-pattern"),Y=W&&W.constantOr(1),se=d.getCrossfadeParameters(),pe,ve,Ne,ze,Be;U?(ve=Y&&!d.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",pe=q.LINES):(ve=Y?"fillPattern":"fill",pe=q.TRIANGLES);for(let tt of x){let st=i.getTile(tt);if(Y&&!st.patternsLoaded())continue;let ht=st.getBucket(d);if(!ht)continue;let je=ht.programConfigurations.get(d.id),mt=E.useProgram(ve,je),pt=E.style.terrain&&E.style.terrain.getTerrainData(tt);Y&&(E.context.activeTexture.set(q.TEXTURE0),st.imageAtlasTexture.bind(q.LINEAR,q.CLAMP_TO_EDGE),je.updatePaintBuffers(se));let vt=W.constantOr(null);if(vt&&st.imageAtlas){let xt=st.imageAtlas,rr=xt.patternPositions[vt.to.toString()],p=xt.patternPositions[vt.from.toString()];rr&&p&&je.setConstantPatternPositions(rr,p)}let Et=pt?tt:null,zt=E.translatePosMatrix(Et?Et.posMatrix:tt.posMatrix,st,d.paint.get("fill-translate"),d.paint.get("fill-translate-anchor"));if(U){ze=ht.indexBuffer2,Be=ht.segments2;let xt=[q.drawingBufferWidth,q.drawingBufferHeight];Ne=ve==="fillOutlinePattern"&&Y?ku(zt,E,se,st,xt):wo(zt,xt)}else ze=ht.indexBuffer,Be=ht.segments,Ne=Y?Lo(zt,E,se,st):Ti(zt);mt.draw(E.context,pe,T,E.stencilModeForClipping(tt),M,Ei.disabled,Ne,pt,d.id,ht.layoutVertexBuffer,ze,Be,d.paint,E.transform.zoom,je)}}function mi(E,i,d,x,T,M,U){let q=E.context,W=q.gl,Y=d.paint.get("fill-extrusion-pattern"),se=Y.constantOr(1),pe=d.getCrossfadeParameters(),ve=d.paint.get("fill-extrusion-opacity");for(let Ne of x){let ze=i.getTile(Ne),Be=ze.getBucket(d);if(!Be)continue;let tt=E.style.terrain&&E.style.terrain.getTerrainData(Ne),st=Be.programConfigurations.get(d.id),ht=E.useProgram(se?"fillExtrusionPattern":"fillExtrusion",st);se&&(E.context.activeTexture.set(W.TEXTURE0),ze.imageAtlasTexture.bind(W.LINEAR,W.CLAMP_TO_EDGE),st.updatePaintBuffers(pe));let je=Y.constantOr(null);if(je&&ze.imageAtlas){let Et=ze.imageAtlas,zt=Et.patternPositions[je.to.toString()],xt=Et.patternPositions[je.from.toString()];zt&&xt&&st.setConstantPatternPositions(zt,xt)}let mt=E.translatePosMatrix(Ne.posMatrix,ze,d.paint.get("fill-extrusion-translate"),d.paint.get("fill-extrusion-translate-anchor")),pt=d.paint.get("fill-extrusion-vertical-gradient"),vt=se?qo(mt,E,pt,ve,Ne,pe,ze):yn(mt,E,pt,ve);ht.draw(q,q.gl.TRIANGLES,T,M,U,Ei.backCCW,vt,tt,d.id,Be.layoutVertexBuffer,Be.indexBuffer,Be.segments,d.paint,E.transform.zoom,st,E.style.terrain&&Be.centroidVertexBuffer)}}function nl(E,i,d,x,T,M,U){let q=E.context,W=q.gl,Y=d.fbo;if(!Y)return;let se=E.useProgram("hillshade"),pe=E.style.terrain&&E.style.terrain.getTerrainData(i);q.activeTexture.set(W.TEXTURE0),W.bindTexture(W.TEXTURE_2D,Y.colorAttachment.get()),se.draw(q,W.TRIANGLES,T,M,U,Ei.disabled,((ve,Ne,ze,Be)=>{let tt=ze.paint.get("hillshade-shadow-color"),st=ze.paint.get("hillshade-highlight-color"),ht=ze.paint.get("hillshade-accent-color"),je=ze.paint.get("hillshade-illumination-direction")*(Math.PI/180);ze.paint.get("hillshade-illumination-anchor")==="viewport"&&(je-=ve.transform.angle);let mt=!ve.options.moving;return{u_matrix:Be?Be.posMatrix:ve.transform.calculatePosMatrix(Ne.tileID.toUnwrapped(),mt),u_image:0,u_latrange:Ln(0,Ne.tileID),u_light:[ze.paint.get("hillshade-exaggeration"),je],u_shadow:tt,u_highlight:st,u_accent:ht}})(E,d,x,pe?i:null),pe,x.id,E.rasterBoundsBuffer,E.quadTriangleIndexBuffer,E.rasterBoundsSegments)}function Ec(E,i,d,x,T,M){let U=E.context,q=U.gl,W=i.dem;if(W&&W.data){let Y=W.dim,se=W.stride,pe=W.getPixels();if(U.activeTexture.set(q.TEXTURE1),U.pixelStoreUnpackPremultiplyAlpha.set(!1),i.demTexture=i.demTexture||E.getTileTexture(se),i.demTexture){let Ne=i.demTexture;Ne.update(pe,{premultiply:!1}),Ne.bind(q.NEAREST,q.CLAMP_TO_EDGE)}else i.demTexture=new Se(U,pe,q.RGBA,{premultiply:!1}),i.demTexture.bind(q.NEAREST,q.CLAMP_TO_EDGE);U.activeTexture.set(q.TEXTURE0);let ve=i.fbo;if(!ve){let Ne=new Se(U,{width:Y,height:Y,data:null},q.RGBA);Ne.bind(q.LINEAR,q.CLAMP_TO_EDGE),ve=i.fbo=U.createFramebuffer(Y,Y,!0),ve.colorAttachment.set(Ne.texture)}U.bindFramebuffer.set(ve.framebuffer),U.viewport.set([0,0,Y,Y]),E.useProgram("hillshadePrepare").draw(U,q.TRIANGLES,x,T,M,Ei.disabled,((Ne,ze)=>{let Be=ze.stride,tt=s.create();return s.ortho(tt,0,s.EXTENT,-s.EXTENT,0,0,1),s.translate(tt,tt,[0,-s.EXTENT,0]),{u_matrix:tt,u_image:1,u_dimension:[Be,Be],u_zoom:Ne.overscaledZ,u_unpack:ze.getUnpackVector()}})(i.tileID,W),null,d.id,E.rasterBoundsBuffer,E.quadTriangleIndexBuffer,E.rasterBoundsSegments),i.needsHillshadePrepare=!1}}function Va(E,i,d,x,T,M){let U=x.paint.get("raster-fade-duration");if(!M&&U>0){let q=s.exported.now(),W=(q-E.timeAdded)/U,Y=i?(q-i.timeAdded)/U:-1,se=d.getSource(),pe=T.coveringZoomLevel({tileSize:se.tileSize,roundZoom:se.roundZoom}),ve=!i||Math.abs(i.tileID.overscaledZ-pe)>Math.abs(E.tileID.overscaledZ-pe),Ne=ve&&E.refreshedUponExpiration?1:s.clamp(ve?W:1-Y,0,1);return E.refreshedUponExpiration&&W>=1&&(E.refreshedUponExpiration=!1),i?{opacity:1,mix:1-Ne}:{opacity:Ne,mix:0}}return{opacity:1,mix:0}}let Al=new s.Color(1,0,0,1),oa=new s.Color(0,1,0,1),Nu=new s.Color(0,0,1,1),ol=new s.Color(1,0,1,1),Os=new s.Color(0,1,1,1);function aa(E,i,d,x){Ta(E,0,i+d/2,E.transform.width,d,x)}function ns(E,i,d,x){Ta(E,i-d/2,0,d,E.transform.height,x)}function Ta(E,i,d,x,T,M){let U=E.context,q=U.gl;q.enable(q.SCISSOR_TEST),q.scissor(i*E.pixelRatio,d*E.pixelRatio,x*E.pixelRatio,T*E.pixelRatio),U.clear({color:M}),q.disable(q.SCISSOR_TEST)}function al(E,i,d){let x=E.context,T=x.gl,M=d.posMatrix,U=E.useProgram("debug"),q=ti.disabled,W=hi.disabled,Y=E.colorModeForRenderPass(),se="$debug",pe=E.style.terrain&&E.style.terrain.getTerrainData(d);x.activeTexture.set(T.TEXTURE0),E.emptyTexture.bind(T.LINEAR,T.CLAMP_TO_EDGE);let ve=i.getTileByID(d.key).latestRawTileData,Ne=Math.floor((ve&&ve.byteLength||0)/1024),ze=i.getTile(d).tileSize,Be=512/Math.min(ze,512)*(d.overscaledZ/E.transform.zoom)*.5,tt=d.canonical.toString();d.overscaledZ!==d.canonical.z&&(tt+=` => ${d.overscaledZ}`),function(st,ht){st.initDebugOverlayCanvas();let je=st.debugOverlayCanvas,mt=st.context.gl,pt=st.debugOverlayCanvas.getContext("2d");pt.clearRect(0,0,je.width,je.height),pt.shadowColor="white",pt.shadowBlur=2,pt.lineWidth=1.5,pt.strokeStyle="white",pt.textBaseline="top",pt.font="bold 36px Open Sans, sans-serif",pt.fillText(ht,5,5),pt.strokeText(ht,5,5),st.debugOverlayTexture.update(je),st.debugOverlayTexture.bind(mt.LINEAR,mt.CLAMP_TO_EDGE)}(E,`${tt} ${Ne}kB`),U.draw(x,T.TRIANGLES,q,W,Fi.alphaBlended,Ei.disabled,zo(M,s.Color.transparent,Be),null,se,E.debugBuffer,E.quadTriangleIndexBuffer,E.debugSegments),U.draw(x,T.LINE_STRIP,q,W,Y,Ei.disabled,zo(M,s.Color.red),pe,se,E.debugBuffer,E.tileBorderIndexBuffer,E.debugSegments)}function Pl(E,i,d){let x=E.context,T=x.gl,M=E.colorModeForRenderPass(),U=new ti(T.LEQUAL,ti.ReadWrite,E.depthRangeFor3D),q=E.useProgram("terrain"),W=i.getTerrainMesh(),Y=i.getTerrainData(d.tileID);x.bindFramebuffer.set(null),x.viewport.set([0,0,E.width,E.height]),x.activeTexture.set(T.TEXTURE0),T.bindTexture(T.TEXTURE_2D,i.getRTTFramebuffer().colorAttachment.get());let se=E.transform.calculatePosMatrix(d.tileID.toUnwrapped());q.draw(x,T.TRIANGLES,U,hi.disabled,M,Ei.backCCW,{u_matrix:se,u_texture:0},Y,"terrain",W.vertexBuffer,W.indexBuffer,W.segments)}function Fs(E,i,d,x){let T=E.context,M=d.tileSize*i.qualityFactor;d.textures[x]||(d.textures[x]=E.getTileTexture(M)||new Se(T,{width:M,height:M,data:null},T.gl.RGBA),d.textures[x].bind(T.gl.LINEAR,T.gl.CLAMP_TO_EDGE),x===0&&i.sourceCache.renderHistory.unshift(d.tileID.key));let U=i.getRTTFramebuffer();U.colorAttachment.set(d.textures[x].texture),T.bindFramebuffer.set(U.framebuffer),T.viewport.set([0,0,M,M])}class Xo{constructor(i){this._coordsDescendingInv={},this._coordsDescendingInvStr={},this.painter=i,this._renderToTexture={background:!0,fill:!0,line:!0,raster:!0},this._coordsDescendingInv={},this._coordsDescendingInvStr={},this._stacks=[],this._prevType=null,this._rerender={},this._renderableTiles=i.style.terrain.sourceCache.getRenderableTiles(),this._init()}_init(){let i=this.painter.style,d=i.terrain;for(let x in i.sourceCaches){this._coordsDescendingInv[x]={};let T=i.sourceCaches[x].getVisibleCoordinates();for(let M of T){let U=d.sourceCache.getTerrainCoords(M);for(let q in U)this._coordsDescendingInv[x][q]||(this._coordsDescendingInv[x][q]=[]),this._coordsDescendingInv[x][q].push(U[q])}}for(let x of i._order){let T=i._layers[x],M=T.source;if(this._renderToTexture[T.type]&&!this._coordsDescendingInvStr[M]){this._coordsDescendingInvStr[M]={};for(let U in this._coordsDescendingInv[M])this._coordsDescendingInvStr[M][U]=this._coordsDescendingInv[M][U].map(q=>q.key).sort().join()}}return this._renderableTiles.forEach(x=>{for(let T in this._coordsDescendingInvStr){let M=this._coordsDescendingInvStr[T][x.tileID.key];M&&M!==x.textureCoords[T]&&x.clearTextures(this.painter),d.needsRerender(T,x.tileID)&&x.clearTextures(this.painter)}this._rerender[x.tileID.key]=!x.textures.length}),d.clearRerenderCache(),d.sourceCache.removeOutdated(this.painter),this}renderLayer(i){let d=i.type,x=this.painter,T=x.style._order,M=x.currentLayer,U=M+1===T.length;if(this._renderToTexture[d]&&(this._prevType&&this._renderToTexture[this._prevType]||this._stacks.push([]),this._prevType=d,this._stacks[this._stacks.length-1].push(T[M]),!U))return!0;if(this._renderToTexture[this._prevType]||d==="hillshade"||this._renderToTexture[d]&&U){this._prevType=d;let q=this._stacks.length-1,W=this._stacks[q]||[];for(let Y of this._renderableTiles){if(Fs(x,x.style.terrain,Y,q),this._rerender[Y.tileID.key]){x.context.clear({color:s.Color.transparent});for(let se=0;se<W.length;se++){let pe=x.style._layers[W[se]],ve=pe.source?this._coordsDescendingInv[pe.source][Y.tileID.key]:[Y.tileID];x._renderTileClippingMasks(pe,ve),x.renderLayer(x,x.style.sourceCaches[pe.source],pe,ve),pe.source&&(Y.textureCoords[pe.source]=this._coordsDescendingInvStr[pe.source][Y.tileID.key])}}Pl(x,x.style.terrain,Y)}if(d==="hillshade"){this._stacks.push([T[M]]);for(let Y of this._renderableTiles){let se=this._coordsDescendingInv[i.source][Y.tileID.key];Fs(x,x.style.terrain,Y,this._stacks.length-1),x.context.clear({color:s.Color.transparent}),x._renderTileClippingMasks(i,se),x.renderLayer(x,x.style.sourceCaches[i.source],i,se),Pl(x,x.style.terrain,Y)}return!0}return this._renderToTexture[d]}return!1}}let sl={symbol:function(E,i,d,x,T){if(E.renderPass!=="translucent")return;let M=hi.disabled,U=E.colorModeForRenderPass();d.layout.get("text-variable-anchor")&&function(q,W,Y,se,pe,ve,Ne){let ze=W.transform,Be=pe==="map",tt=ve==="map";for(let st of q){let ht=se.getTile(st),je=ht.getBucket(Y);if(!je||!je.text||!je.text.segments.get().length)continue;let mt=s.evaluateSizeForZoom(je.textSizeData,ze.zoom),pt=te(ht,1,W.transform.zoom),vt=co(st.posMatrix,tt,Be,W.transform,pt),Et=Y.layout.get("icon-text-fit")!=="none"&&je.hasIconData();if(mt){let zt=Math.pow(2,ze.zoom-ht.tileID.overscaledZ);Uu(je,Be,tt,Ne,ze,vt,st.posMatrix,zt,mt,Et,W.style.terrain?(xt,rr)=>W.style.terrain.getElevation(st,xt,rr):null)}}}(x,E,d,i,d.layout.get("text-rotation-alignment"),d.layout.get("text-pitch-alignment"),T),d.paint.get("icon-opacity").constantOr(1)!==0&&Ea(E,i,d,x,!1,d.paint.get("icon-translate"),d.paint.get("icon-translate-anchor"),d.layout.get("icon-rotation-alignment"),d.layout.get("icon-pitch-alignment"),d.layout.get("icon-keep-upright"),M,U),d.paint.get("text-opacity").constantOr(1)!==0&&Ea(E,i,d,x,!0,d.paint.get("text-translate"),d.paint.get("text-translate-anchor"),d.layout.get("text-rotation-alignment"),d.layout.get("text-pitch-alignment"),d.layout.get("text-keep-upright"),M,U),i.map.showCollisionBoxes&&(Rs(E,i,d,x,d.paint.get("text-translate"),d.paint.get("text-translate-anchor"),!0),Rs(E,i,d,x,d.paint.get("icon-translate"),d.paint.get("icon-translate-anchor"),!1))},circle:function(E,i,d,x){if(E.renderPass!=="translucent")return;let T=d.paint.get("circle-opacity"),M=d.paint.get("circle-stroke-width"),U=d.paint.get("circle-stroke-opacity"),q=!d.layout.get("circle-sort-key").isConstant();if(T.constantOr(1)===0&&(M.constantOr(1)===0||U.constantOr(1)===0))return;let W=E.context,Y=W.gl,se=E.depthModeForSublayer(0,ti.ReadOnly),pe=hi.disabled,ve=E.colorModeForRenderPass(),Ne=[];for(let ze=0;ze<x.length;ze++){let Be=x[ze],tt=i.getTile(Be),st=tt.getBucket(d);if(!st)continue;let ht=st.programConfigurations.get(d.id),je=E.useProgram("circle",ht),mt=st.layoutVertexBuffer,pt=st.indexBuffer,vt=E.style.terrain&&E.style.terrain.getTerrainData(Be),Et={programConfiguration:ht,program:je,layoutVertexBuffer:mt,indexBuffer:pt,uniformValues:Ro(E,Be,tt,d),terrainData:vt};if(q){let zt=st.segments.get();for(let xt of zt)Ne.push({segments:new s.SegmentVector([xt]),sortKey:xt.sortKey,state:Et})}else Ne.push({segments:st.segments,sortKey:0,state:Et})}q&&Ne.sort((ze,Be)=>ze.sortKey-Be.sortKey);for(let ze of Ne){let{programConfiguration:Be,program:tt,layoutVertexBuffer:st,indexBuffer:ht,uniformValues:je,terrainData:mt}=ze.state;tt.draw(W,Y.TRIANGLES,se,pe,ve,Ei.disabled,je,mt,d.id,st,ht,ze.segments,d.paint,E.transform.zoom,Be)}},heatmap:function(E,i,d,x){if(d.paint.get("heatmap-opacity")!==0)if(E.renderPass==="offscreen"){let T=E.context,M=T.gl,U=hi.disabled,q=new Fi([M.ONE,M.ONE],s.Color.transparent,[!0,!0,!0,!0]);(function(W,Y,se){let pe=W.gl;W.activeTexture.set(pe.TEXTURE1),W.viewport.set([0,0,Y.width/4,Y.height/4]);let ve=se.heatmapFbo;if(ve)pe.bindTexture(pe.TEXTURE_2D,ve.colorAttachment.get()),W.bindFramebuffer.set(ve.framebuffer);else{let Ne=pe.createTexture();pe.bindTexture(pe.TEXTURE_2D,Ne),pe.texParameteri(pe.TEXTURE_2D,pe.TEXTURE_WRAP_S,pe.CLAMP_TO_EDGE),pe.texParameteri(pe.TEXTURE_2D,pe.TEXTURE_WRAP_T,pe.CLAMP_TO_EDGE),pe.texParameteri(pe.TEXTURE_2D,pe.TEXTURE_MIN_FILTER,pe.LINEAR),pe.texParameteri(pe.TEXTURE_2D,pe.TEXTURE_MAG_FILTER,pe.LINEAR),ve=se.heatmapFbo=W.createFramebuffer(Y.width/4,Y.height/4,!1),function(ze,Be,tt,st){let ht=ze.gl;ht.texImage2D(ht.TEXTURE_2D,0,ht.RGBA,Be.width/4,Be.height/4,0,ht.RGBA,ze.extRenderToTextureHalfFloat?ze.extTextureHalfFloat.HALF_FLOAT_OES:ht.UNSIGNED_BYTE,null),st.colorAttachment.set(tt)}(W,Y,Ne,ve)}})(T,E,d),T.clear({color:s.Color.transparent});for(let W=0;W<x.length;W++){let Y=x[W];if(i.hasRenderableParent(Y))continue;let se=i.getTile(Y),pe=se.getBucket(d);if(!pe)continue;let ve=pe.programConfigurations.get(d.id),Ne=E.useProgram("heatmap",ve),{zoom:ze}=E.transform;Ne.draw(T,M.TRIANGLES,ti.disabled,U,q,Ei.disabled,Do(Y.posMatrix,se,ze,d.paint.get("heatmap-intensity")),null,d.id,pe.layoutVertexBuffer,pe.indexBuffer,pe.segments,d.paint,E.transform.zoom,ve)}T.viewport.set([0,0,E.width,E.height])}else E.renderPass==="translucent"&&(E.context.setColorMode(E.colorModeForRenderPass()),function(T,M){let U=T.context,q=U.gl,W=M.heatmapFbo;if(!W)return;U.activeTexture.set(q.TEXTURE0),q.bindTexture(q.TEXTURE_2D,W.colorAttachment.get()),U.activeTexture.set(q.TEXTURE1);let Y=M.colorRampTexture;Y||(Y=M.colorRampTexture=new Se(U,M.colorRamp,q.RGBA)),Y.bind(q.LINEAR,q.CLAMP_TO_EDGE),T.useProgram("heatmapTexture").draw(U,q.TRIANGLES,ti.disabled,hi.disabled,T.colorModeForRenderPass(),Ei.disabled,((se,pe,ve,Ne)=>{let ze=s.create();s.ortho(ze,0,se.width,se.height,0,0,1);let Be=se.context.gl;return{u_matrix:ze,u_world:[Be.drawingBufferWidth,Be.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:pe.paint.get("heatmap-opacity")}})(T,M),null,M.id,T.viewportBuffer,T.quadTriangleIndexBuffer,T.viewportSegments,M.paint,T.transform.zoom)}(E,d))},line:function(E,i,d,x){if(E.renderPass!=="translucent")return;let T=d.paint.get("line-opacity"),M=d.paint.get("line-width");if(T.constantOr(1)===0||M.constantOr(1)===0)return;let U=E.depthModeForSublayer(0,ti.ReadOnly),q=E.colorModeForRenderPass(),W=d.paint.get("line-dasharray"),Y=d.paint.get("line-pattern"),se=Y.constantOr(1),pe=d.paint.get("line-gradient"),ve=d.getCrossfadeParameters(),Ne=se?"linePattern":W?"lineSDF":pe?"lineGradient":"line",ze=E.context,Be=ze.gl,tt=!0;for(let st of x){let ht=i.getTile(st);if(se&&!ht.patternsLoaded())continue;let je=ht.getBucket(d);if(!je)continue;let mt=je.programConfigurations.get(d.id),pt=E.context.program.get(),vt=E.useProgram(Ne,mt),Et=tt||vt.program!==pt,zt=E.style.terrain&&E.style.terrain.getTerrainData(st),xt=Y.constantOr(null);if(xt&&ht.imageAtlas){let m=ht.imageAtlas,f=m.patternPositions[xt.to.toString()],v=m.patternPositions[xt.from.toString()];f&&v&&mt.setConstantPatternPositions(f,v)}let rr=zt?st:null,p=se?Hl(E,ht,d,ve,rr):W?Ps(E,ht,d,W,ve,rr):pe?Lu(E,ht,d,je.lineClipsArray.length,rr):Zo(E,ht,d,rr);if(se)ze.activeTexture.set(Be.TEXTURE0),ht.imageAtlasTexture.bind(Be.LINEAR,Be.CLAMP_TO_EDGE),mt.updatePaintBuffers(ve);else if(W&&(Et||E.lineAtlas.dirty))ze.activeTexture.set(Be.TEXTURE0),E.lineAtlas.bind(ze);else if(pe){let m=je.gradients[d.id],f=m.texture;if(d.gradientVersion!==m.version){let v=256;if(d.stepInterpolant){let I=i.getSource().maxzoom,L=st.canonical.z===I?Math.ceil(1<<E.transform.maxZoom-st.canonical.z):1;v=s.clamp(s.nextPowerOfTwo(je.maxLineLength/s.EXTENT*1024*L),256,ze.maxTextureSize)}m.gradient=s.renderColorRamp({expression:d.gradientExpression(),evaluationKey:"lineProgress",resolution:v,image:m.gradient||void 0,clips:je.lineClipsArray}),m.texture?m.texture.update(m.gradient):m.texture=new Se(ze,m.gradient,Be.RGBA),m.version=d.gradientVersion,f=m.texture}ze.activeTexture.set(Be.TEXTURE0),f.bind(d.stepInterpolant?Be.NEAREST:Be.LINEAR,Be.CLAMP_TO_EDGE)}vt.draw(ze,Be.TRIANGLES,U,E.stencilModeForClipping(st),q,Ei.disabled,p,zt,d.id,je.layoutVertexBuffer,je.indexBuffer,je.segments,d.paint,E.transform.zoom,mt,je.layoutVertexBuffer2),tt=!1}},fill:function(E,i,d,x){let T=d.paint.get("fill-color"),M=d.paint.get("fill-opacity");if(M.constantOr(1)===0)return;let U=E.colorModeForRenderPass(),q=d.paint.get("fill-pattern"),W=E.opaquePassEnabledForLayer()&&!q.constantOr(1)&&T.constantOr(s.Color.transparent).a===1&&M.constantOr(0)===1?"opaque":"translucent";if(E.renderPass===W){let Y=E.depthModeForSublayer(1,E.renderPass==="opaque"?ti.ReadWrite:ti.ReadOnly);Na(E,i,d,x,Y,U,!1)}if(E.renderPass==="translucent"&&d.paint.get("fill-antialias")){let Y=E.depthModeForSublayer(d.getPaintProperty("fill-outline-color")?2:0,ti.ReadOnly);Na(E,i,d,x,Y,U,!0)}},"fill-extrusion":function(E,i,d,x){let T=d.paint.get("fill-extrusion-opacity");if(T!==0&&E.renderPass==="translucent"){let M=new ti(E.context.gl.LEQUAL,ti.ReadWrite,E.depthRangeFor3D);if(T!==1||d.paint.get("fill-extrusion-pattern").constantOr(1))mi(E,i,d,x,M,hi.disabled,Fi.disabled),mi(E,i,d,x,M,E.stencilModeFor3D(),E.colorModeForRenderPass());else{let U=E.colorModeForRenderPass();mi(E,i,d,x,M,hi.disabled,U)}}},hillshade:function(E,i,d,x){if(E.renderPass!=="offscreen"&&E.renderPass!=="translucent")return;let T=E.context,M=E.depthModeForSublayer(0,ti.ReadOnly),U=E.colorModeForRenderPass(),[q,W]=E.renderPass==="translucent"?E.stencilConfigForOverlap(x):[{},x];for(let Y of W){let se=i.getTile(Y);se.needsHillshadePrepare!==void 0&&se.needsHillshadePrepare&&E.renderPass==="offscreen"?Ec(E,se,d,M,hi.disabled,U):E.renderPass==="translucent"&&nl(E,Y,se,d,M,q[Y.overscaledZ],U)}T.viewport.set([0,0,E.width,E.height])},raster:function(E,i,d,x){if(E.renderPass!=="translucent"||d.paint.get("raster-opacity")===0||!x.length)return;let T=E.context,M=T.gl,U=i.getSource(),q=E.useProgram("raster"),W=E.colorModeForRenderPass(),[Y,se]=U instanceof br?[{},x]:E.stencilConfigForOverlap(x),pe=se[se.length-1].overscaledZ,ve=!E.options.moving;for(let Ne of se){let ze=E.depthModeForSublayer(Ne.overscaledZ-pe,d.paint.get("raster-opacity")===1?ti.ReadWrite:ti.ReadOnly,M.LESS),Be=i.getTile(Ne);Be.registerFadeDuration(d.paint.get("raster-fade-duration"));let tt=i.findLoadedParent(Ne,0),st=Va(Be,tt,i,d,E.transform,E.style.terrain),ht,je,mt=d.paint.get("raster-resampling")==="nearest"?M.NEAREST:M.LINEAR;T.activeTexture.set(M.TEXTURE0),Be.texture.bind(mt,M.CLAMP_TO_EDGE,M.LINEAR_MIPMAP_NEAREST),T.activeTexture.set(M.TEXTURE1),tt?(tt.texture.bind(mt,M.CLAMP_TO_EDGE,M.LINEAR_MIPMAP_NEAREST),ht=Math.pow(2,tt.tileID.overscaledZ-Be.tileID.overscaledZ),je=[Be.tileID.canonical.x*ht%1,Be.tileID.canonical.y*ht%1]):Be.texture.bind(mt,M.CLAMP_TO_EDGE,M.LINEAR_MIPMAP_NEAREST);let pt=E.style.terrain&&E.style.terrain.getTerrainData(Ne),vt=pt?Ne:null,Et=vt?vt.posMatrix:E.transform.calculatePosMatrix(Ne.toUnwrapped(),ve),zt=vc(Et,je||[0,0],ht||1,st,d);U instanceof br?q.draw(T,M.TRIANGLES,ze,hi.disabled,W,Ei.disabled,zt,pt,d.id,U.boundsBuffer,E.quadTriangleIndexBuffer,U.boundsSegments):q.draw(T,M.TRIANGLES,ze,Y[Ne.overscaledZ],W,Ei.disabled,zt,pt,d.id,E.rasterBoundsBuffer,E.quadTriangleIndexBuffer,E.rasterBoundsSegments)}},background:function(E,i,d,x){let T=d.paint.get("background-color"),M=d.paint.get("background-opacity");if(M===0)return;let U=E.context,q=U.gl,W=E.transform,Y=W.tileSize,se=d.paint.get("background-pattern");if(E.isPatternMissing(se))return;let pe=!se&&T.a===1&&M===1&&E.opaquePassEnabledForLayer()?"opaque":"translucent";if(E.renderPass!==pe)return;let ve=hi.disabled,Ne=E.depthModeForSublayer(0,pe==="opaque"?ti.ReadWrite:ti.ReadOnly),ze=E.colorModeForRenderPass(),Be=E.useProgram(se?"backgroundPattern":"background"),tt=x||W.coveringTiles({tileSize:Y,terrain:E.style.terrain});se&&(U.activeTexture.set(q.TEXTURE0),E.imageManager.bind(E.context));let st=d.getCrossfadeParameters();for(let ht of tt){let je=x?ht.posMatrix:E.transform.calculatePosMatrix(ht.toUnwrapped()),mt=se?xc(je,M,E,se,{tileID:ht,tileSize:Y},st):wl(je,M,T),pt=E.style.terrain&&E.style.terrain.getTerrainData(ht);Be.draw(U,q.TRIANGLES,Ne,ve,ze,Ei.disabled,mt,pt,d.id,E.tileExtentBuffer,E.quadTriangleIndexBuffer,E.tileExtentSegments)}},debug:function(E,i,d){for(let x=0;x<d.length;x++)al(E,i,d[x])},custom:function(E,i,d){let x=E.context,T=d.implementation;if(E.renderPass==="offscreen"){let M=T.prerender;M&&(E.setCustomLayerDefaults(),x.setColorMode(E.colorModeForRenderPass()),M.call(T,x.gl,E.transform.customLayerMatrix()),x.setDirty(),E.setBaseState())}else if(E.renderPass==="translucent"){E.setCustomLayerDefaults(),x.setColorMode(E.colorModeForRenderPass()),x.setStencilMode(hi.disabled);let M=T.renderingMode==="3d"?new ti(E.context.gl.LEQUAL,ti.ReadWrite,E.depthRangeFor3D):E.depthModeForSublayer(0,ti.ReadOnly);x.setDepthMode(M),T.render(x.gl,E.transform.customLayerMatrix()),x.setDirty(),E.setBaseState(),x.bindFramebuffer.set(null)}}};class ru{constructor(i,d){this.context=new Fu(i),this.transform=d,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:s.create(),renderTime:0},this.setup(),this.numSublayers=Ur.maxUnderzooming+Ur.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Ht,this.gpuTimers={}}resize(i,d,x){if(this.width=i*x,this.height=d*x,this.pixelRatio=x,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(let T of this.style._order)this.style._layers[T].resize()}setup(){let i=this.context,d=new s.PosArray;d.emplaceBack(0,0),d.emplaceBack(s.EXTENT,0),d.emplaceBack(0,s.EXTENT),d.emplaceBack(s.EXTENT,s.EXTENT),this.tileExtentBuffer=i.createVertexBuffer(d,Vr.members),this.tileExtentSegments=s.SegmentVector.simpleSegment(0,0,4,2);let x=new s.PosArray;x.emplaceBack(0,0),x.emplaceBack(s.EXTENT,0),x.emplaceBack(0,s.EXTENT),x.emplaceBack(s.EXTENT,s.EXTENT),this.debugBuffer=i.createVertexBuffer(x,Vr.members),this.debugSegments=s.SegmentVector.simpleSegment(0,0,4,5);let T=new s.RasterBoundsArray;T.emplaceBack(0,0,0,0),T.emplaceBack(s.EXTENT,0,s.EXTENT,0),T.emplaceBack(0,s.EXTENT,0,s.EXTENT),T.emplaceBack(s.EXTENT,s.EXTENT,s.EXTENT,s.EXTENT),this.rasterBoundsBuffer=i.createVertexBuffer(T,Tr.members),this.rasterBoundsSegments=s.SegmentVector.simpleSegment(0,0,4,2);let M=new s.PosArray;M.emplaceBack(0,0),M.emplaceBack(1,0),M.emplaceBack(0,1),M.emplaceBack(1,1),this.viewportBuffer=i.createVertexBuffer(M,Vr.members),this.viewportSegments=s.SegmentVector.simpleSegment(0,0,4,2);let U=new s.LineStripIndexArray;U.emplaceBack(0),U.emplaceBack(1),U.emplaceBack(3),U.emplaceBack(2),U.emplaceBack(0),this.tileBorderIndexBuffer=i.createIndexBuffer(U);let q=new s.TriangleIndexArray;q.emplaceBack(0,1,2),q.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=i.createIndexBuffer(q),this.emptyTexture=new Se(i,{width:1,height:1,data:new Uint8Array([0,0,0,0])},i.gl.RGBA);let W=this.context.gl;this.stencilClearMode=new hi({func:W.ALWAYS,mask:0},0,255,W.ZERO,W.ZERO,W.ZERO)}clearStencil(){let i=this.context,d=i.gl;this.nextStencilID=1,this.currentStencilSource=void 0;let x=s.create();s.ortho(x,0,this.width,this.height,0,0,1),s.scale(x,x,[d.drawingBufferWidth,d.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(i,d.TRIANGLES,ti.disabled,this.stencilClearMode,Fi.disabled,Ei.disabled,un(x),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(i,d){if(this.currentStencilSource===i.source||!i.isTileClipped()||!d||!d.length)return;this.currentStencilSource=i.source;let x=this.context,T=x.gl;this.nextStencilID+d.length>256&&this.clearStencil(),x.setColorMode(Fi.disabled),x.setDepthMode(ti.disabled);let M=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(let U of d){let q=this._tileClippingMaskIDs[U.key]=this.nextStencilID++,W=this.style.terrain&&this.style.terrain.getTerrainData(U);M.draw(x,T.TRIANGLES,ti.disabled,new hi({func:T.ALWAYS,mask:0},q,255,T.KEEP,T.KEEP,T.REPLACE),Fi.disabled,Ei.disabled,un(U.posMatrix),W,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let i=this.nextStencilID++,d=this.context.gl;return new hi({func:d.NOTEQUAL,mask:255},i,255,d.KEEP,d.KEEP,d.REPLACE)}stencilModeForClipping(i){let d=this.context.gl;return new hi({func:d.EQUAL,mask:255},this._tileClippingMaskIDs[i.key],0,d.KEEP,d.KEEP,d.REPLACE)}stencilConfigForOverlap(i){let d=this.context.gl,x=i.sort((U,q)=>q.overscaledZ-U.overscaledZ),T=x[x.length-1].overscaledZ,M=x[0].overscaledZ-T+1;if(M>1){this.currentStencilSource=void 0,this.nextStencilID+M>256&&this.clearStencil();let U={};for(let q=0;q<M;q++)U[q+T]=new hi({func:d.GEQUAL,mask:255},q+this.nextStencilID,255,d.KEEP,d.KEEP,d.REPLACE);return this.nextStencilID+=M,[U,x]}return[{[T]:hi.disabled},x]}colorModeForRenderPass(){let i=this.context.gl;return this._showOverdrawInspector?new Fi([i.CONSTANT_COLOR,i.ONE],new s.Color(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Fi.unblended:Fi.alphaBlended}depthModeForSublayer(i,d,x){if(!this.opaquePassEnabledForLayer())return ti.disabled;let T=1-((1+this.currentLayer)*this.numSublayers+i)*this.depthEpsilon;return new ti(x||this.context.gl.LEQUAL,d,[T,T])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(i,d){this.style=i,this.options=d,this.lineAtlas=i.lineAtlas,this.imageManager=i.imageManager,this.glyphManager=i.glyphManager,this.symbolFadeChange=i.placement.symbolFadeChange(s.exported.now()),this.imageManager.beginFrame();let x=this.style._order,T=this.style.sourceCaches,M=this.style.terrain&&new Xo(this);for(let Y in T){let se=T[Y];se.used&&se.prepare(this.context)}let U={},q={},W={};for(let Y in T){let se=T[Y];U[Y]=se.getVisibleCoordinates(),q[Y]=U[Y].slice().reverse(),W[Y]=se.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let Y=0;Y<x.length;Y++)if(this.style._layers[x[Y]].is3D()){this.opaquePassCutoff=Y;break}if(M){this.opaquePassCutoff=0;let Y=this.style.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime);(this.terrainFacilitator.dirty||!s.equals(this.terrainFacilitator.matrix,this.transform.projMatrix)||Y.length)&&(s.copy(this.terrainFacilitator.matrix,this.transform.projMatrix),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(se,pe){let ve=se.context,Ne=ve.gl,ze=Fi.unblended,Be=new ti(Ne.LEQUAL,ti.ReadWrite,[0,1]),tt=pe.getTerrainMesh(),st=pe.sourceCache.getRenderableTiles(),ht=se.useProgram("terrainDepth");ve.bindFramebuffer.set(pe.getFramebuffer("depth").framebuffer),ve.viewport.set([0,0,se.width/devicePixelRatio,se.height/devicePixelRatio]),ve.clear({color:s.Color.transparent,depth:1});for(let je of st){let mt=pe.getTerrainData(je.tileID),pt=se.transform.calculatePosMatrix(je.tileID.toUnwrapped());ht.draw(ve,Ne.TRIANGLES,Be,hi.disabled,ze,Ei.backCCW,{u_matrix:pt},mt,"terrain",tt.vertexBuffer,tt.indexBuffer,tt.segments)}ve.bindFramebuffer.set(null),ve.viewport.set([0,0,se.width,se.height])}(this,this.style.terrain),function(se,pe){let ve=se.context,Ne=ve.gl,ze=Fi.unblended,Be=new ti(Ne.LEQUAL,ti.ReadWrite,[0,1]),tt=pe.getTerrainMesh(),st=pe.getCoordsTexture(),ht=pe.sourceCache.getRenderableTiles(),je=se.useProgram("terrainCoords");ve.bindFramebuffer.set(pe.getFramebuffer("coords").framebuffer),ve.viewport.set([0,0,se.width/devicePixelRatio,se.height/devicePixelRatio]),ve.clear({color:s.Color.transparent,depth:1}),pe.coordsIndex=[];for(let mt of ht){let pt=pe.getTerrainData(mt.tileID);ve.activeTexture.set(Ne.TEXTURE0),Ne.bindTexture(Ne.TEXTURE_2D,st.texture);let vt=se.transform.calculatePosMatrix(mt.tileID.toUnwrapped());je.draw(ve,Ne.TRIANGLES,Be,hi.disabled,ze,Ei.backCCW,{u_matrix:vt,u_terrain_coords_id:(255-pe.coordsIndex.length)/255,u_texture:0},pt,"terrain",tt.vertexBuffer,tt.indexBuffer,tt.segments),pe.coordsIndex.push(mt.tileID.key)}ve.bindFramebuffer.set(null),ve.viewport.set([0,0,se.width,se.height])}(this,this.style.terrain))}this.renderPass="offscreen";for(let Y of x){let se=this.style._layers[Y];if(!se.hasOffscreenPass()||se.isHidden(this.transform.zoom))continue;let pe=q[se.source];(se.type==="custom"||pe.length)&&this.renderLayer(this,T[se.source],se,pe)}if(this.context.bindFramebuffer.set(null),this.context.clear({color:d.showOverdrawInspector?s.Color.black:s.Color.transparent,depth:1}),this.clearStencil(),this._showOverdrawInspector=d.showOverdrawInspector,this.depthRangeFor3D=[0,1-(i._order.length+2)*this.numSublayers*this.depthEpsilon],!M)for(this.renderPass="opaque",this.currentLayer=x.length-1;this.currentLayer>=0;this.currentLayer--){let Y=this.style._layers[x[this.currentLayer]],se=T[Y.source],pe=U[Y.source];this._renderTileClippingMasks(Y,pe),this.renderLayer(this,se,Y,pe)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<x.length;this.currentLayer++){let Y=this.style._layers[x[this.currentLayer]],se=T[Y.source];if(M&&M.renderLayer(Y))continue;let pe=(Y.type==="symbol"?W:q)[Y.source];this._renderTileClippingMasks(Y,U[Y.source]),this.renderLayer(this,se,Y,pe)}if(this.options.showTileBoundaries){let Y,se;Object.values(this.style._layers).forEach(pe=>{pe.source&&!pe.isHidden(this.transform.zoom)&&(pe.source!==(se&&se.id)&&(se=this.style.sourceCaches[pe.source]),(!Y||Y.getSource().maxzoom<se.getSource().maxzoom)&&(Y=se))}),Y&&sl.debug(this,Y,Y.getVisibleCoordinates())}this.options.showPadding&&function(Y){let se=Y.transform.padding;aa(Y,Y.transform.height-(se.top||0),3,Al),aa(Y,se.bottom||0,3,oa),ns(Y,se.left||0,3,Nu),ns(Y,Y.transform.width-(se.right||0),3,ol);let pe=Y.transform.centerPoint;(function(ve,Ne,ze,Be){Ta(ve,Ne-1,ze-10,2,20,Be),Ta(ve,Ne-10,ze-1,20,2,Be)})(Y,pe.x,Y.transform.height-pe.y,Os)}(this),this.context.setDefault()}renderLayer(i,d,x,T){x.isHidden(this.transform.zoom)||(x.type==="background"||x.type==="custom"||(T||[]).length)&&(this.id=x.id,this.gpuTimingStart(x),sl[x.type](i,d,x,T,this.style.placement.variableOffsets),this.gpuTimingEnd())}gpuTimingStart(i){if(!this.options.gpuTiming)return;let d=this.context.extTimerQuery,x=this.gpuTimers[i.id];x||(x=this.gpuTimers[i.id]={calls:0,cpuTime:0,query:d.createQueryEXT()}),x.calls++,d.beginQueryEXT(d.TIME_ELAPSED_EXT,x.query)}gpuTimingEnd(){if(!this.options.gpuTiming)return;let i=this.context.extTimerQuery;i.endQueryEXT(i.TIME_ELAPSED_EXT)}collectGpuTimers(){let i=this.gpuTimers;return this.gpuTimers={},i}queryGpuTimers(i){let d={};for(let x in i){let T=i[x],M=this.context.extTimerQuery,U=M.getQueryObjectEXT(T.query,M.QUERY_RESULT_EXT)/1e6;M.deleteQueryEXT(T.query),d[x]=U}return d}translatePosMatrix(i,d,x,T,M){if(!x[0]&&!x[1])return i;let U=M?T==="map"?this.transform.angle:0:T==="viewport"?-this.transform.angle:0;if(U){let Y=Math.sin(U),se=Math.cos(U);x=[x[0]*se-x[1]*Y,x[0]*Y+x[1]*se]}let q=[M?x[0]:te(d,x[0],this.transform.zoom),M?x[1]:te(d,x[1],this.transform.zoom),0],W=new Float32Array(16);return s.translate(W,i,q),W}saveTileTexture(i){let d=this._tileTextures[i.size[0]];d?d.push(i):this._tileTextures[i.size[0]]=[i]}getTileTexture(i){let d=this._tileTextures[i];return d&&d.length>0?d.pop():null}isPatternMissing(i){if(!i)return!1;if(!i.from||!i.to)return!0;let d=this.imageManager.getPattern(i.from.toString()),x=this.imageManager.getPattern(i.to.toString());return!d||!x}useProgram(i,d){this.cache=this.cache||{};let x=i+(d?d.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.terrain?"/terrain":"");return this.cache[x]||(this.cache[x]=new Ys(this.context,i,kn[i],d,Qs[i],this._showOverdrawInspector,this.style.terrain)),this.cache[x]}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(){let i=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(i.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new Se(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}}class Ml{constructor(i,d){this.points=i,this.planes=d}static fromInvProjectionMatrix(i,d,x){let T=Math.pow(2,x),M=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(q=>{let W=1/(q=s.transformMat4([],q,i))[3]/d*T;return s.mul$1(q,q,[W,W,1/q[3],W])}),U=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(q=>{let W=s.sub([],M[q[0]],M[q[1]]),Y=s.sub([],M[q[2]],M[q[1]]),se=s.normalize([],s.cross([],W,Y)),pe=-s.dot(se,M[q[1]]);return se.concat(pe)});return new Ml(M,U)}}class sa{constructor(i,d){this.min=i,this.max=d,this.center=s.scale$1([],s.add([],this.min,this.max),.5)}quadrant(i){let d=[i%2==0,i<2],x=s.clone$2(this.min),T=s.clone$2(this.max);for(let M=0;M<d.length;M++)x[M]=d[M]?this.min[M]:this.center[M],T[M]=d[M]?this.center[M]:this.max[M];return T[2]=this.max[2],new sa(x,T)}distanceX(i){return Math.max(Math.min(this.max[0],i[0]),this.min[0])-i[0]}distanceY(i){return Math.max(Math.min(this.max[1],i[1]),this.min[1])-i[1]}intersects(i){let d=[[this.min[0],this.min[1],this.min[2],1],[this.max[0],this.min[1],this.min[2],1],[this.max[0],this.max[1],this.min[2],1],[this.min[0],this.max[1],this.min[2],1],[this.min[0],this.min[1],this.max[2],1],[this.max[0],this.min[1],this.max[2],1],[this.max[0],this.max[1],this.max[2],1],[this.min[0],this.max[1],this.max[2],1]],x=!0;for(let T=0;T<i.planes.length;T++){let M=i.planes[T],U=0;for(let q=0;q<d.length;q++)s.dot$1(M,d[q])>=0&&U++;if(U===0)return 0;U!==d.length&&(x=!1)}if(x)return 2;for(let T=0;T<3;T++){let M=Number.MAX_VALUE,U=-Number.MAX_VALUE;for(let q=0;q<i.points.length;q++){let W=i.points[q][T]-this.min[T];M=Math.min(M,W),U=Math.max(U,W)}if(U<0||M>this.max[T]-this.min[T])return 0}return 1}}class Sa{constructor(i=0,d=0,x=0,T=0){if(isNaN(i)||i<0||isNaN(d)||d<0||isNaN(x)||x<0||isNaN(T)||T<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=i,this.bottom=d,this.left=x,this.right=T}interpolate(i,d,x){return d.top!=null&&i.top!=null&&(this.top=s.number(i.top,d.top,x)),d.bottom!=null&&i.bottom!=null&&(this.bottom=s.number(i.bottom,d.bottom,x)),d.left!=null&&i.left!=null&&(this.left=s.number(i.left,d.left,x)),d.right!=null&&i.right!=null&&(this.right=s.number(i.right,d.right,x)),this}getCenter(i,d){let x=s.clamp((this.left+i-this.right)/2,0,i),T=s.clamp((this.top+d-this.bottom)/2,0,d);return new s.pointGeometry(x,T)}equals(i){return this.top===i.top&&this.bottom===i.bottom&&this.left===i.left&&this.right===i.right}clone(){return new Sa(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class os{constructor(i,d,x,T,M){this.tileSize=512,this.maxValidLatitude=85.051129,this.freezeElevation=!1,this._renderWorldCopies=M===void 0||!!M,this._minZoom=i||0,this._maxZoom=d||22,this._minPitch=x??0,this._maxPitch=T??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new s.LngLat(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new Sa,this._posMatrixCache={},this._alignedPosMatrixCache={}}clone(){let i=new os(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return i.tileSize=this.tileSize,i.latRange=this.latRange,i.width=this.width,i.height=this.height,i._center=this._center,i._elevation=this._elevation,i.zoom=this.zoom,i.angle=this.angle,i._fov=this._fov,i._pitch=this._pitch,i._unmodified=this._unmodified,i._edgeInsets=this._edgeInsets.clone(),i._calcMatrices(),i}get minZoom(){return this._minZoom}set minZoom(i){this._minZoom!==i&&(this._minZoom=i,this.zoom=Math.max(this.zoom,i))}get maxZoom(){return this._maxZoom}set maxZoom(i){this._maxZoom!==i&&(this._maxZoom=i,this.zoom=Math.min(this.zoom,i))}get minPitch(){return this._minPitch}set minPitch(i){this._minPitch!==i&&(this._minPitch=i,this.pitch=Math.max(this.pitch,i))}get maxPitch(){return this._maxPitch}set maxPitch(i){this._maxPitch!==i&&(this._maxPitch=i,this.pitch=Math.min(this.pitch,i))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(i){i===void 0?i=!0:i===null&&(i=!1),this._renderWorldCopies=i}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new s.pointGeometry(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(i){let d=-s.wrap(i,-180,180)*Math.PI/180;var x;this.angle!==d&&(this._unmodified=!1,this.angle=d,this._calcMatrices(),this.rotationMatrix=(x=new s.ARRAY_TYPE(4),s.ARRAY_TYPE!=Float32Array&&(x[1]=0,x[2]=0),x[0]=1,x[3]=1,x),function(T,M,U){var q=M[0],W=M[1],Y=M[2],se=M[3],pe=Math.sin(U),ve=Math.cos(U);T[0]=q*ve+Y*pe,T[1]=W*ve+se*pe,T[2]=q*-pe+Y*ve,T[3]=W*-pe+se*ve}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(i){let d=s.clamp(i,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==d&&(this._unmodified=!1,this._pitch=d,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(i){i=Math.max(.01,Math.min(60,i)),this._fov!==i&&(this._unmodified=!1,this._fov=i/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(i){let d=Math.min(Math.max(i,this.minZoom),this.maxZoom);this._zoom!==d&&(this._unmodified=!1,this._zoom=d,this.scale=this.zoomScale(d),this.tileZoom=Math.floor(d),this.zoomFraction=d-this.tileZoom,this._constrain(),this._calcMatrices())}get center(){return this._center}set center(i){i.lat===this._center.lat&&i.lng===this._center.lng||(this._unmodified=!1,this._center=i,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(i){i!==this._elevation&&(this._elevation=i,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(i){this._edgeInsets.equals(i)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,i,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(i){return this._edgeInsets.equals(i)}interpolatePadding(i,d,x){this._unmodified=!1,this._edgeInsets.interpolate(i,d,x),this._constrain(),this._calcMatrices()}coveringZoomLevel(i){let d=(i.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/i.tileSize));return Math.max(0,d)}getVisibleUnwrappedCoordinates(i){let d=[new s.UnwrappedTileID(0,i)];if(this._renderWorldCopies){let x=this.pointCoordinate(new s.pointGeometry(0,0)),T=this.pointCoordinate(new s.pointGeometry(this.width,0)),M=this.pointCoordinate(new s.pointGeometry(this.width,this.height)),U=this.pointCoordinate(new s.pointGeometry(0,this.height)),q=Math.floor(Math.min(x.x,T.x,M.x,U.x)),W=Math.floor(Math.max(x.x,T.x,M.x,U.x)),Y=1;for(let se=q-Y;se<=W+Y;se++)se!==0&&d.push(new s.UnwrappedTileID(se,i))}return d}coveringTiles(i){var d,x;let T=this.coveringZoomLevel(i),M=T;if(i.minzoom!==void 0&&T<i.minzoom)return[];i.maxzoom!==void 0&&T>i.maxzoom&&(T=i.maxzoom);let U=this.pointCoordinate(this.getCameraPoint()),q=s.MercatorCoordinate.fromLngLat(this.center),W=Math.pow(2,T),Y=[W*U.x,W*U.y,0],se=[W*q.x,W*q.y,0],pe=Ml.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,T),ve=i.minzoom||0;!i.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(ve=T);let Ne=i.terrain?2/Math.min(this.tileSize,i.tileSize)*this.tileSize:3,ze=je=>({aabb:new sa([je*W,0,0],[(je+1)*W,W,0]),zoom:0,x:0,y:0,wrap:je,fullyVisible:!1}),Be=[],tt=[],st=T,ht=i.reparseOverscaled?M:T;if(this._renderWorldCopies)for(let je=1;je<=3;je++)Be.push(ze(-je)),Be.push(ze(je));for(Be.push(ze(0));Be.length>0;){let je=Be.pop(),mt=je.x,pt=je.y,vt=je.fullyVisible;if(!vt){let m=je.aabb.intersects(pe);if(m===0)continue;vt=m===2}let Et=i.terrain?Y:se,zt=je.aabb.distanceX(Et),xt=je.aabb.distanceY(Et),rr=Math.max(Math.abs(zt),Math.abs(xt)),p=Ne+(1<<st-je.zoom)-2;if(je.zoom===st||rr>p&&je.zoom>=ve){let m=st-je.zoom,f=Y[0]-.5-(mt<<m),v=Y[1]-.5-(pt<<m);tt.push({tileID:new s.OverscaledTileID(je.zoom===st?ht:je.zoom,je.wrap,je.zoom,mt,pt),distanceSq:s.sqrLen([se[0]-.5-mt,se[1]-.5-pt]),tileDistanceToCamera:Math.sqrt(f*f+v*v)})}else for(let m=0;m<4;m++){let f=(mt<<1)+m%2,v=(pt<<1)+(m>>1),I=je.zoom+1,L=je.aabb.quadrant(m);if(i.terrain){let D=new s.OverscaledTileID(I,je.wrap,I,f,v),G=i.terrain.getMinMaxElevation(D),H=(d=G.minElevation)!==null&&d!==void 0?d:this.elevation,ne=(x=G.maxElevation)!==null&&x!==void 0?x:this.elevation;L=new sa([L.min[0],L.min[1],H],[L.max[0],L.max[1],ne])}Be.push({aabb:L,zoom:I,x:f,y:v,wrap:je.wrap,fullyVisible:vt})}}return tt.sort((je,mt)=>je.distanceSq-mt.distanceSq).map(je=>je.tileID)}resize(i,d){this.width=i,this.height=d,this.pixelsToGLUnits=[2/i,-2/d],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(i){return Math.pow(2,i)}scaleZoom(i){return Math.log(i)/Math.LN2}project(i){let d=s.clamp(i.lat,-this.maxValidLatitude,this.maxValidLatitude);return new s.pointGeometry(s.mercatorXfromLng(i.lng)*this.worldSize,s.mercatorYfromLat(d)*this.worldSize)}unproject(i){return new s.MercatorCoordinate(i.x/this.worldSize,i.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}updateElevation(i){this.freezeElevation||(this.elevation=i?this.getElevation(this._center,i):0)}getElevation(i,d){let x=s.MercatorCoordinate.fromLngLat(i),T=(1<<this.tileZoom)*s.EXTENT,M=x.x*T,U=x.y*T,q=Math.floor(M/s.EXTENT),W=Math.floor(U/s.EXTENT),Y=new s.OverscaledTileID(this.tileZoom,0,this.tileZoom,q,W);return d.getElevation(Y,M%s.EXTENT,U%s.EXTENT,s.EXTENT)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(i){let d=this.pointLocation(this.centerPoint,i),x=this.getElevation(d,i);if(!(this.elevation-x))return;let T=this.getCameraPosition(),M=s.MercatorCoordinate.fromLngLat(T.lngLat,T.altitude),U=s.MercatorCoordinate.fromLngLat(d,x),q=M.x-U.x,W=M.y-U.y,Y=M.z-U.z,se=Math.sqrt(q*q+W*W+Y*Y),pe=this.scaleZoom(this.cameraToCenterDistance/se/this.tileSize);this._elevation=x,this._center=d,this.zoom=pe}setLocationAtPoint(i,d){let x=this.pointCoordinate(d),T=this.pointCoordinate(this.centerPoint),M=this.locationCoordinate(i),U=new s.MercatorCoordinate(M.x-(x.x-T.x),M.y-(x.y-T.y));this.center=this.coordinateLocation(U),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(i,d){return d?this.coordinatePoint(this.locationCoordinate(i),this.getElevation(i,d),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(i))}pointLocation(i,d){return this.coordinateLocation(this.pointCoordinate(i,d))}locationCoordinate(i){return s.MercatorCoordinate.fromLngLat(i)}coordinateLocation(i){return i&&i.toLngLat()}pointCoordinate(i,d){if(d){let ve=d.pointCoordinate(i);if(ve!=null)return ve}let x=[i.x,i.y,0,1],T=[i.x,i.y,1,1];s.transformMat4(x,x,this.pixelMatrixInverse),s.transformMat4(T,T,this.pixelMatrixInverse);let M=x[3],U=T[3],q=x[1]/M,W=T[1]/U,Y=x[2]/M,se=T[2]/U,pe=Y===se?0:(0-Y)/(se-Y);return new s.MercatorCoordinate(s.number(x[0]/M,T[0]/U,pe)/this.worldSize,s.number(q,W,pe)/this.worldSize)}coordinatePoint(i,d=0,x=this.pixelMatrix){let T=[i.x*this.worldSize,i.y*this.worldSize,d,1];return s.transformMat4(T,T,x),new s.pointGeometry(T[0]/T[3],T[1]/T[3])}getBounds(){let i=Math.max(0,this.height/2-this.getHorizon());return new s.LngLatBounds().extend(this.pointLocation(new s.pointGeometry(0,i))).extend(this.pointLocation(new s.pointGeometry(this.width,i))).extend(this.pointLocation(new s.pointGeometry(this.width,this.height))).extend(this.pointLocation(new s.pointGeometry(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new s.LngLatBounds([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(i){i?(this.lngRange=[i.getWest(),i.getEast()],this.latRange=[i.getSouth(),i.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])}calculatePosMatrix(i,d=!1){let x=i.key,T=d?this._alignedPosMatrixCache:this._posMatrixCache;if(T[x])return T[x];let M=i.canonical,U=this.worldSize/this.zoomScale(M.z),q=M.x+Math.pow(2,M.z)*i.wrap,W=s.identity(new Float64Array(16));return s.translate(W,W,[q*U,M.y*U,0]),s.scale(W,W,[U/s.EXTENT,U/s.EXTENT,1]),s.multiply(W,d?this.alignedProjMatrix:this.projMatrix,W),T[x]=new Float32Array(W),T[x]}customLayerMatrix(){return this.mercatorMatrix.slice()}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let i,d,x,T,M=-90,U=90,q=-180,W=180,Y=this.size,se=this._unmodified;if(this.latRange){let Ne=this.latRange;M=s.mercatorYfromLat(Ne[1])*this.worldSize,U=s.mercatorYfromLat(Ne[0])*this.worldSize,i=U-M<Y.y?Y.y/(U-M):0}if(this.lngRange){let Ne=this.lngRange;q=s.wrap(s.mercatorXfromLng(Ne[0])*this.worldSize,0,this.worldSize),W=s.wrap(s.mercatorXfromLng(Ne[1])*this.worldSize,0,this.worldSize),W<q&&(W+=this.worldSize),d=W-q<Y.x?Y.x/(W-q):0}let pe=this.point,ve=Math.max(d||0,i||0);if(ve)return this.center=this.unproject(new s.pointGeometry(d?(W+q)/2:pe.x,i?(U+M)/2:pe.y)),this.zoom+=this.scaleZoom(ve),this._unmodified=se,void(this._constraining=!1);if(this.latRange){let Ne=pe.y,ze=Y.y/2;Ne-ze<M&&(T=M+ze),Ne+ze>U&&(T=U-ze)}if(this.lngRange){let Ne=(q+W)/2,ze=s.wrap(pe.x,Ne-this.worldSize/2,Ne+this.worldSize/2),Be=Y.x/2;ze-Be<q&&(x=q+Be),ze+Be>W&&(x=W-Be)}x===void 0&&T===void 0||(this.center=this.unproject(new s.pointGeometry(x!==void 0?x:pe.x,T!==void 0?T:pe.y)).wrap()),this._unmodified=se,this._constraining=!1}_calcMatrices(){if(!this.height)return;let i=this.centerOffset,d=this.point.x,x=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=s.mercatorZfromAltitude(1,this.center.lat)*this.worldSize;let T=s.identity(new Float64Array(16));s.scale(T,T,[this.width/2,-this.height/2,1]),s.translate(T,T,[1,-1,0]),this.labelPlaneMatrix=T,T=s.identity(new Float64Array(16)),s.scale(T,T,[1,-1,1]),s.translate(T,T,[-1,-1,0]),s.scale(T,T,[2/this.width,2/this.height,1]),this.glCoordMatrix=T,this.cameraToSeaLevelDistance=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch);let M=Math.PI/2+this._pitch,U=this._fov*(.5+i.y/this.height),q=Math.sin(U)*this.cameraToSeaLevelDistance/Math.sin(s.clamp(Math.PI-M-U,.01,Math.PI-.01)),W=this.getHorizon(),Y=2*Math.atan(W/this.cameraToCenterDistance)*(.5+i.y/(2*W)),se=Math.sin(Y)*this.cameraToSeaLevelDistance/Math.sin(s.clamp(Math.PI-M-Y,.01,Math.PI-.01)),pe=Math.cos(Math.PI/2-this._pitch)*q+this.cameraToSeaLevelDistance,ve=Math.cos(Math.PI/2-this._pitch)*se+this.cameraToSeaLevelDistance,Ne=1.01*Math.min(pe,ve),ze=this.height/50;T=new Float64Array(16),s.perspective(T,this._fov,this.width/this.height,ze,Ne),T[8]=2*-i.x/this.width,T[9]=2*i.y/this.height,s.scale(T,T,[1,-1,1]),s.translate(T,T,[0,0,-this.cameraToCenterDistance]),s.rotateX(T,T,this._pitch),s.rotateZ(T,T,this.angle),s.translate(T,T,[-d,-x,0]),this.mercatorMatrix=s.scale([],T,[this.worldSize,this.worldSize,this.worldSize]),s.scale(T,T,[1,1,this._pixelPerMeter]),this.pixelMatrix=s.multiply(new Float64Array(16),this.labelPlaneMatrix,T),s.translate(T,T,[0,0,-this.elevation]),this.projMatrix=T,this.invProjMatrix=s.invert([],T),this.pixelMatrix3D=s.multiply(new Float64Array(16),this.labelPlaneMatrix,T);let Be=this.width%2/2,tt=this.height%2/2,st=Math.cos(this.angle),ht=Math.sin(this.angle),je=d-Math.round(d)+st*Be+ht*tt,mt=x-Math.round(x)+st*tt+ht*Be,pt=new Float64Array(T);if(s.translate(pt,pt,[je>.5?je-1:je,mt>.5?mt-1:mt,0]),this.alignedProjMatrix=pt,T=s.invert(new Float64Array(16),this.pixelMatrix),!T)throw new Error("failed to invert matrix");this.pixelMatrixInverse=T,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;let i=this.pointCoordinate(new s.pointGeometry(0,0)),d=[i.x*this.worldSize,i.y*this.worldSize,0,1];return s.transformMat4(d,d,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){let i=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new s.pointGeometry(0,i))}getCameraQueryGeometry(i){let d=this.getCameraPoint();if(i.length===1)return[i[0],d];{let x=d.x,T=d.y,M=d.x,U=d.y;for(let q of i)x=Math.min(x,q.x),T=Math.min(T,q.y),M=Math.max(M,q.x),U=Math.max(U,q.y);return[new s.pointGeometry(x,T),new s.pointGeometry(M,T),new s.pointGeometry(M,U),new s.pointGeometry(x,U),new s.pointGeometry(x,T)]}}}class iu{constructor(i){this._hashName=i&&encodeURIComponent(i),s.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=function(d,x){let T=!1,M=null,U=()=>{M=null,T&&(d(),M=setTimeout(U,300),T=!1)};return()=>(T=!0,M||U(),M)}(this._updateHashUnthrottled.bind(this))}addTo(i){return this._map=i,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(i){let d=this._map.getCenter(),x=Math.round(100*this._map.getZoom())/100,T=Math.ceil((x*Math.LN2+Math.log(512/360/.5))/Math.LN10),M=Math.pow(10,T),U=Math.round(d.lng*M)/M,q=Math.round(d.lat*M)/M,W=this._map.getBearing(),Y=this._map.getPitch(),se="";if(se+=i?`/${U}/${q}/${x}`:`${x}/${q}/${U}`,(W||Y)&&(se+="/"+Math.round(10*W)/10),Y&&(se+=`/${Math.round(Y)}`),this._hashName){let pe=this._hashName,ve=!1,Ne=window.location.hash.slice(1).split("&").map(ze=>{let Be=ze.split("=")[0];return Be===pe?(ve=!0,`${Be}=${se}`):ze}).filter(ze=>ze);return ve||Ne.push(`${pe}=${se}`),`#${Ne.join("&")}`}return`#${se}`}_getCurrentHash(){let i=window.location.hash.replace("#","");if(this._hashName){let d;return i.split("&").map(x=>x.split("=")).forEach(x=>{x[0]===this._hashName&&(d=x)}),(d&&d[1]||"").split("/")}return i.split("/")}_onHashChange(){let i=this._getCurrentHash();if(i.length>=3&&!i.some(d=>isNaN(d))){let d=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:d,pitch:+(i[4]||0)}),!0}return!1}_updateHashUnthrottled(){let i=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,i)}catch{}}}let as={linearity:.3,easing:s.bezier(0,0,.3,1)},Tc=s.extend({deceleration:2500,maxSpeed:1400},as),kl=s.extend({deceleration:20,maxSpeed:1400},as),nu=s.extend({deceleration:1e3,maxSpeed:360},as),Bs=s.extend({deceleration:1e3,maxSpeed:90},as);class Vu{constructor(i){this._map=i,this.clear()}clear(){this._inertiaBuffer=[]}record(i){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:s.exported.now(),settings:i})}_drainInertiaBuffer(){let i=this._inertiaBuffer,d=s.exported.now();for(;i.length>0&&d-i[0].time>160;)i.shift()}_onMoveEnd(i){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;let d={zoom:0,bearing:0,pitch:0,pan:new s.pointGeometry(0,0),pinchAround:void 0,around:void 0};for(let{settings:M}of this._inertiaBuffer)d.zoom+=M.zoomDelta||0,d.bearing+=M.bearingDelta||0,d.pitch+=M.pitchDelta||0,M.panDelta&&d.pan._add(M.panDelta),M.around&&(d.around=M.around),M.pinchAround&&(d.pinchAround=M.pinchAround);let x=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,T={};if(d.pan.mag()){let M=Us(d.pan.mag(),x,s.extend({},Tc,i||{}));T.offset=d.pan.mult(M.amount/d.pan.mag()),T.center=this._map.transform.center,ss(T,M)}if(d.zoom){let M=Us(d.zoom,x,kl);T.zoom=this._map.transform.zoom+M.amount,ss(T,M)}if(d.bearing){let M=Us(d.bearing,x,nu);T.bearing=this._map.transform.bearing+s.clamp(M.amount,-179,179),ss(T,M)}if(d.pitch){let M=Us(d.pitch,x,Bs);T.pitch=this._map.transform.pitch+M.amount,ss(T,M)}if(T.zoom||T.bearing){let M=d.pinchAround===void 0?d.around:d.pinchAround;T.around=M?this._map.unproject(M):this._map.getCenter()}return this.clear(),s.extend(T,{noMoveStart:!0})}}function ss(E,i){(!E.duration||E.duration<i.duration)&&(E.duration=i.duration,E.easing=i.easing)}function Us(E,i,d){let{maxSpeed:x,linearity:T,deceleration:M}=d,U=s.clamp(E*T/(i/1e3),-x,x),q=Math.abs(U)/(M*T);return{easing:d.easing,duration:1e3*q,amount:U*(q/2)}}class ho extends s.Event{constructor(i,d,x,T={}){let M=V.mousePos(d.getCanvasContainer(),x),U=d.unproject(M);super(i,s.extend({point:M,lngLat:U,originalEvent:x},T)),this._defaultPrevented=!1,this.target=d}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class Ns extends s.Event{constructor(i,d,x){let T=i==="touchend"?x.changedTouches:x.touches,M=V.touchPos(d.getCanvasContainer(),T),U=M.map(W=>d.unproject(W)),q=M.reduce((W,Y,se,pe)=>W.add(Y.div(pe.length)),new s.pointGeometry(0,0));super(i,{points:M,point:q,lngLats:U,lngLat:d.unproject(q),originalEvent:x}),this._defaultPrevented=!1}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class Yn extends s.Event{constructor(i,d,x){super(i,{originalEvent:x}),this._defaultPrevented=!1}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class Sc{constructor(i,d){this._map=i,this._clickTolerance=d.clickTolerance}reset(){delete this._mousedownPos}wheel(i){return this._firePreventable(new Yn(i.type,this._map,i))}mousedown(i,d){return this._mousedownPos=d,this._firePreventable(new ho(i.type,this._map,i))}mouseup(i){this._map.fire(new ho(i.type,this._map,i))}click(i,d){this._mousedownPos&&this._mousedownPos.dist(d)>=this._clickTolerance||this._map.fire(new ho(i.type,this._map,i))}dblclick(i){return this._firePreventable(new ho(i.type,this._map,i))}mouseover(i){this._map.fire(new ho(i.type,this._map,i))}mouseout(i){this._map.fire(new ho(i.type,this._map,i))}touchstart(i){return this._firePreventable(new Ns(i.type,this._map,i))}touchmove(i){this._map.fire(new Ns(i.type,this._map,i))}touchend(i){this._map.fire(new Ns(i.type,this._map,i))}touchcancel(i){this._map.fire(new Ns(i.type,this._map,i))}_firePreventable(i){if(this._map.fire(i),i.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class To{constructor(i){this._map=i}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(i){this._map.fire(new ho(i.type,this._map,i))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new ho("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(i){this._delayContextMenu?this._contextMenuEvent=i:this._ignoreContextMenu||this._map.fire(new ho(i.type,this._map,i)),this._map.listens("contextmenu")&&i.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Ri{constructor(i,d){this._map=i,this._el=i.getCanvasContainer(),this._container=i.getContainer(),this._clickTolerance=d.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(i,d){this.isEnabled()&&i.shiftKey&&i.button===0&&(V.disableDrag(),this._startPos=this._lastPos=d,this._active=!0)}mousemoveWindow(i,d){if(!this._active)return;let x=d;if(this._lastPos.equals(x)||!this._box&&x.dist(this._startPos)<this._clickTolerance)return;let T=this._startPos;this._lastPos=x,this._box||(this._box=V.create("div","maplibregl-boxzoom mapboxgl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair","mapboxgl-crosshair"),this._fireEvent("boxzoomstart",i));let M=Math.min(T.x,x.x),U=Math.max(T.x,x.x),q=Math.min(T.y,x.y),W=Math.max(T.y,x.y);V.setTransform(this._box,`translate(${M}px,${q}px)`),this._box.style.width=U-M+"px",this._box.style.height=W-q+"px"}mouseupWindow(i,d){if(!this._active||i.button!==0)return;let x=this._startPos,T=d;if(this.reset(),V.suppressClick(),x.x!==T.x||x.y!==T.y)return this._map.fire(new s.Event("boxzoomend",{originalEvent:i})),{cameraAnimation:M=>M.fitScreenCoordinates(x,T,this._map.getBearing(),{linear:!0})};this._fireEvent("boxzoomcancel",i)}keydown(i){this._active&&i.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",i))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair","mapboxgl-crosshair"),this._box&&(V.remove(this._box),this._box=null),V.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(i,d){return this._map.fire(new s.Event(i,{originalEvent:d}))}}function Wo(E,i){if(E.length!==i.length)throw new Error(`The number of touches and points are not equal - touches ${E.length}, points ${i.length}`);let d={};for(let x=0;x<E.length;x++)d[E[x].identifier]=i[x];return d}class la{constructor(i){this.reset(),this.numTouches=i.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(i,d,x){(this.centroid||x.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=i.timeStamp),x.length===this.numTouches&&(this.centroid=function(T){let M=new s.pointGeometry(0,0);for(let U of T)M._add(U);return M.div(T.length)}(d),this.touches=Wo(x,d)))}touchmove(i,d,x){if(this.aborted||!this.centroid)return;let T=Wo(x,d);for(let M in this.touches){let U=this.touches[M],q=T[M];(!q||q.dist(U)>30)&&(this.aborted=!0)}}touchend(i,d,x){if((!this.centroid||i.timeStamp-this.startTime>500)&&(this.aborted=!0),x.length===0){let T=!this.aborted&&this.centroid;if(this.reset(),T)return T}}}class Ia{constructor(i){this.singleTap=new la(i),this.numTaps=i.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(i,d,x){this.singleTap.touchstart(i,d,x)}touchmove(i,d,x){this.singleTap.touchmove(i,d,x)}touchend(i,d,x){let T=this.singleTap.touchend(i,d,x);if(T){let M=i.timeStamp-this.lastTime<500,U=!this.lastTap||this.lastTap.dist(T)<30;if(M&&U||this.reset(),this.count++,this.lastTime=i.timeStamp,this.lastTap=T,this.count===this.numTaps)return this.reset(),T}}}class Qr{constructor(){this._zoomIn=new Ia({numTouches:1,numTaps:2}),this._zoomOut=new Ia({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(i,d,x){this._zoomIn.touchstart(i,d,x),this._zoomOut.touchstart(i,d,x)}touchmove(i,d,x){this._zoomIn.touchmove(i,d,x),this._zoomOut.touchmove(i,d,x)}touchend(i,d,x){let T=this._zoomIn.touchend(i,d,x),M=this._zoomOut.touchend(i,d,x);return T?(this._active=!0,i.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:U=>U.easeTo({duration:300,zoom:U.getZoom()+1,around:U.unproject(T)},{originalEvent:i})}):M?(this._active=!0,i.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:U=>U.easeTo({duration:300,zoom:U.getZoom()-1,around:U.unproject(M)},{originalEvent:i})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}let Pi={0:1,2:2};class ro{constructor(i){this.reset(),this._clickTolerance=i.clickTolerance||1}reset(){this._active=!1,this._moved=!1,delete this._lastPoint,delete this._eventButton}_correctButton(i,d){return!1}_move(i,d){return{}}mousedown(i,d){if(this._lastPoint)return;let x=V.mouseButton(i);this._correctButton(i,x)&&(this._lastPoint=d,this._eventButton=x)}mousemoveWindow(i,d){let x=this._lastPoint;if(x){if(i.preventDefault(),function(T,M){let U=Pi[M];return T.buttons===void 0||(T.buttons&U)!==U}(i,this._eventButton))this.reset();else if(this._moved||!(d.dist(x)<this._clickTolerance))return this._moved=!0,this._lastPoint=d,this._move(x,d)}}mouseupWindow(i){this._lastPoint&&V.mouseButton(i)===this._eventButton&&(this._moved&&V.suppressClick(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ga extends ro{mousedown(i,d){super.mousedown(i,d),this._lastPoint&&(this._active=!0)}_correctButton(i,d){return d===0&&!i.ctrlKey}_move(i,d){return{around:d,panDelta:d.sub(i)}}}class So extends ro{_correctButton(i,d){return d===0&&i.ctrlKey||d===2}_move(i,d){let x=.8*(d.x-i.x);if(x)return this._active=!0,{bearingDelta:x}}contextmenu(i){i.preventDefault()}}class ar extends ro{_correctButton(i,d){return d===0&&i.ctrlKey||d===2}_move(i,d){let x=-.5*(d.y-i.y);if(x)return this._active=!0,{pitchDelta:x}}contextmenu(i){i.preventDefault()}}class Ic{constructor(i,d){this._minTouches=i.cooperativeGestures?2:1,this._clickTolerance=i.clickTolerance||1,this._map=d,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new s.pointGeometry(0,0),setTimeout(()=>{this._cancelCooperativeMessage=!1},200)}touchstart(i,d,x){return this._calculateTransform(i,d,x)}touchmove(i,d,x){if(this._map._cooperativeGestures&&(this._minTouches===2&&x.length<2&&!this._cancelCooperativeMessage?this._map._onCooperativeGesture(i,!1,x.length):this._cancelCooperativeMessage||(this._cancelCooperativeMessage=!0)),this._active&&!(x.length<this._minTouches))return i.preventDefault(),this._calculateTransform(i,d,x)}touchend(i,d,x){this._calculateTransform(i,d,x),this._active&&x.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(i,d,x){x.length>0&&(this._active=!0);let T=Wo(x,d),M=new s.pointGeometry(0,0),U=new s.pointGeometry(0,0),q=0;for(let Y in T){let se=T[Y],pe=this._touches[Y];pe&&(M._add(se),U._add(se.sub(pe)),q++,T[Y]=se)}if(this._touches=T,q<this._minTouches||!U.mag())return;let W=U.div(q);return this._sum._add(W),this._sum.mag()<this._clickTolerance?void 0:{around:M.div(q),panDelta:W}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Vs{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}_start(i){}_move(i,d,x){return{}}touchstart(i,d,x){this._firstTwoTouches||x.length<2||(this._firstTwoTouches=[x[0].identifier,x[1].identifier],this._start([d[0],d[1]]))}touchmove(i,d,x){if(!this._firstTwoTouches)return;i.preventDefault();let[T,M]=this._firstTwoTouches,U=$o(x,d,T),q=$o(x,d,M);if(!U||!q)return;let W=this._aroundCenter?null:U.add(q).div(2);return this._move([U,q],W,i)}touchend(i,d,x){if(!this._firstTwoTouches)return;let[T,M]=this._firstTwoTouches,U=$o(x,d,T),q=$o(x,d,M);U&&q||(this._active&&V.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(i){this._enabled=!0,this._aroundCenter=!!i&&i.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function $o(E,i,d){for(let x=0;x<E.length;x++)if(E[x].identifier===d)return i[x]}function Gs(E,i){return Math.log(E/i)/Math.LN2}class Jt extends Vs{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(i){this._startDistance=this._distance=i[0].dist(i[1])}_move(i,d){let x=this._distance;if(this._distance=i[0].dist(i[1]),this._active||!(Math.abs(Gs(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Gs(this._distance,x),pinchAround:d}}}function rn(E,i){return 180*E.angleWith(i)/Math.PI}class Ll extends Vs{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(i){this._startVector=this._vector=i[0].sub(i[1]),this._minDiameter=i[0].dist(i[1])}_move(i,d){let x=this._vector;if(this._vector=i[0].sub(i[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:rn(this._vector,x),pinchAround:d}}_isBelowThreshold(i){this._minDiameter=Math.min(this._minDiameter,i.mag());let d=25/(Math.PI*this._minDiameter)*360,x=rn(i,this._startVector);return Math.abs(x)<d}}function ou(E){return Math.abs(E.y)>Math.abs(E.x)}class nn extends Vs{constructor(i){super(),this._map=i}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(i,d,x){super.touchstart(i,d,x),this._currentTouchCount=x.length}_start(i){this._lastPoints=i,ou(i[0].sub(i[1]))&&(this._valid=!1)}_move(i,d,x){if(this._map._cooperativeGestures&&this._currentTouchCount<3)return;let T=i[0].sub(this._lastPoints[0]),M=i[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(T,M,x.timeStamp),this._valid?(this._lastPoints=i,this._active=!0,{pitchDelta:(T.y+M.y)/2*-.5}):void 0}gestureBeginsVertically(i,d,x){if(this._valid!==void 0)return this._valid;let T=i.mag()>=2,M=d.mag()>=2;if(!T&&!M)return;if(!T||!M)return this._firstMove===void 0&&(this._firstMove=x),x-this._firstMove<100&&void 0;let U=i.y>0==d.y>0;return ou(i)&&ou(d)&&U}}let tr={panStep:100,bearingStep:15,pitchStep:10};class po{constructor(){let i=tr;this._panStep=i.panStep,this._bearingStep=i.bearingStep,this._pitchStep=i.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(i){if(i.altKey||i.ctrlKey||i.metaKey)return;let d=0,x=0,T=0,M=0,U=0;switch(i.keyCode){case 61:case 107:case 171:case 187:d=1;break;case 189:case 109:case 173:d=-1;break;case 37:i.shiftKey?x=-1:(i.preventDefault(),M=-1);break;case 39:i.shiftKey?x=1:(i.preventDefault(),M=1);break;case 38:i.shiftKey?T=1:(i.preventDefault(),U=-1);break;case 40:i.shiftKey?T=-1:(i.preventDefault(),U=1);break;default:return}return this._rotationDisabled&&(x=0,T=0),{cameraAnimation:q=>{let W=q.getZoom();q.easeTo({duration:300,easeId:"keyboardHandler",easing:au,zoom:d?Math.round(W)+d*(i.shiftKey?2:1):W,bearing:q.getBearing()+x*this._bearingStep,pitch:q.getPitch()+T*this._pitchStep,offset:[-M*this._panStep,-U*this._panStep],center:q.getCenter()},{originalEvent:i})}}}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 au(E){return E*(2-E)}let js=4.000244140625;class Fo{constructor(i,d){this._map=i,this._el=i.getCanvasContainer(),this._handler=d,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,s.bindAll(["_onTimeout"],this)}setZoomRate(i){this._defaultZoomRate=i}setWheelZoomRate(i){this._wheelZoomRate=i}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(i){this.isEnabled()||(this._enabled=!0,this._aroundCenter=i&&i.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(i){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!this._map._metaPress)return;i.preventDefault()}let d=i.deltaMode===WheelEvent.DOM_DELTA_LINE?40*i.deltaY:i.deltaY,x=s.exported.now(),T=x-(this._lastWheelEventTime||0);this._lastWheelEventTime=x,d!==0&&d%js==0?this._type="wheel":d!==0&&Math.abs(d)<4?this._type="trackpad":T>400?(this._type=null,this._lastValue=d,this._timeout=setTimeout(this._onTimeout,40,i)):this._type||(this._type=Math.abs(T*d)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,d+=this._lastValue)),i.shiftKey&&d&&(d/=4),this._type&&(this._lastWheelEvent=i,this._delta-=d,this._active||this._start(i)),i.preventDefault()}_onTimeout(i){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(i)}_start(i){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);let d=V.mousePos(this._el,i);this._around=s.LngLat.convert(this._aroundCenter?this._map.getCenter():this._map.unproject(d)),this._aroundPoint=this._map.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;let i=this._map.transform;if(this._delta!==0){let q=this._type==="wheel"&&Math.abs(this._delta)>js?this._wheelZoomRate:this._defaultZoomRate,W=2/(1+Math.exp(-Math.abs(this._delta*q)));this._delta<0&&W!==0&&(W=1/W);let Y=typeof this._targetZoom=="number"?i.zoomScale(this._targetZoom):i.scale;this._targetZoom=Math.min(i.maxZoom,Math.max(i.minZoom,i.scaleZoom(Y*W))),this._type==="wheel"&&(this._startZoom=i.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}let d=typeof this._targetZoom=="number"?this._targetZoom:i.zoom,x=this._startZoom,T=this._easing,M,U=!1;if(this._type==="wheel"&&x&&T){let q=Math.min((s.exported.now()-this._lastWheelEventTime)/200,1),W=T(q);M=s.number(x,d,W),q<1?this._frameId||(this._frameId=!0):U=!0}else M=d,U=!0;return this._active=!0,U&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!U,zoomDelta:M-i.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(i){let d=s.ease;if(this._prevEase){let x=this._prevEase,T=(s.exported.now()-x.start)/x.duration,M=x.easing(T+.01)-x.easing(T),U=.27/Math.sqrt(M*M+1e-4)*.01,q=Math.sqrt(.0729-U*U);d=s.bezier(U,q,.25,1)}return this._prevEase={start:s.exported.now(),duration:i,easing:d},d}reset(){this._active=!1}}class io{constructor(i,d){this._clickZoom=i,this._tapZoom=d}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 Rl{constructor(){this.reset()}reset(){this._active=!1}dblclick(i,d){return i.preventDefault(),{cameraAnimation:x=>{x.easeTo({duration:300,zoom:x.getZoom()+(i.shiftKey?-1:1),around:x.unproject(d)},{originalEvent:i})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class qt{constructor(){this._tap=new Ia({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset()}touchstart(i,d,x){this._swipePoint||(this._tapTime&&i.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?x.length>0&&(this._swipePoint=d[0],this._swipeTouch=x[0].identifier):this._tap.touchstart(i,d,x))}touchmove(i,d,x){if(this._tapTime){if(this._swipePoint){if(x[0].identifier!==this._swipeTouch)return;let T=d[0],M=T.y-this._swipePoint.y;return this._swipePoint=T,i.preventDefault(),this._active=!0,{zoomDelta:M/128}}}else this._tap.touchmove(i,d,x)}touchend(i,d,x){this._tapTime?this._swipePoint&&x.length===0&&this.reset():this._tap.touchend(i,d,x)&&(this._tapTime=i.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class no{constructor(i,d,x){this._el=i,this._mousePan=d,this._touchPan=x}enable(i){this._inertiaOptions=i||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan","mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan","mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class ua{constructor(i,d,x){this._pitchWithRotate=i.pitchWithRotate,this._mouseRotate=d,this._mousePitch=x}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class su{constructor(i,d,x,T){this._el=i,this._touchZoom=d,this._touchRotate=x,this._tapDragZoom=T,this._rotationDisabled=!1,this._enabled=!0}enable(i){this._touchZoom.enable(i),this._rotationDisabled||this._touchRotate.enable(i),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate","mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate","mapboxgl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}let Jn=E=>E.zoom||E.drag||E.pitch||E.rotate;class oo extends s.Event{}function ls(E){return E.panDelta&&E.panDelta.mag()||E.zoomDelta||E.bearingDelta||E.pitchDelta}class zl{constructor(i,d){this._map=i,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Vu(i),this._bearingSnap=d.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(d),s.bindAll(["handleEvent","handleWindowEvent"],this);let x=this._el;this._listeners=[[x,"touchstart",{passive:!0}],[x,"touchmove",{passive:!1}],[x,"touchend",void 0],[x,"touchcancel",void 0],[x,"mousedown",void 0],[x,"mousemove",void 0],[x,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[x,"mouseover",void 0],[x,"mouseout",void 0],[x,"dblclick",void 0],[x,"click",void 0],[x,"keydown",{capture:!1}],[x,"keyup",void 0],[x,"wheel",{passive:!1}],[x,"contextmenu",void 0],[window,"blur",void 0]];for(let[T,M,U]of this._listeners)V.addEventListener(T,M,T===document?this.handleWindowEvent:this.handleEvent,U)}destroy(){for(let[i,d,x]of this._listeners)V.removeEventListener(i,d,i===document?this.handleWindowEvent:this.handleEvent,x)}_addDefaultHandlers(i){let d=this._map,x=d.getCanvasContainer();this._add("mapEvent",new Sc(d,i));let T=d.boxZoom=new Ri(d,i);this._add("boxZoom",T);let M=new Qr,U=new Rl;d.doubleClickZoom=new io(U,M),this._add("tapZoom",M),this._add("clickZoom",U);let q=new qt;this._add("tapDragZoom",q);let W=d.touchPitch=new nn(d);this._add("touchPitch",W);let Y=new So(i),se=new ar(i);d.dragRotate=new ua(i,Y,se),this._add("mouseRotate",Y,["mousePitch"]),this._add("mousePitch",se,["mouseRotate"]);let pe=new Ga(i),ve=new Ic(i,d);d.dragPan=new no(x,pe,ve),this._add("mousePan",pe),this._add("touchPan",ve,["touchZoom","touchRotate"]);let Ne=new Ll,ze=new Jt;d.touchZoomRotate=new su(x,ze,Ne,q),this._add("touchRotate",Ne,["touchPan","touchZoom"]),this._add("touchZoom",ze,["touchPan","touchRotate"]);let Be=d.scrollZoom=new Fo(d,this);this._add("scrollZoom",Be,["mousePan"]);let tt=d.keyboard=new po;this._add("keyboard",tt),this._add("blockableMapEvent",new To(d));for(let st of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])i.interactive&&i[st]&&d[st].enable(i[st])}_add(i,d,x){this._handlers.push({handlerName:i,handler:d,allowed:x}),this._handlersById[i]=d}stop(i){if(!this._updatingCamera){for(let{handler:d}of this._handlers)d.reset();this._inertia.clear(),this._fireEvents({},{},i),this._changes=[]}}isActive(){for(let{handler:i}of this._handlers)if(i.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return Boolean(Jn(this._eventsInProgress))||this.isZooming()}_blockedByActive(i,d,x){for(let T in i)if(T!==x&&(!d||d.indexOf(T)<0))return!0;return!1}handleWindowEvent(i){this.handleEvent(i,`${i.type}Window`)}_getMapTouches(i){let d=[];for(let x of i)this._el.contains(x.target)&&d.push(x);return d}handleEvent(i,d){if(i.type==="blur")return void this.stop(!0);this._updatingCamera=!0;let x=i.type==="renderFrame"?void 0:i,T={needsRenderFrame:!1},M={},U={},q=i.touches,W=q?this._getMapTouches(q):void 0,Y=W?V.touchPos(this._el,W):V.mousePos(this._el,i);for(let{handlerName:ve,handler:Ne,allowed:ze}of this._handlers){if(!Ne.isEnabled())continue;let Be;this._blockedByActive(U,ze,ve)?Ne.reset():Ne[d||i.type]&&(Be=Ne[d||i.type](i,Y,W),this.mergeHandlerResult(T,M,Be,ve,x),Be&&Be.needsRenderFrame&&this._triggerRenderFrame()),(Be||Ne.isActive())&&(U[ve]=Ne)}let se={};for(let ve in this._previousActiveHandlers)U[ve]||(se[ve]=x);this._previousActiveHandlers=U,(Object.keys(se).length||ls(T))&&(this._changes.push([T,M,se]),this._triggerRenderFrame()),(Object.keys(U).length||ls(T))&&this._map._stop(!0),this._updatingCamera=!1;let{cameraAnimation:pe}=T;pe&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],pe(this._map))}mergeHandlerResult(i,d,x,T,M){if(!x)return;s.extend(i,x);let U={handlerName:T,originalEvent:x.originalEvent||M};x.zoomDelta!==void 0&&(d.zoom=U),x.panDelta!==void 0&&(d.drag=U),x.pitchDelta!==void 0&&(d.pitch=U),x.bearingDelta!==void 0&&(d.rotate=U)}_applyChanges(){let i={},d={},x={};for(let[T,M,U]of this._changes)T.panDelta&&(i.panDelta=(i.panDelta||new s.pointGeometry(0,0))._add(T.panDelta)),T.zoomDelta&&(i.zoomDelta=(i.zoomDelta||0)+T.zoomDelta),T.bearingDelta&&(i.bearingDelta=(i.bearingDelta||0)+T.bearingDelta),T.pitchDelta&&(i.pitchDelta=(i.pitchDelta||0)+T.pitchDelta),T.around!==void 0&&(i.around=T.around),T.pinchAround!==void 0&&(i.pinchAround=T.pinchAround),T.noInertia&&(i.noInertia=T.noInertia),s.extend(d,M),s.extend(x,U);this._updateMapTransform(i,d,x),this._changes=[]}_updateMapTransform(i,d,x){let T=this._map,M=T.transform,U=T.style&&T.style.terrain;if(!(ls(i)||U&&this._drag))return this._fireEvents(d,x,!0);let{panDelta:q,zoomDelta:W,bearingDelta:Y,pitchDelta:se,around:pe,pinchAround:ve}=i;ve!==void 0&&(pe=ve),T._stop(!0),pe=pe||T.transform.centerPoint;let Ne=M.pointLocation(q?pe.sub(q):pe);Y&&(M.bearing+=Y),se&&(M.pitch+=se),W&&(M.zoom+=W),U?d.drag&&!this._drag?(this._drag={center:M.centerPoint,lngLat:M.pointLocation(pe),point:pe,handlerName:d.drag.handlerName},T.fire(new s.Event("freezeElevation",{freeze:!0}))):this._drag&&x[this._drag.handlerName]?(T.fire(new s.Event("freezeElevation",{freeze:!1})),this._drag=null):d.drag&&this._drag&&(M.center=M.pointLocation(M.centerPoint.sub(q))):M.setLocationAtPoint(Ne,pe),this._map._update(),i.noInertia||this._inertia.record(i),this._fireEvents(d,x,!0)}_fireEvents(i,d,x){let T=Jn(this._eventsInProgress),M=Jn(i),U={};for(let se in i){let{originalEvent:pe}=i[se];this._eventsInProgress[se]||(U[`${se}start`]=pe),this._eventsInProgress[se]=i[se]}!T&&M&&this._fireEvent("movestart",M.originalEvent);for(let se in U)this._fireEvent(se,U[se]);M&&this._fireEvent("move",M.originalEvent);for(let se in i){let{originalEvent:pe}=i[se];this._fireEvent(se,pe)}let q={},W;for(let se in this._eventsInProgress){let{handlerName:pe,originalEvent:ve}=this._eventsInProgress[se];this._handlersById[pe].isActive()||(delete this._eventsInProgress[se],W=d[pe]||ve,q[`${se}end`]=W)}for(let se in q)this._fireEvent(se,q[se]);let Y=Jn(this._eventsInProgress);if(x&&(T||M)&&!Y){this._updatingCamera=!0;let se=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),pe=ve=>ve!==0&&-this._bearingSnap<ve&&ve<this._bearingSnap;se?(pe(se.bearing||this._map.getBearing())&&(se.bearing=0),this._map.easeTo(se,{originalEvent:W})):(this._map.fire(new s.Event("moveend",{originalEvent:W})),pe(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(i,d){this._map.fire(new s.Event(i,d?{originalEvent:d}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(i=>{delete this._frameId,this.handleEvent(new oo("renderFrame",{timeStamp:i})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}let Ki={extend:(E,...i)=>s.extend(E,...i),run(E){E()},logToElement(E,i=!1,d="log"){let x=window.document.getElementById(d);x&&(i&&(x.innerHTML=""),x.innerHTML+=`<br>${E}`)}};class gi extends s.Evented{constructor(i,d){super(),this._moving=!1,this._zooming=!1,this.transform=i,this._bearingSnap=d.bearingSnap,s.bindAll(["_renderFrameCallback"],this)}getCenter(){return new s.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(i,d){return this.jumpTo({center:i},d)}panBy(i,d,x){return i=s.pointGeometry.convert(i).mult(-1),this.panTo(this.transform.center,s.extend({offset:i},d),x)}panTo(i,d,x){return this.easeTo(s.extend({center:i},d),x)}getZoom(){return this.transform.zoom}setZoom(i,d){return this.jumpTo({zoom:i},d),this}zoomTo(i,d,x){return this.easeTo(s.extend({zoom:i},d),x)}zoomIn(i,d){return this.zoomTo(this.getZoom()+1,i,d),this}zoomOut(i,d){return this.zoomTo(this.getZoom()-1,i,d),this}getBearing(){return this.transform.bearing}setBearing(i,d){return this.jumpTo({bearing:i},d),this}getPadding(){return this.transform.padding}setPadding(i,d){return this.jumpTo({padding:i},d),this}rotateTo(i,d,x){return this.easeTo(s.extend({bearing:i},d),x)}resetNorth(i,d){return this.rotateTo(0,s.extend({duration:1e3},i),d),this}resetNorthPitch(i,d){return this.easeTo(s.extend({bearing:0,pitch:0,duration:1e3},i),d),this}snapToNorth(i,d){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(i,d):this}getPitch(){return this.transform.pitch}setPitch(i,d){return this.jumpTo({pitch:i},d),this}cameraForBounds(i,d){i=s.LngLatBounds.convert(i);let x=d&&d.bearing||0;return this._cameraForBoxAndBearing(i.getNorthWest(),i.getSouthEast(),x,d)}_cameraForBoxAndBearing(i,d,x,T){let M={top:0,bottom:0,right:0,left:0};if(typeof(T=s.extend({padding:M,offset:[0,0],maxZoom:this.transform.maxZoom},T)).padding=="number"){let pt=T.padding;T.padding={top:pt,bottom:pt,right:pt,left:pt}}T.padding=s.extend(M,T.padding);let U=this.transform,q=U.padding,W=U.project(s.LngLat.convert(i)),Y=U.project(s.LngLat.convert(d)),se=W.rotate(-x*Math.PI/180),pe=Y.rotate(-x*Math.PI/180),ve=new s.pointGeometry(Math.max(se.x,pe.x),Math.max(se.y,pe.y)),Ne=new s.pointGeometry(Math.min(se.x,pe.x),Math.min(se.y,pe.y)),ze=ve.sub(Ne),Be=(U.width-(q.left+q.right+T.padding.left+T.padding.right))/ze.x,tt=(U.height-(q.top+q.bottom+T.padding.top+T.padding.bottom))/ze.y;if(tt<0||Be<0)return void s.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.");let st=Math.min(U.scaleZoom(U.scale*Math.min(Be,tt)),T.maxZoom),ht=s.pointGeometry.convert(T.offset),je=new s.pointGeometry((T.padding.left-T.padding.right)/2,(T.padding.top-T.padding.bottom)/2).rotate(x*Math.PI/180),mt=ht.add(je).mult(U.scale/U.zoomScale(st));return{center:U.unproject(W.add(Y).div(2).sub(mt)),zoom:st,bearing:x}}fitBounds(i,d,x){return this._fitInternal(this.cameraForBounds(i,d),d,x)}fitScreenCoordinates(i,d,x,T,M){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(s.pointGeometry.convert(i)),this.transform.pointLocation(s.pointGeometry.convert(d)),x,T),T,M)}_fitInternal(i,d,x){return i?(delete(d=s.extend(i,d)).padding,d.linear?this.easeTo(d,x):this.flyTo(d,x)):this}jumpTo(i,d){this.stop();let x=this.transform,T=!1,M=!1,U=!1;return"zoom"in i&&x.zoom!==+i.zoom&&(T=!0,x.zoom=+i.zoom),i.center!==void 0&&(x.center=s.LngLat.convert(i.center)),"bearing"in i&&x.bearing!==+i.bearing&&(M=!0,x.bearing=+i.bearing),"pitch"in i&&x.pitch!==+i.pitch&&(U=!0,x.pitch=+i.pitch),i.padding==null||x.isPaddingEqual(i.padding)||(x.padding=i.padding),this.fire(new s.Event("movestart",d)).fire(new s.Event("move",d)),T&&this.fire(new s.Event("zoomstart",d)).fire(new s.Event("zoom",d)).fire(new s.Event("zoomend",d)),M&&this.fire(new s.Event("rotatestart",d)).fire(new s.Event("rotate",d)).fire(new s.Event("rotateend",d)),U&&this.fire(new s.Event("pitchstart",d)).fire(new s.Event("pitch",d)).fire(new s.Event("pitchend",d)),this.fire(new s.Event("moveend",d))}calculateCameraOptionsFromTo(i,d,x,T=0){let M=s.MercatorCoordinate.fromLngLat(i,d),U=s.MercatorCoordinate.fromLngLat(x,T),q=U.x-M.x,W=U.y-M.y,Y=U.z-M.z,se=Math.hypot(q,W,Y);if(se===0)throw new Error("Can't calculate camera options with same From and To");let pe=Math.hypot(q,W),ve=this.transform.scaleZoom(this.transform.cameraToCenterDistance/se/this.transform.tileSize),Ne=180*Math.atan2(q,-W)/Math.PI,ze=180*Math.acos(pe/se)/Math.PI;return ze=Y<0?90-ze:90+ze,{center:U.toLngLat(),zoom:ve,pitch:ze,bearing:Ne}}easeTo(i,d){this._stop(!1,i.easeId),((i=s.extend({offset:[0,0],duration:500,easing:s.ease},i)).animate===!1||!i.essential&&s.exported.prefersReducedMotion)&&(i.duration=0);let x=this.transform,T=this.getZoom(),M=this.getBearing(),U=this.getPitch(),q=this.getPadding(),W="zoom"in i?+i.zoom:T,Y="bearing"in i?this._normalizeBearing(i.bearing,M):M,se="pitch"in i?+i.pitch:U,pe="padding"in i?i.padding:x.padding,ve=s.pointGeometry.convert(i.offset),Ne=x.centerPoint.add(ve),ze=x.pointLocation(Ne),Be=s.LngLat.convert(i.center||ze);this._normalizeCenter(Be);let tt=x.project(ze),st=x.project(Be).sub(tt),ht=x.zoomScale(W-T),je,mt;i.around&&(je=s.LngLat.convert(i.around),mt=x.locationPoint(je));let pt={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||W!==T,this._rotating=this._rotating||M!==Y,this._pitching=this._pitching||se!==U,this._padding=!x.isPaddingEqual(pe),this._easeId=i.easeId,this._prepareEase(d,i.noMoveStart,pt),this._ease(vt=>{if(this._zooming&&(x.zoom=s.number(T,W,vt)),this._rotating&&(x.bearing=s.number(M,Y,vt)),this._pitching&&(x.pitch=s.number(U,se,vt)),this._padding&&(x.interpolatePadding(q,pe,vt),Ne=x.centerPoint.add(ve)),je)x.setLocationAtPoint(je,mt);else{let Et=x.zoomScale(x.zoom-T),zt=W>T?Math.min(2,ht):Math.max(.5,ht),xt=Math.pow(zt,1-vt),rr=x.unproject(tt.add(st.mult(vt*xt)).mult(Et));x.setLocationAtPoint(x.renderWorldCopies?rr.wrap():rr,Ne)}this._fireMoveEvents(d)},vt=>{this._afterEase(d,vt)},i),this}_prepareEase(i,d,x={}){this._moving=!0,this.fire(new s.Event("freezeElevation",{freeze:!0})),d||x.moving||this.fire(new s.Event("movestart",i)),this._zooming&&!x.zooming&&this.fire(new s.Event("zoomstart",i)),this._rotating&&!x.rotating&&this.fire(new s.Event("rotatestart",i)),this._pitching&&!x.pitching&&this.fire(new s.Event("pitchstart",i))}_fireMoveEvents(i){this.fire(new s.Event("move",i)),this._zooming&&this.fire(new s.Event("zoom",i)),this._rotating&&this.fire(new s.Event("rotate",i)),this._pitching&&this.fire(new s.Event("pitch",i))}_afterEase(i,d){if(this._easeId&&d&&this._easeId===d)return;delete this._easeId,this.fire(new s.Event("freezeElevation",{freeze:!1}));let x=this._zooming,T=this._rotating,M=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,x&&this.fire(new s.Event("zoomend",i)),T&&this.fire(new s.Event("rotateend",i)),M&&this.fire(new s.Event("pitchend",i)),this.fire(new s.Event("moveend",i))}flyTo(i,d){if(!i.essential&&s.exported.prefersReducedMotion){let I=s.pick(i,["center","zoom","bearing","pitch","around"]);return this.jumpTo(I,d)}this.stop(),i=s.extend({offset:[0,0],speed:1.2,curve:1.42,easing:s.ease},i);let x=this.transform,T=this.getZoom(),M=this.getBearing(),U=this.getPitch(),q=this.getPadding(),W="zoom"in i?s.clamp(+i.zoom,x.minZoom,x.maxZoom):T,Y="bearing"in i?this._normalizeBearing(i.bearing,M):M,se="pitch"in i?+i.pitch:U,pe="padding"in i?i.padding:x.padding,ve=x.zoomScale(W-T),Ne=s.pointGeometry.convert(i.offset),ze=x.centerPoint.add(Ne),Be=x.pointLocation(ze),tt=s.LngLat.convert(i.center||Be);this._normalizeCenter(tt);let st=x.project(Be),ht=x.project(tt).sub(st),je=i.curve,mt=Math.max(x.width,x.height),pt=mt/ve,vt=ht.mag();if("minZoom"in i){let I=s.clamp(Math.min(i.minZoom,T,W),x.minZoom,x.maxZoom),L=mt/x.zoomScale(I-T);je=Math.sqrt(L/vt*2)}let Et=je*je;function zt(I){let L=(pt*pt-mt*mt+(I?-1:1)*Et*Et*vt*vt)/(2*(I?pt:mt)*Et*vt);return Math.log(Math.sqrt(L*L+1)-L)}function xt(I){return(Math.exp(I)-Math.exp(-I))/2}function rr(I){return(Math.exp(I)+Math.exp(-I))/2}let p=zt(0),m=function(I){return rr(p)/rr(p+je*I)},f=function(I){return mt*((rr(p)*(xt(L=p+je*I)/rr(L))-xt(p))/Et)/vt;var L},v=(zt(1)-p)/je;if(Math.abs(vt)<1e-6||!isFinite(v)){if(Math.abs(mt-pt)<1e-6)return this.easeTo(i,d);let I=pt<mt?-1:1;v=Math.abs(Math.log(pt/mt))/je,f=function(){return 0},m=function(L){return Math.exp(I*je*L)}}return i.duration="duration"in i?+i.duration:1e3*v/("screenSpeed"in i?+i.screenSpeed/je:+i.speed),i.maxDuration&&i.duration>i.maxDuration&&(i.duration=0),this._zooming=!0,this._rotating=M!==Y,this._pitching=se!==U,this._padding=!x.isPaddingEqual(pe),this._prepareEase(d,!1),this._ease(I=>{let L=I*v,D=1/m(L);x.zoom=I===1?W:T+x.scaleZoom(D),this._rotating&&(x.bearing=s.number(M,Y,I)),this._pitching&&(x.pitch=s.number(U,se,I)),this._padding&&(x.interpolatePadding(q,pe,I),ze=x.centerPoint.add(Ne));let G=I===1?tt:x.unproject(st.add(ht.mult(f(L))).mult(D));x.setLocationAtPoint(x.renderWorldCopies?G.wrap():G,ze),this._fireMoveEvents(d)},()=>this._afterEase(d),i),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(i,d){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){let x=this._onEaseEnd;delete this._onEaseEnd,x.call(this,d)}if(!i){let x=this.handlers;x&&x.stop(!1)}return this}_ease(i,d,x){x.animate===!1||x.duration===0?(i(1),d()):(this._easeStart=s.exported.now(),this._easeOptions=x,this._onEaseFrame=i,this._onEaseEnd=d,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){let i=Math.min((s.exported.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(i)),i<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(i,d){i=s.wrap(i,-180,180);let x=Math.abs(i-d);return Math.abs(i-360-d)<x&&(i-=360),Math.abs(i+360-d)<x&&(i+=360),i}_normalizeCenter(i){let d=this.transform;if(!d.renderWorldCopies||d.lngRange)return;let x=i.lng-d.center.lng;i.lng+=x>180?-360:x<-180?360:0}}class ll{constructor(i={}){this.options=i,s.bindAll(["_toggleAttribution","_updateData","_updateCompact","_updateCompactMinimize"],this)}getDefaultPosition(){return"bottom-right"}onAdd(i){return this._map=i,this._compact=this.options&&this.options.compact,this._container=V.create("details","maplibregl-ctrl maplibregl-ctrl-attrib mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=V.create("summary","maplibregl-ctrl-attrib-button mapboxgl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=V.create("div","maplibregl-ctrl-attrib-inner mapboxgl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){V.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(i,d){let x=this._map._getUIString(`AttributionControl.${d}`);i.title=x,i.setAttribute("aria-label",x)}_toggleAttribution(){this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show","mapboxgl-compact-show")):(this._container.classList.add("maplibregl-compact-show","mapboxgl-compact-show"),this._container.removeAttribute("open")))}_updateData(i){!i||i.sourceDataType!=="metadata"&&i.sourceDataType!=="visibility"&&i.dataType!=="style"&&i.type!=="terrain"||this._updateAttributions()}_updateAttributions(){if(!this._map.style)return;let i=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?i=i.concat(this.options.customAttribution.map(T=>typeof T!="string"?"":T)):typeof this.options.customAttribution=="string"&&i.push(this.options.customAttribution)),this._map.style.stylesheet){let T=this._map.style.stylesheet;this.styleOwner=T.owner,this.styleId=T.id}let d=this._map.style.sourceCaches;for(let T in d){let M=d[T];if(M.used||M.usedForTerrain){let U=M.getSource();U.attribution&&i.indexOf(U.attribution)<0&&i.push(U.attribution)}}i=i.filter(T=>String(T).trim()),i.sort((T,M)=>T.length-M.length),i=i.filter((T,M)=>{for(let U=M+1;U<i.length;U++)if(i[U].indexOf(T)>=0)return!1;return!0});let x=i.join(" | ");x!==this._attribHTML&&(this._attribHTML=x,i.length?(this._innerContainer.innerHTML=x,this._container.classList.remove("maplibregl-attrib-empty","mapboxgl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty","mapboxgl-attrib-empty"),this._updateCompact(),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","mapboxgl-compact","maplibregl-compact-show","mapboxgl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show","mapboxgl-compact","mapboxgl-compact-show"))}_updateCompactMinimize(){this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show","mapboxgl-compact-show")}}class us{constructor(i={}){this.options=i,s.bindAll(["_updateCompact"],this)}getDefaultPosition(){return"bottom-left"}onAdd(i){this._map=i,this._compact=this.options&&this.options.compact,this._container=V.create("div","maplibregl-ctrl mapboxgl-ctrl");let d=V.create("a","maplibregl-ctrl-logo mapboxgl-ctrl-logo");return d.target="_blank",d.rel="noopener nofollow",d.href="https://maplibre.org/",d.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),d.setAttribute("rel","noopener nofollow"),this._container.appendChild(d),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){V.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}_updateCompact(){let i=this._container.children;if(i.length){let d=i[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&d.classList.add("maplibregl-compact","mapboxgl-compact"):d.classList.remove("maplibregl-compact","mapboxgl-compact")}}}class lu{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(i){let d=++this._id;return this._queue.push({callback:i,id:d,cancelled:!1}),d}remove(i){let d=this._currentlyRunning,x=d?this._queue.concat(d):this._queue;for(let T of x)if(T.id===i)return void(T.cancelled=!0)}run(i=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");let d=this._currentlyRunning=this._queue;this._queue=[];for(let x of d)if(!x.cancelled&&(x.callback(i),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}let uu={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","TerrainControl.enableTerrain":"Enable terrain","TerrainControl.disableTerrain":"Disable terrain"},Ho={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:void 0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,maplibreLogo:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",transformRequest:null,fadeDuration:300,crossSourceCollisions:!0},Bo={showCompass:!0,showZoom:!0,visualizePitch:!1};class Fr{constructor(i,d,x=!1){this._clickTolerance=10,this.element=d,this.mouseRotate=new So({clickTolerance:i.dragRotate._mouseRotate._clickTolerance}),this.map=i,x&&(this.mousePitch=new ar({clickTolerance:i.dragRotate._mousePitch._clickTolerance})),s.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),V.addEventListener(d,"mousedown",this.mousedown),V.addEventListener(d,"touchstart",this.touchstart,{passive:!1}),V.addEventListener(d,"touchmove",this.touchmove),V.addEventListener(d,"touchend",this.touchend),V.addEventListener(d,"touchcancel",this.reset)}down(i,d){this.mouseRotate.mousedown(i,d),this.mousePitch&&this.mousePitch.mousedown(i,d),V.disableDrag()}move(i,d){let x=this.map,T=this.mouseRotate.mousemoveWindow(i,d);if(T&&T.bearingDelta&&x.setBearing(x.getBearing()+T.bearingDelta),this.mousePitch){let M=this.mousePitch.mousemoveWindow(i,d);M&&M.pitchDelta&&x.setPitch(x.getPitch()+M.pitchDelta)}}off(){let i=this.element;V.removeEventListener(i,"mousedown",this.mousedown),V.removeEventListener(i,"touchstart",this.touchstart,{passive:!1}),V.removeEventListener(i,"touchmove",this.touchmove),V.removeEventListener(i,"touchend",this.touchend),V.removeEventListener(i,"touchcancel",this.reset),this.offTemp()}offTemp(){V.enableDrag(),V.removeEventListener(window,"mousemove",this.mousemove),V.removeEventListener(window,"mouseup",this.mouseup)}mousedown(i){this.down(s.extend({},i,{ctrlKey:!0,preventDefault:()=>i.preventDefault()}),V.mousePos(this.element,i)),V.addEventListener(window,"mousemove",this.mousemove),V.addEventListener(window,"mouseup",this.mouseup)}mousemove(i){this.move(i,V.mousePos(this.element,i))}mouseup(i){this.mouseRotate.mouseupWindow(i),this.mousePitch&&this.mousePitch.mouseupWindow(i),this.offTemp()}touchstart(i){i.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=V.touchPos(this.element,i.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>i.preventDefault()},this._startPos))}touchmove(i){i.targetTouches.length!==1?this.reset():(this._lastPos=V.touchPos(this.element,i.targetTouches)[0],this.move({preventDefault:()=>i.preventDefault()},this._lastPos))}touchend(i){i.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),this.reset()}reset(){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()}}function Io(E,i,d){if(E=new s.LngLat(E.lng,E.lat),i){let x=new s.LngLat(E.lng-360,E.lat),T=new s.LngLat(E.lng+360,E.lat),M=d.locationPoint(E).distSqr(i);d.locationPoint(x).distSqr(i)<M?E=x:d.locationPoint(T).distSqr(i)<M&&(E=T)}for(;Math.abs(E.lng-d.center.lng)>180;){let x=d.locationPoint(E);if(x.x>=0&&x.y>=0&&x.x<=d.width&&x.y<=d.height)break;E.lng>d.center.lng?E.lng-=360:E.lng+=360}return E}let sr={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 hr(E,i,d){let x=E.classList;for(let T in sr)x.remove(`maplibregl-${d}-anchor-${T}`,`mapboxgl-${d}-anchor-${T}`);x.add(`maplibregl-${d}-anchor-${i}`,`mapboxgl-${d}-anchor-${i}`)}class Ko extends s.Evented{constructor(i,d){if(super(),(i instanceof HTMLElement||d)&&(i=s.extend({element:i},d)),s.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress"],this),this._anchor=i&&i.anchor||"center",this._color=i&&i.color||"#3FB1CE",this._scale=i&&i.scale||1,this._draggable=i&&i.draggable||!1,this._clickTolerance=i&&i.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=i&&i.rotation||0,this._rotationAlignment=i&&i.rotationAlignment||"auto",this._pitchAlignment=i&&i.pitchAlignment&&i.pitchAlignment!=="auto"?i.pitchAlignment:this._rotationAlignment,i&&i.element)this._element=i.element,this._offset=s.pointGeometry.convert(i&&i.offset||[0,0]);else{this._defaultMarker=!0,this._element=V.create("div"),this._element.setAttribute("aria-label","Map marker");let x=V.createNS("http://www.w3.org/2000/svg","svg"),T=41,M=27;x.setAttributeNS(null,"display","block"),x.setAttributeNS(null,"height",`${T}px`),x.setAttributeNS(null,"width",`${M}px`),x.setAttributeNS(null,"viewBox",`0 0 ${M} ${T}`);let U=V.createNS("http://www.w3.org/2000/svg","g");U.setAttributeNS(null,"stroke","none"),U.setAttributeNS(null,"stroke-width","1"),U.setAttributeNS(null,"fill","none"),U.setAttributeNS(null,"fill-rule","evenodd");let q=V.createNS("http://www.w3.org/2000/svg","g");q.setAttributeNS(null,"fill-rule","nonzero");let W=V.createNS("http://www.w3.org/2000/svg","g");W.setAttributeNS(null,"transform","translate(3.0, 29.0)"),W.setAttributeNS(null,"fill","#000000");let Y=[{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(let ht of Y){let je=V.createNS("http://www.w3.org/2000/svg","ellipse");je.setAttributeNS(null,"opacity","0.04"),je.setAttributeNS(null,"cx","10.5"),je.setAttributeNS(null,"cy","5.80029008"),je.setAttributeNS(null,"rx",ht.rx),je.setAttributeNS(null,"ry",ht.ry),W.appendChild(je)}let se=V.createNS("http://www.w3.org/2000/svg","g");se.setAttributeNS(null,"fill",this._color);let pe=V.createNS("http://www.w3.org/2000/svg","path");pe.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"),se.appendChild(pe);let ve=V.createNS("http://www.w3.org/2000/svg","g");ve.setAttributeNS(null,"opacity","0.25"),ve.setAttributeNS(null,"fill","#000000");let Ne=V.createNS("http://www.w3.org/2000/svg","path");Ne.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"),ve.appendChild(Ne);let ze=V.createNS("http://www.w3.org/2000/svg","g");ze.setAttributeNS(null,"transform","translate(6.0, 7.0)"),ze.setAttributeNS(null,"fill","#FFFFFF");let Be=V.createNS("http://www.w3.org/2000/svg","g");Be.setAttributeNS(null,"transform","translate(8.0, 8.0)");let tt=V.createNS("http://www.w3.org/2000/svg","circle");tt.setAttributeNS(null,"fill","#000000"),tt.setAttributeNS(null,"opacity","0.25"),tt.setAttributeNS(null,"cx","5.5"),tt.setAttributeNS(null,"cy","5.5"),tt.setAttributeNS(null,"r","5.4999962");let st=V.createNS("http://www.w3.org/2000/svg","circle");st.setAttributeNS(null,"fill","#FFFFFF"),st.setAttributeNS(null,"cx","5.5"),st.setAttributeNS(null,"cy","5.5"),st.setAttributeNS(null,"r","5.4999962"),Be.appendChild(tt),Be.appendChild(st),q.appendChild(W),q.appendChild(se),q.appendChild(ve),q.appendChild(ze),q.appendChild(Be),x.appendChild(q),x.setAttributeNS(null,"height",T*this._scale+"px"),x.setAttributeNS(null,"width",M*this._scale+"px"),this._element.appendChild(x),this._offset=s.pointGeometry.convert(i&&i.offset||[0,-14])}this._element.classList.add("maplibregl-marker","mapboxgl-marker"),this._element.addEventListener("dragstart",x=>{x.preventDefault()}),this._element.addEventListener("mousedown",x=>{x.preventDefault()}),hr(this._element,this._anchor,"marker"),this._popup=null}addTo(i){return this.remove(),this._map=i,i.getCanvasContainer().appendChild(this._element),i.on("move",this._update),i.on("moveend",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),V.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(i){return this._lngLat=s.LngLat.convert(i),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(i){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),i){if(!("offset"in i.options)){let T=Math.sqrt(Math.pow(13.5,2)/2);i.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[T,-1*(38.1-13.5+T)],"bottom-right":[-T,-1*(38.1-13.5+T)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=i,this._lngLat&&this._popup.setLngLat(this._lngLat),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}_onKeyPress(i){let d=i.code,x=i.charCode||i.keyCode;d!=="Space"&&d!=="Enter"&&x!==32&&x!==13||this.togglePopup()}_onMapClick(i){let d=i.originalEvent.target,x=this._element;this._popup&&(d===x||x.contains(d))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){let i=this._popup;return i?(i.isOpen()?i.remove():i.addTo(this._map),this):this}_update(i){if(!this._map)return;this._map.transform.renderWorldCopies&&(this._lngLat=Io(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);let d="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?d=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(d=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let x="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?x="rotateX(0deg)":this._pitchAlignment==="map"&&(x=`rotateX(${this._map.getPitch()}deg)`),i&&i.type!=="moveend"||(this._pos=this._pos.round()),V.setTransform(this._element,`${sr[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${x} ${d}`),this._map.style&&this._map.style.terrain&&!this._opacityTimeout&&(this._opacityTimeout=setTimeout(()=>{let T=this._map.unproject(this._pos),M=40075016686e-3*Math.abs(Math.cos(this._lngLat.lat*Math.PI/180))/Math.pow(2,this._map.transform.tileZoom+8);this._element.style.opacity=T.distanceTo(this._lngLat)>20*M?"0.2":"1.0",this._opacityTimeout=null},100))}getOffset(){return this._offset}setOffset(i){return this._offset=s.pointGeometry.convert(i),this._update(),this}_onMove(i){if(!this._isDragging){let d=this._clickTolerance||this._map._clickTolerance;this._isDragging=i.point.dist(this._pointerdownPos)>=d}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 s.Event("dragstart"))),this.fire(new s.Event("drag")))}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new s.Event("dragend")),this._state="inactive"}_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))}setDraggable(i){return this._draggable=!!i,this._map&&(i?(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(i){return this._rotation=i||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(i){return this._rotationAlignment=i||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(i){return this._pitchAlignment=i&&i!=="auto"?i:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}}let Ca={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0},Nn,xi=0,Yo=!1,cr={maxWidth:100,unit:"metric"};function lr(E,i,d){let x=d&&d.maxWidth||100,T=E._container.clientHeight/2,M=E.unproject([0,T]),U=E.unproject([x,T]),q=M.distanceTo(U);if(d&&d.unit==="imperial"){let W=3.2808*q;W>5280?ca(i,x,W/5280,E._getUIString("ScaleControl.Miles")):ca(i,x,W,E._getUIString("ScaleControl.Feet"))}else d&&d.unit==="nautical"?ca(i,x,q/1852,E._getUIString("ScaleControl.NauticalMiles")):q>=1e3?ca(i,x,q/1e3,E._getUIString("ScaleControl.Kilometers")):ca(i,x,q,E._getUIString("ScaleControl.Meters"))}function ca(E,i,d,x){let T=function(M){let U=Math.pow(10,`${Math.floor(M)}`.length-1),q=M/U;return q=q>=10?10:q>=5?5:q>=3?3:q>=2?2:q>=1?1:function(W){let Y=Math.pow(10,Math.ceil(-Math.log(W)/Math.LN10));return Math.round(W*Y)/Y}(q),U*q}(d);E.style.width=i*(T/d)+"px",E.innerHTML=`${T}&nbsp;${x}`}let si={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},Si=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function In(E){if(E){if(typeof E=="number"){let i=Math.round(Math.sqrt(.5*Math.pow(E,2)));return{center:new s.pointGeometry(0,0),top:new s.pointGeometry(0,E),"top-left":new s.pointGeometry(i,i),"top-right":new s.pointGeometry(-i,i),bottom:new s.pointGeometry(0,-E),"bottom-left":new s.pointGeometry(i,-i),"bottom-right":new s.pointGeometry(-i,-i),left:new s.pointGeometry(E,0),right:new s.pointGeometry(-E,0)}}if(E instanceof s.pointGeometry||Array.isArray(E)){let i=s.pointGeometry.convert(E);return{center:i,top:i,"top-left":i,"top-right":i,bottom:i,"bottom-left":i,"bottom-right":i,left:i,right:i}}return{center:s.pointGeometry.convert(E.center||[0,0]),top:s.pointGeometry.convert(E.top||[0,0]),"top-left":s.pointGeometry.convert(E["top-left"]||[0,0]),"top-right":s.pointGeometry.convert(E["top-right"]||[0,0]),bottom:s.pointGeometry.convert(E.bottom||[0,0]),"bottom-left":s.pointGeometry.convert(E["bottom-left"]||[0,0]),"bottom-right":s.pointGeometry.convert(E["bottom-right"]||[0,0]),left:s.pointGeometry.convert(E.left||[0,0]),right:s.pointGeometry.convert(E.right||[0,0])}}return In(new s.pointGeometry(0,0))}let ao={supported:P,setRTLTextPlugin:s.setRTLTextPlugin,getRTLTextPluginStatus:s.getRTLTextPluginStatus,Map:class extends gi{constructor(E){var i;if(s.PerformanceUtils.mark(s.PerformanceMarkers.create),(E=s.extend({},Ho,E)).minZoom!=null&&E.maxZoom!=null&&E.minZoom>E.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(E.minPitch!=null&&E.maxPitch!=null&&E.minPitch>E.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(E.minPitch!=null&&E.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(E.maxPitch!=null&&E.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new os(E.minZoom,E.maxZoom,E.minPitch,E.maxPitch,E.renderWorldCopies),{bearingSnap:E.bearingSnap}),this._interactive=E.interactive,this._cooperativeGestures=E.cooperativeGestures,this._maxTileCacheSize=E.maxTileCacheSize,this._failIfMajorPerformanceCaveat=E.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=E.preserveDrawingBuffer,this._antialias=E.antialias,this._trackResize=E.trackResize,this._bearingSnap=E.bearingSnap,this._refreshExpiredTiles=E.refreshExpiredTiles,this._fadeDuration=E.fadeDuration,this._crossSourceCollisions=E.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=E.collectResourceTiming,this._renderTaskQueue=new lu,this._controls=[],this._mapId=s.uniqueId(),this._locale=s.extend({},uu,E.locale),this._clickTolerance=E.clickTolerance,this._pixelRatio=(i=E.pixelRatio)!==null&&i!==void 0?i:devicePixelRatio,this._requestManager=new me(E.transformRequest),typeof E.container=="string"){if(this._container=document.getElementById(E.container),!this._container)throw new Error(`Container '${E.container}' not found.`)}else{if(!(E.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=E.container}if(E.maxBounds&&this.setMaxBounds(E.maxBounds),s.bindAll(["_onWindowOnline","_onWindowResize","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),this.painter===void 0)throw new Error("Failed to initialize WebGL.");this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),typeof window<"u"&&(addEventListener("online",this._onWindowOnline,!1),addEventListener("resize",this._onWindowResize,!1),addEventListener("orientationchange",this._onWindowResize,!1)),this.handlers=new zl(this,E),this._cooperativeGestures&&this._setupCooperativeGestures(),this._hash=E.hash&&new iu(typeof E.hash=="string"&&E.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:E.center,zoom:E.zoom,bearing:E.bearing,pitch:E.pitch}),E.bounds&&(this.resize(),this.fitBounds(E.bounds,s.extend({},E.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=E.localIdeographFontFamily,E.style&&this.setStyle(E.style,{localIdeographFontFamily:E.localIdeographFontFamily}),E.attributionControl&&this.addControl(new ll({customAttribution:E.customAttribution})),E.maplibreLogo&&this.addControl(new us,E.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",d=>{this._update(d.dataType==="style"),this.fire(new s.Event(`${d.dataType}data`,d))}),this.on("dataloading",d=>{this.fire(new s.Event(`${d.dataType}dataloading`,d))}),this.on("dataabort",d=>{this.fire(new s.Event("sourcedataabort",d))})}_getMapId(){return this._mapId}addControl(E,i){if(i===void 0&&(i=E.getDefaultPosition?E.getDefaultPosition():"top-right"),!E||!E.onAdd)return this.fire(new s.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));let d=E.onAdd(this);this._controls.push(E);let x=this._controlPositions[i];return i.indexOf("bottom")!==-1?x.insertBefore(d,x.firstChild):x.appendChild(d),this}removeControl(E){if(!E||!E.onRemove)return this.fire(new s.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));let i=this._controls.indexOf(E);return i>-1&&this._controls.splice(i,1),E.onRemove(this),this}hasControl(E){return this._controls.indexOf(E)>-1}calculateCameraOptionsFromTo(E,i,d,x){return x==null&&this.style.terrain&&(x=this.transform.getElevation(d,this.style.terrain)),super.calculateCameraOptionsFromTo(E,i,d,x)}resize(E){let i=this._containerDimensions(),d=i[0],x=i[1];this._resizeCanvas(d,x,this.getPixelRatio()),this.transform.resize(d,x),this.painter.resize(d,x,this.getPixelRatio());let T=!this._moving;return T&&(this.stop(),this.fire(new s.Event("movestart",E)).fire(new s.Event("move",E))),this.fire(new s.Event("resize",E)),T&&this.fire(new s.Event("moveend",E)),this}getPixelRatio(){return this._pixelRatio}setPixelRatio(E){let[i,d]=this._containerDimensions();this._pixelRatio=E,this._resizeCanvas(i,d,E),this.painter.resize(i,d,E)}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(E){return this.transform.setMaxBounds(s.LngLatBounds.convert(E)),this._update()}setMinZoom(E){if((E=E??-2)>=-2&&E<=this.transform.maxZoom)return this.transform.minZoom=E,this._update(),this.getZoom()<E&&this.setZoom(E),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(E){if((E=E??22)>=this.transform.minZoom)return this.transform.maxZoom=E,this._update(),this.getZoom()>E&&this.setZoom(E),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(E){if((E=E??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(E>=0&&E<=this.transform.maxPitch)return this.transform.minPitch=E,this._update(),this.getPitch()<E&&this.setPitch(E),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(E){if((E=E??60)>85)throw new Error("maxPitch must be less than or equal to 85");if(E>=this.transform.minPitch)return this.transform.maxPitch=E,this._update(),this.getPitch()>E&&this.setPitch(E),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(E){return this.transform.renderWorldCopies=E,this._update()}project(E){return this.transform.locationPoint(s.LngLat.convert(E),this.style&&this.style.terrain)}unproject(E){return this.transform.pointLocation(s.pointGeometry.convert(E),this.style&&this.style.terrain)}isMoving(){return this._moving||this.handlers.isMoving()}isZooming(){return this._zooming||this.handlers.isZooming()}isRotating(){return this._rotating||this.handlers.isRotating()}_createDelegatedListener(E,i,d){if(E==="mouseenter"||E==="mouseover"){let x=!1;return{layer:i,listener:d,delegates:{mousemove:M=>{let U=this.getLayer(i)?this.queryRenderedFeatures(M.point,{layers:[i]}):[];U.length?x||(x=!0,d.call(this,new ho(E,this,M.originalEvent,{features:U}))):x=!1},mouseout:()=>{x=!1}}}}if(E==="mouseleave"||E==="mouseout"){let x=!1;return{layer:i,listener:d,delegates:{mousemove:U=>{(this.getLayer(i)?this.queryRenderedFeatures(U.point,{layers:[i]}):[]).length?x=!0:x&&(x=!1,d.call(this,new ho(E,this,U.originalEvent)))},mouseout:U=>{x&&(x=!1,d.call(this,new ho(E,this,U.originalEvent)))}}}}{let x=T=>{let M=this.getLayer(i)?this.queryRenderedFeatures(T.point,{layers:[i]}):[];M.length&&(T.features=M,d.call(this,T),delete T.features)};return{layer:i,listener:d,delegates:{[E]:x}}}}on(E,i,d){if(d===void 0)return super.on(E,i);let x=this._createDelegatedListener(E,i,d);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[E]=this._delegatedListeners[E]||[],this._delegatedListeners[E].push(x);for(let T in x.delegates)this.on(T,x.delegates[T]);return this}once(E,i,d){if(d===void 0)return super.once(E,i);let x=this._createDelegatedListener(E,i,d);for(let T in x.delegates)this.once(T,x.delegates[T]);return this}off(E,i,d){return d===void 0?super.off(E,i):(this._delegatedListeners&&this._delegatedListeners[E]&&(x=>{let T=this._delegatedListeners[E];for(let M=0;M<T.length;M++){let U=T[M];if(U.layer===i&&U.listener===d){for(let q in U.delegates)this.off(q,U.delegates[q]);return T.splice(M,1),this}}})(),this)}queryRenderedFeatures(E,i){if(!this.style)return[];let d;if(i!==void 0||E===void 0||E instanceof s.pointGeometry||Array.isArray(E)||(i=E,E=void 0),i=i||{},(E=E||[[0,0],[this.transform.width,this.transform.height]])instanceof s.pointGeometry||typeof E[0]=="number")d=[s.pointGeometry.convert(E)];else{let x=s.pointGeometry.convert(E[0]),T=s.pointGeometry.convert(E[1]);d=[x,new s.pointGeometry(T.x,x.y),T,new s.pointGeometry(x.x,T.y),x]}return this.style.queryRenderedFeatures(d,i,this.transform)}querySourceFeatures(E,i){return this.style.querySourceFeatures(E,i)}setStyle(E,i){return(i=s.extend({},{localIdeographFontFamily:this._localIdeographFontFamily},i)).diff!==!1&&i.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&E?(this._diffStyle(E,i),this):(this._localIdeographFontFamily=i.localIdeographFontFamily,this._updateStyle(E,i))}setTransformRequest(E){return this._requestManager.setTransformRequest(E),this}_getUIString(E){let i=this._locale[E];if(i==null)throw new Error(`Missing UI string '${E}'`);return i}_updateStyle(E,i){return this.style&&(this.style.setEventedParent(null),this.style._remove()),E?(this.style=new Sn(this,i||{}),this.style.setEventedParent(this,{style:this.style}),typeof E=="string"?this.style.loadURL(E):this.style.loadJSON(E),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Sn(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(E,i){if(typeof E=="string"){let d=this._requestManager.transformRequest(E,s.ResourceType.Style);s.getJSON(d,(x,T)=>{x?this.fire(new s.ErrorEvent(x)):T&&this._updateDiff(T,i)})}else typeof E=="object"&&this._updateDiff(E,i)}_updateDiff(E,i){try{this.style.setState(E)&&this._update(!0)}catch(d){s.warnOnce(`Unable to perform style diff: ${d.message||d.error||d}. Rebuilding the style from scratch.`),this._updateStyle(E,i)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():s.warnOnce("There is no style added to the map.")}addSource(E,i){return this._lazyInitEmptyStyle(),this.style.addSource(E,i),this._update(!0)}isSourceLoaded(E){let i=this.style&&this.style.sourceCaches[E];if(i!==void 0)return i.loaded();this.fire(new s.ErrorEvent(new Error(`There is no source with ID '${E}'`)))}setTerrain(E){return this.style.setTerrain(E),this}getTerrain(){return this.style.terrain&&this.style.terrain.options}areTilesLoaded(){let E=this.style&&this.style.sourceCaches;for(let i in E){let d=E[i]._tiles;for(let x in d){let T=d[x];if(T.state!=="loaded"&&T.state!=="errored")return!1}}return!0}addSourceType(E,i,d){return this._lazyInitEmptyStyle(),this.style.addSourceType(E,i,d)}removeSource(E){return this.style.removeSource(E),this._update(!0)}getSource(E){return this.style.getSource(E)}addImage(E,i,{pixelRatio:d=1,sdf:x=!1,stretchX:T,stretchY:M,content:U}={}){if(this._lazyInitEmptyStyle(),i instanceof HTMLImageElement||s.isImageBitmap(i)){let{width:q,height:W,data:Y}=s.exported.getImageData(i);this.style.addImage(E,{data:new s.RGBAImage({width:q,height:W},Y),pixelRatio:d,stretchX:T,stretchY:M,content:U,sdf:x,version:0})}else{if(i.width===void 0||i.height===void 0)return this.fire(new s.ErrorEvent(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{let{width:q,height:W,data:Y}=i,se=i;this.style.addImage(E,{data:new s.RGBAImage({width:q,height:W},new Uint8Array(Y)),pixelRatio:d,stretchX:T,stretchY:M,content:U,sdf:x,version:0,userImage:se}),se.onAdd&&se.onAdd(this,E)}}}updateImage(E,i){let d=this.style.getImage(E);if(!d)return this.fire(new s.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let x=i instanceof HTMLImageElement||s.isImageBitmap(i)?s.exported.getImageData(i):i,{width:T,height:M,data:U}=x;if(T===void 0||M===void 0)return this.fire(new s.ErrorEvent(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(T!==d.data.width||M!==d.data.height)return this.fire(new s.ErrorEvent(new Error("The width and height of the updated image must be that same as the previous version of the image")));let q=!(i instanceof HTMLImageElement||s.isImageBitmap(i));d.data.replace(U,q),this.style.updateImage(E,d)}hasImage(E){return E?!!this.style.getImage(E):(this.fire(new s.ErrorEvent(new Error("Missing required image id"))),!1)}removeImage(E){this.style.removeImage(E)}loadImage(E,i){s.getImage(this._requestManager.transformRequest(E,s.ResourceType.Image),i)}listImages(){return this.style.listImages()}addLayer(E,i){return this._lazyInitEmptyStyle(),this.style.addLayer(E,i),this._update(!0)}moveLayer(E,i){return this.style.moveLayer(E,i),this._update(!0)}removeLayer(E){return this.style.removeLayer(E),this._update(!0)}getLayer(E){return this.style.getLayer(E)}setLayerZoomRange(E,i,d){return this.style.setLayerZoomRange(E,i,d),this._update(!0)}setFilter(E,i,d={}){return this.style.setFilter(E,i,d),this._update(!0)}getFilter(E){return this.style.getFilter(E)}setPaintProperty(E,i,d,x={}){return this.style.setPaintProperty(E,i,d,x),this._update(!0)}getPaintProperty(E,i){return this.style.getPaintProperty(E,i)}setLayoutProperty(E,i,d,x={}){return this.style.setLayoutProperty(E,i,d,x),this._update(!0)}getLayoutProperty(E,i){return this.style.getLayoutProperty(E,i)}setLight(E,i={}){return this._lazyInitEmptyStyle(),this.style.setLight(E,i),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(E,i){return this.style.setFeatureState(E,i),this._update()}removeFeatureState(E,i){return this.style.removeFeatureState(E,i),this._update()}getFeatureState(E){return this.style.getFeatureState(E)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let E=0,i=0;return this._container&&(E=this._container.clientWidth||400,i=this._container.clientHeight||300),[E,i]}_setupContainer(){let E=this._container;E.classList.add("maplibregl-map","mapboxgl-map");let i=this._canvasContainer=V.create("div","maplibregl-canvas-container mapboxgl-canvas-container",E);this._interactive&&i.classList.add("maplibregl-interactive","mapboxgl-interactive"),this._canvas=V.create("canvas","maplibregl-canvas mapboxgl-canvas",i),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");let d=this._containerDimensions();this._resizeCanvas(d[0],d[1],this.getPixelRatio());let x=this._controlContainer=V.create("div","maplibregl-control-container mapboxgl-control-container",E),T=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(M=>{T[M]=V.create("div",`maplibregl-ctrl-${M} mapboxgl-ctrl-${M}`,x)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_setupCooperativeGestures(){let E=this._container;this._metaPress=!1,this._cooperativeGesturesScreen=V.create("div","maplibregl-cooperative-gesture-screen",E);let i="Control",d=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.windowsHelpText?this._cooperativeGestures.windowsHelpText:"Use Ctrl + scroll to zoom the map";navigator.platform.indexOf("Mac")===0&&(d=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.macHelpText?this._cooperativeGestures.macHelpText:"Use \u2318 + scroll to zoom the map",i="Meta"),this._cooperativeGesturesScreen.innerHTML=`
1073
1073
  <div class="maplibregl-desktop-message">${d}</div>
1074
1074
  <div class="maplibregl-mobile-message">${typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.mobileHelpText?this._cooperativeGestures.mobileHelpText:"Use two fingers to move the map"}</div>
1075
- `,document.addEventListener("keydown",x=>{x.key===i&&(this._metaPress=!0)}),document.addEventListener("keyup",x=>{x.key===i&&(this._metaPress=!1)}),this._canvasContainer.addEventListener("wheel",x=>{this._onCooperativeGesture(x,this._metaPress,1)},!1),this._canvasContainer.classList.remove("mapboxgl-touch-drag-pan","maplibregl-touch-drag-pan")}_resizeCanvas(E,i,d){this._canvas.width=d*E,this._canvas.height=d*i,this._canvas.style.width=`${E}px`,this._canvas.style.height=`${i}px`}_setupPainter(){let E=s.extend({},P.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),i=this._canvas.getContext("webgl",E)||this._canvas.getContext("experimental-webgl",E);i?(this.painter=new ru(i,this.transform),s.exported$1.testSupport(i)):this.fire(new s.ErrorEvent(new Error("Failed to initialize WebGL")))}_contextLost(E){E.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new s.Event("webglcontextlost",{originalEvent:E}))}_contextRestored(E){this._setupPainter(),this.resize(),this._update(),this.fire(new s.Event("webglcontextrestored",{originalEvent:E}))}_onMapScroll(E){if(E.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}_onCooperativeGesture(E,i,d){return!i&&d<2&&(this._cooperativeGesturesScreen.classList.add("maplibregl-show"),setTimeout(()=>{this._cooperativeGesturesScreen.classList.remove("maplibregl-show")},100)),!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(E){return this.style?(this._styleDirty=this._styleDirty||E,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(E){return this._update(),this._renderTaskQueue.add(E)}_cancelRenderFrame(E){this._renderTaskQueue.remove(E)}_render(E){let i,d=0,x=this.painter.context.extTimerQuery;if(this.listens("gpu-timing-frame")&&(i=x.createQueryEXT(),x.beginQueryEXT(x.TIME_ELAPSED_EXT,i),d=s.exported.now()),this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(E),this._removed)return;let T=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;let U=this.transform.zoom,q=s.exported.now();this.style.zoomHistory.update(U,q);let W=new s.EvaluationParameters(U,{now:q,fadeDuration:this._fadeDuration,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),Y=W.crossFadingFactor();Y===1&&Y===this._crossFadingFactor||(T=!0,this._crossFadingFactor=Y),this.style.update(W)}if(this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.style.terrain&&this.style.terrain.sourceCache.update(this.transform,this.style.terrain),this.transform.updateElevation(this.style.terrain),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,this._fadeDuration,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:this._fadeDuration,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer")}),this.fire(new s.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,s.PerformanceUtils.mark(s.PerformanceMarkers.load),this.fire(new s.Event("load"))),this.style&&(this.style.hasTransitions()||T)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),this.listens("gpu-timing-frame")){let U=s.exported.now()-d;x.endQueryEXT(x.TIME_ELAPSED_EXT,i),setTimeout(()=>{let q=x.getQueryObjectEXT(i,x.QUERY_RESULT_EXT)/1e6;x.deleteQueryEXT(i),this.fire(new s.Event("gpu-timing-frame",{cpuTime:U,gpuTime:q}))},50)}if(this.listens("gpu-timing-layer")){let U=this.painter.collectGpuTimers();setTimeout(()=>{let q=this.painter.queryGpuTimers(U);this.fire(new s.Event("gpu-timing-layer",{layerTimes:q}))},50)}let M=this._sourcesDirty||this._styleDirty||this._placementDirty;return M||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new s.Event("idle")),!this._loaded||this._fullyLoaded||M||(this._fullyLoaded=!0,s.PerformanceUtils.mark(s.PerformanceMarkers.fullLoad)),this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){this._hash&&this._hash.remove();for(let i of this._controls)i.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&(removeEventListener("resize",this._onWindowResize,!1),removeEventListener("orientationchange",this._onWindowResize,!1),removeEventListener("online",this._onWindowOnline,!1));let E=this.painter.context.gl.getExtension("WEBGL_lose_context");E&&E.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),V.remove(this._canvasContainer),V.remove(this._controlContainer),this._cooperativeGestures&&V.remove(this._cooperativeGesturesScreen),this._container.classList.remove("maplibregl-map","mapboxgl-map"),s.PerformanceUtils.clearMetrics(),this._removed=!0,this.fire(new s.Event("remove"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=s.exported.frame(E=>{s.PerformanceUtils.frame(E),this._frame=null,this._render(E)}))}_onWindowOnline(){this._update()}_onWindowResize(E){this._trackResize&&this.resize({originalEvent:E})._update()}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(E){this._showTileBoundaries!==E&&(this._showTileBoundaries=E,this._update())}get showPadding(){return!!this._showPadding}set showPadding(E){this._showPadding!==E&&(this._showPadding=E,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(E){this._showCollisionBoxes!==E&&(this._showCollisionBoxes=E,E?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(E){this._showOverdrawInspector!==E&&(this._showOverdrawInspector=E,this._update())}get repaint(){return!!this._repaint}set repaint(E){this._repaint!==E&&(this._repaint=E,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(E){this._vertices=E,this._update()}_setCacheLimits(E,i){s.setCacheLimits(E,i)}get version(){return"2.4.0"}},NavigationControl:class{constructor(E){this.options=s.extend({},Bo,E),this._container=V.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",i=>i.preventDefault()),this.options.showZoom&&(s.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in mapboxgl-ctrl-zoom-in",i=>this._map.zoomIn({},{originalEvent:i})),V.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out mapboxgl-ctrl-zoom-out",i=>this._map.zoomOut({},{originalEvent:i})),V.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(s.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("maplibregl-ctrl-compass mapboxgl-ctrl-compass",i=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:i}):this._map.resetNorth({},{originalEvent:i})}),this._compassIcon=V.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){let E=this._map.getZoom(),i=E===this._map.getMaxZoom(),d=E===this._map.getMinZoom();this._zoomInButton.disabled=i,this._zoomOutButton.disabled=d,this._zoomInButton.setAttribute("aria-disabled",i.toString()),this._zoomOutButton.setAttribute("aria-disabled",d.toString())}_rotateCompassArrow(){let E=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=E}onAdd(E){return this._map=E,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Fr(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){V.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(E,i){let d=V.create("button",E,this._container);return d.type="button",d.addEventListener("click",i),d}_setButtonTitle(E,i){let d=this._map._getUIString(`NavigationControl.${i}`);E.title=d,E.setAttribute("aria-label",d)}},GeolocateControl:class extends s.Evented{constructor(E){super(),this.options=s.extend({},Ca,E),s.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker"],this)}onAdd(E){var i;return this._map=E,this._container=V.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),i=this._setupUI,Nn!==void 0?i(Nn):window.navigator.permissions!==void 0?window.navigator.permissions.query({name:"geolocation"}).then(d=>{Nn=d.state!=="denied",i(Nn)}):(Nn=!!window.navigator.geolocation,i(Nn)),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(),V.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,xi=0,Yo=!1}_isOutOfMapMaxBounds(E){let i=this._map.getMaxBounds(),d=E.coords;return i&&(d.longitude<i.getWest()||d.longitude>i.getEast()||d.latitude<i.getSouth()||d.latitude>i.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_onSuccess(E){if(this._map){if(this._isOutOfMapMaxBounds(E))return this._setErrorState(),this.fire(new s.Event("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","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(E),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(E),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new s.Event("geolocate",E)),this._finish()}}_updateCamera(E){let i=new s.LngLat(E.coords.longitude,E.coords.latitude),d=E.coords.accuracy,x=this._map.getBearing(),T=s.extend({bearing:x},this.options.fitBoundsOptions);this._map.fitBounds(i.toBounds(d),T,{geolocateSource:!0})}_updateMarker(E){if(E){let i=new s.LngLat(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()}_updateCircleRadius(){let E=this._map._container.clientHeight/2,i=this._map.unproject([0,E]),d=this._map.unproject([1,E]),x=i.distanceTo(d),T=Math.ceil(2*this._accuracy/x);this._circleElement.style.width=`${T}px`,this._circleElement.style.height=`${T}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_onError(E){if(this._map){if(this.options.trackUserLocation)if(E.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;let 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&&Yo)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new s.Event("error",E)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(E){if(this._container.addEventListener("contextmenu",i=>i.preventDefault()),this._geolocateButton=V.create("button","maplibregl-ctrl-geolocate mapboxgl-ctrl-geolocate",this._container),V.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",E===!1){s.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");let i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i)}else{let i=this._map._getUIString("GeolocateControl.FindMyLocation");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=V.create("div","maplibregl-user-location-dot mapboxgl-user-location-dot"),this._userLocationDotMarker=new Ko(this._dotElement),this._circleElement=V.create("div","maplibregl-user-location-accuracy-circle mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Ko({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",i=>{i.geolocateSource||this._watchState!=="ACTIVE_LOCK"||i.originalEvent&&i.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this.fire(new s.Event("trackuserlocationend")))})}trigger(){if(!this._setup)return s.warnOnce("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new s.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":xi--,Yo=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this.fire(new s.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new s.Event("trackuserlocationstart"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let E;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),xi++,xi>1?(E={maximumAge:6e5,timeout:0},Yo=!0):(E=this.options.positionOptions,Yo=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,E)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:ll,LogoControl:us,ScaleControl:class{constructor(E){this.options=s.extend({},cr,E),s.bindAll(["_onMove","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_onMove(){lr(this._map,this._container,this.options)}onAdd(E){return this._map=E,this._container=V.create("div","maplibregl-ctrl maplibregl-ctrl-scale mapboxgl-ctrl mapboxgl-ctrl-scale",E.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){V.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}setUnit(E){this.options.unit=E,lr(this._map,this._container,this.options)}},FullscreenControl:class{constructor(E){this._fullscreen=!1,E&&E.container&&(E.container instanceof HTMLElement?this._container=E.container:s.warnOnce("Full screen control 'container' must be a DOM element.")),s.bindAll(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(E){return this._map=E,this._container||(this._container=this._map.getContainer()),this._controlContainer=V.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",s.warnOnce("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){V.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!!(document.fullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled||document.webkitFullscreenEnabled)}_setupUI(){let E=this._fullscreenButton=V.create("button","maplibregl-ctrl-fullscreen mapboxgl-ctrl-fullscreen",this._controlContainer);V.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",E).setAttribute("aria-hidden","true"),E.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){let E=this._getTitle();this._fullscreenButton.setAttribute("aria-label",E),this._fullscreenButton.title=E}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen&&window.document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},TerrainControl:class{constructor(E){this.options=E,s.bindAll(["_toggleTerrain","_updateTerrainIcon"],this)}onAdd(E){return this._map=E,this._container=V.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._terrainButton=V.create("button","maplibregl-ctrl-terrain mapboxgl-ctrl-terrain",this._container),V.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){V.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}_toggleTerrain(){this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()}_updateTerrainIcon(){this._terrainButton.classList.remove("maplibregl-ctrl-terrain","mapboxgl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled","mapboxgl-ctrl-terrain-enabled"),this._map.style.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled","mapboxgl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain","mapboxgl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))}},Popup:class extends s.Evented{constructor(E){super(),this.options=s.extend(Object.create(si),E),s.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag"],this)}addTo(E){return this._map&&this.remove(),this._map=E,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer","mapboxgl-track-pointer")):this._map.on("move",this._update),this.fire(new s.Event("open")),this}isOpen(){return!!this._map}remove(){return this._content&&V.remove(this._content),this._container&&(V.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new s.Event("close")),this}getLngLat(){return this._lngLat}setLngLat(E){return this._lngLat=s.LngLat.convert(E),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer","mapboxgl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer","mapboxgl-track-pointer")),this}getElement(){return this._container}setText(E){return this.setDOMContent(document.createTextNode(E))}setHTML(E){let i=document.createDocumentFragment(),d=document.createElement("body"),x;for(d.innerHTML=E;x=d.firstChild,x;)i.appendChild(x);return this.setDOMContent(i)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(E){return this.options.maxWidth=E,this._update(),this}setDOMContent(E){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=V.create("div","maplibregl-popup-content mapboxgl-popup-content",this._container);return this._content.appendChild(E),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(E){this._container&&this._container.classList.add(E)}removeClassName(E){this._container&&this._container.classList.remove(E)}setOffset(E){return this.options.offset=E,this._update(),this}toggleClassName(E){if(this._container)return this._container.classList.toggle(E)}_createCloseButton(){this.options.closeButton&&(this._closeButton=V.create("button","maplibregl-popup-close-button mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))}_onMouseUp(E){this._update(E.point)}_onMouseMove(E){this._update(E.point)}_onDrag(E){this._update(E.point)}_update(E){if(!this._map||!this._lngLat&&!this._trackPointer||!this._content||(this._container||(this._container=V.create("div","maplibregl-popup mapboxgl-popup",this._map.getContainer()),this._tip=V.create("div","maplibregl-popup-tip mapboxgl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(" ").forEach(M=>this._container.classList.add(M)),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer")),this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=Io(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!E))return;let i=this._pos=this._trackPointer&&E?E:this._map.project(this._lngLat),d=this.options.anchor,x=In(this.options.offset);if(!d){let M=this._container.offsetWidth,U=this._container.offsetHeight,q;q=i.y+x.bottom.y<U?["top"]:i.y>this._map.transform.height-U?["bottom"]:[],i.x<M/2?q.push("left"):i.x>this._map.transform.width-M/2&&q.push("right"),d=q.length===0?"bottom":q.join("-")}let T=i.add(x[d]).round();V.setTransform(this._container,`${sr[d]} translate(${T.x}px,${T.y}px)`),hr(this._container,d,"popup")}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;let E=this._container.querySelector(Si);E&&E.focus()}_onClose(){this.remove()}},Marker:Ko,Style:Sn,LngLat:s.LngLat,LngLatBounds:s.LngLatBounds,Point:s.pointGeometry,MercatorCoordinate:s.MercatorCoordinate,Evented:s.Evented,AJAXError:s.AJAXError,config:s.config,CanvasSource:Ir,GeoJSONSource:Br,ImageSource:br,RasterDEMTileSource:Mt,RasterTileSource:Qt,VectorTileSource:Vt,VideoSource:Mr,prewarm:function(){sn().acquire(Ni)},clearPrewarmedResources:function(){let E=Zi;E&&(E.isPreloaded()&&E.numActive()===1?(E.release(Ni),Zi=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},get version(){return"2.4.0"},get workerCount(){return Cr.workerCount},set workerCount(E){Cr.workerCount=E},get maxParallelImageRequests(){return s.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(E){s.config.MAX_PARALLEL_IMAGE_REQUESTS=E},clearStorage(E){s.clearTileCache(E)},workerUrl:"",addProtocol(E,i){s.config.REGISTERED_PROTOCOLS[E]=i},removeProtocol(E){delete s.config.REGISTERED_PROTOCOLS[E]}};return Ki.extend(ao,{isSafari:s.isSafari,getPerformanceMetrics:s.PerformanceUtils.getPerformanceMetrics}),ao});var r=n;return r})});var a1=qf((hB,o1)=>{var wE="Expected a function",i1=NaN,EE="[object Symbol]",TE=/^\s+|\s+$/g,SE=/^[-+]0x[0-9a-f]+$/i,IE=/^0b[01]+$/i,CE=/^0o[0-7]+$/i,AE=parseInt,PE=typeof global=="object"&&global&&global.Object===Object&&global,ME=typeof self=="object"&&self&&self.Object===Object&&self,kE=PE||ME||Function("return this")(),LE=Object.prototype,RE=LE.toString,zE=Math.max,DE=Math.min,z_=function(){return kE.Date.now()};function OE(_,c,n){var u,r,s,P,z,F,N=0,V=!1,me=!1,be=!0;if(typeof _!="function")throw new TypeError(wE);c=n1(c)||0,D_(n)&&(V=!!n.leading,me="maxWait"in n,s=me?zE(n1(n.maxWait)||0,c):s,be="trailing"in n?!!n.trailing:be);function Se(ct){var Tt=u,St=r;return u=r=void 0,N=ct,P=_.apply(St,Tt),P}function Ve(ct){return N=ct,z=setTimeout(Ge,c),V?Se(ct):P}function Ke(ct){var Tt=ct-F,St=ct-N,Lt=c-Tt;return me?DE(Lt,s-St):Lt}function Ie(ct){var Tt=ct-F,St=ct-N;return F===void 0||Tt>=c||Tt<0||me&&St>=s}function Ge(){var ct=z_();if(Ie(ct))return et(ct);z=setTimeout(Ge,Ke(ct))}function et(ct){return z=void 0,be&&u?Se(ct):(u=r=void 0,P)}function rt(){z!==void 0&&clearTimeout(z),N=0,u=F=r=z=void 0}function _t(){return z===void 0?P:et(z_())}function yt(){var ct=z_(),Tt=Ie(ct);if(u=arguments,r=this,F=ct,Tt){if(z===void 0)return Ve(F);if(me)return z=setTimeout(Ge,c),Se(F)}return z===void 0&&(z=setTimeout(Ge,c)),P}return yt.cancel=rt,yt.flush=_t,yt}function D_(_){var c=typeof _;return!!_&&(c=="object"||c=="function")}function FE(_){return!!_&&typeof _=="object"}function BE(_){return typeof _=="symbol"||FE(_)&&RE.call(_)==EE}function n1(_){if(typeof _=="number")return _;if(BE(_))return i1;if(D_(_)){var c=typeof _.valueOf=="function"?_.valueOf():_;_=D_(c)?c+"":c}if(typeof _!="string")return _===0?_:+_;_=_.replace(TE,"");var n=IE.test(_);return n||CE.test(_)?AE(_.slice(2),n?2:8):SE.test(_)?i1:+_}o1.exports=OE});var h1=qf((pB,c1)=>{var u1="Expected a function",s1=NaN,UE="[object Symbol]",NE=/^\s+|\s+$/g,VE=/^[-+]0x[0-9a-f]+$/i,GE=/^0b[01]+$/i,jE=/^0o[0-7]+$/i,qE=parseInt,ZE=typeof global=="object"&&global&&global.Object===Object&&global,XE=typeof self=="object"&&self&&self.Object===Object&&self,WE=ZE||XE||Function("return this")(),$E=Object.prototype,HE=$E.toString,KE=Math.max,YE=Math.min,O_=function(){return WE.Date.now()};function JE(_,c,n){var u,r,s,P,z,F,N=0,V=!1,me=!1,be=!0;if(typeof _!="function")throw new TypeError(u1);c=l1(c)||0,pg(n)&&(V=!!n.leading,me="maxWait"in n,s=me?KE(l1(n.maxWait)||0,c):s,be="trailing"in n?!!n.trailing:be);function Se(ct){var Tt=u,St=r;return u=r=void 0,N=ct,P=_.apply(St,Tt),P}function Ve(ct){return N=ct,z=setTimeout(Ge,c),V?Se(ct):P}function Ke(ct){var Tt=ct-F,St=ct-N,Lt=c-Tt;return me?YE(Lt,s-St):Lt}function Ie(ct){var Tt=ct-F,St=ct-N;return F===void 0||Tt>=c||Tt<0||me&&St>=s}function Ge(){var ct=O_();if(Ie(ct))return et(ct);z=setTimeout(Ge,Ke(ct))}function et(ct){return z=void 0,be&&u?Se(ct):(u=r=void 0,P)}function rt(){z!==void 0&&clearTimeout(z),N=0,u=F=r=z=void 0}function _t(){return z===void 0?P:et(O_())}function yt(){var ct=O_(),Tt=Ie(ct);if(u=arguments,r=this,F=ct,Tt){if(z===void 0)return Ve(F);if(me)return z=setTimeout(Ge,c),Se(F)}return z===void 0&&(z=setTimeout(Ge,c)),P}return yt.cancel=rt,yt.flush=_t,yt}function QE(_,c,n){var u=!0,r=!0;if(typeof _!="function")throw new TypeError(u1);return pg(n)&&(u="leading"in n?!!n.leading:u,r="trailing"in n?!!n.trailing:r),JE(_,c,{leading:u,maxWait:c,trailing:r})}function pg(_){var c=typeof _;return!!_&&(c=="object"||c=="function")}function eT(_){return!!_&&typeof _=="object"}function tT(_){return typeof _=="symbol"||eT(_)&&HE.call(_)==UE}function l1(_){if(typeof _=="number")return _;if(tT(_))return s1;if(pg(_)){var c=typeof _.valueOf=="function"?_.valueOf():_;_=pg(c)?c+"":c}if(typeof _!="string")return _===0?_:+_;_=_.replace(NE,"");var n=GE.test(_);return n||jE.test(_)?qE(_.slice(2),n?2:8):VE.test(_)?s1:+_}c1.exports=QE});var mg={};iy(mg,{CopyrightControl:()=>sx,Layer:()=>Is,MapboxLayer:()=>np,MapboxStyleLayer:()=>r1,MaplibreLayer:()=>op,RealtimeAPI:()=>Wf,RealtimeLayer:()=>f1,RealtimeModes:()=>ra,RoutingAPI:()=>Zf,RoutingControl:()=>$0,RoutingLayer:()=>ug,StopFinderControl:()=>K0,StopsAPI:()=>Xf,VectorLayer:()=>d1,WMSLayer:()=>m1,createTrackerFilters:()=>uy,fullTrajectoryDelayStyle:()=>p1,fullTrajectoryStyle:()=>dg,getCircleCanvas:()=>Ry,getDelayBgCanvas:()=>ky,getDelayTextCanvas:()=>Ly,getHoursAndMinutes:()=>Iv,getLayersAsFlatArray:()=>$f,getMapboxMapCopyrights:()=>oc,getMapboxRender:()=>tf,getMaplibreRender:()=>ef,getTextCanvas:()=>zy,getUTCDateString:()=>Tv,getUTCTimeString:()=>Sv,getUrlWithParams:()=>Zh,pad:()=>km,realtimeDefaultStyle:()=>Hh,realtimeDelayStyle:()=>Dy,realtimeSimpleStyle:()=>Oy,removeDuplicate:()=>Xh,renderTrajectories:()=>Hf,sortByDelay:()=>cy,trackerConfig:()=>rf});var $1=function(){function _(c){this.propagationStopped,this.defaultPrevented,this.type=c,this.target=null}return _.prototype.preventDefault=function(){this.defaultPrevented=!0},_.prototype.stopPropagation=function(){this.propagationStopped=!0},_}();var La=$1;var jp={PROPERTYCHANGE:"propertychange"};var H1=function(){function _(){this.disposed=!1}return _.prototype.dispose=function(){this.disposed||(this.disposed=!0,this.disposeInternal())},_.prototype.disposeInternal=function(){},_}(),dv=H1;function mv(_,c,n){for(var u,r,s=n||rh,P=0,z=_.length,F=!1;P<z;)u=P+(z-P>>1),r=+s(_[u],c),r<0?P=u+1:(z=u,F=!r);return F?P:~P}function rh(_,c){return _>c?1:_<c?-1:0}function gv(_,c){return _.indexOf(c)>=0}function yv(_,c,n){for(;c<n;){var u=_[c];_[c]=_[n],_[n]=u,++c,--n}}function Ha(_,c){for(var n=Array.isArray(c)?c:[c],u=n.length,r=0;r<u;r++)_[_.length]=n[r]}function _s(_,c){var n=_.length;if(n!==c.length)return!1;for(var u=0;u<n;u++)if(_[u]!==c[u])return!1;return!0}function Sm(){return!0}function qh(){}function _v(_){var c=!1,n,u,r;return function(){var s=Array.prototype.slice.call(arguments);return(!c||this!==r||!_s(s,u))&&(c=!0,r=this,u=s,n=_.apply(this,arguments)),n}}var Ra=typeof Object.assign=="function"?Object.assign:function(_,c){if(_==null)throw new TypeError("Cannot convert undefined or null to object");for(var n=Object(_),u=1,r=arguments.length;u<r;++u){var s=arguments[u];if(s!=null)for(var P in s)s.hasOwnProperty(P)&&(n[P]=s[P])}return n};function ih(_){for(var c in _)delete _[c]}var Im=typeof Object.values=="function"?Object.values:function(_){var c=[];for(var n in _)c.push(_[n]);return c};function Vl(_){var c;for(c in _)return!1;return!c}var K1=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Y1=function(_){K1(c,_);function c(n){var u=_.call(this)||this;return u.eventTarget_=n,u.pendingRemovals_=null,u.dispatching_=null,u.listeners_=null,u}return c.prototype.addEventListener=function(n,u){if(!(!n||!u)){var r=this.listeners_||(this.listeners_={}),s=r[n]||(r[n]=[]);s.indexOf(u)===-1&&s.push(u)}},c.prototype.dispatchEvent=function(n){var u=typeof n=="string",r=u?n:n.type,s=this.listeners_&&this.listeners_[r];if(!!s){var P=u?new La(n):n;P.target||(P.target=this.eventTarget_||this);var z=this.dispatching_||(this.dispatching_={}),F=this.pendingRemovals_||(this.pendingRemovals_={});r in z||(z[r]=0,F[r]=0),++z[r];for(var N,V=0,me=s.length;V<me;++V)if("handleEvent"in s[V]?N=s[V].handleEvent(P):N=s[V].call(this,P),N===!1||P.propagationStopped){N=!1;break}if(--z[r]===0){var be=F[r];for(delete F[r];be--;)this.removeEventListener(r,qh);delete z[r]}return N}},c.prototype.disposeInternal=function(){this.listeners_&&ih(this.listeners_)},c.prototype.getListeners=function(n){return this.listeners_&&this.listeners_[n]||void 0},c.prototype.hasListener=function(n){return this.listeners_?n?n in this.listeners_:Object.keys(this.listeners_).length>0:!1},c.prototype.removeEventListener=function(n,u){var r=this.listeners_&&this.listeners_[n];if(r){var s=r.indexOf(u);s!==-1&&(this.pendingRemovals_&&n in this.pendingRemovals_?(r[s]=qh,++this.pendingRemovals_[n]):(r.splice(s,1),r.length===0&&delete this.listeners_[n]))}},c}(dv),nh=Y1;var Ji={CHANGE:"change",ERROR:"error",BLUR:"blur",CLEAR:"clear",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",DRAGENTER:"dragenter",DRAGOVER:"dragover",DROP:"drop",FOCUS:"focus",KEYDOWN:"keydown",KEYPRESS:"keypress",LOAD:"load",RESIZE:"resize",TOUCHMOVE:"touchmove",WHEEL:"wheel"};function lo(_,c,n,u,r){if(u&&u!==_&&(n=n.bind(u)),r){var s=n;n=function(){_.removeEventListener(c,n),s.apply(this,arguments)}}var P={target:_,type:c,listener:n};return _.addEventListener(c,n),P}function qp(_,c,n,u){return lo(_,c,n,u,!0)}function Ao(_){_&&_.target&&(_.target.removeEventListener(_.type,_.listener),ih(_))}var J1=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Cm=function(_){J1(c,_);function c(){var n=_.call(this)||this;return n.on=n.onInternal,n.once=n.onceInternal,n.un=n.unInternal,n.revision_=0,n}return c.prototype.changed=function(){++this.revision_,this.dispatchEvent(Ji.CHANGE)},c.prototype.getRevision=function(){return this.revision_},c.prototype.onInternal=function(n,u){if(Array.isArray(n)){for(var r=n.length,s=new Array(r),P=0;P<r;++P)s[P]=lo(this,n[P],u);return s}else return lo(this,n,u)},c.prototype.onceInternal=function(n,u){var r;if(Array.isArray(n)){var s=n.length;r=new Array(s);for(var P=0;P<s;++P)r[P]=qp(this,n[P],u)}else r=qp(this,n,u);return u.ol_key=r,r},c.prototype.unInternal=function(n,u){var r=u.ol_key;if(r)Ka(r);else if(Array.isArray(n))for(var s=0,P=n.length;s<P;++s)this.removeEventListener(n[s],u);else this.removeEventListener(n,u)},c}(nh);Cm.prototype.on;Cm.prototype.once;Cm.prototype.un;function Ka(_){if(Array.isArray(_))for(var c=0,n=_.length;c<n;++c)Ao(_[c]);else Ao(_)}var Am=Cm;function jr(){return function(){throw new Error("Unimplemented abstract method.")}()}var Q1=0;function Ai(_){return _.ol_uid||(_.ol_uid=String(++Q1))}var Pm="6.14.1";var xv=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),vv=function(_){xv(c,_);function c(n,u,r){var s=_.call(this,n)||this;return s.key=u,s.oldValue=r,s}return c}(La);var eb=function(_){xv(c,_);function c(n){var u=_.call(this)||this;return u.on,u.once,u.un,Ai(u),u.values_=null,n!==void 0&&u.setProperties(n),u}return c.prototype.get=function(n){var u;return this.values_&&this.values_.hasOwnProperty(n)&&(u=this.values_[n]),u},c.prototype.getKeys=function(){return this.values_&&Object.keys(this.values_)||[]},c.prototype.getProperties=function(){return this.values_&&Ra({},this.values_)||{}},c.prototype.hasProperties=function(){return!!this.values_},c.prototype.notify=function(n,u){var r;r="change:".concat(n),this.hasListener(r)&&this.dispatchEvent(new vv(r,n,u)),r=jp.PROPERTYCHANGE,this.hasListener(r)&&this.dispatchEvent(new vv(r,n,u))},c.prototype.addChangeListener=function(n,u){this.addEventListener("change:".concat(n),u)},c.prototype.removeChangeListener=function(n,u){this.removeEventListener("change:".concat(n),u)},c.prototype.set=function(n,u,r){var s=this.values_||(this.values_={});if(r)s[n]=u;else{var P=s[n];s[n]=u,P!==u&&this.notify(n,P)}},c.prototype.setProperties=function(n,u){for(var r in n)this.set(r,n[r],u)},c.prototype.applyProperties=function(n){!n.values_||Ra(this.values_||(this.values_={}),n.values_)},c.prototype.unset=function(n,u){if(this.values_&&n in this.values_){var r=this.values_[n];delete this.values_[n],Vl(this.values_)&&(this.values_=null),u||this.notify(n,r)}},c}(Am),Po=eb;var tb=(_,c)=>{let n=new URL(_);return Object.entries(c||{}).forEach(([r,s])=>{s!=null&&n.searchParams.set(r,s)}),n},Zh=tb;var ny=class extends Po{constructor(n){super();this.url=n.url,this.apiKey=n.apiKey}fetch(n,u,r){if(!this.url)return Promise.reject(new Error(`No url defined for request to ${this.url}/${n}`));if(!this.url&&!this.apiKey&&!/key=/.test(this.url))return Promise.reject(new Error(`No apiKey defined for request to ${this.url}`));let s=u||{},P=Zh(`${this.url}${n||""}`,{key:this.apiKey,...s});return fetch(P.toString(),r).then(z=>{try{return z.json().then(F=>{if(F.error)throw new Error(F.error);return F})}catch(F){return Promise.reject(new Error(F))}})}},Mm=ny;var oy=class extends Mm{constructor(c={}){super({url:"https://api.geops.io/routing/v1/",...c})}route(c,n){return this.fetch("",c,n)}},Zf=oy;var ay=class extends Mm{constructor(c={}){super({url:"https://api.geops.io/stops/v1/",...c})}search(c,n){return this.fetch("",c,n)}},Xf=ay;var Zp=class{constructor(){this.defineProperties()}defineProperties(){Object.defineProperties(this,{closed:{get:()=>!!(this.websocket&&this.websocket.readyState===this.websocket.CLOSED)},closing:{get:()=>!!(this.websocket&&this.websocket.readyState===this.websocket.CLOSING)},connecting:{get:()=>!!(this.websocket&&this.websocket.readyState===this.websocket.CONNECTING)},open:{get:()=>!!(this.websocket&&this.websocket.readyState===this.websocket.OPEN)},messagesOnOpen:{value:[],writable:!0},subscriptions:{value:[],writable:!0},subscribed:{value:{},writable:!0}})}static getRequestString(c,n={}){let u=`${c} ${n.channel}`;return u+=n.args?` ${n.args}`:"",u+=n.id?` ${n.id}`:"",u.trim()}connect(c,n=()=>{}){this.websocket&&!this.closed&&this.websocket.close(),this.websocket=new WebSocket(c),this.open?(n(),this.subscribePreviousSubscriptions()):this.websocket.addEventListener("open",()=>{n(),this.subscribePreviousSubscriptions()})}close(){this.websocket&&(this.websocket.onclose=null,this.websocket.close(),this.websocket=void 0,this.messagesOnOpen=[])}send(c){if(!this.websocket)return;let n=()=>{this.websocket?.send(c)};this.open?this.messagesOnOpen.includes(c)||n():this.messagesOnOpen.includes(c)||(this.messagesOnOpen.push(c),this.websocket.addEventListener("open",()=>{this.messagesOnOpen=[],n()}),this.websocket.addEventListener("close",()=>{this.messagesOnOpen=[]}))}addEvents(c,n){this.websocket&&(this.websocket.addEventListener("message",c),n&&(this.websocket.addEventListener("error",n),this.websocket.addEventListener("close",n)))}removeEvents(c,n){this.websocket&&(this.websocket.removeEventListener("message",c),n&&(this.websocket.removeEventListener("error",n),this.websocket.removeEventListener("close",n)))}listen(c,n,u){this.unlisten(c,n);let r=s=>{let P;try{P=JSON.parse(s.data)}catch(N){console.error("WebSocket: unable to parse JSON data",N,s.data);return}let z=c.channel;z+=c.args?` ${c.args}`:"";let F;P.source==="buffer"?F=P.content:F=[P],F.forEach(N=>{N?.source===z&&(!c.id||c.id===P.client_reference)&&n(N)})};return this.addEvents(r,u),{onMessageCb:r,onErrorCb:u}}unlisten(c,n){[...this.subscriptions||[],...this.requests||[]].filter(u=>u.params.channel===c.channel&&(!n||u.cb===n)).forEach(({onMessageCb:u,onErrorCb:r})=>{this.removeEvents(u,r)})}get(c,n,u){let r=Zp.getRequestString("GET",c);this.send(r);let s=V=>(...me)=>{V(...me);let be=this.requests.findIndex(Ke=>r===Ke.requestString&&n===Ke.cb),{onMessageCb:Se,onErrorCb:Ve}=this.requests[be];this.removeEvents(Se,Ve),this.requests.splice(be,1)},{onMessageCb:P,onErrorCb:z}=this.listen(c,s(n),u&&s(u));this.requests||(this.requests=[]);let F=this.requests.findIndex(V=>r===V.requestString&&n===V.cb),N={params:c,requestString:r,cb:n,errorCb:u,onMessageCb:P,onErrorCb:z};F>-1?this.requests[F]=N:this.requests.push(N)}subscribe(c,n,u,r=!1){let{onMessageCb:s,onErrorCb:P}=this.listen(c,n,u),z=Zp.getRequestString("",c),F=this.subscriptions.findIndex(V=>c.channel===V.params.channel&&n===V.cb),N={params:c,cb:n,errorCb:u,onMessageCb:s,onErrorCb:P,quiet:r};F>-1?this.subscriptions[F]=N:this.subscriptions.push(N),this.subscribed[z]||(N.quiet||(this.send(`GET ${z}`),this.send(`SUB ${z}`)),this.subscribed[z]=!0)}unsubscribe(c,n){let u=this.subscriptions.filter(r=>r.params.channel===c&&(!n||r.cb===n));u.forEach(({onMessageCb:r,onErrorCb:s})=>{this.removeEvents(r,s)}),this.subscriptions=this.subscriptions.filter(r=>r.params.channel!==c||n&&r.cb!==n),c&&this.subscribed[c]&&!this.subscriptions.find(r=>r.params.channel===c)&&u.find(r=>!r.quiet)&&(this.send(`DEL ${c}`),this.subscribed[c]=!1)}subscribePreviousSubscriptions(){Object.keys(this.subscribed).forEach(c=>{this.subscribed[c]=!1}),[...this.subscriptions].forEach(c=>{this.subscribe(c.params,c.cb,c.errorCb,c.quiet)})}},bv=Zp;var rb=_=>(_.stations.forEach(c=>{c.arrivalTimeWithDelay=c.arrivalTime,c.departureTime&&(c.departureTimeWithDelay=c.departureTime),c.arrivalDelay&&(c.arrivalTime-=c.arrivalDelay,c.departureTime&&(c.departureTime-=c.arrivalDelay))}),_),sy=rb;var ib=(_,c)=>_===c.SCHEMATIC?"_schematic":"",xu=ib;var nb=(_,c,n=!1)=>{let u=["HIDDEN","LEAVING","BOARDING"],r=_.has_fzo&&u.indexOf(_.state)>-1,s=c.has_fzo&&u.indexOf(c.state)>-1;if(r||s){if(r!==s)return r?-1:1;if(_.state!==c.state)return u.indexOf(_.state)-u.indexOf(c.state)}let P=null,z=null,F=Date.now();return n?(P=new Date(_.min_arrival_time||_.time).getTime()-F,z=new Date(c.min_arrival_time||c.time).getTime()-F):(P=new Date(_.time).getTime()-F,z=new Date(c.time).getTime()-F),P-z},wv=nb;var ra={RAW:"raw",TOPOGRAPHIC:"topographic",SCHEMATIC:"schematic"},ly=class{constructor(c={}){this.defineProperties(c),this.subscribedStationUic=void 0,this.departureUpdateTimeout=void 0,this.maxDepartureAge=30,this.extraGeoms={},this.prefix=c.prefix||"",this.onOpen=this.onOpen.bind(this)}defineProperties(c){let n=c;typeof c=="string"&&(n={url:c});let{apiKey:u}=n,{url:r,projection:s,bbox:P,buffer:z=[100,100]}=n,F=new bv;u&&(r=`${r||"wss://api.geops.io/tracker-ws/v1/"}?key=${u}`),Object.defineProperties(this,{url:{get:()=>r,set:N=>{r=N,this.open()}},projection:{get:()=>s,set:N=>{N!==s&&(s=N,this.wsApi&&this.wsApi.send(`PROJECTION ${s}`))}},bbox:{get:()=>P,set:N=>{JSON.stringify(N)!==JSON.stringify(P)&&(P=N,this.wsApi&&P&&this.wsApi.send(`BBOX ${P.join(" ")}`))}},buffer:{get:()=>z,set:N=>{JSON.stringify(N)!==JSON.stringify(z)&&(z=N,this.wsApi&&this.wsApi.send(`BUFFER ${z.join(" ")}`))}},wsApi:{value:F,writable:!0},pingIntervalMs:{value:c.pingIntervalMs||1e4,writable:!0},reconnectTimeoutMs:{value:c.pingIntervalMs||100,writable:!0}})}open(){this.close(),this.wsApi.connect(this.url,this.onOpen),this.wsApi.websocket&&(this.wsApi.websocket.onclose=()=>{this.onClose()})}close(){this.wsApi.close()}reset(){this.wsApi.send("RESET")}onOpen(){this.projection&&this.wsApi.send(`PROJECTION ${this.projection}`),this.bbox&&this.wsApi.send(`BBOX ${this.bbox.join(" ")}`),this.buffer&&this.wsApi.send(`BUFFER ${this.buffer.join(" ")}`),this.pingIntervalMs&&(window.clearInterval(this.pingInterval),this.pingInterval=window.setInterval(()=>{this.wsApi.send("PING")},this.pingIntervalMs))}onClose(){window.clearTimeout(this.pingInterval),window.clearTimeout(this.reconnectTimeout),this.reconnectTimeoutMs&&(this.reconnectTimeout=window.setTimeout(()=>this.open(),this.reconnectTimeoutMs))}subscribe(c,n,u,r=!1){!c||!n||this.wsApi.subscribe({channel:c},n,u,r)}unsubscribe(c,n="",u){this.wsApi.unsubscribe(`${c}${xu(ra.SCHEMATIC,ra)}${n}`,u),this.wsApi.unsubscribe(`${c}${xu(ra.TOPOGRAPHIC,ra)}${n||""}`,u)}filterDepartures(c,n=!1){let u=Object.keys(c).map(me=>c[me]);u.sort((me,be)=>wv(me,be,n));let r=new Date;r.setMinutes(r.getMinutes()+this.maxDepartureAge);let s=r.getTime(),P=new Date;P.setMinutes(P.getMinutes()-this.maxDepartureAge);let z=P.getTime(),F=[],N=[],V=null;for(let me=u.length-1;me>=0;me-=1){let be={...u[me]},Se=new Date(be.time).getTime();Se>z&&Se<s&&(be.state==="BOARDING"&&(N.indexOf(be.platform)===-1?N.push(be.platform):be.state="HIDDEN"),V&&be.to[0]===V.to[0]&&Math.abs(Se-V.time)<1e3&&be.line.name===V.line.name&&(be.state="HIDDEN"),/(STOP_CANCELLED|JOURNEY_CANCELLED)/.test(be.state)&&(be.cancelled=!0),V=be,V.time=Se,F.unshift(be))}return F}subscribeDepartures(c,n,u){window.clearTimeout(this.departureUpdateTimeout),this.unsubscribeDepartures(),this.subscribedStationUic=c;let r=c?`timetable_${c}`:null,s={};if(!r)return;let P=z=>{if(z.source===r){let F=z.content||{},N=new Date(F.timestamp).getTime()-Date.now();s[F.call_id]={...F,timediff:N},window.clearTimeout(this.departureUpdateTimeout),this.departureUpdateTimeout=window.setTimeout(()=>{let V=this.filterDepartures(s,n||!1);u(V)},100)}};this.subscribe(r,P,()=>{u([])})}unsubscribeDepartures(c){this.subscribedStationUic&&(this.unsubscribe(`timetable_${this.subscribedStationUic}`,"",c),this.subscribedStationUic=void 0)}subscribeDisruptions(c){this.subscribe(`${this.prefix}newsticker`,n=>{c(n.content)})}unsubscribeDisruptions(c){this.unsubscribe(`${this.prefix}newsticker`,"",c)}getStation(c,n){let u={channel:`station${xu(n,ra)}`,args:c};return new Promise((r,s)=>{this.wsApi.get(u,P=>{P.content?r(P.content):s()})})}getStations(c){let n=[],u={channel:`station${xu(c,ra)}`};return window.clearTimeout(this.stationUpdateTimeout),new Promise((r,s)=>{this.wsApi.get(u,P=>{P.content?(n.push(P.content),window.clearTimeout(this.stationUpdateTimeout),this.stationUpdateTimeout=window.setTimeout(()=>{r(n)},50)):s(P.content)})})}subscribeStations(c,n){this.unsubscribeStations(),this.subscribe(`station${xu(c,ra)}`,u=>{u.content&&n(u.content)})}unsubscribeStations(c){window.clearTimeout(this.stationUpdateTimeout),this.unsubscribe("station","",c)}subscribeExtraGeoms(c){this.subscribe("extra_geoms",n=>{let u=n.content;if(u){let{ref:r}=u.properties;u.type==="Feature"?this.extraGeoms[r]=u:delete this.extraGeoms[r],c(Object.keys(this.extraGeoms).map(s=>this.extraGeoms[s]))}})}unsubscribeExtraGeoms(c){this.unsubscribe("extra_geoms","",c)}subscribeTrajectory(c,n,u=!1){this.unsubscribeTrajectory(n),this.subscribe(`trajectory${xu(c,ra)}`,n,void 0,u)}unsubscribeTrajectory(c){this.unsubscribe("trajectory","",c)}subscribeDeletedVehicles(c,n,u=!1){this.unsubscribeDeletedVehicles(n),this.subscribe(`deleted_vehicles${xu(c,ra)}`,n,void 0,u)}unsubscribeDeletedVehicles(c){this.unsubscribe("deleted_vehicles","",c)}getFullTrajectory(c,n,u){let r=[`full_trajectory${xu(n,ra)}`];c&&r.push(c),(!n||n===ra.TOPOGRAPHIC)&&u&&r.push(`gen${u}`);let s={channel:r.join("_")};return new Promise(P=>{this.wsApi.get(s,z=>{z.content&&P(z.content)})})}getFullTrajectories(c,n,u){let r=c.map(s=>this.getFullTrajectory(s,n,u));return Promise.all(r)}subscribeFullTrajectory(c,n){this.unsubscribeFullTrajectory(c),this.subscribe(`full_trajectory${xu(n,ra)}_${c}`,u=>{console.log("subscribe full_trajectory",u)},u=>{console.log("subscribe full_trajectory error",u)})}unsubscribeFullTrajectory(c,n){this.unsubscribe("full_trajectory",`_${c}`,n)}getStopSequence(c){let n={channel:`stopsequence_${c}`};return new Promise((u,r)=>{this.wsApi.get(n,s=>{let P=s.content;if(P&&P.length){let z=P.map(F=>sy(F));u(z)}u([])},s=>{r(s)})})}getStopSequences(c){let n=c.map(u=>this.getStopSequence(u));return Promise.all(n)}subscribeStopSequence(c,n){window.clearTimeout(this.fullTrajectoryUpdateTimeout),this.unsubscribeStopSequence(c),this.subscribe(`stopsequence_${c}`,u=>{let r=u.content;if(r&&r.length){let s=r.map(P=>sy(P));n(s)}},u=>{console.log("subscribe stopsequence error",u)})}unsubscribeStopSequence(c,n){this.unsubscribe("stopsequence",`_${c}`,n)}subscribeHealthCheck(c){this.unsubscribeHealthCheck(),this.subscribe("healthcheck",c)}unsubscribeHealthCheck(){this.unsubscribe("healthcheck")}},Wf=ly;var ob=_=>{let c=_.filter(s=>s!=null&&s.trim&&s.trim()),n=c.map(s=>s.toLowerCase());return[...new Set(n)].map(s=>c.find(P=>P.toLowerCase()===s))},Xh=ob;var ab=_=>{if(!_)return[];let{style:c}=_;if(!c)return[];let{sourceCaches:n}=c,u=[];return Object.values(n).forEach(r=>{if(r.used){let s=r.getSource(),P=s.attribution||s.options&&s.options.attribution;P&&(u=u.concat(P.replace(/&copy;/g,"\xA9").split(/(<a.*?<\/a>)/)))}}),Xh(u)},oc=ab;var sb=(_,c,n,u)=>{let r=[];if(!_&&!c&&!n&&!u)return null;if(u){let s=typeof u=="string"?[u]:u,P=z=>{let F=z.properties.name||z.properties.line&&z.properties.line.name||"";return F?s.some(N=>new RegExp(N,"i").test(F)):!1};r.push(P)}if(_){let P=(typeof _=="string"?_.split(","):_).map(F=>F.replace(/\s+/g,"").toUpperCase()),z=F=>{let{line:N,name:V}=F.properties,me=(V||N&&N.name||"").toUpperCase();return me?P.includes(me):!1};r.push(z)}if(c){let P=(typeof c=="string"?c.split(","):c).map(F=>parseInt(F,10)),z=F=>{let N=parseInt(F.properties.routeIdentifier.split(".")[0],10);return P.includes(N)};r.push(z)}if(n){let s=typeof n=="string"?[n]:n,P=z=>s.some(F=>new RegExp(F,"i").test(z.properties.operator||""));r.push(P)}return r.length?s=>{for(let P=0;P<r.length;P+=1)if(!r[P](s))return!1;return!0}:null},uy=sb;var Ev=_=>{let c=_;Array.isArray(c)||(c=[_]);let n=[];return c.forEach(u=>{n.push(u);let{children:r}=u;n=n.concat(Ev(r||[]))}),n},$f=Ev;var Tv=(_=new Date)=>{let c=(_.getUTCMonth()+1).toString();c=c.length===1?`0${c}`:c;let n=_.getUTCDate().toString();return n=n.length===1?`0${n}`:n,[_.getUTCFullYear(),c,n].join("")},Sv=_=>[_.getUTCHours(),_.getUTCMinutes(),`${_.getUTCSeconds()}.${_.getUTCMilliseconds()}`].join(":"),km=_=>_<10?`0${_}`:_,Iv=_=>{if(!_||_<=0)return"";let c=new Date(_);return`${km(c.getHours())}:${km(c.getMinutes())}`};var lb=(_,c)=>{let n=_.properties,u=c.properties;return n.delay===null&&u.delay!==null?1:u.delay===null&&n.delay!==null?-1:n.cancelled&&!u.cancelled?u.delay<18e4?-1:1:u.cancelled&&!n.cancelled?n.delay<18e4?1:-1:u.delay-n.delay},cy=lb;var oh=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"",SS=oh.indexOf("firefox")!==-1,ub=oh.indexOf("safari")!==-1&&oh.indexOf("chrom")==-1,IS=ub&&!!(oh.indexOf("version/15.4")>=0||oh.match(/cpu (os|iphone os) 15_4 like mac os x/)),CS=oh.indexOf("webkit")!==-1&&oh.indexOf("edge")==-1,AS=oh.indexOf("macintosh")!==-1;var ah=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,Cv=typeof Image<"u"&&Image.prototype.decode,PS=function(){var _=!1;try{var c=Object.defineProperty({},"passive",{get:function(){_=!0}});window.addEventListener("_",null,c),window.removeEventListener("_",null,c)}catch{}return _}();var cb=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),hb=function(_){cb(c,_);function c(n){var u=this,r=Pm==="latest"?Pm:"v"+Pm.split("-")[0],s="Assertion failed. See https://openlayers.org/en/"+r+"/doc/errors/#"+n+" for details.";return u=_.call(this,s)||this,u.code=n,u.name="AssertionError",u.message=s,u}return c}(Error),Lm=hb;function wn(_,c){if(!_)throw new Lm(c)}var FS=new Array(6);function za(){return[1,0,0,1,0,0]}function pb(_,c,n,u,r,s,P){return _[0]=c,_[1]=n,_[2]=u,_[3]=r,_[4]=s,_[5]=P,_}function Pv(_,c){return _[0]=c[0],_[1]=c[1],_[2]=c[2],_[3]=c[3],_[4]=c[4],_[5]=c[5],_}function xo(_,c){var n=c[0],u=c[1];return c[0]=_[0]*n+_[2]*u+_[4],c[1]=_[1]*n+_[3]*u+_[5],c}function Mv(_,c,n){return pb(_,c,0,0,n,0,0)}function vs(_,c,n,u,r,s,P,z){var F=Math.sin(s),N=Math.cos(s);return _[0]=u*N,_[1]=r*F,_[2]=-u*F,_[3]=r*N,_[4]=P*u*N-z*u*F+c,_[5]=P*r*F+z*r*N+n,_}function kv(_,c,n,u,r,s,P){return hy(vs(za(),_,c,n,u,r,s,P))}function Lv(_,c){var n=fb(c);wn(n!==0,32);var u=c[0],r=c[1],s=c[2],P=c[3],z=c[4],F=c[5];return _[0]=P/n,_[1]=-r/n,_[2]=-s/n,_[3]=u/n,_[4]=(s*F-P*z)/n,_[5]=-(u*F-r*z)/n,_}function fb(_){return _[0]*_[3]-_[1]*_[2]}var Av;function hy(_){var c="matrix("+_.join(", ")+")";if(ah)return c;var n=Av||(Av=document.createElement("div"));return n.style.transform=c,n.style.transform}var Pt={POINT:"Point",LINE_STRING:"LineString",LINEAR_RING:"LinearRing",POLYGON:"Polygon",MULTI_POINT:"MultiPoint",MULTI_LINE_STRING:"MultiLineString",MULTI_POLYGON:"MultiPolygon",GEOMETRY_COLLECTION:"GeometryCollection",CIRCLE:"Circle"};var db=(_,c,n)=>{let{time_intervals:u,olGeometry:r,coordinate:s}=c.properties,P,z;if(n&&s)P=s;else if(r.getType()===Pt.POINT)P=r.getCoordinates();else if(r.getType()===Pt.LINE_STRING){let F=u||[[]],N=F[0],V=F[F.length-1];if(_<N[0])[,,z]=N,P=r.getFirstCoordinate();else if(_>V[0])[,,z]=V,P=r.getLastCoordinate();else for(let me=0;me<F.length-1;me+=1){let[be,Se]=F[me],[Ve,Ke]=F[me+1];if(be<=_&&_<=Ve){let Ge=Math.min((_-be)/(Ve-be),1)*(Ke-Se)+Se;P=r.getCoordinateAt(Ge),[,,z]=F[me];break}}}else console.error("This geometry type is not supported. Only Point or LineString are. Current geometry: ",r);return{coord:P,rotation:z}},Rv=db;var mb=(_,c,n,u,r)=>{if(!_)return{renderedTrajectories:[]};let{time:s=Date.now(),size:P=[],center:z,resolution:F,rotation:N=0,pixelRatio:V=1}=u;if(!F||!z)return{renderedTrajectories:[]};let{noInterpolate:me=!1,hoverVehicleId:be,selectedVehicleId:Se}=r,Ve=_.getContext("2d");Ve?.clearRect(0,0,_.width,_.height);let[Ke,Ie]=P;Ke&&Ie&&(_.width!==Ke||_.height!==Ie)&&([_.width,_.height]=[Ke*V,Ie*V]);let Ge=vs(za(),P[0]/2,P[1]/2,1/F,-1/F,-N,-z[0],-z[1]);_.style&&(_.style.width=`${_.width/V}px`,_.style.height=`${_.height/V}px`);let et,rt,_t,yt,ct,Tt,St,Lt,ur=[];for(let Vt=c.length-1;Vt>=0;Vt-=1){let Qt=c[Vt],{train_id:or,timeOffset:Mt}=Qt.properties,{coord:Br,rotation:Tr}=Rv(s-(Mt||0),Qt,me);if(c[Vt].properties.coordinate=Br,c[Vt].properties.rotation=Tr,!Br)continue;let br=xo(Ge,[...Br]);if(!br||(br=br.map(ai=>ai*V),br[0]<0||br[0]>_.width||br[1]<0||br[1]>_.height))continue;let Mr=n(Qt,u,r);if(!Mr)continue;let Ir=Mr.width,xr=Mr.height;be!==or&&Se!==or&&Ve?.drawImage(Mr,br[0]-Ir/2,br[1]-xr/2,Ir,xr),be&&be===or&&(et=Mr,rt=br,_t=Ir,yt=xr),Se&&Se===or&&(ct=Mr,Tt=br,St=Ir,Lt=xr),ur.push(Qt)}return ct&&Tt&&St&&Lt&&Ve?.drawImage(ct,Tt[0]-St/2,Tt[1]-Lt/2,St,Lt),et&&rt&&_t&&yt&&Ve?.drawImage(et,rt[0]-_t/2,rt[1]-yt/2,_t,yt),{renderedTrajectories:ur}},Hf=mb;var Gl={RADIANS:"radians",DEGREES:"degrees",FEET:"ft",METERS:"m",PIXELS:"pixels",TILE_PIXELS:"tile-pixels",USFEET:"us-ft"},ZS={9001:Gl.METERS,9002:Gl.FEET,9003:Gl.USFEET,9101:Gl.RADIANS,9102:Gl.DEGREES};var bu={};bu[Gl.RADIANS]=6370997/(2*Math.PI);bu[Gl.DEGREES]=2*Math.PI*6370997/360;bu[Gl.FEET]=.3048;bu[Gl.METERS]=1;bu[Gl.USFEET]=1200/3937;var ac=Gl;var gb=function(){function _(c){this.code_=c.code,this.units_=c.units,this.extent_=c.extent!==void 0?c.extent:null,this.worldExtent_=c.worldExtent!==void 0?c.worldExtent:null,this.axisOrientation_=c.axisOrientation!==void 0?c.axisOrientation:"enu",this.global_=c.global!==void 0?c.global:!1,this.canWrapX_=!!(this.global_&&this.extent_),this.getPointResolutionFunc_=c.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=c.metersPerUnit}return _.prototype.canWrapX=function(){return this.canWrapX_},_.prototype.getCode=function(){return this.code_},_.prototype.getExtent=function(){return this.extent_},_.prototype.getUnits=function(){return this.units_},_.prototype.getMetersPerUnit=function(){return this.metersPerUnit_||bu[this.units_]},_.prototype.getWorldExtent=function(){return this.worldExtent_},_.prototype.getAxisOrientation=function(){return this.axisOrientation_},_.prototype.isGlobal=function(){return this.global_},_.prototype.setGlobal=function(c){this.global_=c,this.canWrapX_=!!(c&&this.extent_)},_.prototype.getDefaultTileGrid=function(){return this.defaultTileGrid_},_.prototype.setDefaultTileGrid=function(c){this.defaultTileGrid_=c},_.prototype.setExtent=function(c){this.extent_=c,this.canWrapX_=!!(this.global_&&c)},_.prototype.setWorldExtent=function(c){this.worldExtent_=c},_.prototype.setGetPointResolution=function(c){this.getPointResolutionFunc_=c},_.prototype.getPointResolutionFunc=function(){return this.getPointResolutionFunc_},_}(),Rm=gb;function jl(_,c,n){return Math.min(Math.max(_,c),n)}var zv=function(){var _;return"cosh"in Math?_=Math.cosh:_=function(c){var n=Math.exp(c);return(n+1/n)/2},_}(),HS=function(){var _;return"log2"in Math?_=Math.log2:_=function(c){return Math.log(c)*Math.LOG2E},_}();function Dv(_,c,n,u,r,s){var P=r-n,z=s-u;if(P!==0||z!==0){var F=((_-n)*P+(c-u)*z)/(P*P+z*z);F>1?(n=r,u=s):F>0&&(n+=P*F,u+=z*F)}return ql(_,c,n,u)}function ql(_,c,n,u){var r=n-_,s=u-c;return r*r+s*s}function Ov(_){return _*180/Math.PI}function zm(_,c){var n=_%c;return n*c<0?n+c:n}function gl(_,c,n){return _+n*(c-_)}var yb=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Kf=6378137,Wp=Math.PI*Kf,_b=[-Wp,-Wp,Wp,Wp],vb=[-180,-85,180,85],Dm=Kf*Math.log(Math.tan(Math.PI/2)),Xp=function(_){yb(c,_);function c(n){return _.call(this,{code:n,units:ac.METERS,extent:_b,global:!0,worldExtent:vb,getPointResolution:function(u,r){return u/zv(r[1]/Kf)}})||this}return c}(Rm),py=[new Xp("EPSG:3857"),new Xp("EPSG:102100"),new Xp("EPSG:102113"),new Xp("EPSG:900913"),new Xp("http://www.opengis.net/def/crs/EPSG/0/3857"),new Xp("http://www.opengis.net/gml/srs/epsg.xml#3857")];function Fv(_,c,n){var u=_.length,r=n>1?n:2,s=c;s===void 0&&(r>2?s=_.slice():s=new Array(u));for(var P=0;P<u;P+=r){s[P]=Wp*_[P]/180;var z=Kf*Math.log(Math.tan(Math.PI*(+_[P+1]+90)/360));z>Dm?z=Dm:z<-Dm&&(z=-Dm),s[P+1]=z}return s}function Bv(_,c,n){var u=_.length,r=n>1?n:2,s=c;s===void 0&&(r>2?s=_.slice():s=new Array(u));for(var P=0;P<u;P+=r)s[P]=180*_[P]/Wp,s[P+1]=360*Math.atan(Math.exp(_[P+1]/Kf))/Math.PI-90;return s}var xb=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),bb=6378137,Uv=[-180,-90,180,90],wb=Math.PI*bb/180,Wh=function(_){xb(c,_);function c(n,u){return _.call(this,{code:n,units:ac.DEGREES,extent:Uv,axisOrientation:u,global:!0,metersPerUnit:wb,worldExtent:Uv})||this}return c}(Rm),fy=[new Wh("CRS:84"),new Wh("EPSG:4326","neu"),new Wh("urn:ogc:def:crs:OGC:1.3:CRS84"),new Wh("urn:ogc:def:crs:OGC:2:84"),new Wh("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new Wh("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new Wh("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];var dy={};function Nv(_){return dy[_]||dy[_.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function Vv(_,c){dy[_]=c}var $p={};function Yf(_,c,n){var u=_.getCode(),r=c.getCode();u in $p||($p[u]={}),$p[u][r]=n}function Gv(_,c){var n;return _ in $p&&c in $p[_]&&(n=$p[_][c]),n}var Mo={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function wu(_){for(var c=Ya(),n=0,u=_.length;n<u;++n)my(c,_[n]);return c}function Eb(_,c,n){var u=Math.min.apply(null,_),r=Math.min.apply(null,c),s=Math.max.apply(null,_),P=Math.max.apply(null,c);return sh(u,r,s,P,n)}function yl(_,c,n){return n?(n[0]=_[0]-c,n[1]=_[1]-c,n[2]=_[2]+c,n[3]=_[3]+c,n):[_[0]-c,_[1]-c,_[2]+c,_[3]+c]}function jv(_,c){return c?(c[0]=_[0],c[1]=_[1],c[2]=_[2],c[3]=_[3],c):_.slice()}function xs(_,c,n){var u,r;return c<_[0]?u=_[0]-c:_[2]<c?u=c-_[2]:u=0,n<_[1]?r=_[1]-n:_[3]<n?r=n-_[3]:r=0,u*u+r*r}function Hp(_,c){return Jf(_,c[0],c[1])}function sc(_,c){return _[0]<=c[0]&&c[2]<=_[2]&&_[1]<=c[1]&&c[3]<=_[3]}function Jf(_,c,n){return _[0]<=c&&c<=_[2]&&_[1]<=n&&n<=_[3]}function Om(_,c){var n=_[0],u=_[1],r=_[2],s=_[3],P=c[0],z=c[1],F=Mo.UNKNOWN;return P<n?F=F|Mo.LEFT:P>r&&(F=F|Mo.RIGHT),z<u?F=F|Mo.BELOW:z>s&&(F=F|Mo.ABOVE),F===Mo.UNKNOWN&&(F=Mo.INTERSECTING),F}function Ya(){return[1/0,1/0,-1/0,-1/0]}function sh(_,c,n,u,r){return r?(r[0]=_,r[1]=c,r[2]=n,r[3]=u,r):[_,c,n,u]}function Kp(_){return sh(1/0,1/0,-1/0,-1/0,_)}function Yp(_,c){var n=_[0],u=_[1];return sh(n,u,n,u,c)}function Fm(_,c,n,u,r){var s=Kp(r);return gy(s,_,c,n,u)}function Bm(_,c){return _[0]==c[0]&&_[2]==c[2]&&_[1]==c[1]&&_[3]==c[3]}function qv(_,c){return c[0]<_[0]&&(_[0]=c[0]),c[2]>_[2]&&(_[2]=c[2]),c[1]<_[1]&&(_[1]=c[1]),c[3]>_[3]&&(_[3]=c[3]),_}function my(_,c){c[0]<_[0]&&(_[0]=c[0]),c[0]>_[2]&&(_[2]=c[0]),c[1]<_[1]&&(_[1]=c[1]),c[1]>_[3]&&(_[3]=c[1])}function gy(_,c,n,u,r){for(;n<u;n+=r)Tb(_,c[n],c[n+1]);return _}function Tb(_,c,n){_[0]=Math.min(_[0],c),_[1]=Math.min(_[1],n),_[2]=Math.max(_[2],c),_[3]=Math.max(_[3],n)}function Zv(_,c){var n;return n=c(yy(_)),n||(n=c(_y(_)),n)||(n=c(xy(_)),n)||(n=c(vy(_)),n)?n:!1}function yy(_){return[_[0],_[1]]}function _y(_){return[_[2],_[1]]}function $h(_){return[(_[0]+_[2])/2,(_[1]+_[3])/2]}function Eu(_){return _[3]-_[1]}function Xv(_,c,n){var u=n||Ya();return ko(_,c)?(_[0]>c[0]?u[0]=_[0]:u[0]=c[0],_[1]>c[1]?u[1]=_[1]:u[1]=c[1],_[2]<c[2]?u[2]=_[2]:u[2]=c[2],_[3]<c[3]?u[3]=_[3]:u[3]=c[3]):Kp(u),u}function vy(_){return[_[0],_[3]]}function xy(_){return[_[2],_[3]]}function bs(_){return _[2]-_[0]}function ko(_,c){return _[0]<=c[2]&&_[2]>=c[0]&&_[1]<=c[3]&&_[3]>=c[1]}function Wv(_,c){return c?(c[0]=_[0],c[1]=_[1],c[2]=_[2],c[3]=_[3],c):_}function $v(_,c,n){var u=!1,r=Om(_,c),s=Om(_,n);if(r===Mo.INTERSECTING||s===Mo.INTERSECTING)u=!0;else{var P=_[0],z=_[1],F=_[2],N=_[3],V=c[0],me=c[1],be=n[0],Se=n[1],Ve=(Se-me)/(be-V),Ke=void 0,Ie=void 0;!!(s&Mo.ABOVE)&&!(r&Mo.ABOVE)&&(Ke=be-(Se-N)/Ve,u=Ke>=P&&Ke<=F),!u&&!!(s&Mo.RIGHT)&&!(r&Mo.RIGHT)&&(Ie=Se-(be-F)*Ve,u=Ie>=z&&Ie<=N),!u&&!!(s&Mo.BELOW)&&!(r&Mo.BELOW)&&(Ke=be-(Se-z)/Ve,u=Ke>=P&&Ke<=F),!u&&!!(s&Mo.LEFT)&&!(r&Mo.LEFT)&&(Ie=Se-(be-P)*Ve,u=Ie>=z&&Ie<=N)}return u}function Hv(_,c,n,u){var r=[];if(u>1)for(var s=_[2]-_[0],P=_[3]-_[1],z=0;z<u;++z)r.push(_[0]+s*z/u,_[1],_[2],_[1]+P*z/u,_[2]-s*z/u,_[3],_[0],_[3]-P*z/u);else r=[_[0],_[1],_[2],_[1],_[2],_[3],_[0],_[3]];c(r,r,2);for(var F=[],N=[],z=0,V=r.length;z<V;z+=2)F.push(r[z]),N.push(r[z+1]);return Eb(F,N,n)}function Kv(_,c){var n=c.getExtent(),u=$h(_);if(c.canWrapX()&&(u[0]<n[0]||u[0]>=n[2])){var r=bs(n),s=Math.floor((u[0]-n[0])/r),P=s*r;_[0]-=P,_[2]-=P}return _}function by(_,c){var n=_[0],u=_[1],r=c[0],s=c[1],P=r[0],z=r[1],F=s[0],N=s[1],V=F-P,me=N-z,be=V===0&&me===0?0:(V*(n-P)+me*(u-z))/(V*V+me*me||0),Se,Ve;return be<=0?(Se=P,Ve=z):be>=1?(Se=F,Ve=N):(Se=P+be*V,Ve=z+be*me),[Se,Ve]}function Tu(_,c){for(var n=!0,u=_.length-1;u>=0;--u)if(_[u]!=c[u]){n=!1;break}return n}function Jp(_,c){var n=_[0]-c[0],u=_[1]-c[1];return n*n+u*u}function wy(_,c){return Math.sqrt(Jp(_,c))}function Yv(_,c){return Jp(_,by(_,c))}function Jv(_,c){if(c.canWrapX()){var n=bs(c.getExtent()),u=Qv(_,c,n);u&&(_[0]-=u*n)}return _}function Qv(_,c,n){var u=c.getExtent(),r=0;if(c.canWrapX()&&(_[0]<u[0]||_[0]>u[2])){var s=n||bs(u);r=Math.floor((_[0]-u[0])/s)}return r}var Ey=!0;function Sb(_){var c=_===void 0?!0:_;Ey=!c}function Ty(_,c,n){var u;if(c!==void 0){for(var r=0,s=_.length;r<s;++r)c[r]=_[r];u=c}else u=_.slice();return u}function Ib(_,c,n){if(c!==void 0&&_!==c){for(var u=0,r=_.length;u<r;++u)c[u]=_[u];_=c}return _}function Cb(_){Vv(_.getCode(),_),Yf(_,_,Ty)}function Ab(_){_.forEach(Cb)}function ga(_){return typeof _=="string"?Nv(_):_||null}function ex(_){Ab(_),_.forEach(function(c){_.forEach(function(n){c!==n&&Yf(c,n,Ty)})})}function Pb(_,c,n,u){_.forEach(function(r){c.forEach(function(s){Yf(r,s,n),Yf(s,r,u)})})}function uo(_,c){return Sb(),Nm(_,"EPSG:4326",c!==void 0?c:"EPSG:3857")}function lh(_,c){var n=Nm(_,c!==void 0?c:"EPSG:3857","EPSG:4326"),u=n[0];return(u<-180||u>180)&&(n[0]=zm(u+180,360)-180),n}function tx(_,c){if(_===c)return!0;var n=_.getUnits()===c.getUnits();if(_.getCode()===c.getCode())return n;var u=Um(_,c);return u===Ty&&n}function Um(_,c){var n=_.getCode(),u=c.getCode(),r=Gv(n,u);return r||(r=Ib),r}function Qf(_,c){var n=ga(_),u=ga(c);return Um(n,u)}function Nm(_,c,n){var u=Qf(c,n);return u(_,void 0,_.length)}function ed(_,c,n,u){var r=Qf(c,n);return Hv(_,r,void 0,u)}var Zl=null;function uh(){return Zl}function Sy(_,c){return Zl?Nm(_,c,Zl):_}function Xl(_,c){return Zl?Nm(_,Zl,c):(Ey&&!Tu(_,[0,0])&&_[0]>=-180&&_[0]<=180&&_[1]>=-90&&_[1]<=90&&(Ey=!1,console.warn("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),_)}function Qp(_,c){return Zl?ed(_,c,Zl):_}function td(_,c){return Zl?ed(_,Zl,c):_}function rx(_,c){if(!Zl)return _;var n=ga(c).getUnits(),u=Zl.getUnits();return n&&u?_*bu[n]/bu[u]:_}function Mb(){ex(py),ex(fy),Pb(fy,py,Fv,Bv)}Mb();function ef(_){return c=>{let{map:n,mbMap:u,olLayer:r}=_;if(!n||!u)return null;let s=u.getCanvas(),{viewState:P}=c,z=r.getOpacity();return s.style.opacity=z,u.jumpTo({center:lh(P.center),zoom:P.zoom-1,bearing:Ov(-P.rotation),animate:!1}),s.isConnected?(s.width!==c.size[0]||s.height!==c.size[1])&&u.resize():n.render(),u.redraw(),u.getContainer()}}function tf(_){return c=>{let{map:n,mbMap:u,renderState:r,olLayer:s}=_;if(!n||!u)return document.createElement("div");let P=!1,z=u.getCanvas(),{viewState:F}=c,N=s?.getVisible();r&&r?.visible!==N&&(z.style.display=N?"block":"none",r.visible=N,z.style.position="absolute");let V=s?.getOpacity();z&&r&&r.opacity!==V&&(z.style.opacity=V,r.opacity=V);let{rotation:me}=F;r&&r.rotation!==me&&(u.rotateTo(-(me||0)*180/Math.PI,{animate:!1}),P=!0,r.rotation=me),r&&r.center&&(r.zoom!==F.zoom||r.center[0]!==F.center[0]||r.center[1]!==F.center[1])&&(u.jumpTo({center:lh(F.center),zoom:F.zoom-1}),P=!0,r.zoom=F.zoom,r.center=F.center);let be=n.getSize()||[0,0];if(r&&r.size&&(r.size[0]!==be[0]||r.size[1]!==be[1])&&(P=!0,r.size=be),u&&u.style&&u.isStyleLoaded()&&P)try{u._frame&&(u._frame.cancel(),u._frame=null),u._render()}catch(Se){console.warn(Se)}return u.getContainer()}}var rf={};iy(rf,{bgColors:()=>nx,getBgColor:()=>Rb,getDelayColor:()=>Ob,getDelayText:()=>Fb,getRadius:()=>Lb,getTextColor:()=>zb,getTextSize:()=>Db,getTypeIndex:()=>Vm,textColors:()=>ox,types:()=>ix});var kb={0:[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],1:[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],2:[0,0,0,0,0,2,2,3,7,7,7,12,15,15,15,15,15],3:[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],4:[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],5:[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],6:[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],7:[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],8:[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],9:[0,0,0,0,0,2,2,3,7,7,7,12,15,15,15,15,15]},ix=[/^Tram/i,/^Subway( \/ Metro \/ S-Bahn)?/i,/^Train/i,/^Bus/i,/^Ferry/i,/^Cable ?Car/i,/^Gondola/i,/^Funicular/i,/^(Long distance bus|coach)/i,/^Rail/i],nx=["#ffb400","#ff5400","#ff8080","#ea0000","#3000ff","#ffb400","#41a27b","#00d237","#b5b5b5","#ff8080"],ox=["#000000","#ffffff","#000000","#ffffff","#ffffff","#000000","#ffffff","#000000","#000000","#000000"],Vm=_=>typeof _=="string"?ix.findIndex(c=>c.test(_)):_,Lb=(_,c)=>{try{let n=Vm(_||0);return kb[n][c]}catch{return 1}},Rb=(_=0)=>{try{let c=Vm(_);return nx[c]}catch{return 1}},zb=(_=0)=>{try{let c=Vm(_);return ox[c]}catch{return 1}},Db=(_,c,n,u)=>{if(!_)return 0;_.font=`bold ${u}px Arial`;let r=_.measureText(n),s=25,P=0;for(;r.width>c-6&&P<s;)u-=.5,_.font=`bold ${u}px arial, sans-serif`,r=_.measureText(n),P+=1;return u},Ob=(_,c,n)=>c?n?"#ff0000":"#a0a0a0":_>=36e5?"#ed004c":_>=5e5?"#e80000":_>=3e5?"#ff4a00":_>=18e4?"#f7bf00":_===null?"#a0a0a0":"#00a00c",Fb=(_,c)=>c?String.fromCodePoint(215):_>36e5?`+${Math.round(_/36e5)}h`:_>59e3?`+${Math.round(_/6e4)}m`:_>0?`+${_}s`:"";var Bb=(_,c)=>{let n=null;return typeof window>"u"?null:(document?.createElement?(n=document.createElement("canvas"),n.width=_,n.height=c):OffscreenCanvas?n=new OffscreenCanvas(_,c):console.error("We didn't find a way to create a canvas element, document.createElement('canvas') and new OffscrenCanvas() are not supported"),n)},nf=Bb;var Iy={},ky=(_,c,n)=>{let u=`${_}, ${c}, ${n}`;if(!Iy[u]){let r=nf(_*2,_*2);if(r){let s=r.getContext("2d");if(!s)return null;s.beginPath(),s.arc(_,_,c,0,2*Math.PI,!1),s.fillStyle=n,s.filter="blur(1px)",s.fill(),Iy[u]=r}}return Iy[u]},Cy={},Ly=(_,c,n,u,r,s="#000",P=1)=>{let z=`${_}, ${c}, ${u}, ${r}, ${s}, ${P}`;if(!Cy[z]){let F=nf(_,n+8*P);if(F){let N=F.getContext("2d");if(!N)return null;N.textAlign="left",N.textBaseline="middle",N.font=u,N.fillStyle=r,N.strokeStyle=s,N.lineWidth=1.5*P;let V=c;N.strokeText(V,0,n),N.fillText(V,0,n),Cy[z]=F}}return Cy[z]},Ay={},Ry=(_,c,n,u,r,s)=>{let P=`${_}, ${c}, ${n}, ${u}, ${r}, ${s}`;if(!Ay[P]){let z=nf(_*2,_*2);if(z){let F=z.getContext("2d");if(!F)return null;F.fillStyle=n,u&&(F.lineWidth=1*s,F.strokeStyle="#000000"),F.beginPath(),F.arc(_,_,c,0,2*Math.PI,!1),F.fill(),r&&F.setLineDash([5,3]),u&&F.stroke(),Ay[P]=z}}return Ay[P]},Py={},zy=(_,c,n,u,r,s,P)=>{let z=`${_}, ${c}, ${n}, ${u},${r}, ${s}, ${P}`;if(!Py[z]){let F=nf(c*2,c*2);if(F){let N=F.getContext("2d");if(!N)return null;s&&(N.save(),N.textBaseline="middle",N.textAlign="center",N.font=`bold ${n+2}px Arial`,N.strokeStyle=r,N.strokeText(_,c,c),N.restore()),N.textBaseline="middle",N.textAlign="center",N.fillStyle=u,N.font=`bold ${n}px Arial`,N.strokeStyle=r,N.strokeText(_,c,c),N.fillText(_,c,c),Py[z]=F}}return Py[z]},My={},Ub=(_,c,n)=>{let{hoverVehicleId:u,selectedVehicleId:r,useDelayStyle:s,delayOutlineColor:P="#000",delayDisplay:z=3e5,getRadius:F=()=>0,getBgColor:N=()=>"#000",getDelayColor:V=()=>"#000",getDelayText:me=()=>null,getTextColor:be=()=>"#000",getTextSize:Se=()=>0}=n,{zoom:Ve,pixelRatio:Ke=1}=c,{type:Ie}=_.properties,{train_id:Ge,line:et,delay:rt,state:_t,operator_provides_realtime_journey:yt}=_.properties,{name:ct,text_color:Tt,color:St}=et||{},Lt=_t==="JOURNEY_CANCELLED";Ie||(Ie="Rail"),ct||(ct="I"),Tt||(Tt="#000000"),St&&St[0]!=="#"&&(St=`#${St}`),Tt[0]!=="#"&&(Tt=`#${Tt}`);let ur=Math.min(Math.floor(Ve||1),16),Vt=!!(u&&u===Ge),Qt=!!(r&&r===Ge),or=F(Ie,ur)*Ke,Mt=or>=7*Ke;(Vt||Qt)&&(or=Mt?or+5*Ke:14*Ke);let Br=or>10*Ke,Tr=`${or}${Vt}${Qt}${Lt}${rt}`;if(s?Tr+=`${yt}`:Tr+=`${Ie}${St}`,Br&&(Tr+=`${ct}${Tt}`),!My[Tr]){if(or===0)return null;let br=1*Ke,Mr=or+2,Ir=or*2,xr=Mr*2+br*2+100*Ke,ai=xr/2,jt=nf(xr,xr);if(jt){let Yr=jt.getContext("2d");if(!Yr)return null;if(Mt&&rt!==null){let Li=ky(ai,Mr,V(rt,Lt));Li&&Yr.drawImage(Li,0,0)}if(Mt&&(Vt||(rt||0)>=z||Lt)){let Li=Math.max(Lt?19:14,Math.min(Lt?19:17,or*1.2))*Ke,Pn=me(rt,Lt);if(Pn){let Ni=Pn.length*Li,Cr=Ly(Ni,Pn,Li,`bold ${Li}px arial, sans-serif`,V(rt,Lt,!0),P,Ke);Cr&&Yr.drawImage(Cr,ai+Mr+br,ai-Li)}}let vi;s?vi=V(rt,Lt):vi=St||N(Ie);let Ur=Ry(ai,or,vi,Mt||Vt||Qt,!!Mt&&!!s&&rt===null&&yt==="yes",Ke);if(Ur&&Yr.drawImage(Ur,0,0),Br&&Yr){let Li=Math.max(or,10),Pn=Se(Yr,Ir,ct,Li),Ni=s?"#000000":Tt||be(Ie),Zn=zy(ct,ai,Pn,Ni,vi,!!s&&rt===null&&yt==="yes",Ke);Zn&&Yr.drawImage(Zn,0,0)}My[Tr]=jt}}return My[Tr]},Hh=Ub;var Nb=(_,c,n)=>Hh(_,c,{...n,useDelayStyle:!0}),Dy=Nb;var of,Vb=()=>{if(!of){of=document.createElement("canvas"),of.width=15,of.height=15;let _=of.getContext("2d");_&&(_.arc(8,8,5,0,2*Math.PI,!1),_.fillStyle="#8ED6FF",_.fill(),_.lineWidth=3,_.strokeStyle="black",_.stroke(),_.lineWidth=3)}return of},Oy=Vb;var Qi={OPACITY:"opacity",VISIBLE:"visible",EXTENT:"extent",Z_INDEX:"zIndex",MAX_RESOLUTION:"maxResolution",MIN_RESOLUTION:"minResolution",MAX_ZOOM:"maxZoom",MIN_ZOOM:"minZoom",SOURCE:"source",MAP:"map"};var Gb=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),jb=function(_){Gb(c,_);function c(n){var u=_.call(this)||this;u.on,u.once,u.un,u.background_=n.background;var r=Ra({},n);return typeof n.properties=="object"&&(delete r.properties,Ra(r,n.properties)),r[Qi.OPACITY]=n.opacity!==void 0?n.opacity:1,wn(typeof r[Qi.OPACITY]=="number",64),r[Qi.VISIBLE]=n.visible!==void 0?n.visible:!0,r[Qi.Z_INDEX]=n.zIndex,r[Qi.MAX_RESOLUTION]=n.maxResolution!==void 0?n.maxResolution:1/0,r[Qi.MIN_RESOLUTION]=n.minResolution!==void 0?n.minResolution:0,r[Qi.MIN_ZOOM]=n.minZoom!==void 0?n.minZoom:-1/0,r[Qi.MAX_ZOOM]=n.maxZoom!==void 0?n.maxZoom:1/0,u.className_=r.className!==void 0?r.className:"ol-layer",delete r.className,u.setProperties(r),u.state_=null,u}return c.prototype.getBackground=function(){return this.background_},c.prototype.getClassName=function(){return this.className_},c.prototype.getLayerState=function(n){var u=this.state_||{layer:this,managed:n===void 0?!0:n},r=this.getZIndex();return u.opacity=jl(Math.round(this.getOpacity()*100)/100,0,1),u.visible=this.getVisible(),u.extent=this.getExtent(),u.zIndex=r===void 0&&!u.managed?1/0:r,u.maxResolution=this.getMaxResolution(),u.minResolution=Math.max(this.getMinResolution(),0),u.minZoom=this.getMinZoom(),u.maxZoom=this.getMaxZoom(),this.state_=u,u},c.prototype.getLayersArray=function(n){return jr()},c.prototype.getLayerStatesArray=function(n){return jr()},c.prototype.getExtent=function(){return this.get(Qi.EXTENT)},c.prototype.getMaxResolution=function(){return this.get(Qi.MAX_RESOLUTION)},c.prototype.getMinResolution=function(){return this.get(Qi.MIN_RESOLUTION)},c.prototype.getMinZoom=function(){return this.get(Qi.MIN_ZOOM)},c.prototype.getMaxZoom=function(){return this.get(Qi.MAX_ZOOM)},c.prototype.getOpacity=function(){return this.get(Qi.OPACITY)},c.prototype.getSourceState=function(){return jr()},c.prototype.getVisible=function(){return this.get(Qi.VISIBLE)},c.prototype.getZIndex=function(){return this.get(Qi.Z_INDEX)},c.prototype.setBackground=function(n){this.background_=n,this.changed()},c.prototype.setExtent=function(n){this.set(Qi.EXTENT,n)},c.prototype.setMaxResolution=function(n){this.set(Qi.MAX_RESOLUTION,n)},c.prototype.setMinResolution=function(n){this.set(Qi.MIN_RESOLUTION,n)},c.prototype.setMaxZoom=function(n){this.set(Qi.MAX_ZOOM,n)},c.prototype.setMinZoom=function(n){this.set(Qi.MIN_ZOOM,n)},c.prototype.setOpacity=function(n){wn(typeof n=="number",64),this.set(Qi.OPACITY,n)},c.prototype.setVisible=function(n){this.set(Qi.VISIBLE,n)},c.prototype.setZIndex=function(n){this.set(Qi.Z_INDEX,n)},c.prototype.disposeInternal=function(){this.state_&&(this.state_.layer=null,this.state_=null),_.prototype.disposeInternal.call(this)},c}(Po),Gm=jb;var rd={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"};var Su={UNDEFINED:"undefined",LOADING:"loading",READY:"ready",ERROR:"error"};var qb=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Zb=function(_){qb(c,_);function c(n){var u=this,r=Ra({},n);delete r.source,u=_.call(this,r)||this,u.on,u.once,u.un,u.mapPrecomposeKey_=null,u.mapRenderKey_=null,u.sourceChangeKey_=null,u.renderer_=null,u.rendered=!1,n.render&&(u.render=n.render),n.map&&u.setMap(n.map),u.addChangeListener(Qi.SOURCE,u.handleSourcePropertyChange_);var s=n.source?n.source:null;return u.setSource(s),u}return c.prototype.getLayersArray=function(n){var u=n||[];return u.push(this),u},c.prototype.getLayerStatesArray=function(n){var u=n||[];return u.push(this.getLayerState()),u},c.prototype.getSource=function(){return this.get(Qi.SOURCE)||null},c.prototype.getRenderSource=function(){return this.getSource()},c.prototype.getSourceState=function(){var n=this.getSource();return n?n.getState():Su.UNDEFINED},c.prototype.handleSourceChange_=function(){this.changed()},c.prototype.handleSourcePropertyChange_=function(){this.sourceChangeKey_&&(Ao(this.sourceChangeKey_),this.sourceChangeKey_=null);var n=this.getSource();n&&(this.sourceChangeKey_=lo(n,Ji.CHANGE,this.handleSourceChange_,this)),this.changed()},c.prototype.getFeatures=function(n){return this.renderer_?this.renderer_.getFeatures(n):new Promise(function(u){return u([])})},c.prototype.getData=function(n){return!this.renderer_||!this.rendered?null:this.renderer_.getData(n)},c.prototype.render=function(n,u){var r=this.getRenderer();if(r.prepareFrame(n))return this.rendered=!0,r.renderFrame(n,u)},c.prototype.unrender=function(){this.rendered=!1},c.prototype.setMapInternal=function(n){n||this.unrender(),this.set(Qi.MAP,n)},c.prototype.getMapInternal=function(){return this.get(Qi.MAP)},c.prototype.setMap=function(n){this.mapPrecomposeKey_&&(Ao(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),n||this.changed(),this.mapRenderKey_&&(Ao(this.mapRenderKey_),this.mapRenderKey_=null),n&&(this.mapPrecomposeKey_=lo(n,rd.PRECOMPOSE,function(u){var r=u,s=r.frameState.layerStatesArray,P=this.getLayerState(!1);wn(!s.some(function(z){return z.layer===P.layer}),67),s.push(P)},this),this.mapRenderKey_=lo(this,Ji.CHANGE,n.render,n),this.changed())},c.prototype.setSource=function(n){this.set(Qi.SOURCE,n)},c.prototype.getRenderer=function(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_},c.prototype.hasRenderer=function(){return!!this.renderer_},c.prototype.createRenderer=function(){return null},c.prototype.disposeInternal=function(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_),this.setSource(null),_.prototype.disposeInternal.call(this)},c}(Gm);function ax(_,c){if(!_.visible)return!1;var n=c.resolution;if(n<_.minResolution||n>=_.maxResolution)return!1;var u=c.zoom;return u>_.minZoom&&u<=_.maxZoom}var Kh=Zb;var Fy=class extends Po{constructor(n={}){super(n);this.defineProperties(n);let{active:u}={active:n.active!==!1,...n};this.active=u}defineProperties(n){let{target:u,element:r,render:s}={...n};Object.defineProperties(this,{active:{get:()=>this.get("active"),set:P=>{this.set("active",P),P?this.activate():this.deactivate(),this.render()}},map:{get:()=>this.get("map"),set:P=>{if(this.map&&this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element),this.deactivate(),this.set("map",P),this.map){let z=this.target||this.map.getTargetElement&&this.map.getTargetElement()||this.map.getContainer&&this.map.getContainer();this.element||this.createDefaultElement(),this.element&&z.appendChild(this.element),this.active&&this.activate()}this.render()}},target:{value:u},element:{value:r,writable:!0},render:{value:s||this.render,writable:!0}})}attachToMap(n){this.map=n}detachFromMap(){this.map=void 0}activate(){this.deactivate()}deactivate(){console.error("This function must be implemented in subclasses")}render(n){console.error("This function must be implemented in subclasses")}createDefaultElement(){console.error("This function must be implemented in subclasses")}},af=Fy;var By=class extends af{render(){!this.element||(this.element.innerHTML=this.active?this.getCopyrights().join(" | "):"")}createDefaultElement(){this.element=document.createElement("div"),this.element.id="mbt-copyright",Object.assign(this.element.style,{position:"absolute",bottom:0,right:0,fontSize:".8rem",padding:"0 10px"})}getCopyrights(){return console.error("The getCopyrights() function must be implemented in subclasses.",this),[]}},jm=By;var Uy=class extends jm{constructor(n){super(n);this.onPostRender=this.onPostRender.bind(this)}getCopyrights(){if(!this.frameState)return[];let n=[];return this.frameState?.layerStatesArray.forEach(u=>{let{layer:r}=u;this.frameState&&ax(u,this.frameState.viewState)&&r&&r.getSource&&r.getSource()&&r.getSource().getAttributions()&&(n=n.concat(r.getSource().getAttributions()(this.frameState)))}),Xh(n)}activate(){super.activate(),this.map&&this.map.on("postrender",this.onPostRender)}deactivate(){this.map&&this.map.un("postrender",this.onPostRender),super.deactivate()}onPostRender(n){this.map&&this.element&&(this.frameState=n.frameState||void 0,this.render())}},sx=Uy;var ws={ADD:"add",REMOVE:"remove"};var ux=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),lx={LENGTH:"length"},qm=function(_){ux(c,_);function c(n,u,r){var s=_.call(this,n)||this;return s.element=u,s.index=r,s}return c}(La);var Xb=function(_){ux(c,_);function c(n,u){var r=_.call(this)||this;r.on,r.once,r.un;var s=u||{};if(r.unique_=!!s.unique,r.array_=n||[],r.unique_)for(var P=0,z=r.array_.length;P<z;++P)r.assertUnique_(r.array_[P],P);return r.updateLength_(),r}return c.prototype.clear=function(){for(;this.getLength()>0;)this.pop()},c.prototype.extend=function(n){for(var u=0,r=n.length;u<r;++u)this.push(n[u]);return this},c.prototype.forEach=function(n){for(var u=this.array_,r=0,s=u.length;r<s;++r)n(u[r],r,u)},c.prototype.getArray=function(){return this.array_},c.prototype.item=function(n){return this.array_[n]},c.prototype.getLength=function(){return this.get(lx.LENGTH)},c.prototype.insertAt=function(n,u){this.unique_&&this.assertUnique_(u),this.array_.splice(n,0,u),this.updateLength_(),this.dispatchEvent(new qm(ws.ADD,u,n))},c.prototype.pop=function(){return this.removeAt(this.getLength()-1)},c.prototype.push=function(n){this.unique_&&this.assertUnique_(n);var u=this.getLength();return this.insertAt(u,n),this.getLength()},c.prototype.remove=function(n){for(var u=this.array_,r=0,s=u.length;r<s;++r)if(u[r]===n)return this.removeAt(r)},c.prototype.removeAt=function(n){var u=this.array_[n];return this.array_.splice(n,1),this.updateLength_(),this.dispatchEvent(new qm(ws.REMOVE,u,n)),u},c.prototype.setAt=function(n,u){var r=this.getLength();if(n<r){this.unique_&&this.assertUnique_(u,n);var s=this.array_[n];this.array_[n]=u,this.dispatchEvent(new qm(ws.REMOVE,s,n)),this.dispatchEvent(new qm(ws.ADD,u,n))}else{for(var P=r;P<n;++P)this.insertAt(P,void 0);this.insertAt(n,u)}},c.prototype.updateLength_=function(){this.set(lx.LENGTH,this.array_.length)},c.prototype.assertUnique_=function(n,u){for(var r=0,s=this.array_.length;r<s;++r)if(this.array_[r]===n&&r!==u)throw new Lm(58)},c}(Po),ch=Xb;var Wb=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),$b=function(_){Wb(c,_);function c(n){var u=_.call(this)||this;if(u.on,u.once,u.un,u.id_=void 0,u.geometryName_="geometry",u.style_=null,u.styleFunction_=void 0,u.geometryChangeKey_=null,u.addChangeListener(u.geometryName_,u.handleGeometryChanged_),n)if(typeof n.getSimplifiedGeometry=="function"){var r=n;u.setGeometry(r)}else{var s=n;u.setProperties(s)}return u}return c.prototype.clone=function(){var n=new c(this.hasProperties()?this.getProperties():null);n.setGeometryName(this.getGeometryName());var u=this.getGeometry();u&&n.setGeometry(u.clone());var r=this.getStyle();return r&&n.setStyle(r),n},c.prototype.getGeometry=function(){return this.get(this.geometryName_)},c.prototype.getId=function(){return this.id_},c.prototype.getGeometryName=function(){return this.geometryName_},c.prototype.getStyle=function(){return this.style_},c.prototype.getStyleFunction=function(){return this.styleFunction_},c.prototype.handleGeometryChange_=function(){this.changed()},c.prototype.handleGeometryChanged_=function(){this.geometryChangeKey_&&(Ao(this.geometryChangeKey_),this.geometryChangeKey_=null);var n=this.getGeometry();n&&(this.geometryChangeKey_=lo(n,Ji.CHANGE,this.handleGeometryChange_,this)),this.changed()},c.prototype.setGeometry=function(n){this.set(this.geometryName_,n)},c.prototype.setStyle=function(n){this.style_=n,this.styleFunction_=n?Hb(n):void 0,this.changed()},c.prototype.setId=function(n){this.id_=n,this.changed()},c.prototype.setGeometryName=function(n){this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=n,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_()},c}(Po);function Hb(_){if(typeof _=="function")return _;var c;if(Array.isArray(_))c=_;else{wn(typeof _.getZIndex=="function",41);var n=_;c=[n]}return function(){return c}}var lc=$b;var An={XY:"XY",XYZ:"XYZ",XYM:"XYM",XYZM:"XYZM"};function _l(_,c,n,u,r,s){for(var P=s||[],z=0,F=c;F<n;F+=u){var N=_[F],V=_[F+1];P[z++]=r[0]*N+r[2]*V+r[4],P[z++]=r[1]*N+r[3]*V+r[5]}return s&&P.length!=z&&(P.length=z),P}function Zm(_,c,n,u,r,s,P){for(var z=P||[],F=Math.cos(r),N=Math.sin(r),V=s[0],me=s[1],be=0,Se=c;Se<n;Se+=u){var Ve=_[Se]-V,Ke=_[Se+1]-me;z[be++]=V+Ve*F-Ke*N,z[be++]=me+Ve*N+Ke*F;for(var Ie=Se+2;Ie<Se+u;++Ie)z[be++]=_[Ie]}return P&&z.length!=be&&(z.length=be),z}function cx(_,c,n,u,r,s,P,z){for(var F=z||[],N=P[0],V=P[1],me=0,be=c;be<n;be+=u){var Se=_[be]-N,Ve=_[be+1]-V;F[me++]=N+r*Se,F[me++]=V+s*Ve;for(var Ke=be+2;Ke<be+u;++Ke)F[me++]=_[Ke]}return z&&F.length!=me&&(F.length=me),F}function hx(_,c,n,u,r,s,P){for(var z=P||[],F=0,N=c;N<n;N+=u){z[F++]=_[N]+r,z[F++]=_[N+1]+s;for(var V=N+2;V<N+u;++V)z[F++]=_[V]}return P&&z.length!=F&&(z.length=F),z}var Kb=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),px=za(),Yb=function(_){Kb(c,_);function c(){var n=_.call(this)||this;return n.extent_=Ya(),n.extentRevision_=-1,n.simplifiedGeometryMaxMinSquaredTolerance=0,n.simplifiedGeometryRevision=0,n.simplifyTransformedInternal=_v(function(u,r,s){if(!s)return this.getSimplifiedGeometry(r);var P=this.clone();return P.applyTransform(s),P.getSimplifiedGeometry(r)}),n}return c.prototype.simplifyTransformed=function(n,u){return this.simplifyTransformedInternal(this.getRevision(),n,u)},c.prototype.clone=function(){return jr()},c.prototype.closestPointXY=function(n,u,r,s){return jr()},c.prototype.containsXY=function(n,u){var r=this.getClosestPoint([n,u]);return r[0]===n&&r[1]===u},c.prototype.getClosestPoint=function(n,u){var r=u||[NaN,NaN];return this.closestPointXY(n[0],n[1],r,1/0),r},c.prototype.intersectsCoordinate=function(n){return this.containsXY(n[0],n[1])},c.prototype.computeExtent=function(n){return jr()},c.prototype.getExtent=function(n){if(this.extentRevision_!=this.getRevision()){var u=this.computeExtent(this.extent_);(isNaN(u[0])||isNaN(u[1]))&&Kp(u),this.extentRevision_=this.getRevision()}return Wv(this.extent_,n)},c.prototype.rotate=function(n,u){jr()},c.prototype.scale=function(n,u,r){jr()},c.prototype.simplify=function(n){return this.getSimplifiedGeometry(n*n)},c.prototype.getSimplifiedGeometry=function(n){return jr()},c.prototype.getType=function(){return jr()},c.prototype.applyTransform=function(n){jr()},c.prototype.intersectsExtent=function(n){return jr()},c.prototype.translate=function(n,u){jr()},c.prototype.transform=function(n,u){var r=ga(n),s=r.getUnits()==ac.TILE_PIXELS?function(P,z,F){var N=r.getExtent(),V=r.getWorldExtent(),me=Eu(V)/Eu(N);return vs(px,V[0],V[3],me,-me,0,0,0),_l(P,0,P.length,F,px,z),Qf(r,u)(P,z,F)}:Qf(r,u);return this.applyTransform(s),this},c}(Po),Xm=Yb;var Jb=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Qb=function(_){Jb(c,_);function c(){var n=_.call(this)||this;return n.layout=An.XY,n.stride=2,n.flatCoordinates=null,n}return c.prototype.computeExtent=function(n){return Fm(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,n)},c.prototype.getCoordinates=function(){return jr()},c.prototype.getFirstCoordinate=function(){return this.flatCoordinates.slice(0,this.stride)},c.prototype.getFlatCoordinates=function(){return this.flatCoordinates},c.prototype.getLastCoordinate=function(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)},c.prototype.getLayout=function(){return this.layout},c.prototype.getSimplifiedGeometry=function(n){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),n<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&n<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;var u=this.getSimplifiedGeometryInternal(n),r=u.getFlatCoordinates();return r.length<this.flatCoordinates.length?u:(this.simplifiedGeometryMaxMinSquaredTolerance=n,this)},c.prototype.getSimplifiedGeometryInternal=function(n){return this},c.prototype.getStride=function(){return this.stride},c.prototype.setFlatCoordinates=function(n,u){this.stride=fx(n),this.layout=n,this.flatCoordinates=u},c.prototype.setCoordinates=function(n,u){jr()},c.prototype.setLayout=function(n,u,r){var s;if(n)s=fx(n);else{for(var P=0;P<r;++P)if(u.length===0){this.layout=An.XY,this.stride=2;return}else u=u[0];s=u.length,n=ew(s)}this.layout=n,this.stride=s},c.prototype.applyTransform=function(n){this.flatCoordinates&&(n(this.flatCoordinates,this.flatCoordinates,this.stride),this.changed())},c.prototype.rotate=function(n,u){var r=this.getFlatCoordinates();if(r){var s=this.getStride();Zm(r,0,r.length,s,n,u,r),this.changed()}},c.prototype.scale=function(n,u,r){var s=u;s===void 0&&(s=n);var P=r;P||(P=$h(this.getExtent()));var z=this.getFlatCoordinates();if(z){var F=this.getStride();cx(z,0,z.length,F,n,s,P,z),this.changed()}},c.prototype.translate=function(n,u){var r=this.getFlatCoordinates();if(r){var s=this.getStride();hx(r,0,r.length,s,n,u,r),this.changed()}},c}(Xm);function ew(_){var c;return _==2?c=An.XY:_==3?c=An.XYZ:_==4&&(c=An.XYZM),c}function fx(_){var c;return _==An.XY?c=2:_==An.XYZ||_==An.XYM?c=3:_==An.XYZM&&(c=4),c}function dx(_,c,n){var u=_.getFlatCoordinates();if(u){var r=_.getStride();return _l(u,0,u.length,r,c,n)}else return null}var Es=Qb;function mx(_,c,n,u,r,s,P){var z=_[c],F=_[c+1],N=_[n]-z,V=_[n+1]-F,me;if(N===0&&V===0)me=c;else{var be=((r-z)*N+(s-F)*V)/(N*N+V*V);if(be>1)me=n;else if(be>0){for(var Se=0;Se<u;++Se)P[Se]=gl(_[c+Se],_[n+Se],be);P.length=u;return}else me=c}for(var Se=0;Se<u;++Se)P[Se]=_[me+Se];P.length=u}function id(_,c,n,u,r){var s=_[c],P=_[c+1];for(c+=u;c<n;c+=u){var z=_[c],F=_[c+1],N=ql(s,P,z,F);N>r&&(r=N),s=z,P=F}return r}function nd(_,c,n,u,r){for(var s=0,P=n.length;s<P;++s){var z=n[s];r=id(_,c,z,u,r),c=z}return r}function gx(_,c,n,u,r){for(var s=0,P=n.length;s<P;++s){var z=n[s];r=nd(_,c,z,u,r),c=z[z.length-1]}return r}function od(_,c,n,u,r,s,P,z,F,N,V){if(c==n)return N;var me,be;if(r===0)if(be=ql(P,z,_[c],_[c+1]),be<N){for(me=0;me<u;++me)F[me]=_[c+me];return F.length=u,be}else return N;for(var Se=V||[NaN,NaN],Ve=c+u;Ve<n;)if(mx(_,Ve-u,Ve,u,P,z,Se),be=ql(P,z,Se[0],Se[1]),be<N){for(N=be,me=0;me<u;++me)F[me]=Se[me];F.length=u,Ve+=u}else Ve+=u*Math.max((Math.sqrt(be)-Math.sqrt(N))/r|0,1);if(s&&(mx(_,n-u,c,u,P,z,Se),be=ql(P,z,Se[0],Se[1]),be<N)){for(N=be,me=0;me<u;++me)F[me]=Se[me];F.length=u}return N}function ad(_,c,n,u,r,s,P,z,F,N,V){for(var me=V||[NaN,NaN],be=0,Se=n.length;be<Se;++be){var Ve=n[be];N=od(_,c,Ve,u,r,s,P,z,F,N,me),c=Ve}return N}function yx(_,c,n,u,r,s,P,z,F,N,V){for(var me=V||[NaN,NaN],be=0,Se=n.length;be<Se;++be){var Ve=n[be];N=ad(_,c,Ve,u,r,s,P,z,F,N,me),c=Ve[Ve.length-1]}return N}function _x(_,c,n,u){for(var r=0,s=n.length;r<s;++r)_[c++]=n[r];return c}function Yh(_,c,n,u){for(var r=0,s=n.length;r<s;++r)for(var P=n[r],z=0;z<u;++z)_[c++]=P[z];return c}function sd(_,c,n,u,r){for(var s=r||[],P=0,z=0,F=n.length;z<F;++z){var N=Yh(_,c,n[z],u);s[P++]=N,c=N}return s.length=P,s}function vx(_,c,n,u,r){for(var s=r||[],P=0,z=0,F=n.length;z<F;++z){var N=sd(_,c,n[z],u,s[P]);s[P++]=N,c=N[N.length-1]}return s.length=P,s}function ld(_,c,n,u,r,s,P){var z=(n-c)/u;if(z<3){for(;c<n;c+=u)s[P++]=_[c],s[P++]=_[c+1];return P}var F=new Array(z);F[0]=1,F[z-1]=1;for(var N=[c,n-u],V=0;N.length>0;){for(var me=N.pop(),be=N.pop(),Se=0,Ve=_[be],Ke=_[be+1],Ie=_[me],Ge=_[me+1],et=be+u;et<me;et+=u){var rt=_[et],_t=_[et+1],yt=Dv(rt,_t,Ve,Ke,Ie,Ge);yt>Se&&(V=et,Se=yt)}Se>r&&(F[(V-c)/u]=1,be+u<V&&N.push(be,V),V+u<me&&N.push(V,me))}for(var et=0;et<z;++et)F[et]&&(s[P++]=_[c+et*u],s[P++]=_[c+et*u+1]);return P}function xx(_,c,n,u,r,s,P,z){for(var F=0,N=n.length;F<N;++F){var V=n[F];P=ld(_,c,V,u,r,s,P),z.push(P),c=V}return P}function hh(_,c){return c*Math.round(_/c)}function tw(_,c,n,u,r,s,P){if(c==n)return P;var z=hh(_[c],r),F=hh(_[c+1],r);c+=u,s[P++]=z,s[P++]=F;var N,V;do if(N=hh(_[c],r),V=hh(_[c+1],r),c+=u,c==n)return s[P++]=N,s[P++]=V,P;while(N==z&&V==F);for(;c<n;){var me=hh(_[c],r),be=hh(_[c+1],r);if(c+=u,!(me==N&&be==V)){var Se=N-z,Ve=V-F,Ke=me-z,Ie=be-F;if(Se*Ie==Ve*Ke&&(Se<0&&Ke<Se||Se==Ke||Se>0&&Ke>Se)&&(Ve<0&&Ie<Ve||Ve==Ie||Ve>0&&Ie>Ve)){N=me,V=be;continue}s[P++]=N,s[P++]=V,z=N,F=V,N=me,V=be}}return s[P++]=N,s[P++]=V,P}function Ny(_,c,n,u,r,s,P,z){for(var F=0,N=n.length;F<N;++F){var V=n[F];P=tw(_,c,V,u,r,s,P),z.push(P),c=V}return P}function bx(_,c,n,u,r,s,P,z){for(var F=0,N=n.length;F<N;++F){var V=n[F],me=[];P=Ny(_,c,V,u,r,s,P,me),z.push(me),c=V[V.length-1]}return P}function vl(_,c,n,u,r){for(var s=r!==void 0?r:[],P=0,z=c;z<n;z+=u)s[P++]=_.slice(z,z+u);return s.length=P,s}function ph(_,c,n,u,r){for(var s=r!==void 0?r:[],P=0,z=0,F=n.length;z<F;++z){var N=n[z];s[P++]=vl(_,c,N,u,s[P]),c=N}return s.length=P,s}function ud(_,c,n,u,r){for(var s=r!==void 0?r:[],P=0,z=0,F=n.length;z<F;++z){var N=n[z];s[P++]=ph(_,c,N,u,s[P]),c=N[N.length-1]}return s.length=P,s}function Vy(_,c,n,u){for(var r=0,s=_[n-u],P=_[n-u+1];c<n;c+=u){var z=_[c],F=_[c+1];r+=P*z-s*F,s=z,P=F}return r/2}function Gy(_,c,n,u){for(var r=0,s=0,P=n.length;s<P;++s){var z=n[s];r+=Vy(_,c,z,u),c=z}return r}function wx(_,c,n,u){for(var r=0,s=0,P=n.length;s<P;++s){var z=n[s];r+=Gy(_,c,z,u),c=z[z.length-1]}return r}var rw=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),iw=function(_){rw(c,_);function c(n,u){var r=_.call(this)||this;return r.maxDelta_=-1,r.maxDeltaRevision_=-1,u!==void 0&&!Array.isArray(n[0])?r.setFlatCoordinates(u,n):r.setCoordinates(n,u),r}return c.prototype.clone=function(){return new c(this.flatCoordinates.slice(),this.layout)},c.prototype.closestPointXY=function(n,u,r,s){return s<xs(this.getExtent(),n,u)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(id(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),od(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,n,u,r,s))},c.prototype.getArea=function(){return Vy(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)},c.prototype.getCoordinates=function(){return vl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)},c.prototype.getSimplifiedGeometryInternal=function(n){var u=[];return u.length=ld(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,n,u,0),new c(u,An.XY)},c.prototype.getType=function(){return Pt.LINEAR_RING},c.prototype.intersectsExtent=function(n){return!1},c.prototype.setCoordinates=function(n,u){this.setLayout(u,n,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Yh(this.flatCoordinates,0,n,this.stride),this.changed()},c}(Es),jy=iw;var nw=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),ow=function(_){nw(c,_);function c(n,u){var r=_.call(this)||this;return r.setCoordinates(n,u),r}return c.prototype.clone=function(){var n=new c(this.flatCoordinates.slice(),this.layout);return n.applyProperties(this),n},c.prototype.closestPointXY=function(n,u,r,s){var P=this.flatCoordinates,z=ql(n,u,P[0],P[1]);if(z<s){for(var F=this.stride,N=0;N<F;++N)r[N]=P[N];return r.length=F,z}else return s},c.prototype.getCoordinates=function(){return this.flatCoordinates?this.flatCoordinates.slice():[]},c.prototype.computeExtent=function(n){return Yp(this.flatCoordinates,n)},c.prototype.getType=function(){return Pt.POINT},c.prototype.intersectsExtent=function(n){return Jf(n,this.flatCoordinates[0],this.flatCoordinates[1])},c.prototype.setCoordinates=function(n,u){this.setLayout(u,n,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=_x(this.flatCoordinates,0,n,this.stride),this.changed()},c}(Es),ya=ow;function Ex(_,c,n,u,r){var s=Zv(r,function(P){return!fh(_,c,n,u,P[0],P[1])});return!s}function fh(_,c,n,u,r,s){for(var P=0,z=_[n-u],F=_[n-u+1];c<n;c+=u){var N=_[c],V=_[c+1];F<=s?V>s&&(N-z)*(s-F)-(r-z)*(V-F)>0&&P++:V<=s&&(N-z)*(s-F)-(r-z)*(V-F)<0&&P--,z=N,F=V}return P!==0}function cd(_,c,n,u,r,s){if(n.length===0||!fh(_,c,n[0],u,r,s))return!1;for(var P=1,z=n.length;P<z;++P)if(fh(_,n[P-1],n[P],u,r,s))return!1;return!0}function Tx(_,c,n,u,r,s){if(n.length===0)return!1;for(var P=0,z=n.length;P<z;++P){var F=n[P];if(cd(_,c,F,u,r,s))return!0;c=F[F.length-1]}return!1}function qy(_,c,n,u,r,s,P){for(var z,F,N,V,me,be,Se,Ve=r[s+1],Ke=[],Ie=0,Ge=n.length;Ie<Ge;++Ie){var et=n[Ie];for(V=_[et-u],be=_[et-u+1],z=c;z<et;z+=u)me=_[z],Se=_[z+1],(Ve<=be&&Se<=Ve||be<=Ve&&Ve<=Se)&&(N=(Ve-be)/(Se-be)*(me-V)+V,Ke.push(N)),V=me,be=Se}var rt=NaN,_t=-1/0;for(Ke.sort(rh),V=Ke[0],z=1,F=Ke.length;z<F;++z){me=Ke[z];var yt=Math.abs(me-V);yt>_t&&(N=(V+me)/2,cd(_,c,n,u,N,Ve)&&(rt=N,_t=yt)),V=me}return isNaN(rt)&&(rt=r[s]),P?(P.push(rt,Ve,_t),P):[rt,Ve,_t]}function Sx(_,c,n,u,r){for(var s=[],P=0,z=n.length;P<z;++P){var F=n[P];s=qy(_,c,F,u,r,2*P,s),c=F[F.length-1]}return s}function Wm(_,c,n,u,r){var s;for(c+=u;c<n;c+=u)if(s=r(_.slice(c-u,c),_.slice(c,c+u)),s)return s;return!1}function hd(_,c,n,u,r){var s=gy(Ya(),_,c,n,u);return ko(r,s)?sc(r,s)||s[0]>=r[0]&&s[2]<=r[2]||s[1]>=r[1]&&s[3]<=r[3]?!0:Wm(_,c,n,u,function(P,z){return $v(r,P,z)}):!1}function Ix(_,c,n,u,r){for(var s=0,P=n.length;s<P;++s){if(hd(_,c,n[s],u,r))return!0;c=n[s]}return!1}function aw(_,c,n,u,r){return!!(hd(_,c,n,u,r)||fh(_,c,n,u,r[0],r[1])||fh(_,c,n,u,r[0],r[3])||fh(_,c,n,u,r[2],r[1])||fh(_,c,n,u,r[2],r[3]))}function Zy(_,c,n,u,r){if(!aw(_,c,n[0],u,r))return!1;if(n.length===1)return!0;for(var s=1,P=n.length;s<P;++s)if(Ex(_,n[s-1],n[s],u,r)&&!hd(_,n[s-1],n[s],u,r))return!1;return!0}function Cx(_,c,n,u,r){for(var s=0,P=n.length;s<P;++s){var z=n[s];if(Zy(_,c,z,u,r))return!0;c=z[z.length-1]}return!1}function Ax(_,c,n,u){for(;c<n-u;){for(var r=0;r<u;++r){var s=_[c+r];_[c+r]=_[n-u+r],_[n-u+r]=s}c+=u,n-=u}}function Px(_,c,n,u){for(var r=0,s=_[n-u],P=_[n-u+1];c<n;c+=u){var z=_[c],F=_[c+1];r+=(z-s)*(F+P),s=z,P=F}return r===0?void 0:r>0}function Xy(_,c,n,u,r){for(var s=r!==void 0?r:!1,P=0,z=n.length;P<z;++P){var F=n[P],N=Px(_,c,F,u);if(P===0){if(s&&N||!s&&!N)return!1}else if(s&&!N||!s&&N)return!1;c=F}return!0}function Mx(_,c,n,u,r){for(var s=0,P=n.length;s<P;++s){var z=n[s];if(!Xy(_,c,z,u,r))return!1;z.length&&(c=z[z.length-1])}return!0}function $m(_,c,n,u,r){for(var s=r!==void 0?r:!1,P=0,z=n.length;P<z;++P){var F=n[P],N=Px(_,c,F,u),V=P===0?s&&N||!s&&!N:s&&!N||!s&&N;V&&Ax(_,c,F,u),c=F}return c}function Wy(_,c,n,u,r){for(var s=0,P=n.length;s<P;++s)c=$m(_,c,n[s],u,r);return c}var sw=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),kx=function(_){sw(c,_);function c(n,u,r){var s=_.call(this)||this;return s.ends_=[],s.flatInteriorPointRevision_=-1,s.flatInteriorPoint_=null,s.maxDelta_=-1,s.maxDeltaRevision_=-1,s.orientedRevision_=-1,s.orientedFlatCoordinates_=null,u!==void 0&&r?(s.setFlatCoordinates(u,n),s.ends_=r):s.setCoordinates(n,u),s}return c.prototype.appendLinearRing=function(n){this.flatCoordinates?Ha(this.flatCoordinates,n.getFlatCoordinates()):this.flatCoordinates=n.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()},c.prototype.clone=function(){var n=new c(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return n.applyProperties(this),n},c.prototype.closestPointXY=function(n,u,r,s){return s<xs(this.getExtent(),n,u)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(nd(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),ad(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,n,u,r,s))},c.prototype.containsXY=function(n,u){return cd(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,n,u)},c.prototype.getArea=function(){return Gy(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)},c.prototype.getCoordinates=function(n){var u;return n!==void 0?(u=this.getOrientedFlatCoordinates().slice(),$m(u,0,this.ends_,this.stride,n)):u=this.flatCoordinates,ph(u,0,this.ends_,this.stride)},c.prototype.getEnds=function(){return this.ends_},c.prototype.getFlatInteriorPoint=function(){if(this.flatInteriorPointRevision_!=this.getRevision()){var n=$h(this.getExtent());this.flatInteriorPoint_=qy(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,n,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_},c.prototype.getInteriorPoint=function(){return new ya(this.getFlatInteriorPoint(),An.XYM)},c.prototype.getLinearRingCount=function(){return this.ends_.length},c.prototype.getLinearRing=function(n){return n<0||this.ends_.length<=n?null:new jy(this.flatCoordinates.slice(n===0?0:this.ends_[n-1],this.ends_[n]),this.layout)},c.prototype.getLinearRings=function(){for(var n=this.layout,u=this.flatCoordinates,r=this.ends_,s=[],P=0,z=0,F=r.length;z<F;++z){var N=r[z],V=new jy(u.slice(P,N),n);s.push(V),P=N}return s},c.prototype.getOrientedFlatCoordinates=function(){if(this.orientedRevision_!=this.getRevision()){var n=this.flatCoordinates;Xy(n,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=n:(this.orientedFlatCoordinates_=n.slice(),this.orientedFlatCoordinates_.length=$m(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_},c.prototype.getSimplifiedGeometryInternal=function(n){var u=[],r=[];return u.length=Ny(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(n),u,0,r),new c(u,An.XY,r)},c.prototype.getType=function(){return Pt.POLYGON},c.prototype.intersectsExtent=function(n){return Zy(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,n)},c.prototype.setCoordinates=function(n,u){this.setLayout(u,n,2),this.flatCoordinates||(this.flatCoordinates=[]);var r=sd(this.flatCoordinates,0,n,this.stride,this.ends_);this.flatCoordinates.length=r.length===0?0:r[r.length-1],this.changed()},c}(Es),pd=kx;function $y(_,c,n){for(var u=c||32,r=_.getStride(),s=_.getLayout(),P=_.getCenter(),z=r*(u+1),F=new Array(z),N=0;N<z;N+=r){F[N]=0,F[N+1]=0;for(var V=2;V<r;V++)F[N+V]=P[V]}var me=[F.length],be=new kx(F,s,me);return lw(be,P,_.getRadius(),n),be}function lw(_,c,n,u){for(var r=_.getFlatCoordinates(),s=_.getStride(),P=r.length/s-1,z=u||0,F=0;F<=P;++F){var N=F*s,V=z+zm(F,P)*2*Math.PI/P;r[N]=c[0]+n*Math.cos(V),r[N+1]=c[1]+n*Math.sin(V)}_.changed()}var uw=function(){function _(c){var n=c||{};this.color_=n.color!==void 0?n.color:null}return _.prototype.clone=function(){var c=this.getColor();return new _({color:Array.isArray(c)?c.slice():c||void 0})},_.prototype.getColor=function(){return this.color_},_.prototype.setColor=function(c){this.color_=c},_}(),Hs=uw;function Km(_,c,n,u,r,s,P){var z,F,N=(n-c)/u;if(N===1)z=c;else if(N===2)z=c,F=r;else if(N!==0){for(var V=_[c],me=_[c+1],be=0,Se=[0],Ve=c+u;Ve<n;Ve+=u){var Ke=_[Ve],Ie=_[Ve+1];be+=Math.sqrt((Ke-V)*(Ke-V)+(Ie-me)*(Ie-me)),Se.push(be),V=Ke,me=Ie}var Ge=r*be,et=mv(Se,Ge);et<0?(F=(Ge-Se[-et-2])/(Se[-et-1]-Se[-et-2]),z=c+(-et-2)*u):z=c+et*u}for(var rt=P>1?P:2,_t=s||new Array(rt),Ve=0;Ve<rt;++Ve)_t[Ve]=z===void 0?NaN:F===void 0?_[z+Ve]:gl(_[z+Ve],_[z+u+Ve],F);return _t}function Hm(_,c,n,u,r,s){if(n==c)return null;var P;if(r<_[c+u-1])return s?(P=_.slice(c,c+u),P[u-1]=r,P):null;if(_[n-1]<r)return s?(P=_.slice(n-u,n),P[u-1]=r,P):null;if(r==_[c+u-1])return _.slice(c,c+u);for(var z=c/u,F=n/u;z<F;){var N=z+F>>1;r<_[(N+1)*u-1]?F=N:z=N+1}var V=_[z*u-1];if(r==V)return _.slice((z-1)*u,(z-1)*u+u);var me=_[(z+1)*u-1],be=(r-V)/(me-V);P=[];for(var Se=0;Se<u-1;++Se)P.push(gl(_[(z-1)*u+Se],_[z*u+Se],be));return P.push(r),P}function Lx(_,c,n,u,r,s,P){if(P)return Hm(_,c,n[n.length-1],u,r,s);var z;if(r<_[u-1])return s?(z=_.slice(0,u),z[u-1]=r,z):null;if(_[_.length-1]<r)return s?(z=_.slice(_.length-u),z[u-1]=r,z):null;for(var F=0,N=n.length;F<N;++F){var V=n[F];if(c!=V){if(r<_[c+u-1])return null;if(r<=_[V-1])return Hm(_,c,V,u,r,!1);c=V}}return null}function Ym(_,c,n,u){for(var r=_[c],s=_[c+1],P=0,z=c+u;z<n;z+=u){var F=_[z],N=_[z+1];P+=Math.sqrt((F-r)*(F-r)+(N-s)*(N-s)),r=F,s=N}return P}var cw=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),hw=function(_){cw(c,_);function c(n,u){var r=_.call(this)||this;return r.flatMidpoint_=null,r.flatMidpointRevision_=-1,r.maxDelta_=-1,r.maxDeltaRevision_=-1,u!==void 0&&!Array.isArray(n[0])?r.setFlatCoordinates(u,n):r.setCoordinates(n,u),r}return c.prototype.appendCoordinate=function(n){this.flatCoordinates?Ha(this.flatCoordinates,n):this.flatCoordinates=n.slice(),this.changed()},c.prototype.clone=function(){var n=new c(this.flatCoordinates.slice(),this.layout);return n.applyProperties(this),n},c.prototype.closestPointXY=function(n,u,r,s){return s<xs(this.getExtent(),n,u)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(id(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),od(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,n,u,r,s))},c.prototype.forEachSegment=function(n){return Wm(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,n)},c.prototype.getCoordinateAtM=function(n,u){if(this.layout!=An.XYM&&this.layout!=An.XYZM)return null;var r=u!==void 0?u:!1;return Hm(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,n,r)},c.prototype.getCoordinates=function(){return vl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)},c.prototype.getCoordinateAt=function(n,u){return Km(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,n,u,this.stride)},c.prototype.getLength=function(){return Ym(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)},c.prototype.getFlatMidpoint=function(){return this.flatMidpointRevision_!=this.getRevision()&&(this.flatMidpoint_=this.getCoordinateAt(.5,this.flatMidpoint_),this.flatMidpointRevision_=this.getRevision()),this.flatMidpoint_},c.prototype.getSimplifiedGeometryInternal=function(n){var u=[];return u.length=ld(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,n,u,0),new c(u,An.XY)},c.prototype.getType=function(){return Pt.LINE_STRING},c.prototype.intersectsExtent=function(n){return hd(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,n)},c.prototype.setCoordinates=function(n,u){this.setLayout(u,n,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Yh(this.flatCoordinates,0,n,this.stride),this.changed()},c}(Es),uc=hw;var pw=function(){function _(c){var n=c||{};this.color_=n.color!==void 0?n.color:null,this.lineCap_=n.lineCap,this.lineDash_=n.lineDash!==void 0?n.lineDash:null,this.lineDashOffset_=n.lineDashOffset,this.lineJoin_=n.lineJoin,this.miterLimit_=n.miterLimit,this.width_=n.width}return _.prototype.clone=function(){var c=this.getColor();return new _({color:Array.isArray(c)?c.slice():c||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),width:this.getWidth()})},_.prototype.getColor=function(){return this.color_},_.prototype.getLineCap=function(){return this.lineCap_},_.prototype.getLineDash=function(){return this.lineDash_},_.prototype.getLineDashOffset=function(){return this.lineDashOffset_},_.prototype.getLineJoin=function(){return this.lineJoin_},_.prototype.getMiterLimit=function(){return this.miterLimit_},_.prototype.getWidth=function(){return this.width_},_.prototype.setColor=function(c){this.color_=c},_.prototype.setLineCap=function(c){this.lineCap_=c},_.prototype.setLineDash=function(c){this.lineDash_=c},_.prototype.setLineDashOffset=function(c){this.lineDashOffset_=c},_.prototype.setLineJoin=function(c){this.lineJoin_=c},_.prototype.setMiterLimit=function(c){this.miterLimit_=c},_.prototype.setWidth=function(c){this.width_=c},_}(),_a=pw;var qi={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function Hy(_,c){return Array.isArray(_)?_:(c===void 0?c=[_,_]:(c[0]=_,c[1]=_),c)}var fw=function(){function _(c){this.opacity_=c.opacity,this.rotateWithView_=c.rotateWithView,this.rotation_=c.rotation,this.scale_=c.scale,this.scaleArray_=Hy(c.scale),this.displacement_=c.displacement}return _.prototype.clone=function(){var c=this.getScale();return new _({opacity:this.getOpacity(),scale:Array.isArray(c)?c.slice():c,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice()})},_.prototype.getOpacity=function(){return this.opacity_},_.prototype.getRotateWithView=function(){return this.rotateWithView_},_.prototype.getRotation=function(){return this.rotation_},_.prototype.getScale=function(){return this.scale_},_.prototype.getScaleArray=function(){return this.scaleArray_},_.prototype.getDisplacement=function(){return this.displacement_},_.prototype.getAnchor=function(){return jr()},_.prototype.getImage=function(c){return jr()},_.prototype.getHitDetectionImage=function(){return jr()},_.prototype.getPixelRatio=function(c){return 1},_.prototype.getImageState=function(){return jr()},_.prototype.getImageSize=function(){return jr()},_.prototype.getOrigin=function(){return jr()},_.prototype.getSize=function(){return jr()},_.prototype.setDisplacement=function(c){this.displacement_=c},_.prototype.setOpacity=function(c){this.opacity_=c},_.prototype.setRotateWithView=function(c){this.rotateWithView_=c},_.prototype.setRotation=function(c){this.rotation_=c},_.prototype.setScale=function(c){this.scale_=c,this.scaleArray_=Hy(c)},_.prototype.listenImageChange=function(c){jr()},_.prototype.load=function(){jr()},_.prototype.unlistenImageChange=function(c){jr()},_}(),Jm=fw;var dw=/^#([a-f0-9]{3}|[a-f0-9]{4}(?:[a-f0-9]{2}){0,2})$/i,mw=/^([a-z]*)$|^hsla?\(.*\)$/i;function Qm(_){return typeof _=="string"?_:Ky(_)}function gw(_){var c=document.createElement("div");if(c.style.color=_,c.style.color!==""){document.body.appendChild(c);var n=getComputedStyle(c).color;return document.body.removeChild(c),n}else return""}var yw=function(){var _=1024,c={},n=0;return function(u){var r;if(c.hasOwnProperty(u))r=c[u];else{if(n>=_){var s=0;for(var P in c)(s++&3)===0&&(delete c[P],--n)}r=_w(u),c[u]=r,++n}return r}}();function Jh(_){return Array.isArray(_)?_:yw(_)}function _w(_){var c,n,u,r,s;if(mw.exec(_)&&(_=gw(_)),dw.exec(_)){var P=_.length-1,z=void 0;P<=4?z=1:z=2;var F=P===4||P===8;c=parseInt(_.substr(1+0*z,z),16),n=parseInt(_.substr(1+1*z,z),16),u=parseInt(_.substr(1+2*z,z),16),F?r=parseInt(_.substr(1+3*z,z),16):r=255,z==1&&(c=(c<<4)+c,n=(n<<4)+n,u=(u<<4)+u,F&&(r=(r<<4)+r)),s=[c,n,u,r/255]}else _.indexOf("rgba(")==0?(s=_.slice(5,-1).split(",").map(Number),Rx(s)):_.indexOf("rgb(")==0?(s=_.slice(4,-1).split(",").map(Number),s.push(1),Rx(s)):wn(!1,14);return s}function Rx(_){return _[0]=jl(_[0]+.5|0,0,255),_[1]=jl(_[1]+.5|0,0,255),_[2]=jl(_[2]+.5|0,0,255),_[3]=jl(_[3],0,1),_}function Ky(_){var c=_[0];c!=(c|0)&&(c=c+.5|0);var n=_[1];n!=(n|0)&&(n=n+.5|0);var u=_[2];u!=(u|0)&&(u=u+.5|0);var r=_[3]===void 0?1:Math.round(_[3]*100)/100;return"rgba("+c+","+n+","+u+","+r+")"}function Ts(_){return Array.isArray(_)?Ky(_):_}function Ja(_,c,n,u){var r;return n&&n.length?r=n.shift():ah?r=new OffscreenCanvas(_||300,c||300):r=document.createElement("canvas"),_&&(r.width=_),c&&(r.height=c),r.getContext("2d",u)}var vw=new RegExp(["^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)","(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?","(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))","(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))",`?\\s*([-,\\"\\'\\sa-z]+?)\\s*$`].join(""),"i"),zx=["style","variant","weight","size","lineHeight","family"],Yy=function(_){var c=_.match(vw);if(!c)return null;for(var n={lineHeight:"normal",size:"1.2em",style:"normal",weight:"normal",variant:"normal"},u=0,r=zx.length;u<r;++u){var s=c[u+1];s!==void 0&&(n[zx[u]]=s)}return n.families=n.family.split(/,\s?/),n};function Dx(_){return _===1?"":String(Math.round(_*100)/100)}var tg="10px sans-serif",Ss="#000",Qh="round",cc=[],hc=0,Iu="round",pc=10,fc="#000",mh="center",ep="middle",dc=[0,0,0,0],mc=1,dh=new Po,xw=new nh;xw.setSize=function(){console.warn("labelCache is deprecated.")};var sf=null,Jy,Qy={},Ox=function(){var _=100,c="32px ",n=["monospace","serif"],u=n.length,r="wmytzilWMYTZIL@#/&?$%10\uF013",s,P;function z(N,V,me){for(var be=!0,Se=0;Se<u;++Se){var Ve=n[Se];if(P=eg(N+" "+V+" "+c+Ve,r),me!=Ve){var Ke=eg(N+" "+V+" "+c+me+","+Ve,r);be=be&&Ke!=P}}return!!be}function F(){for(var N=!0,V=dh.getKeys(),me=0,be=V.length;me<be;++me){var Se=V[me];dh.get(Se)<_&&(z.apply(this,Se.split(`
1075
+ `,document.addEventListener("keydown",x=>{x.key===i&&(this._metaPress=!0)}),document.addEventListener("keyup",x=>{x.key===i&&(this._metaPress=!1)}),this._canvasContainer.addEventListener("wheel",x=>{this._onCooperativeGesture(x,this._metaPress,1)},!1),this._canvasContainer.classList.remove("mapboxgl-touch-drag-pan","maplibregl-touch-drag-pan")}_resizeCanvas(E,i,d){this._canvas.width=d*E,this._canvas.height=d*i,this._canvas.style.width=`${E}px`,this._canvas.style.height=`${i}px`}_setupPainter(){let E=s.extend({},P.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),i=this._canvas.getContext("webgl",E)||this._canvas.getContext("experimental-webgl",E);i?(this.painter=new ru(i,this.transform),s.exported$1.testSupport(i)):this.fire(new s.ErrorEvent(new Error("Failed to initialize WebGL")))}_contextLost(E){E.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new s.Event("webglcontextlost",{originalEvent:E}))}_contextRestored(E){this._setupPainter(),this.resize(),this._update(),this.fire(new s.Event("webglcontextrestored",{originalEvent:E}))}_onMapScroll(E){if(E.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}_onCooperativeGesture(E,i,d){return!i&&d<2&&(this._cooperativeGesturesScreen.classList.add("maplibregl-show"),setTimeout(()=>{this._cooperativeGesturesScreen.classList.remove("maplibregl-show")},100)),!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(E){return this.style?(this._styleDirty=this._styleDirty||E,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(E){return this._update(),this._renderTaskQueue.add(E)}_cancelRenderFrame(E){this._renderTaskQueue.remove(E)}_render(E){let i,d=0,x=this.painter.context.extTimerQuery;if(this.listens("gpu-timing-frame")&&(i=x.createQueryEXT(),x.beginQueryEXT(x.TIME_ELAPSED_EXT,i),d=s.exported.now()),this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(E),this._removed)return;let T=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;let U=this.transform.zoom,q=s.exported.now();this.style.zoomHistory.update(U,q);let W=new s.EvaluationParameters(U,{now:q,fadeDuration:this._fadeDuration,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),Y=W.crossFadingFactor();Y===1&&Y===this._crossFadingFactor||(T=!0,this._crossFadingFactor=Y),this.style.update(W)}if(this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.style.terrain&&this.style.terrain.sourceCache.update(this.transform,this.style.terrain),this.transform.updateElevation(this.style.terrain),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,this._fadeDuration,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:this._fadeDuration,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer")}),this.fire(new s.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,s.PerformanceUtils.mark(s.PerformanceMarkers.load),this.fire(new s.Event("load"))),this.style&&(this.style.hasTransitions()||T)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),this.listens("gpu-timing-frame")){let U=s.exported.now()-d;x.endQueryEXT(x.TIME_ELAPSED_EXT,i),setTimeout(()=>{let q=x.getQueryObjectEXT(i,x.QUERY_RESULT_EXT)/1e6;x.deleteQueryEXT(i),this.fire(new s.Event("gpu-timing-frame",{cpuTime:U,gpuTime:q}))},50)}if(this.listens("gpu-timing-layer")){let U=this.painter.collectGpuTimers();setTimeout(()=>{let q=this.painter.queryGpuTimers(U);this.fire(new s.Event("gpu-timing-layer",{layerTimes:q}))},50)}let M=this._sourcesDirty||this._styleDirty||this._placementDirty;return M||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new s.Event("idle")),!this._loaded||this._fullyLoaded||M||(this._fullyLoaded=!0,s.PerformanceUtils.mark(s.PerformanceMarkers.fullLoad)),this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){this._hash&&this._hash.remove();for(let i of this._controls)i.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&(removeEventListener("resize",this._onWindowResize,!1),removeEventListener("orientationchange",this._onWindowResize,!1),removeEventListener("online",this._onWindowOnline,!1));let E=this.painter.context.gl.getExtension("WEBGL_lose_context");E&&E.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),V.remove(this._canvasContainer),V.remove(this._controlContainer),this._cooperativeGestures&&V.remove(this._cooperativeGesturesScreen),this._container.classList.remove("maplibregl-map","mapboxgl-map"),s.PerformanceUtils.clearMetrics(),this._removed=!0,this.fire(new s.Event("remove"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=s.exported.frame(E=>{s.PerformanceUtils.frame(E),this._frame=null,this._render(E)}))}_onWindowOnline(){this._update()}_onWindowResize(E){this._trackResize&&this.resize({originalEvent:E})._update()}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(E){this._showTileBoundaries!==E&&(this._showTileBoundaries=E,this._update())}get showPadding(){return!!this._showPadding}set showPadding(E){this._showPadding!==E&&(this._showPadding=E,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(E){this._showCollisionBoxes!==E&&(this._showCollisionBoxes=E,E?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(E){this._showOverdrawInspector!==E&&(this._showOverdrawInspector=E,this._update())}get repaint(){return!!this._repaint}set repaint(E){this._repaint!==E&&(this._repaint=E,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(E){this._vertices=E,this._update()}_setCacheLimits(E,i){s.setCacheLimits(E,i)}get version(){return"2.4.0"}},NavigationControl:class{constructor(E){this.options=s.extend({},Bo,E),this._container=V.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",i=>i.preventDefault()),this.options.showZoom&&(s.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in mapboxgl-ctrl-zoom-in",i=>this._map.zoomIn({},{originalEvent:i})),V.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out mapboxgl-ctrl-zoom-out",i=>this._map.zoomOut({},{originalEvent:i})),V.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(s.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("maplibregl-ctrl-compass mapboxgl-ctrl-compass",i=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:i}):this._map.resetNorth({},{originalEvent:i})}),this._compassIcon=V.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){let E=this._map.getZoom(),i=E===this._map.getMaxZoom(),d=E===this._map.getMinZoom();this._zoomInButton.disabled=i,this._zoomOutButton.disabled=d,this._zoomInButton.setAttribute("aria-disabled",i.toString()),this._zoomOutButton.setAttribute("aria-disabled",d.toString())}_rotateCompassArrow(){let E=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=E}onAdd(E){return this._map=E,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Fr(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){V.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(E,i){let d=V.create("button",E,this._container);return d.type="button",d.addEventListener("click",i),d}_setButtonTitle(E,i){let d=this._map._getUIString(`NavigationControl.${i}`);E.title=d,E.setAttribute("aria-label",d)}},GeolocateControl:class extends s.Evented{constructor(E){super(),this.options=s.extend({},Ca,E),s.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker"],this)}onAdd(E){var i;return this._map=E,this._container=V.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),i=this._setupUI,Nn!==void 0?i(Nn):window.navigator.permissions!==void 0?window.navigator.permissions.query({name:"geolocation"}).then(d=>{Nn=d.state!=="denied",i(Nn)}):(Nn=!!window.navigator.geolocation,i(Nn)),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(),V.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,xi=0,Yo=!1}_isOutOfMapMaxBounds(E){let i=this._map.getMaxBounds(),d=E.coords;return i&&(d.longitude<i.getWest()||d.longitude>i.getEast()||d.latitude<i.getSouth()||d.latitude>i.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_onSuccess(E){if(this._map){if(this._isOutOfMapMaxBounds(E))return this._setErrorState(),this.fire(new s.Event("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","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(E),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(E),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new s.Event("geolocate",E)),this._finish()}}_updateCamera(E){let i=new s.LngLat(E.coords.longitude,E.coords.latitude),d=E.coords.accuracy,x=this._map.getBearing(),T=s.extend({bearing:x},this.options.fitBoundsOptions);this._map.fitBounds(i.toBounds(d),T,{geolocateSource:!0})}_updateMarker(E){if(E){let i=new s.LngLat(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()}_updateCircleRadius(){let E=this._map._container.clientHeight/2,i=this._map.unproject([0,E]),d=this._map.unproject([1,E]),x=i.distanceTo(d),T=Math.ceil(2*this._accuracy/x);this._circleElement.style.width=`${T}px`,this._circleElement.style.height=`${T}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_onError(E){if(this._map){if(this.options.trackUserLocation)if(E.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;let 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&&Yo)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new s.Event("error",E)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(E){if(this._container.addEventListener("contextmenu",i=>i.preventDefault()),this._geolocateButton=V.create("button","maplibregl-ctrl-geolocate mapboxgl-ctrl-geolocate",this._container),V.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",E===!1){s.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");let i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i)}else{let i=this._map._getUIString("GeolocateControl.FindMyLocation");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=V.create("div","maplibregl-user-location-dot mapboxgl-user-location-dot"),this._userLocationDotMarker=new Ko(this._dotElement),this._circleElement=V.create("div","maplibregl-user-location-accuracy-circle mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Ko({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",i=>{i.geolocateSource||this._watchState!=="ACTIVE_LOCK"||i.originalEvent&&i.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this.fire(new s.Event("trackuserlocationend")))})}trigger(){if(!this._setup)return s.warnOnce("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new s.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":xi--,Yo=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this.fire(new s.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new s.Event("trackuserlocationstart"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let E;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),xi++,xi>1?(E={maximumAge:6e5,timeout:0},Yo=!0):(E=this.options.positionOptions,Yo=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,E)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:ll,LogoControl:us,ScaleControl:class{constructor(E){this.options=s.extend({},cr,E),s.bindAll(["_onMove","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_onMove(){lr(this._map,this._container,this.options)}onAdd(E){return this._map=E,this._container=V.create("div","maplibregl-ctrl maplibregl-ctrl-scale mapboxgl-ctrl mapboxgl-ctrl-scale",E.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){V.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}setUnit(E){this.options.unit=E,lr(this._map,this._container,this.options)}},FullscreenControl:class{constructor(E){this._fullscreen=!1,E&&E.container&&(E.container instanceof HTMLElement?this._container=E.container:s.warnOnce("Full screen control 'container' must be a DOM element.")),s.bindAll(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(E){return this._map=E,this._container||(this._container=this._map.getContainer()),this._controlContainer=V.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",s.warnOnce("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){V.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!!(document.fullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled||document.webkitFullscreenEnabled)}_setupUI(){let E=this._fullscreenButton=V.create("button","maplibregl-ctrl-fullscreen mapboxgl-ctrl-fullscreen",this._controlContainer);V.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",E).setAttribute("aria-hidden","true"),E.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){let E=this._getTitle();this._fullscreenButton.setAttribute("aria-label",E),this._fullscreenButton.title=E}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen&&window.document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},TerrainControl:class{constructor(E){this.options=E,s.bindAll(["_toggleTerrain","_updateTerrainIcon"],this)}onAdd(E){return this._map=E,this._container=V.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._terrainButton=V.create("button","maplibregl-ctrl-terrain mapboxgl-ctrl-terrain",this._container),V.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){V.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}_toggleTerrain(){this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()}_updateTerrainIcon(){this._terrainButton.classList.remove("maplibregl-ctrl-terrain","mapboxgl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled","mapboxgl-ctrl-terrain-enabled"),this._map.style.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled","mapboxgl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain","mapboxgl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))}},Popup:class extends s.Evented{constructor(E){super(),this.options=s.extend(Object.create(si),E),s.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag"],this)}addTo(E){return this._map&&this.remove(),this._map=E,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer","mapboxgl-track-pointer")):this._map.on("move",this._update),this.fire(new s.Event("open")),this}isOpen(){return!!this._map}remove(){return this._content&&V.remove(this._content),this._container&&(V.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new s.Event("close")),this}getLngLat(){return this._lngLat}setLngLat(E){return this._lngLat=s.LngLat.convert(E),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer","mapboxgl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer","mapboxgl-track-pointer")),this}getElement(){return this._container}setText(E){return this.setDOMContent(document.createTextNode(E))}setHTML(E){let i=document.createDocumentFragment(),d=document.createElement("body"),x;for(d.innerHTML=E;x=d.firstChild,x;)i.appendChild(x);return this.setDOMContent(i)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(E){return this.options.maxWidth=E,this._update(),this}setDOMContent(E){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=V.create("div","maplibregl-popup-content mapboxgl-popup-content",this._container);return this._content.appendChild(E),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(E){this._container&&this._container.classList.add(E)}removeClassName(E){this._container&&this._container.classList.remove(E)}setOffset(E){return this.options.offset=E,this._update(),this}toggleClassName(E){if(this._container)return this._container.classList.toggle(E)}_createCloseButton(){this.options.closeButton&&(this._closeButton=V.create("button","maplibregl-popup-close-button mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))}_onMouseUp(E){this._update(E.point)}_onMouseMove(E){this._update(E.point)}_onDrag(E){this._update(E.point)}_update(E){if(!this._map||!this._lngLat&&!this._trackPointer||!this._content||(this._container||(this._container=V.create("div","maplibregl-popup mapboxgl-popup",this._map.getContainer()),this._tip=V.create("div","maplibregl-popup-tip mapboxgl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(" ").forEach(M=>this._container.classList.add(M)),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer")),this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=Io(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!E))return;let i=this._pos=this._trackPointer&&E?E:this._map.project(this._lngLat),d=this.options.anchor,x=In(this.options.offset);if(!d){let M=this._container.offsetWidth,U=this._container.offsetHeight,q;q=i.y+x.bottom.y<U?["top"]:i.y>this._map.transform.height-U?["bottom"]:[],i.x<M/2?q.push("left"):i.x>this._map.transform.width-M/2&&q.push("right"),d=q.length===0?"bottom":q.join("-")}let T=i.add(x[d]).round();V.setTransform(this._container,`${sr[d]} translate(${T.x}px,${T.y}px)`),hr(this._container,d,"popup")}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;let E=this._container.querySelector(Si);E&&E.focus()}_onClose(){this.remove()}},Marker:Ko,Style:Sn,LngLat:s.LngLat,LngLatBounds:s.LngLatBounds,Point:s.pointGeometry,MercatorCoordinate:s.MercatorCoordinate,Evented:s.Evented,AJAXError:s.AJAXError,config:s.config,CanvasSource:Ir,GeoJSONSource:Br,ImageSource:br,RasterDEMTileSource:Mt,RasterTileSource:Qt,VectorTileSource:Vt,VideoSource:Mr,prewarm:function(){sn().acquire(Ni)},clearPrewarmedResources:function(){let E=Zi;E&&(E.isPreloaded()&&E.numActive()===1?(E.release(Ni),Zi=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},get version(){return"2.4.0"},get workerCount(){return Cr.workerCount},set workerCount(E){Cr.workerCount=E},get maxParallelImageRequests(){return s.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(E){s.config.MAX_PARALLEL_IMAGE_REQUESTS=E},clearStorage(E){s.clearTileCache(E)},workerUrl:"",addProtocol(E,i){s.config.REGISTERED_PROTOCOLS[E]=i},removeProtocol(E){delete s.config.REGISTERED_PROTOCOLS[E]}};return Ki.extend(ao,{isSafari:s.isSafari,getPerformanceMetrics:s.PerformanceUtils.getPerformanceMetrics}),ao});var r=n;return r})});var a1=qf((hB,o1)=>{var wE="Expected a function",i1=NaN,EE="[object Symbol]",TE=/^\s+|\s+$/g,SE=/^[-+]0x[0-9a-f]+$/i,IE=/^0b[01]+$/i,CE=/^0o[0-7]+$/i,AE=parseInt,PE=typeof global=="object"&&global&&global.Object===Object&&global,ME=typeof self=="object"&&self&&self.Object===Object&&self,kE=PE||ME||Function("return this")(),LE=Object.prototype,RE=LE.toString,zE=Math.max,DE=Math.min,z_=function(){return kE.Date.now()};function OE(_,c,n){var u,r,s,P,z,F,N=0,V=!1,me=!1,be=!0;if(typeof _!="function")throw new TypeError(wE);c=n1(c)||0,D_(n)&&(V=!!n.leading,me="maxWait"in n,s=me?zE(n1(n.maxWait)||0,c):s,be="trailing"in n?!!n.trailing:be);function Se(ct){var Tt=u,St=r;return u=r=void 0,N=ct,P=_.apply(St,Tt),P}function Ve(ct){return N=ct,z=setTimeout(Ge,c),V?Se(ct):P}function Ke(ct){var Tt=ct-F,St=ct-N,Lt=c-Tt;return me?DE(Lt,s-St):Lt}function Ie(ct){var Tt=ct-F,St=ct-N;return F===void 0||Tt>=c||Tt<0||me&&St>=s}function Ge(){var ct=z_();if(Ie(ct))return et(ct);z=setTimeout(Ge,Ke(ct))}function et(ct){return z=void 0,be&&u?Se(ct):(u=r=void 0,P)}function rt(){z!==void 0&&clearTimeout(z),N=0,u=F=r=z=void 0}function _t(){return z===void 0?P:et(z_())}function yt(){var ct=z_(),Tt=Ie(ct);if(u=arguments,r=this,F=ct,Tt){if(z===void 0)return Ve(F);if(me)return z=setTimeout(Ge,c),Se(F)}return z===void 0&&(z=setTimeout(Ge,c)),P}return yt.cancel=rt,yt.flush=_t,yt}function D_(_){var c=typeof _;return!!_&&(c=="object"||c=="function")}function FE(_){return!!_&&typeof _=="object"}function BE(_){return typeof _=="symbol"||FE(_)&&RE.call(_)==EE}function n1(_){if(typeof _=="number")return _;if(BE(_))return i1;if(D_(_)){var c=typeof _.valueOf=="function"?_.valueOf():_;_=D_(c)?c+"":c}if(typeof _!="string")return _===0?_:+_;_=_.replace(TE,"");var n=IE.test(_);return n||CE.test(_)?AE(_.slice(2),n?2:8):SE.test(_)?i1:+_}o1.exports=OE});var h1=qf((pB,c1)=>{var u1="Expected a function",s1=NaN,UE="[object Symbol]",NE=/^\s+|\s+$/g,VE=/^[-+]0x[0-9a-f]+$/i,GE=/^0b[01]+$/i,jE=/^0o[0-7]+$/i,qE=parseInt,ZE=typeof global=="object"&&global&&global.Object===Object&&global,XE=typeof self=="object"&&self&&self.Object===Object&&self,WE=ZE||XE||Function("return this")(),$E=Object.prototype,HE=$E.toString,KE=Math.max,YE=Math.min,O_=function(){return WE.Date.now()};function JE(_,c,n){var u,r,s,P,z,F,N=0,V=!1,me=!1,be=!0;if(typeof _!="function")throw new TypeError(u1);c=l1(c)||0,pg(n)&&(V=!!n.leading,me="maxWait"in n,s=me?KE(l1(n.maxWait)||0,c):s,be="trailing"in n?!!n.trailing:be);function Se(ct){var Tt=u,St=r;return u=r=void 0,N=ct,P=_.apply(St,Tt),P}function Ve(ct){return N=ct,z=setTimeout(Ge,c),V?Se(ct):P}function Ke(ct){var Tt=ct-F,St=ct-N,Lt=c-Tt;return me?YE(Lt,s-St):Lt}function Ie(ct){var Tt=ct-F,St=ct-N;return F===void 0||Tt>=c||Tt<0||me&&St>=s}function Ge(){var ct=O_();if(Ie(ct))return et(ct);z=setTimeout(Ge,Ke(ct))}function et(ct){return z=void 0,be&&u?Se(ct):(u=r=void 0,P)}function rt(){z!==void 0&&clearTimeout(z),N=0,u=F=r=z=void 0}function _t(){return z===void 0?P:et(O_())}function yt(){var ct=O_(),Tt=Ie(ct);if(u=arguments,r=this,F=ct,Tt){if(z===void 0)return Ve(F);if(me)return z=setTimeout(Ge,c),Se(F)}return z===void 0&&(z=setTimeout(Ge,c)),P}return yt.cancel=rt,yt.flush=_t,yt}function QE(_,c,n){var u=!0,r=!0;if(typeof _!="function")throw new TypeError(u1);return pg(n)&&(u="leading"in n?!!n.leading:u,r="trailing"in n?!!n.trailing:r),JE(_,c,{leading:u,maxWait:c,trailing:r})}function pg(_){var c=typeof _;return!!_&&(c=="object"||c=="function")}function eT(_){return!!_&&typeof _=="object"}function tT(_){return typeof _=="symbol"||eT(_)&&HE.call(_)==UE}function l1(_){if(typeof _=="number")return _;if(tT(_))return s1;if(pg(_)){var c=typeof _.valueOf=="function"?_.valueOf():_;_=pg(c)?c+"":c}if(typeof _!="string")return _===0?_:+_;_=_.replace(NE,"");var n=GE.test(_);return n||jE.test(_)?qE(_.slice(2),n?2:8):VE.test(_)?s1:+_}c1.exports=QE});var mg={};iy(mg,{CopyrightControl:()=>sx,Layer:()=>Is,MapboxLayer:()=>np,MapboxStyleLayer:()=>r1,MaplibreLayer:()=>op,RealtimeAPI:()=>Wf,RealtimeLayer:()=>f1,RealtimeModes:()=>ra,RoutingAPI:()=>Zf,RoutingControl:()=>$0,RoutingLayer:()=>ug,StopFinderControl:()=>K0,StopsAPI:()=>Xf,VectorLayer:()=>d1,WMSLayer:()=>m1,createTrackerFilters:()=>uy,fullTrajectoryDelayStyle:()=>p1,fullTrajectoryStyle:()=>dg,getCircleCanvas:()=>Ry,getDelayBgCanvas:()=>ky,getDelayTextCanvas:()=>Ly,getHoursAndMinutes:()=>Iv,getLayersAsFlatArray:()=>$f,getMapboxMapCopyrights:()=>oc,getMapboxRender:()=>tf,getMaplibreRender:()=>ef,getTextCanvas:()=>zy,getUTCDateString:()=>Tv,getUTCTimeString:()=>Sv,getUrlWithParams:()=>Zh,pad:()=>km,realtimeDefaultStyle:()=>Hh,realtimeDelayStyle:()=>Dy,realtimeSimpleStyle:()=>Oy,removeDuplicate:()=>Xh,renderTrajectories:()=>Hf,sortByDelay:()=>cy,trackerConfig:()=>rf});var $1=function(){function _(c){this.propagationStopped,this.defaultPrevented,this.type=c,this.target=null}return _.prototype.preventDefault=function(){this.defaultPrevented=!0},_.prototype.stopPropagation=function(){this.propagationStopped=!0},_}();var La=$1;var jp={PROPERTYCHANGE:"propertychange"};var H1=function(){function _(){this.disposed=!1}return _.prototype.dispose=function(){this.disposed||(this.disposed=!0,this.disposeInternal())},_.prototype.disposeInternal=function(){},_}(),dv=H1;function mv(_,c,n){for(var u,r,s=n||rh,P=0,z=_.length,F=!1;P<z;)u=P+(z-P>>1),r=+s(_[u],c),r<0?P=u+1:(z=u,F=!r);return F?P:~P}function rh(_,c){return _>c?1:_<c?-1:0}function gv(_,c){return _.indexOf(c)>=0}function yv(_,c,n){for(;c<n;){var u=_[c];_[c]=_[n],_[n]=u,++c,--n}}function Ha(_,c){for(var n=Array.isArray(c)?c:[c],u=n.length,r=0;r<u;r++)_[_.length]=n[r]}function _s(_,c){var n=_.length;if(n!==c.length)return!1;for(var u=0;u<n;u++)if(_[u]!==c[u])return!1;return!0}function Sm(){return!0}function qh(){}function _v(_){var c=!1,n,u,r;return function(){var s=Array.prototype.slice.call(arguments);return(!c||this!==r||!_s(s,u))&&(c=!0,r=this,u=s,n=_.apply(this,arguments)),n}}var Ra=typeof Object.assign=="function"?Object.assign:function(_,c){if(_==null)throw new TypeError("Cannot convert undefined or null to object");for(var n=Object(_),u=1,r=arguments.length;u<r;++u){var s=arguments[u];if(s!=null)for(var P in s)s.hasOwnProperty(P)&&(n[P]=s[P])}return n};function ih(_){for(var c in _)delete _[c]}var Im=typeof Object.values=="function"?Object.values:function(_){var c=[];for(var n in _)c.push(_[n]);return c};function Vl(_){var c;for(c in _)return!1;return!c}var K1=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Y1=function(_){K1(c,_);function c(n){var u=_.call(this)||this;return u.eventTarget_=n,u.pendingRemovals_=null,u.dispatching_=null,u.listeners_=null,u}return c.prototype.addEventListener=function(n,u){if(!(!n||!u)){var r=this.listeners_||(this.listeners_={}),s=r[n]||(r[n]=[]);s.indexOf(u)===-1&&s.push(u)}},c.prototype.dispatchEvent=function(n){var u=typeof n=="string",r=u?n:n.type,s=this.listeners_&&this.listeners_[r];if(!!s){var P=u?new La(n):n;P.target||(P.target=this.eventTarget_||this);var z=this.dispatching_||(this.dispatching_={}),F=this.pendingRemovals_||(this.pendingRemovals_={});r in z||(z[r]=0,F[r]=0),++z[r];for(var N,V=0,me=s.length;V<me;++V)if("handleEvent"in s[V]?N=s[V].handleEvent(P):N=s[V].call(this,P),N===!1||P.propagationStopped){N=!1;break}if(--z[r]===0){var be=F[r];for(delete F[r];be--;)this.removeEventListener(r,qh);delete z[r]}return N}},c.prototype.disposeInternal=function(){this.listeners_&&ih(this.listeners_)},c.prototype.getListeners=function(n){return this.listeners_&&this.listeners_[n]||void 0},c.prototype.hasListener=function(n){return this.listeners_?n?n in this.listeners_:Object.keys(this.listeners_).length>0:!1},c.prototype.removeEventListener=function(n,u){var r=this.listeners_&&this.listeners_[n];if(r){var s=r.indexOf(u);s!==-1&&(this.pendingRemovals_&&n in this.pendingRemovals_?(r[s]=qh,++this.pendingRemovals_[n]):(r.splice(s,1),r.length===0&&delete this.listeners_[n]))}},c}(dv),nh=Y1;var Ji={CHANGE:"change",ERROR:"error",BLUR:"blur",CLEAR:"clear",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",DRAGENTER:"dragenter",DRAGOVER:"dragover",DROP:"drop",FOCUS:"focus",KEYDOWN:"keydown",KEYPRESS:"keypress",LOAD:"load",RESIZE:"resize",TOUCHMOVE:"touchmove",WHEEL:"wheel"};function lo(_,c,n,u,r){if(u&&u!==_&&(n=n.bind(u)),r){var s=n;n=function(){_.removeEventListener(c,n),s.apply(this,arguments)}}var P={target:_,type:c,listener:n};return _.addEventListener(c,n),P}function qp(_,c,n,u){return lo(_,c,n,u,!0)}function Ao(_){_&&_.target&&(_.target.removeEventListener(_.type,_.listener),ih(_))}var J1=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Cm=function(_){J1(c,_);function c(){var n=_.call(this)||this;return n.on=n.onInternal,n.once=n.onceInternal,n.un=n.unInternal,n.revision_=0,n}return c.prototype.changed=function(){++this.revision_,this.dispatchEvent(Ji.CHANGE)},c.prototype.getRevision=function(){return this.revision_},c.prototype.onInternal=function(n,u){if(Array.isArray(n)){for(var r=n.length,s=new Array(r),P=0;P<r;++P)s[P]=lo(this,n[P],u);return s}else return lo(this,n,u)},c.prototype.onceInternal=function(n,u){var r;if(Array.isArray(n)){var s=n.length;r=new Array(s);for(var P=0;P<s;++P)r[P]=qp(this,n[P],u)}else r=qp(this,n,u);return u.ol_key=r,r},c.prototype.unInternal=function(n,u){var r=u.ol_key;if(r)Ka(r);else if(Array.isArray(n))for(var s=0,P=n.length;s<P;++s)this.removeEventListener(n[s],u);else this.removeEventListener(n,u)},c}(nh);Cm.prototype.on;Cm.prototype.once;Cm.prototype.un;function Ka(_){if(Array.isArray(_))for(var c=0,n=_.length;c<n;++c)Ao(_[c]);else Ao(_)}var Am=Cm;function jr(){return function(){throw new Error("Unimplemented abstract method.")}()}var Q1=0;function Ai(_){return _.ol_uid||(_.ol_uid=String(++Q1))}var Pm="6.14.1";var xv=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),vv=function(_){xv(c,_);function c(n,u,r){var s=_.call(this,n)||this;return s.key=u,s.oldValue=r,s}return c}(La);var eb=function(_){xv(c,_);function c(n){var u=_.call(this)||this;return u.on,u.once,u.un,Ai(u),u.values_=null,n!==void 0&&u.setProperties(n),u}return c.prototype.get=function(n){var u;return this.values_&&this.values_.hasOwnProperty(n)&&(u=this.values_[n]),u},c.prototype.getKeys=function(){return this.values_&&Object.keys(this.values_)||[]},c.prototype.getProperties=function(){return this.values_&&Ra({},this.values_)||{}},c.prototype.hasProperties=function(){return!!this.values_},c.prototype.notify=function(n,u){var r;r="change:".concat(n),this.hasListener(r)&&this.dispatchEvent(new vv(r,n,u)),r=jp.PROPERTYCHANGE,this.hasListener(r)&&this.dispatchEvent(new vv(r,n,u))},c.prototype.addChangeListener=function(n,u){this.addEventListener("change:".concat(n),u)},c.prototype.removeChangeListener=function(n,u){this.removeEventListener("change:".concat(n),u)},c.prototype.set=function(n,u,r){var s=this.values_||(this.values_={});if(r)s[n]=u;else{var P=s[n];s[n]=u,P!==u&&this.notify(n,P)}},c.prototype.setProperties=function(n,u){for(var r in n)this.set(r,n[r],u)},c.prototype.applyProperties=function(n){!n.values_||Ra(this.values_||(this.values_={}),n.values_)},c.prototype.unset=function(n,u){if(this.values_&&n in this.values_){var r=this.values_[n];delete this.values_[n],Vl(this.values_)&&(this.values_=null),u||this.notify(n,r)}},c}(Am),Po=eb;var tb=(_,c)=>{let n=new URL(_);return Object.entries(c||{}).forEach(([r,s])=>{s!=null&&n.searchParams.set(r,s)}),n},Zh=tb;var ny=class extends Po{constructor(n){super();this.url=n.url,this.apiKey=n.apiKey}fetch(n,u,r){if(!this.url)return Promise.reject(new Error(`No url defined for request to ${this.url}/${n}`));if(!this.url&&!this.apiKey&&!/key=/.test(this.url))return Promise.reject(new Error(`No apiKey defined for request to ${this.url}`));let s=u||{},P=Zh(`${this.url}${n||""}`,{key:this.apiKey,...s});return fetch(P.toString(),r).then(z=>{try{return z.json().then(F=>{if(F.error)throw new Error(F.error);return F})}catch(F){return Promise.reject(new Error(F))}})}},Mm=ny;var oy=class extends Mm{constructor(c={}){super({url:"https://api.geops.io/routing/v1/",...c})}route(c,n){return this.fetch("",c,n)}},Zf=oy;var ay=class extends Mm{constructor(c={}){super({url:"https://api.geops.io/stops/v1/",...c})}search(c,n){return this.fetch("",c,n)}},Xf=ay;var Zp=class{constructor(){this.defineProperties()}defineProperties(){Object.defineProperties(this,{closed:{get:()=>!!(this.websocket&&this.websocket.readyState===this.websocket.CLOSED)},closing:{get:()=>!!(this.websocket&&this.websocket.readyState===this.websocket.CLOSING)},connecting:{get:()=>!!(this.websocket&&this.websocket.readyState===this.websocket.CONNECTING)},open:{get:()=>!!(this.websocket&&this.websocket.readyState===this.websocket.OPEN)},messagesOnOpen:{value:[],writable:!0},subscriptions:{value:[],writable:!0},subscribed:{value:{},writable:!0}})}static getRequestString(c,n={}){let u=`${c} ${n.channel}`;return u+=n.args?` ${n.args}`:"",u+=n.id?` ${n.id}`:"",u.trim()}connect(c,n=()=>{}){this.websocket&&!this.closed&&this.websocket.close(),this.websocket=new WebSocket(c),this.open?(n(),this.subscribePreviousSubscriptions()):this.websocket.addEventListener("open",()=>{n(),this.subscribePreviousSubscriptions()})}close(){this.websocket&&(this.websocket.onclose=null,this.websocket.close(),this.websocket=void 0,this.messagesOnOpen=[])}send(c){if(!this.websocket)return;let n=()=>{this.websocket?.send(c)};this.open?this.messagesOnOpen.includes(c)||n():this.messagesOnOpen.includes(c)||(this.messagesOnOpen.push(c),this.websocket.addEventListener("open",()=>{this.messagesOnOpen=[],n()}),this.websocket.addEventListener("close",()=>{this.messagesOnOpen=[]}))}addEvents(c,n){this.websocket&&(this.websocket.addEventListener("message",c),n&&(this.websocket.addEventListener("error",n),this.websocket.addEventListener("close",n)))}removeEvents(c,n){this.websocket&&(this.websocket.removeEventListener("message",c),n&&(this.websocket.removeEventListener("error",n),this.websocket.removeEventListener("close",n)))}listen(c,n,u){this.unlisten(c,n);let r=s=>{let P;try{P=JSON.parse(s.data)}catch(N){console.error("WebSocket: unable to parse JSON data",N,s.data);return}let z=c.channel;z+=c.args?` ${c.args}`:"";let F;P.source==="buffer"?F=P.content:F=[P],F.forEach(N=>{N?.source===z&&(!c.id||c.id===P.client_reference)&&n(N)})};return this.addEvents(r,u),{onMessageCb:r,onErrorCb:u}}unlisten(c,n){[...this.subscriptions||[],...this.requests||[]].filter(u=>u.params.channel===c.channel&&(!n||u.cb===n)).forEach(({onMessageCb:u,onErrorCb:r})=>{this.removeEvents(u,r)})}get(c,n,u){let r=Zp.getRequestString("GET",c);this.send(r);let s=V=>(...me)=>{V(...me);let be=this.requests.findIndex(Ke=>r===Ke.requestString&&n===Ke.cb),{onMessageCb:Se,onErrorCb:Ve}=this.requests[be];this.removeEvents(Se,Ve),this.requests.splice(be,1)},{onMessageCb:P,onErrorCb:z}=this.listen(c,s(n),u&&s(u));this.requests||(this.requests=[]);let F=this.requests.findIndex(V=>r===V.requestString&&n===V.cb),N={params:c,requestString:r,cb:n,errorCb:u,onMessageCb:P,onErrorCb:z};F>-1?this.requests[F]=N:this.requests.push(N)}subscribe(c,n,u,r=!1){let{onMessageCb:s,onErrorCb:P}=this.listen(c,n,u),z=Zp.getRequestString("",c),F=this.subscriptions.findIndex(V=>c.channel===V.params.channel&&n===V.cb),N={params:c,cb:n,errorCb:u,onMessageCb:s,onErrorCb:P,quiet:r};F>-1?this.subscriptions[F]=N:this.subscriptions.push(N),this.subscribed[z]||(N.quiet||(this.send(`GET ${z}`),this.send(`SUB ${z}`)),this.subscribed[z]=!0)}unsubscribe(c,n){let u=this.subscriptions.filter(r=>r.params.channel===c&&(!n||r.cb===n));u.forEach(({onMessageCb:r,onErrorCb:s})=>{this.removeEvents(r,s)}),this.subscriptions=this.subscriptions.filter(r=>r.params.channel!==c||n&&r.cb!==n),c&&this.subscribed[c]&&!this.subscriptions.find(r=>r.params.channel===c)&&u.find(r=>!r.quiet)&&(this.send(`DEL ${c}`),this.subscribed[c]=!1)}subscribePreviousSubscriptions(){Object.keys(this.subscribed).forEach(c=>{this.subscribed[c]=!1}),[...this.subscriptions].forEach(c=>{this.subscribe(c.params,c.cb,c.errorCb,c.quiet)})}},bv=Zp;var rb=_=>(_.stations.forEach(c=>{c.arrivalTimeWithDelay=c.arrivalTime,c.departureTime&&(c.departureTimeWithDelay=c.departureTime),c.arrivalDelay&&(c.arrivalTime-=c.arrivalDelay,c.departureTime&&(c.departureTime-=c.arrivalDelay))}),_),sy=rb;var ib=(_,c)=>_===c.SCHEMATIC?"_schematic":"",xu=ib;var nb=(_,c,n=!1)=>{let u=["HIDDEN","LEAVING","BOARDING"],r=_.has_fzo&&u.indexOf(_.state)>-1,s=c.has_fzo&&u.indexOf(c.state)>-1;if(r||s){if(r!==s)return r?-1:1;if(_.state!==c.state)return u.indexOf(_.state)-u.indexOf(c.state)}let P=null,z=null,F=Date.now();return n?(P=new Date(_.min_arrival_time||_.time).getTime()-F,z=new Date(c.min_arrival_time||c.time).getTime()-F):(P=new Date(_.time).getTime()-F,z=new Date(c.time).getTime()-F),P-z},wv=nb;var ra={RAW:"raw",TOPOGRAPHIC:"topographic",SCHEMATIC:"schematic"},ly=class{constructor(c={}){this.defineProperties(c),this.subscribedStationUic=void 0,this.departureUpdateTimeout=void 0,this.maxDepartureAge=30,this.extraGeoms={},this.prefix=c.prefix||"",this.onOpen=this.onOpen.bind(this)}defineProperties(c){let n=c;typeof c=="string"&&(n={url:c});let{apiKey:u}=n,{url:r,projection:s,bbox:P,buffer:z=[100,100]}=n,F=new bv;u&&(r=`${r||"wss://api.geops.io/tracker-ws/v1/"}?key=${u}`),Object.defineProperties(this,{url:{get:()=>r,set:N=>{r=N,this.open()}},projection:{get:()=>s,set:N=>{N!==s&&(s=N,this.wsApi&&this.wsApi.send(`PROJECTION ${s}`))}},bbox:{get:()=>P,set:N=>{JSON.stringify(N)!==JSON.stringify(P)&&(P=N,this.wsApi&&P&&this.wsApi.send(`BBOX ${P.join(" ")}`))}},buffer:{get:()=>z,set:N=>{JSON.stringify(N)!==JSON.stringify(z)&&(z=N,this.wsApi&&this.wsApi.send(`BUFFER ${z.join(" ")}`))}},wsApi:{value:F,writable:!0},pingIntervalMs:{value:c.pingIntervalMs||1e4,writable:!0},reconnectTimeoutMs:{value:c.pingIntervalMs||100,writable:!0}})}open(){this.close(),this.wsApi.connect(this.url,this.onOpen),this.wsApi.websocket&&(this.wsApi.websocket.onclose=()=>{this.onClose()})}close(){this.wsApi.close()}reset(){this.wsApi.send("RESET")}onOpen(){this.projection&&this.wsApi.send(`PROJECTION ${this.projection}`),this.bbox&&this.wsApi.send(`BBOX ${this.bbox.join(" ")}`),this.buffer&&this.wsApi.send(`BUFFER ${this.buffer.join(" ")}`),this.pingIntervalMs&&(window.clearInterval(this.pingInterval),this.pingInterval=window.setInterval(()=>{this.wsApi.send("PING")},this.pingIntervalMs))}onClose(){window.clearTimeout(this.pingInterval),window.clearTimeout(this.reconnectTimeout),this.reconnectTimeoutMs&&(this.reconnectTimeout=window.setTimeout(()=>this.open(),this.reconnectTimeoutMs))}subscribe(c,n,u,r=!1){!c||!n||this.wsApi.subscribe({channel:c},n,u,r)}unsubscribe(c,n="",u){this.wsApi.unsubscribe(`${c}${xu(ra.SCHEMATIC,ra)}${n}`,u),this.wsApi.unsubscribe(`${c}${xu(ra.TOPOGRAPHIC,ra)}${n||""}`,u)}filterDepartures(c,n=!1){let u=Object.keys(c).map(me=>c[me]);u.sort((me,be)=>wv(me,be,n));let r=new Date;r.setMinutes(r.getMinutes()+this.maxDepartureAge);let s=r.getTime(),P=new Date;P.setMinutes(P.getMinutes()-this.maxDepartureAge);let z=P.getTime(),F=[],N=[],V=null;for(let me=u.length-1;me>=0;me-=1){let be={...u[me]},Se=new Date(be.time).getTime();Se>z&&Se<s&&(be.state==="BOARDING"&&(N.indexOf(be.platform)===-1?N.push(be.platform):be.state="HIDDEN"),V&&be.to[0]===V.to[0]&&Math.abs(Se-V.time)<1e3&&be.line.name===V.line.name&&(be.state="HIDDEN"),/(STOP_CANCELLED|JOURNEY_CANCELLED)/.test(be.state)&&(be.cancelled=!0),V=be,V.time=Se,F.unshift(be))}return F}subscribeDepartures(c,n,u){window.clearTimeout(this.departureUpdateTimeout),this.unsubscribeDepartures(),this.subscribedStationUic=c;let r=c?`timetable_${c}`:null,s={};if(!r)return;let P=z=>{if(z.source===r){let F=z.content||{},N=new Date(F.timestamp).getTime()-Date.now();s[F.call_id]={...F,timediff:N},window.clearTimeout(this.departureUpdateTimeout),this.departureUpdateTimeout=window.setTimeout(()=>{let V=this.filterDepartures(s,n||!1);u(V)},100)}};this.subscribe(r,P,()=>{u([])})}unsubscribeDepartures(c){this.subscribedStationUic&&(this.unsubscribe(`timetable_${this.subscribedStationUic}`,"",c),this.subscribedStationUic=void 0)}subscribeDisruptions(c){this.subscribe(`${this.prefix}newsticker`,n=>{c(n.content)})}unsubscribeDisruptions(c){this.unsubscribe(`${this.prefix}newsticker`,"",c)}getStation(c,n){let u={channel:`station${xu(n,ra)}`,args:c};return new Promise((r,s)=>{this.wsApi.get(u,P=>{P.content?r(P.content):s()})})}getStations(c){let n=[],u={channel:`station${xu(c,ra)}`};return window.clearTimeout(this.stationUpdateTimeout),new Promise((r,s)=>{this.wsApi.get(u,P=>{P.content?(n.push(P.content),window.clearTimeout(this.stationUpdateTimeout),this.stationUpdateTimeout=window.setTimeout(()=>{r(n)},50)):s(P.content)})})}subscribeStations(c,n){this.unsubscribeStations(),this.subscribe(`station${xu(c,ra)}`,u=>{u.content&&n(u.content)})}unsubscribeStations(c){window.clearTimeout(this.stationUpdateTimeout),this.unsubscribe("station","",c)}subscribeExtraGeoms(c){this.subscribe("extra_geoms",n=>{let u=n.content;if(u){let{ref:r}=u.properties;u.type==="Feature"?this.extraGeoms[r]=u:delete this.extraGeoms[r],c(Object.keys(this.extraGeoms).map(s=>this.extraGeoms[s]))}})}unsubscribeExtraGeoms(c){this.unsubscribe("extra_geoms","",c)}subscribeTrajectory(c,n,u=!1){this.unsubscribeTrajectory(n),this.subscribe(`trajectory${xu(c,ra)}`,n,void 0,u)}unsubscribeTrajectory(c){this.unsubscribe("trajectory","",c)}subscribeDeletedVehicles(c,n,u=!1){this.unsubscribeDeletedVehicles(n),this.subscribe(`deleted_vehicles${xu(c,ra)}`,n,void 0,u)}unsubscribeDeletedVehicles(c){this.unsubscribe("deleted_vehicles","",c)}getFullTrajectory(c,n,u){let r=[`full_trajectory${xu(n,ra)}`];c&&r.push(c),(!n||n===ra.TOPOGRAPHIC)&&u&&r.push(`gen${u}`);let s={channel:r.join("_")};return new Promise(P=>{this.wsApi.get(s,z=>{z.content&&P(z.content)})})}getFullTrajectories(c,n,u){let r=c.map(s=>this.getFullTrajectory(s,n,u));return Promise.all(r)}subscribeFullTrajectory(c,n){this.unsubscribeFullTrajectory(c),this.subscribe(`full_trajectory${xu(n,ra)}_${c}`,u=>{console.log("subscribe full_trajectory",u)},u=>{console.log("subscribe full_trajectory error",u)})}unsubscribeFullTrajectory(c,n){this.unsubscribe("full_trajectory",`_${c}`,n)}getStopSequence(c){let n={channel:`stopsequence_${c}`};return new Promise((u,r)=>{this.wsApi.get(n,s=>{let P=s.content;if(P&&P.length){let z=P.map(F=>sy(F));u(z)}u([])},s=>{r(s)})})}getStopSequences(c){let n=c.map(u=>this.getStopSequence(u));return Promise.all(n)}subscribeStopSequence(c,n){window.clearTimeout(this.fullTrajectoryUpdateTimeout),this.unsubscribeStopSequence(c),this.subscribe(`stopsequence_${c}`,u=>{let r=u.content;if(r&&r.length){let s=r.map(P=>sy(P));n(s)}},u=>{console.log("subscribe stopsequence error",u)})}unsubscribeStopSequence(c,n){this.unsubscribe("stopsequence",`_${c}`,n)}subscribeHealthCheck(c){this.unsubscribeHealthCheck(),this.subscribe("healthcheck",c)}unsubscribeHealthCheck(){this.unsubscribe("healthcheck")}},Wf=ly;var ob=_=>{let c=_.filter(s=>s!=null&&s.trim&&s.trim()),n=c.map(s=>s.toLowerCase());return[...new Set(n)].map(s=>c.find(P=>P.toLowerCase()===s))},Xh=ob;var ab=_=>{if(!_)return[];let{style:c}=_;if(!c)return[];let{sourceCaches:n}=c,u=[];return Object.values(n).forEach(r=>{if(r.used){let s=r.getSource(),P=s.attribution||s.options&&s.options.attribution;P&&(u=u.concat(P.replace(/&copy;/g,"\xA9").split(/(<a.*?<\/a>)/)))}}),Xh(u)},oc=ab;var sb=(_,c,n,u)=>{let r=[];if(!_&&!c&&!n&&!u)return null;if(u){let s=typeof u=="string"?[u]:u,P=z=>{let F=z.properties.name||z.properties.line&&z.properties.line.name||"";return F?s.some(N=>new RegExp(N,"i").test(F)):!1};r.push(P)}if(_){let P=(typeof _=="string"?_.split(","):_).map(F=>F.replace(/\s+/g,"").toUpperCase()),z=F=>{let{line:N,name:V}=F.properties,me=(V||N&&N.name||"").toUpperCase();return me?P.includes(me):!1};r.push(z)}if(c){let P=(typeof c=="string"?c.split(","):c).map(F=>parseInt(F,10)),z=F=>{let N=parseInt(F.properties.routeIdentifier.split(".")[0],10);return P.includes(N)};r.push(z)}if(n){let s=typeof n=="string"?[n]:n,P=z=>s.some(F=>new RegExp(F,"i").test(z.properties.operator||""));r.push(P)}return r.length?s=>{for(let P=0;P<r.length;P+=1)if(!r[P](s))return!1;return!0}:null},uy=sb;var Ev=_=>{let c=_;Array.isArray(c)||(c=[_]);let n=[];return c.forEach(u=>{n.push(u);let{children:r}=u;n=n.concat(Ev(r||[]))}),n},$f=Ev;var Tv=(_=new Date)=>{let c=(_.getUTCMonth()+1).toString();c=c.length===1?`0${c}`:c;let n=_.getUTCDate().toString();return n=n.length===1?`0${n}`:n,[_.getUTCFullYear(),c,n].join("")},Sv=_=>[_.getUTCHours(),_.getUTCMinutes(),`${_.getUTCSeconds()}.${_.getUTCMilliseconds()}`].join(":"),km=_=>_<10?`0${_}`:_,Iv=_=>{if(!_||_<=0)return"";let c=new Date(_);return`${km(c.getHours())}:${km(c.getMinutes())}`};var lb=(_,c)=>{let n=_.properties,u=c.properties;return n.delay===null&&u.delay!==null?1:u.delay===null&&n.delay!==null?-1:n.cancelled&&!u.cancelled?u.delay<18e4?-1:1:u.cancelled&&!n.cancelled?n.delay<18e4?1:-1:u.delay-n.delay},cy=lb;var oh=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"",SS=oh.indexOf("firefox")!==-1,ub=oh.indexOf("safari")!==-1&&oh.indexOf("chrom")==-1,IS=ub&&!!(oh.indexOf("version/15.4")>=0||oh.match(/cpu (os|iphone os) 15_4 like mac os x/)),CS=oh.indexOf("webkit")!==-1&&oh.indexOf("edge")==-1,AS=oh.indexOf("macintosh")!==-1;var ah=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,Cv=typeof Image<"u"&&Image.prototype.decode,PS=function(){var _=!1;try{var c=Object.defineProperty({},"passive",{get:function(){_=!0}});window.addEventListener("_",null,c),window.removeEventListener("_",null,c)}catch{}return _}();var cb=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),hb=function(_){cb(c,_);function c(n){var u=this,r=Pm==="latest"?Pm:"v"+Pm.split("-")[0],s="Assertion failed. See https://openlayers.org/en/"+r+"/doc/errors/#"+n+" for details.";return u=_.call(this,s)||this,u.code=n,u.name="AssertionError",u.message=s,u}return c}(Error),Lm=hb;function wn(_,c){if(!_)throw new Lm(c)}var FS=new Array(6);function za(){return[1,0,0,1,0,0]}function pb(_,c,n,u,r,s,P){return _[0]=c,_[1]=n,_[2]=u,_[3]=r,_[4]=s,_[5]=P,_}function Pv(_,c){return _[0]=c[0],_[1]=c[1],_[2]=c[2],_[3]=c[3],_[4]=c[4],_[5]=c[5],_}function xo(_,c){var n=c[0],u=c[1];return c[0]=_[0]*n+_[2]*u+_[4],c[1]=_[1]*n+_[3]*u+_[5],c}function Mv(_,c,n){return pb(_,c,0,0,n,0,0)}function vs(_,c,n,u,r,s,P,z){var F=Math.sin(s),N=Math.cos(s);return _[0]=u*N,_[1]=r*F,_[2]=-u*F,_[3]=r*N,_[4]=P*u*N-z*u*F+c,_[5]=P*r*F+z*r*N+n,_}function kv(_,c,n,u,r,s,P){return hy(vs(za(),_,c,n,u,r,s,P))}function Lv(_,c){var n=fb(c);wn(n!==0,32);var u=c[0],r=c[1],s=c[2],P=c[3],z=c[4],F=c[5];return _[0]=P/n,_[1]=-r/n,_[2]=-s/n,_[3]=u/n,_[4]=(s*F-P*z)/n,_[5]=-(u*F-r*z)/n,_}function fb(_){return _[0]*_[3]-_[1]*_[2]}var Av;function hy(_){var c="matrix("+_.join(", ")+")";if(ah)return c;var n=Av||(Av=document.createElement("div"));return n.style.transform=c,n.style.transform}var Pt={POINT:"Point",LINE_STRING:"LineString",LINEAR_RING:"LinearRing",POLYGON:"Polygon",MULTI_POINT:"MultiPoint",MULTI_LINE_STRING:"MultiLineString",MULTI_POLYGON:"MultiPolygon",GEOMETRY_COLLECTION:"GeometryCollection",CIRCLE:"Circle"};var db=(_,c,n)=>{let{time_intervals:u,olGeometry:r,coordinate:s}=c.properties,P,z;if(n&&s)P=s;else if(r.getType()===Pt.POINT)P=r.getCoordinates();else if(r.getType()===Pt.LINE_STRING){let F=u||[[]],N=F[0],V=F[F.length-1];if(_<N[0])[,,z]=N,P=r.getFirstCoordinate();else if(_>V[0])[,,z]=V,P=r.getLastCoordinate();else for(let me=0;me<F.length-1;me+=1){let[be,Se]=F[me],[Ve,Ke]=F[me+1];if(be<=_&&_<=Ve){let Ge=Math.min((_-be)/(Ve-be),1)*(Ke-Se)+Se;P=r.getCoordinateAt(Ge),[,,z]=F[me];break}}}else console.error("This geometry type is not supported. Only Point or LineString are. Current geometry: ",r);return{coord:P,rotation:z}},Rv=db;var mb=(_,c,n,u,r)=>{if(!_)return{renderedTrajectories:[]};let{time:s=Date.now(),size:P=[],center:z,resolution:F,rotation:N=0,pixelRatio:V=1}=u;if(!F||!z)return{renderedTrajectories:[]};let{noInterpolate:me=!1,hoverVehicleId:be,selectedVehicleId:Se}=r,Ve=_.getContext("2d");Ve?.clearRect(0,0,_.width,_.height);let[Ke,Ie]=P;Ke&&Ie&&(_.width!==Ke||_.height!==Ie)&&([_.width,_.height]=[Ke*V,Ie*V]);let Ge=vs(za(),P[0]/2,P[1]/2,1/F,-1/F,-N,-z[0],-z[1]);_.style&&(_.style.width=`${_.width/V}px`,_.style.height=`${_.height/V}px`);let et,rt,_t,yt,ct,Tt,St,Lt,ur=[];for(let Vt=c.length-1;Vt>=0;Vt-=1){let Qt=c[Vt],{train_id:or,timeOffset:Mt}=Qt.properties,{coord:Br,rotation:Tr}=Rv(s-(Mt||0),Qt,me);if(c[Vt].properties.coordinate=Br,c[Vt].properties.rotation=Tr,!Br)continue;let br=xo(Ge,[...Br]);if(!br||(br=br.map(ai=>ai*V),br[0]<0||br[0]>_.width||br[1]<0||br[1]>_.height))continue;let Mr=n(Qt,u,r);if(!Mr)continue;let Ir=Mr.width,xr=Mr.height;be!==or&&Se!==or&&Ve?.drawImage(Mr,br[0]-Ir/2,br[1]-xr/2,Ir,xr),be&&be===or&&(et=Mr,rt=br,_t=Ir,yt=xr),Se&&Se===or&&(ct=Mr,Tt=br,St=Ir,Lt=xr),ur.push(Qt)}return ct&&Tt&&St&&Lt&&Ve?.drawImage(ct,Tt[0]-St/2,Tt[1]-Lt/2,St,Lt),et&&rt&&_t&&yt&&Ve?.drawImage(et,rt[0]-_t/2,rt[1]-yt/2,_t,yt),{renderedTrajectories:ur}},Hf=mb;var Gl={RADIANS:"radians",DEGREES:"degrees",FEET:"ft",METERS:"m",PIXELS:"pixels",TILE_PIXELS:"tile-pixels",USFEET:"us-ft"},ZS={9001:Gl.METERS,9002:Gl.FEET,9003:Gl.USFEET,9101:Gl.RADIANS,9102:Gl.DEGREES};var bu={};bu[Gl.RADIANS]=6370997/(2*Math.PI);bu[Gl.DEGREES]=2*Math.PI*6370997/360;bu[Gl.FEET]=.3048;bu[Gl.METERS]=1;bu[Gl.USFEET]=1200/3937;var ac=Gl;var gb=function(){function _(c){this.code_=c.code,this.units_=c.units,this.extent_=c.extent!==void 0?c.extent:null,this.worldExtent_=c.worldExtent!==void 0?c.worldExtent:null,this.axisOrientation_=c.axisOrientation!==void 0?c.axisOrientation:"enu",this.global_=c.global!==void 0?c.global:!1,this.canWrapX_=!!(this.global_&&this.extent_),this.getPointResolutionFunc_=c.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=c.metersPerUnit}return _.prototype.canWrapX=function(){return this.canWrapX_},_.prototype.getCode=function(){return this.code_},_.prototype.getExtent=function(){return this.extent_},_.prototype.getUnits=function(){return this.units_},_.prototype.getMetersPerUnit=function(){return this.metersPerUnit_||bu[this.units_]},_.prototype.getWorldExtent=function(){return this.worldExtent_},_.prototype.getAxisOrientation=function(){return this.axisOrientation_},_.prototype.isGlobal=function(){return this.global_},_.prototype.setGlobal=function(c){this.global_=c,this.canWrapX_=!!(c&&this.extent_)},_.prototype.getDefaultTileGrid=function(){return this.defaultTileGrid_},_.prototype.setDefaultTileGrid=function(c){this.defaultTileGrid_=c},_.prototype.setExtent=function(c){this.extent_=c,this.canWrapX_=!!(this.global_&&c)},_.prototype.setWorldExtent=function(c){this.worldExtent_=c},_.prototype.setGetPointResolution=function(c){this.getPointResolutionFunc_=c},_.prototype.getPointResolutionFunc=function(){return this.getPointResolutionFunc_},_}(),Rm=gb;function jl(_,c,n){return Math.min(Math.max(_,c),n)}var zv=function(){var _;return"cosh"in Math?_=Math.cosh:_=function(c){var n=Math.exp(c);return(n+1/n)/2},_}(),HS=function(){var _;return"log2"in Math?_=Math.log2:_=function(c){return Math.log(c)*Math.LOG2E},_}();function Dv(_,c,n,u,r,s){var P=r-n,z=s-u;if(P!==0||z!==0){var F=((_-n)*P+(c-u)*z)/(P*P+z*z);F>1?(n=r,u=s):F>0&&(n+=P*F,u+=z*F)}return ql(_,c,n,u)}function ql(_,c,n,u){var r=n-_,s=u-c;return r*r+s*s}function Ov(_){return _*180/Math.PI}function zm(_,c){var n=_%c;return n*c<0?n+c:n}function gl(_,c,n){return _+n*(c-_)}var yb=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Kf=6378137,Wp=Math.PI*Kf,_b=[-Wp,-Wp,Wp,Wp],vb=[-180,-85,180,85],Dm=Kf*Math.log(Math.tan(Math.PI/2)),Xp=function(_){yb(c,_);function c(n){return _.call(this,{code:n,units:ac.METERS,extent:_b,global:!0,worldExtent:vb,getPointResolution:function(u,r){return u/zv(r[1]/Kf)}})||this}return c}(Rm),py=[new Xp("EPSG:3857"),new Xp("EPSG:102100"),new Xp("EPSG:102113"),new Xp("EPSG:900913"),new Xp("http://www.opengis.net/def/crs/EPSG/0/3857"),new Xp("http://www.opengis.net/gml/srs/epsg.xml#3857")];function Fv(_,c,n){var u=_.length,r=n>1?n:2,s=c;s===void 0&&(r>2?s=_.slice():s=new Array(u));for(var P=0;P<u;P+=r){s[P]=Wp*_[P]/180;var z=Kf*Math.log(Math.tan(Math.PI*(+_[P+1]+90)/360));z>Dm?z=Dm:z<-Dm&&(z=-Dm),s[P+1]=z}return s}function Bv(_,c,n){var u=_.length,r=n>1?n:2,s=c;s===void 0&&(r>2?s=_.slice():s=new Array(u));for(var P=0;P<u;P+=r)s[P]=180*_[P]/Wp,s[P+1]=360*Math.atan(Math.exp(_[P+1]/Kf))/Math.PI-90;return s}var xb=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),bb=6378137,Uv=[-180,-90,180,90],wb=Math.PI*bb/180,Wh=function(_){xb(c,_);function c(n,u){return _.call(this,{code:n,units:ac.DEGREES,extent:Uv,axisOrientation:u,global:!0,metersPerUnit:wb,worldExtent:Uv})||this}return c}(Rm),fy=[new Wh("CRS:84"),new Wh("EPSG:4326","neu"),new Wh("urn:ogc:def:crs:OGC:1.3:CRS84"),new Wh("urn:ogc:def:crs:OGC:2:84"),new Wh("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new Wh("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new Wh("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];var dy={};function Nv(_){return dy[_]||dy[_.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function Vv(_,c){dy[_]=c}var $p={};function Yf(_,c,n){var u=_.getCode(),r=c.getCode();u in $p||($p[u]={}),$p[u][r]=n}function Gv(_,c){var n;return _ in $p&&c in $p[_]&&(n=$p[_][c]),n}var Mo={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function wu(_){for(var c=Ya(),n=0,u=_.length;n<u;++n)my(c,_[n]);return c}function Eb(_,c,n){var u=Math.min.apply(null,_),r=Math.min.apply(null,c),s=Math.max.apply(null,_),P=Math.max.apply(null,c);return sh(u,r,s,P,n)}function yl(_,c,n){return n?(n[0]=_[0]-c,n[1]=_[1]-c,n[2]=_[2]+c,n[3]=_[3]+c,n):[_[0]-c,_[1]-c,_[2]+c,_[3]+c]}function jv(_,c){return c?(c[0]=_[0],c[1]=_[1],c[2]=_[2],c[3]=_[3],c):_.slice()}function xs(_,c,n){var u,r;return c<_[0]?u=_[0]-c:_[2]<c?u=c-_[2]:u=0,n<_[1]?r=_[1]-n:_[3]<n?r=n-_[3]:r=0,u*u+r*r}function Hp(_,c){return Jf(_,c[0],c[1])}function sc(_,c){return _[0]<=c[0]&&c[2]<=_[2]&&_[1]<=c[1]&&c[3]<=_[3]}function Jf(_,c,n){return _[0]<=c&&c<=_[2]&&_[1]<=n&&n<=_[3]}function Om(_,c){var n=_[0],u=_[1],r=_[2],s=_[3],P=c[0],z=c[1],F=Mo.UNKNOWN;return P<n?F=F|Mo.LEFT:P>r&&(F=F|Mo.RIGHT),z<u?F=F|Mo.BELOW:z>s&&(F=F|Mo.ABOVE),F===Mo.UNKNOWN&&(F=Mo.INTERSECTING),F}function Ya(){return[1/0,1/0,-1/0,-1/0]}function sh(_,c,n,u,r){return r?(r[0]=_,r[1]=c,r[2]=n,r[3]=u,r):[_,c,n,u]}function Kp(_){return sh(1/0,1/0,-1/0,-1/0,_)}function Yp(_,c){var n=_[0],u=_[1];return sh(n,u,n,u,c)}function Fm(_,c,n,u,r){var s=Kp(r);return gy(s,_,c,n,u)}function Bm(_,c){return _[0]==c[0]&&_[2]==c[2]&&_[1]==c[1]&&_[3]==c[3]}function qv(_,c){return c[0]<_[0]&&(_[0]=c[0]),c[2]>_[2]&&(_[2]=c[2]),c[1]<_[1]&&(_[1]=c[1]),c[3]>_[3]&&(_[3]=c[3]),_}function my(_,c){c[0]<_[0]&&(_[0]=c[0]),c[0]>_[2]&&(_[2]=c[0]),c[1]<_[1]&&(_[1]=c[1]),c[1]>_[3]&&(_[3]=c[1])}function gy(_,c,n,u,r){for(;n<u;n+=r)Tb(_,c[n],c[n+1]);return _}function Tb(_,c,n){_[0]=Math.min(_[0],c),_[1]=Math.min(_[1],n),_[2]=Math.max(_[2],c),_[3]=Math.max(_[3],n)}function Zv(_,c){var n;return n=c(yy(_)),n||(n=c(_y(_)),n)||(n=c(xy(_)),n)||(n=c(vy(_)),n)?n:!1}function yy(_){return[_[0],_[1]]}function _y(_){return[_[2],_[1]]}function $h(_){return[(_[0]+_[2])/2,(_[1]+_[3])/2]}function Eu(_){return _[3]-_[1]}function Xv(_,c,n){var u=n||Ya();return ko(_,c)?(_[0]>c[0]?u[0]=_[0]:u[0]=c[0],_[1]>c[1]?u[1]=_[1]:u[1]=c[1],_[2]<c[2]?u[2]=_[2]:u[2]=c[2],_[3]<c[3]?u[3]=_[3]:u[3]=c[3]):Kp(u),u}function vy(_){return[_[0],_[3]]}function xy(_){return[_[2],_[3]]}function bs(_){return _[2]-_[0]}function ko(_,c){return _[0]<=c[2]&&_[2]>=c[0]&&_[1]<=c[3]&&_[3]>=c[1]}function Wv(_,c){return c?(c[0]=_[0],c[1]=_[1],c[2]=_[2],c[3]=_[3],c):_}function $v(_,c,n){var u=!1,r=Om(_,c),s=Om(_,n);if(r===Mo.INTERSECTING||s===Mo.INTERSECTING)u=!0;else{var P=_[0],z=_[1],F=_[2],N=_[3],V=c[0],me=c[1],be=n[0],Se=n[1],Ve=(Se-me)/(be-V),Ke=void 0,Ie=void 0;!!(s&Mo.ABOVE)&&!(r&Mo.ABOVE)&&(Ke=be-(Se-N)/Ve,u=Ke>=P&&Ke<=F),!u&&!!(s&Mo.RIGHT)&&!(r&Mo.RIGHT)&&(Ie=Se-(be-F)*Ve,u=Ie>=z&&Ie<=N),!u&&!!(s&Mo.BELOW)&&!(r&Mo.BELOW)&&(Ke=be-(Se-z)/Ve,u=Ke>=P&&Ke<=F),!u&&!!(s&Mo.LEFT)&&!(r&Mo.LEFT)&&(Ie=Se-(be-P)*Ve,u=Ie>=z&&Ie<=N)}return u}function Hv(_,c,n,u){var r=[];if(u>1)for(var s=_[2]-_[0],P=_[3]-_[1],z=0;z<u;++z)r.push(_[0]+s*z/u,_[1],_[2],_[1]+P*z/u,_[2]-s*z/u,_[3],_[0],_[3]-P*z/u);else r=[_[0],_[1],_[2],_[1],_[2],_[3],_[0],_[3]];c(r,r,2);for(var F=[],N=[],z=0,V=r.length;z<V;z+=2)F.push(r[z]),N.push(r[z+1]);return Eb(F,N,n)}function Kv(_,c){var n=c.getExtent(),u=$h(_);if(c.canWrapX()&&(u[0]<n[0]||u[0]>=n[2])){var r=bs(n),s=Math.floor((u[0]-n[0])/r),P=s*r;_[0]-=P,_[2]-=P}return _}function by(_,c){var n=_[0],u=_[1],r=c[0],s=c[1],P=r[0],z=r[1],F=s[0],N=s[1],V=F-P,me=N-z,be=V===0&&me===0?0:(V*(n-P)+me*(u-z))/(V*V+me*me||0),Se,Ve;return be<=0?(Se=P,Ve=z):be>=1?(Se=F,Ve=N):(Se=P+be*V,Ve=z+be*me),[Se,Ve]}function Tu(_,c){for(var n=!0,u=_.length-1;u>=0;--u)if(_[u]!=c[u]){n=!1;break}return n}function Jp(_,c){var n=_[0]-c[0],u=_[1]-c[1];return n*n+u*u}function wy(_,c){return Math.sqrt(Jp(_,c))}function Yv(_,c){return Jp(_,by(_,c))}function Jv(_,c){if(c.canWrapX()){var n=bs(c.getExtent()),u=Qv(_,c,n);u&&(_[0]-=u*n)}return _}function Qv(_,c,n){var u=c.getExtent(),r=0;if(c.canWrapX()&&(_[0]<u[0]||_[0]>u[2])){var s=n||bs(u);r=Math.floor((_[0]-u[0])/s)}return r}var Ey=!0;function Sb(_){var c=_===void 0?!0:_;Ey=!c}function Ty(_,c,n){var u;if(c!==void 0){for(var r=0,s=_.length;r<s;++r)c[r]=_[r];u=c}else u=_.slice();return u}function Ib(_,c,n){if(c!==void 0&&_!==c){for(var u=0,r=_.length;u<r;++u)c[u]=_[u];_=c}return _}function Cb(_){Vv(_.getCode(),_),Yf(_,_,Ty)}function Ab(_){_.forEach(Cb)}function ga(_){return typeof _=="string"?Nv(_):_||null}function ex(_){Ab(_),_.forEach(function(c){_.forEach(function(n){c!==n&&Yf(c,n,Ty)})})}function Pb(_,c,n,u){_.forEach(function(r){c.forEach(function(s){Yf(r,s,n),Yf(s,r,u)})})}function uo(_,c){return Sb(),Nm(_,"EPSG:4326",c!==void 0?c:"EPSG:3857")}function lh(_,c){var n=Nm(_,c!==void 0?c:"EPSG:3857","EPSG:4326"),u=n[0];return(u<-180||u>180)&&(n[0]=zm(u+180,360)-180),n}function tx(_,c){if(_===c)return!0;var n=_.getUnits()===c.getUnits();if(_.getCode()===c.getCode())return n;var u=Um(_,c);return u===Ty&&n}function Um(_,c){var n=_.getCode(),u=c.getCode(),r=Gv(n,u);return r||(r=Ib),r}function Qf(_,c){var n=ga(_),u=ga(c);return Um(n,u)}function Nm(_,c,n){var u=Qf(c,n);return u(_,void 0,_.length)}function ed(_,c,n,u){var r=Qf(c,n);return Hv(_,r,void 0,u)}var Zl=null;function uh(){return Zl}function Sy(_,c){return Zl?Nm(_,c,Zl):_}function Xl(_,c){return Zl?Nm(_,Zl,c):(Ey&&!Tu(_,[0,0])&&_[0]>=-180&&_[0]<=180&&_[1]>=-90&&_[1]<=90&&(Ey=!1,console.warn("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),_)}function Qp(_,c){return Zl?ed(_,c,Zl):_}function td(_,c){return Zl?ed(_,Zl,c):_}function rx(_,c){if(!Zl)return _;var n=ga(c).getUnits(),u=Zl.getUnits();return n&&u?_*bu[n]/bu[u]:_}function Mb(){ex(py),ex(fy),Pb(fy,py,Fv,Bv)}Mb();function ef(_){return c=>{let{map:n,mbMap:u,olLayer:r}=_;if(!n||!u)return null;let s=u.getCanvas(),{viewState:P}=c,z=r.getOpacity();return s.style.opacity=z,u.jumpTo({center:lh(P.center),zoom:P.zoom-1,bearing:Ov(-P.rotation),animate:!1}),s.isConnected?(s.width!==c.size[0]||s.height!==c.size[1])&&u.resize():n.render(),u.redraw(),u.getContainer()}}function tf(_){return c=>{let{map:n,mbMap:u,renderState:r,olLayer:s}=_;if(!n||!u)return document.createElement("div");let P=!1,z=u.getCanvas(),{viewState:F}=c,N=s?.getVisible();r&&r?.visible!==N&&(z.style.display=N?"block":"none",r.visible=N,z.style.position="absolute");let V=s?.getOpacity();z&&r&&r.opacity!==V&&(z.style.opacity=V,r.opacity=V);let{rotation:me}=F;r&&r.rotation!==me&&(u.rotateTo(-(me||0)*180/Math.PI,{animate:!1}),P=!0,r.rotation=me),r&&r.center&&(r.zoom!==F.zoom||r.center[0]!==F.center[0]||r.center[1]!==F.center[1])&&(u.jumpTo({center:lh(F.center),zoom:F.zoom-1}),P=!0,r.zoom=F.zoom,r.center=F.center);let be=n.getSize()||[0,0];if(r&&r.size&&(r.size[0]!==be[0]||r.size[1]!==be[1])&&(P=!0,r.size=be),u&&u.style&&u.isStyleLoaded()&&P)try{u._frame&&(u._frame.cancel(),u._frame=null),u._render()}catch(Se){console.warn(Se)}return u.getContainer()}}var rf={};iy(rf,{bgColors:()=>nx,getBgColor:()=>Rb,getDelayColor:()=>Ob,getDelayText:()=>Fb,getRadius:()=>Lb,getTextColor:()=>zb,getTextSize:()=>Db,getTypeIndex:()=>Vm,textColors:()=>ox,types:()=>ix});var kb={0:[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],1:[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],2:[0,0,0,0,0,2,2,3,7,7,7,12,15,15,15,15,15],3:[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],4:[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],5:[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],6:[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],7:[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],8:[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],9:[0,0,0,0,0,2,2,3,7,7,7,12,15,15,15,15,15]},ix=[/^Tram/i,/^Subway( \/ Metro \/ S-Bahn)?/i,/^Train/i,/^Bus/i,/^Ferry/i,/^Cable ?Car/i,/^Gondola/i,/^Funicular/i,/^(Long distance bus|coach)/i,/^Rail/i],nx=["#ffb400","#ff5400","#ff8080","#ea0000","#3000ff","#ffb400","#41a27b","#00d237","#b5b5b5","#ff8080"],ox=["#000000","#ffffff","#000000","#ffffff","#ffffff","#000000","#ffffff","#000000","#000000","#000000"],Vm=_=>typeof _=="string"?ix.findIndex(c=>c.test(_)):_,Lb=(_,c)=>{try{let n=Vm(_||0);return kb[n][c]}catch{return 1}},Rb=(_=0)=>{try{let c=Vm(_);return nx[c]}catch{return 1}},zb=(_=0)=>{try{let c=Vm(_);return ox[c]}catch{return 1}},Db=(_,c,n,u)=>{if(!_)return 0;_.font=`bold ${u}px Arial`;let r=_.measureText(n),s=25,P=0;for(;r.width>c-6&&P<s;)u-=.5,_.font=`bold ${u}px arial, sans-serif`,r=_.measureText(n),P+=1;return u},Ob=(_,c,n)=>c?n?"#ff0000":"#a0a0a0":_>=36e5?"#ed004c":_>=5e5?"#e80000":_>=3e5?"#ff4a00":_>=18e4?"#f7bf00":_===null?"#a0a0a0":"#00a00c",Fb=(_,c)=>c?String.fromCodePoint(215):_>36e5?`+${Math.round(_/36e5)}h`:_>59e3?`+${Math.round(_/6e4)}m`:_>0?`+${_}s`:"";var Bb=(_,c)=>{let n=null;return typeof window>"u"?null:(document?.createElement?(n=document.createElement("canvas"),n.width=_,n.height=c):OffscreenCanvas?n=new OffscreenCanvas(_,c):console.error("We didn't find a way to create a canvas element, document.createElement('canvas') and new OffscrenCanvas() are not supported"),n)},nf=Bb;var Iy={},ky=(_,c,n)=>{let u=`${_}, ${c}, ${n}`;if(!Iy[u]){let r=nf(_*2,_*2);if(r){let s=r.getContext("2d");if(!s)return null;s.beginPath(),s.arc(_,_,c,0,2*Math.PI,!1),s.fillStyle=n,s.filter="blur(1px)",s.fill(),Iy[u]=r}}return Iy[u]},Cy={},Ly=(_,c,n,u,r,s="#000",P=1)=>{let z=`${_}, ${c}, ${u}, ${r}, ${s}, ${P}`;if(!Cy[z]){let F=nf(_,n+8*P);if(F){let N=F.getContext("2d");if(!N)return null;N.textAlign="left",N.textBaseline="middle",N.font=u,N.fillStyle=r,N.strokeStyle=s,N.lineWidth=1.5*P;let V=c;N.strokeText(V,0,n),N.fillText(V,0,n),Cy[z]=F}}return Cy[z]},Ay={},Ry=(_,c,n,u,r,s)=>{let P=`${_}, ${c}, ${n}, ${u}, ${r}, ${s}`;if(!Ay[P]){let z=nf(_*2,_*2);if(z){let F=z.getContext("2d");if(!F)return null;F.fillStyle=n,u&&(F.lineWidth=1*s,F.strokeStyle="#000000"),F.beginPath(),F.arc(_,_,c,0,2*Math.PI,!1),F.fill(),r&&F.setLineDash([5,3]),u&&F.stroke(),Ay[P]=z}}return Ay[P]},Py={},zy=(_,c,n,u,r,s,P)=>{let z=`${_}, ${c}, ${n}, ${u},${r}, ${s}, ${P}`;if(!Py[z]){let F=nf(c*2,c*2);if(F){let N=F.getContext("2d");if(!N)return null;s&&(N.save(),N.textBaseline="middle",N.textAlign="center",N.font=`bold ${n+2}px Arial`,N.strokeStyle=r,N.strokeText(_,c,c),N.restore()),N.textBaseline="middle",N.textAlign="center",N.fillStyle=u,N.font=`bold ${n}px Arial`,N.strokeStyle=r,N.strokeText(_,c,c),N.fillText(_,c,c),Py[z]=F}}return Py[z]},My={},Ub=(_,c,n)=>{let{hoverVehicleId:u,selectedVehicleId:r,useDelayStyle:s,delayOutlineColor:P="#000",delayDisplay:z=3e5,getRadius:F=()=>0,getBgColor:N=()=>"#000",getDelayColor:V=()=>"#000",getDelayText:me=()=>null,getTextColor:be=()=>"#000",getTextSize:Se=()=>0}=n,{zoom:Ve,pixelRatio:Ke=1}=c,{type:Ie}=_.properties,{train_id:Ge,line:et,delay:rt,state:_t,operator_provides_realtime_journey:yt}=_.properties,{name:ct,text_color:Tt,color:St}=et||{},Lt=_t==="JOURNEY_CANCELLED";Ie||(Ie="Rail"),ct||(ct="I"),Tt||(Tt="#000000"),St&&St[0]!=="#"&&(St=`#${St}`),Tt[0]!=="#"&&(Tt=`#${Tt}`);let ur=Math.min(Math.floor(Ve||1),16),Vt=!!(u&&u===Ge),Qt=!!(r&&r===Ge),or=F(Ie,ur)*Ke,Mt=or>=7*Ke;(Vt||Qt)&&(or=Mt?or+5*Ke:14*Ke);let Br=or>10*Ke,Tr=`${or}${Vt}${Qt}${Lt}${rt}`;if(s?Tr+=`${yt}`:Tr+=`${Ie}${St}`,Br&&(Tr+=`${ct}${Tt}`),!My[Tr]){if(or===0)return null;let br=1*Ke,Mr=or+2,Ir=or*2,xr=Mr*2+br*2+100*Ke,ai=xr/2,jt=nf(xr,xr);if(jt){let Yr=jt.getContext("2d");if(!Yr)return null;if(Mt&&rt!==null){let Li=ky(ai,Mr,V(rt,Lt));Li&&Yr.drawImage(Li,0,0)}if(Mt&&(Vt||(rt||0)>=z||Lt)){let Li=Math.max(Lt?19:14,Math.min(Lt?19:17,or*1.2))*Ke,Pn=me(rt,Lt);if(Pn){let Ni=Pn.length*Li,Cr=Ly(Ni,Pn,Li,`bold ${Li}px arial, sans-serif`,V(rt,Lt,!0),P,Ke);Cr&&Yr.drawImage(Cr,ai+Mr+br,ai-Li)}}let vi;s?vi=V(rt,Lt):vi=St||N(Ie);let Ur=Ry(ai,or,vi,Mt||Vt||Qt,!!Mt&&!!s&&rt===null&&yt==="yes",Ke);if(Ur&&Yr.drawImage(Ur,0,0),Br&&Yr){let Li=Math.max(or,10),Pn=Se(Yr,Ir,ct,Li),Ni=s?"#000000":Tt||be(Ie),Zn=zy(ct,ai,Pn,Ni,vi,!!s&&rt===null&&yt==="yes",Ke);Zn&&Yr.drawImage(Zn,0,0)}My[Tr]=jt}}return My[Tr]},Hh=Ub;var Nb=(_,c,n)=>Hh(_,c,{...n,useDelayStyle:!0}),Dy=Nb;var of,Vb=()=>{if(!of){of=document.createElement("canvas"),of.width=15,of.height=15;let _=of.getContext("2d");_&&(_.arc(8,8,5,0,2*Math.PI,!1),_.fillStyle="#8ED6FF",_.fill(),_.lineWidth=3,_.strokeStyle="black",_.stroke(),_.lineWidth=3)}return of},Oy=Vb;var Qi={OPACITY:"opacity",VISIBLE:"visible",EXTENT:"extent",Z_INDEX:"zIndex",MAX_RESOLUTION:"maxResolution",MIN_RESOLUTION:"minResolution",MAX_ZOOM:"maxZoom",MIN_ZOOM:"minZoom",SOURCE:"source",MAP:"map"};var Gb=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),jb=function(_){Gb(c,_);function c(n){var u=_.call(this)||this;u.on,u.once,u.un,u.background_=n.background;var r=Ra({},n);return typeof n.properties=="object"&&(delete r.properties,Ra(r,n.properties)),r[Qi.OPACITY]=n.opacity!==void 0?n.opacity:1,wn(typeof r[Qi.OPACITY]=="number",64),r[Qi.VISIBLE]=n.visible!==void 0?n.visible:!0,r[Qi.Z_INDEX]=n.zIndex,r[Qi.MAX_RESOLUTION]=n.maxResolution!==void 0?n.maxResolution:1/0,r[Qi.MIN_RESOLUTION]=n.minResolution!==void 0?n.minResolution:0,r[Qi.MIN_ZOOM]=n.minZoom!==void 0?n.minZoom:-1/0,r[Qi.MAX_ZOOM]=n.maxZoom!==void 0?n.maxZoom:1/0,u.className_=r.className!==void 0?r.className:"ol-layer",delete r.className,u.setProperties(r),u.state_=null,u}return c.prototype.getBackground=function(){return this.background_},c.prototype.getClassName=function(){return this.className_},c.prototype.getLayerState=function(n){var u=this.state_||{layer:this,managed:n===void 0?!0:n},r=this.getZIndex();return u.opacity=jl(Math.round(this.getOpacity()*100)/100,0,1),u.visible=this.getVisible(),u.extent=this.getExtent(),u.zIndex=r===void 0&&!u.managed?1/0:r,u.maxResolution=this.getMaxResolution(),u.minResolution=Math.max(this.getMinResolution(),0),u.minZoom=this.getMinZoom(),u.maxZoom=this.getMaxZoom(),this.state_=u,u},c.prototype.getLayersArray=function(n){return jr()},c.prototype.getLayerStatesArray=function(n){return jr()},c.prototype.getExtent=function(){return this.get(Qi.EXTENT)},c.prototype.getMaxResolution=function(){return this.get(Qi.MAX_RESOLUTION)},c.prototype.getMinResolution=function(){return this.get(Qi.MIN_RESOLUTION)},c.prototype.getMinZoom=function(){return this.get(Qi.MIN_ZOOM)},c.prototype.getMaxZoom=function(){return this.get(Qi.MAX_ZOOM)},c.prototype.getOpacity=function(){return this.get(Qi.OPACITY)},c.prototype.getSourceState=function(){return jr()},c.prototype.getVisible=function(){return this.get(Qi.VISIBLE)},c.prototype.getZIndex=function(){return this.get(Qi.Z_INDEX)},c.prototype.setBackground=function(n){this.background_=n,this.changed()},c.prototype.setExtent=function(n){this.set(Qi.EXTENT,n)},c.prototype.setMaxResolution=function(n){this.set(Qi.MAX_RESOLUTION,n)},c.prototype.setMinResolution=function(n){this.set(Qi.MIN_RESOLUTION,n)},c.prototype.setMaxZoom=function(n){this.set(Qi.MAX_ZOOM,n)},c.prototype.setMinZoom=function(n){this.set(Qi.MIN_ZOOM,n)},c.prototype.setOpacity=function(n){wn(typeof n=="number",64),this.set(Qi.OPACITY,n)},c.prototype.setVisible=function(n){this.set(Qi.VISIBLE,n)},c.prototype.setZIndex=function(n){this.set(Qi.Z_INDEX,n)},c.prototype.disposeInternal=function(){this.state_&&(this.state_.layer=null,this.state_=null),_.prototype.disposeInternal.call(this)},c}(Po),Gm=jb;var rd={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"};var Su={UNDEFINED:"undefined",LOADING:"loading",READY:"ready",ERROR:"error"};var qb=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Zb=function(_){qb(c,_);function c(n){var u=this,r=Ra({},n);delete r.source,u=_.call(this,r)||this,u.on,u.once,u.un,u.mapPrecomposeKey_=null,u.mapRenderKey_=null,u.sourceChangeKey_=null,u.renderer_=null,u.rendered=!1,n.render&&(u.render=n.render),n.map&&u.setMap(n.map),u.addChangeListener(Qi.SOURCE,u.handleSourcePropertyChange_);var s=n.source?n.source:null;return u.setSource(s),u}return c.prototype.getLayersArray=function(n){var u=n||[];return u.push(this),u},c.prototype.getLayerStatesArray=function(n){var u=n||[];return u.push(this.getLayerState()),u},c.prototype.getSource=function(){return this.get(Qi.SOURCE)||null},c.prototype.getRenderSource=function(){return this.getSource()},c.prototype.getSourceState=function(){var n=this.getSource();return n?n.getState():Su.UNDEFINED},c.prototype.handleSourceChange_=function(){this.changed()},c.prototype.handleSourcePropertyChange_=function(){this.sourceChangeKey_&&(Ao(this.sourceChangeKey_),this.sourceChangeKey_=null);var n=this.getSource();n&&(this.sourceChangeKey_=lo(n,Ji.CHANGE,this.handleSourceChange_,this)),this.changed()},c.prototype.getFeatures=function(n){return this.renderer_?this.renderer_.getFeatures(n):new Promise(function(u){return u([])})},c.prototype.getData=function(n){return!this.renderer_||!this.rendered?null:this.renderer_.getData(n)},c.prototype.render=function(n,u){var r=this.getRenderer();if(r.prepareFrame(n))return this.rendered=!0,r.renderFrame(n,u)},c.prototype.unrender=function(){this.rendered=!1},c.prototype.setMapInternal=function(n){n||this.unrender(),this.set(Qi.MAP,n)},c.prototype.getMapInternal=function(){return this.get(Qi.MAP)},c.prototype.setMap=function(n){this.mapPrecomposeKey_&&(Ao(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),n||this.changed(),this.mapRenderKey_&&(Ao(this.mapRenderKey_),this.mapRenderKey_=null),n&&(this.mapPrecomposeKey_=lo(n,rd.PRECOMPOSE,function(u){var r=u,s=r.frameState.layerStatesArray,P=this.getLayerState(!1);wn(!s.some(function(z){return z.layer===P.layer}),67),s.push(P)},this),this.mapRenderKey_=lo(this,Ji.CHANGE,n.render,n),this.changed())},c.prototype.setSource=function(n){this.set(Qi.SOURCE,n)},c.prototype.getRenderer=function(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_},c.prototype.hasRenderer=function(){return!!this.renderer_},c.prototype.createRenderer=function(){return null},c.prototype.disposeInternal=function(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_),this.setSource(null),_.prototype.disposeInternal.call(this)},c}(Gm);function ax(_,c){if(!_.visible)return!1;var n=c.resolution;if(n<_.minResolution||n>=_.maxResolution)return!1;var u=c.zoom;return u>_.minZoom&&u<=_.maxZoom}var Kh=Zb;var Fy=class extends Po{constructor(n={}){super(n);this.defineProperties(n);let{active:u}={active:n.active!==!1,...n};this.active=u}defineProperties(n){let{target:u,element:r,render:s}={...n};Object.defineProperties(this,{active:{get:()=>this.get("active"),set:P=>{this.set("active",P),P?this.activate():this.deactivate(),this.render()}},map:{get:()=>this.get("map"),set:P=>{if(this.map&&this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element),this.deactivate(),this.set("map",P),this.map){let z=this.target||this.map.getTargetElement&&this.map.getTargetElement()||this.map.getContainer&&this.map.getContainer();this.element||this.createDefaultElement(),this.element&&z.appendChild(this.element),this.active&&this.activate()}this.render()}},target:{value:u},element:{value:r,writable:!0},render:{value:s||this.render,writable:!0}})}attachToMap(n){this.map=n}detachFromMap(){this.map=void 0}activate(){this.deactivate()}deactivate(){console.error("The function deactivate() must be implemented in subclasses")}render(n){console.error("The function render() must be implemented in subclasses")}createDefaultElement(){console.error("The function createDefaultElement() must be implemented in subclasses")}},af=Fy;var By=class extends af{render(){!this.element||(this.element.innerHTML=this.active?this.getCopyrights().join(" | "):"")}createDefaultElement(){this.element=document.createElement("div"),this.element.id="mbt-copyright",Object.assign(this.element.style,{position:"absolute",bottom:0,right:0,fontSize:".8rem",padding:"0 10px"})}getCopyrights(){return console.error("The getCopyrights() function must be implemented in subclasses.",this),[]}},jm=By;var Uy=class extends jm{constructor(n){super(n);this.onPostRender=this.onPostRender.bind(this)}getCopyrights(){if(!this.frameState)return[];let n=[];return this.frameState?.layerStatesArray.forEach(u=>{let{layer:r}=u;this.frameState&&ax(u,this.frameState.viewState)&&r&&r.getSource&&r.getSource()&&r.getSource().getAttributions()&&(n=n.concat(r.getSource().getAttributions()(this.frameState)))}),Xh(n)}activate(){super.activate(),this.map&&this.map.on("postrender",this.onPostRender)}deactivate(){this.map&&this.map.un("postrender",this.onPostRender)}onPostRender(n){this.map&&this.element&&(this.frameState=n.frameState||void 0,this.render())}},sx=Uy;var ws={ADD:"add",REMOVE:"remove"};var ux=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),lx={LENGTH:"length"},qm=function(_){ux(c,_);function c(n,u,r){var s=_.call(this,n)||this;return s.element=u,s.index=r,s}return c}(La);var Xb=function(_){ux(c,_);function c(n,u){var r=_.call(this)||this;r.on,r.once,r.un;var s=u||{};if(r.unique_=!!s.unique,r.array_=n||[],r.unique_)for(var P=0,z=r.array_.length;P<z;++P)r.assertUnique_(r.array_[P],P);return r.updateLength_(),r}return c.prototype.clear=function(){for(;this.getLength()>0;)this.pop()},c.prototype.extend=function(n){for(var u=0,r=n.length;u<r;++u)this.push(n[u]);return this},c.prototype.forEach=function(n){for(var u=this.array_,r=0,s=u.length;r<s;++r)n(u[r],r,u)},c.prototype.getArray=function(){return this.array_},c.prototype.item=function(n){return this.array_[n]},c.prototype.getLength=function(){return this.get(lx.LENGTH)},c.prototype.insertAt=function(n,u){this.unique_&&this.assertUnique_(u),this.array_.splice(n,0,u),this.updateLength_(),this.dispatchEvent(new qm(ws.ADD,u,n))},c.prototype.pop=function(){return this.removeAt(this.getLength()-1)},c.prototype.push=function(n){this.unique_&&this.assertUnique_(n);var u=this.getLength();return this.insertAt(u,n),this.getLength()},c.prototype.remove=function(n){for(var u=this.array_,r=0,s=u.length;r<s;++r)if(u[r]===n)return this.removeAt(r)},c.prototype.removeAt=function(n){var u=this.array_[n];return this.array_.splice(n,1),this.updateLength_(),this.dispatchEvent(new qm(ws.REMOVE,u,n)),u},c.prototype.setAt=function(n,u){var r=this.getLength();if(n<r){this.unique_&&this.assertUnique_(u,n);var s=this.array_[n];this.array_[n]=u,this.dispatchEvent(new qm(ws.REMOVE,s,n)),this.dispatchEvent(new qm(ws.ADD,u,n))}else{for(var P=r;P<n;++P)this.insertAt(P,void 0);this.insertAt(n,u)}},c.prototype.updateLength_=function(){this.set(lx.LENGTH,this.array_.length)},c.prototype.assertUnique_=function(n,u){for(var r=0,s=this.array_.length;r<s;++r)if(this.array_[r]===n&&r!==u)throw new Lm(58)},c}(Po),ch=Xb;var Wb=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),$b=function(_){Wb(c,_);function c(n){var u=_.call(this)||this;if(u.on,u.once,u.un,u.id_=void 0,u.geometryName_="geometry",u.style_=null,u.styleFunction_=void 0,u.geometryChangeKey_=null,u.addChangeListener(u.geometryName_,u.handleGeometryChanged_),n)if(typeof n.getSimplifiedGeometry=="function"){var r=n;u.setGeometry(r)}else{var s=n;u.setProperties(s)}return u}return c.prototype.clone=function(){var n=new c(this.hasProperties()?this.getProperties():null);n.setGeometryName(this.getGeometryName());var u=this.getGeometry();u&&n.setGeometry(u.clone());var r=this.getStyle();return r&&n.setStyle(r),n},c.prototype.getGeometry=function(){return this.get(this.geometryName_)},c.prototype.getId=function(){return this.id_},c.prototype.getGeometryName=function(){return this.geometryName_},c.prototype.getStyle=function(){return this.style_},c.prototype.getStyleFunction=function(){return this.styleFunction_},c.prototype.handleGeometryChange_=function(){this.changed()},c.prototype.handleGeometryChanged_=function(){this.geometryChangeKey_&&(Ao(this.geometryChangeKey_),this.geometryChangeKey_=null);var n=this.getGeometry();n&&(this.geometryChangeKey_=lo(n,Ji.CHANGE,this.handleGeometryChange_,this)),this.changed()},c.prototype.setGeometry=function(n){this.set(this.geometryName_,n)},c.prototype.setStyle=function(n){this.style_=n,this.styleFunction_=n?Hb(n):void 0,this.changed()},c.prototype.setId=function(n){this.id_=n,this.changed()},c.prototype.setGeometryName=function(n){this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=n,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_()},c}(Po);function Hb(_){if(typeof _=="function")return _;var c;if(Array.isArray(_))c=_;else{wn(typeof _.getZIndex=="function",41);var n=_;c=[n]}return function(){return c}}var lc=$b;var An={XY:"XY",XYZ:"XYZ",XYM:"XYM",XYZM:"XYZM"};function _l(_,c,n,u,r,s){for(var P=s||[],z=0,F=c;F<n;F+=u){var N=_[F],V=_[F+1];P[z++]=r[0]*N+r[2]*V+r[4],P[z++]=r[1]*N+r[3]*V+r[5]}return s&&P.length!=z&&(P.length=z),P}function Zm(_,c,n,u,r,s,P){for(var z=P||[],F=Math.cos(r),N=Math.sin(r),V=s[0],me=s[1],be=0,Se=c;Se<n;Se+=u){var Ve=_[Se]-V,Ke=_[Se+1]-me;z[be++]=V+Ve*F-Ke*N,z[be++]=me+Ve*N+Ke*F;for(var Ie=Se+2;Ie<Se+u;++Ie)z[be++]=_[Ie]}return P&&z.length!=be&&(z.length=be),z}function cx(_,c,n,u,r,s,P,z){for(var F=z||[],N=P[0],V=P[1],me=0,be=c;be<n;be+=u){var Se=_[be]-N,Ve=_[be+1]-V;F[me++]=N+r*Se,F[me++]=V+s*Ve;for(var Ke=be+2;Ke<be+u;++Ke)F[me++]=_[Ke]}return z&&F.length!=me&&(F.length=me),F}function hx(_,c,n,u,r,s,P){for(var z=P||[],F=0,N=c;N<n;N+=u){z[F++]=_[N]+r,z[F++]=_[N+1]+s;for(var V=N+2;V<N+u;++V)z[F++]=_[V]}return P&&z.length!=F&&(z.length=F),z}var Kb=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),px=za(),Yb=function(_){Kb(c,_);function c(){var n=_.call(this)||this;return n.extent_=Ya(),n.extentRevision_=-1,n.simplifiedGeometryMaxMinSquaredTolerance=0,n.simplifiedGeometryRevision=0,n.simplifyTransformedInternal=_v(function(u,r,s){if(!s)return this.getSimplifiedGeometry(r);var P=this.clone();return P.applyTransform(s),P.getSimplifiedGeometry(r)}),n}return c.prototype.simplifyTransformed=function(n,u){return this.simplifyTransformedInternal(this.getRevision(),n,u)},c.prototype.clone=function(){return jr()},c.prototype.closestPointXY=function(n,u,r,s){return jr()},c.prototype.containsXY=function(n,u){var r=this.getClosestPoint([n,u]);return r[0]===n&&r[1]===u},c.prototype.getClosestPoint=function(n,u){var r=u||[NaN,NaN];return this.closestPointXY(n[0],n[1],r,1/0),r},c.prototype.intersectsCoordinate=function(n){return this.containsXY(n[0],n[1])},c.prototype.computeExtent=function(n){return jr()},c.prototype.getExtent=function(n){if(this.extentRevision_!=this.getRevision()){var u=this.computeExtent(this.extent_);(isNaN(u[0])||isNaN(u[1]))&&Kp(u),this.extentRevision_=this.getRevision()}return Wv(this.extent_,n)},c.prototype.rotate=function(n,u){jr()},c.prototype.scale=function(n,u,r){jr()},c.prototype.simplify=function(n){return this.getSimplifiedGeometry(n*n)},c.prototype.getSimplifiedGeometry=function(n){return jr()},c.prototype.getType=function(){return jr()},c.prototype.applyTransform=function(n){jr()},c.prototype.intersectsExtent=function(n){return jr()},c.prototype.translate=function(n,u){jr()},c.prototype.transform=function(n,u){var r=ga(n),s=r.getUnits()==ac.TILE_PIXELS?function(P,z,F){var N=r.getExtent(),V=r.getWorldExtent(),me=Eu(V)/Eu(N);return vs(px,V[0],V[3],me,-me,0,0,0),_l(P,0,P.length,F,px,z),Qf(r,u)(P,z,F)}:Qf(r,u);return this.applyTransform(s),this},c}(Po),Xm=Yb;var Jb=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Qb=function(_){Jb(c,_);function c(){var n=_.call(this)||this;return n.layout=An.XY,n.stride=2,n.flatCoordinates=null,n}return c.prototype.computeExtent=function(n){return Fm(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,n)},c.prototype.getCoordinates=function(){return jr()},c.prototype.getFirstCoordinate=function(){return this.flatCoordinates.slice(0,this.stride)},c.prototype.getFlatCoordinates=function(){return this.flatCoordinates},c.prototype.getLastCoordinate=function(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)},c.prototype.getLayout=function(){return this.layout},c.prototype.getSimplifiedGeometry=function(n){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),n<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&n<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;var u=this.getSimplifiedGeometryInternal(n),r=u.getFlatCoordinates();return r.length<this.flatCoordinates.length?u:(this.simplifiedGeometryMaxMinSquaredTolerance=n,this)},c.prototype.getSimplifiedGeometryInternal=function(n){return this},c.prototype.getStride=function(){return this.stride},c.prototype.setFlatCoordinates=function(n,u){this.stride=fx(n),this.layout=n,this.flatCoordinates=u},c.prototype.setCoordinates=function(n,u){jr()},c.prototype.setLayout=function(n,u,r){var s;if(n)s=fx(n);else{for(var P=0;P<r;++P)if(u.length===0){this.layout=An.XY,this.stride=2;return}else u=u[0];s=u.length,n=ew(s)}this.layout=n,this.stride=s},c.prototype.applyTransform=function(n){this.flatCoordinates&&(n(this.flatCoordinates,this.flatCoordinates,this.stride),this.changed())},c.prototype.rotate=function(n,u){var r=this.getFlatCoordinates();if(r){var s=this.getStride();Zm(r,0,r.length,s,n,u,r),this.changed()}},c.prototype.scale=function(n,u,r){var s=u;s===void 0&&(s=n);var P=r;P||(P=$h(this.getExtent()));var z=this.getFlatCoordinates();if(z){var F=this.getStride();cx(z,0,z.length,F,n,s,P,z),this.changed()}},c.prototype.translate=function(n,u){var r=this.getFlatCoordinates();if(r){var s=this.getStride();hx(r,0,r.length,s,n,u,r),this.changed()}},c}(Xm);function ew(_){var c;return _==2?c=An.XY:_==3?c=An.XYZ:_==4&&(c=An.XYZM),c}function fx(_){var c;return _==An.XY?c=2:_==An.XYZ||_==An.XYM?c=3:_==An.XYZM&&(c=4),c}function dx(_,c,n){var u=_.getFlatCoordinates();if(u){var r=_.getStride();return _l(u,0,u.length,r,c,n)}else return null}var Es=Qb;function mx(_,c,n,u,r,s,P){var z=_[c],F=_[c+1],N=_[n]-z,V=_[n+1]-F,me;if(N===0&&V===0)me=c;else{var be=((r-z)*N+(s-F)*V)/(N*N+V*V);if(be>1)me=n;else if(be>0){for(var Se=0;Se<u;++Se)P[Se]=gl(_[c+Se],_[n+Se],be);P.length=u;return}else me=c}for(var Se=0;Se<u;++Se)P[Se]=_[me+Se];P.length=u}function id(_,c,n,u,r){var s=_[c],P=_[c+1];for(c+=u;c<n;c+=u){var z=_[c],F=_[c+1],N=ql(s,P,z,F);N>r&&(r=N),s=z,P=F}return r}function nd(_,c,n,u,r){for(var s=0,P=n.length;s<P;++s){var z=n[s];r=id(_,c,z,u,r),c=z}return r}function gx(_,c,n,u,r){for(var s=0,P=n.length;s<P;++s){var z=n[s];r=nd(_,c,z,u,r),c=z[z.length-1]}return r}function od(_,c,n,u,r,s,P,z,F,N,V){if(c==n)return N;var me,be;if(r===0)if(be=ql(P,z,_[c],_[c+1]),be<N){for(me=0;me<u;++me)F[me]=_[c+me];return F.length=u,be}else return N;for(var Se=V||[NaN,NaN],Ve=c+u;Ve<n;)if(mx(_,Ve-u,Ve,u,P,z,Se),be=ql(P,z,Se[0],Se[1]),be<N){for(N=be,me=0;me<u;++me)F[me]=Se[me];F.length=u,Ve+=u}else Ve+=u*Math.max((Math.sqrt(be)-Math.sqrt(N))/r|0,1);if(s&&(mx(_,n-u,c,u,P,z,Se),be=ql(P,z,Se[0],Se[1]),be<N)){for(N=be,me=0;me<u;++me)F[me]=Se[me];F.length=u}return N}function ad(_,c,n,u,r,s,P,z,F,N,V){for(var me=V||[NaN,NaN],be=0,Se=n.length;be<Se;++be){var Ve=n[be];N=od(_,c,Ve,u,r,s,P,z,F,N,me),c=Ve}return N}function yx(_,c,n,u,r,s,P,z,F,N,V){for(var me=V||[NaN,NaN],be=0,Se=n.length;be<Se;++be){var Ve=n[be];N=ad(_,c,Ve,u,r,s,P,z,F,N,me),c=Ve[Ve.length-1]}return N}function _x(_,c,n,u){for(var r=0,s=n.length;r<s;++r)_[c++]=n[r];return c}function Yh(_,c,n,u){for(var r=0,s=n.length;r<s;++r)for(var P=n[r],z=0;z<u;++z)_[c++]=P[z];return c}function sd(_,c,n,u,r){for(var s=r||[],P=0,z=0,F=n.length;z<F;++z){var N=Yh(_,c,n[z],u);s[P++]=N,c=N}return s.length=P,s}function vx(_,c,n,u,r){for(var s=r||[],P=0,z=0,F=n.length;z<F;++z){var N=sd(_,c,n[z],u,s[P]);s[P++]=N,c=N[N.length-1]}return s.length=P,s}function ld(_,c,n,u,r,s,P){var z=(n-c)/u;if(z<3){for(;c<n;c+=u)s[P++]=_[c],s[P++]=_[c+1];return P}var F=new Array(z);F[0]=1,F[z-1]=1;for(var N=[c,n-u],V=0;N.length>0;){for(var me=N.pop(),be=N.pop(),Se=0,Ve=_[be],Ke=_[be+1],Ie=_[me],Ge=_[me+1],et=be+u;et<me;et+=u){var rt=_[et],_t=_[et+1],yt=Dv(rt,_t,Ve,Ke,Ie,Ge);yt>Se&&(V=et,Se=yt)}Se>r&&(F[(V-c)/u]=1,be+u<V&&N.push(be,V),V+u<me&&N.push(V,me))}for(var et=0;et<z;++et)F[et]&&(s[P++]=_[c+et*u],s[P++]=_[c+et*u+1]);return P}function xx(_,c,n,u,r,s,P,z){for(var F=0,N=n.length;F<N;++F){var V=n[F];P=ld(_,c,V,u,r,s,P),z.push(P),c=V}return P}function hh(_,c){return c*Math.round(_/c)}function tw(_,c,n,u,r,s,P){if(c==n)return P;var z=hh(_[c],r),F=hh(_[c+1],r);c+=u,s[P++]=z,s[P++]=F;var N,V;do if(N=hh(_[c],r),V=hh(_[c+1],r),c+=u,c==n)return s[P++]=N,s[P++]=V,P;while(N==z&&V==F);for(;c<n;){var me=hh(_[c],r),be=hh(_[c+1],r);if(c+=u,!(me==N&&be==V)){var Se=N-z,Ve=V-F,Ke=me-z,Ie=be-F;if(Se*Ie==Ve*Ke&&(Se<0&&Ke<Se||Se==Ke||Se>0&&Ke>Se)&&(Ve<0&&Ie<Ve||Ve==Ie||Ve>0&&Ie>Ve)){N=me,V=be;continue}s[P++]=N,s[P++]=V,z=N,F=V,N=me,V=be}}return s[P++]=N,s[P++]=V,P}function Ny(_,c,n,u,r,s,P,z){for(var F=0,N=n.length;F<N;++F){var V=n[F];P=tw(_,c,V,u,r,s,P),z.push(P),c=V}return P}function bx(_,c,n,u,r,s,P,z){for(var F=0,N=n.length;F<N;++F){var V=n[F],me=[];P=Ny(_,c,V,u,r,s,P,me),z.push(me),c=V[V.length-1]}return P}function vl(_,c,n,u,r){for(var s=r!==void 0?r:[],P=0,z=c;z<n;z+=u)s[P++]=_.slice(z,z+u);return s.length=P,s}function ph(_,c,n,u,r){for(var s=r!==void 0?r:[],P=0,z=0,F=n.length;z<F;++z){var N=n[z];s[P++]=vl(_,c,N,u,s[P]),c=N}return s.length=P,s}function ud(_,c,n,u,r){for(var s=r!==void 0?r:[],P=0,z=0,F=n.length;z<F;++z){var N=n[z];s[P++]=ph(_,c,N,u,s[P]),c=N[N.length-1]}return s.length=P,s}function Vy(_,c,n,u){for(var r=0,s=_[n-u],P=_[n-u+1];c<n;c+=u){var z=_[c],F=_[c+1];r+=P*z-s*F,s=z,P=F}return r/2}function Gy(_,c,n,u){for(var r=0,s=0,P=n.length;s<P;++s){var z=n[s];r+=Vy(_,c,z,u),c=z}return r}function wx(_,c,n,u){for(var r=0,s=0,P=n.length;s<P;++s){var z=n[s];r+=Gy(_,c,z,u),c=z[z.length-1]}return r}var rw=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),iw=function(_){rw(c,_);function c(n,u){var r=_.call(this)||this;return r.maxDelta_=-1,r.maxDeltaRevision_=-1,u!==void 0&&!Array.isArray(n[0])?r.setFlatCoordinates(u,n):r.setCoordinates(n,u),r}return c.prototype.clone=function(){return new c(this.flatCoordinates.slice(),this.layout)},c.prototype.closestPointXY=function(n,u,r,s){return s<xs(this.getExtent(),n,u)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(id(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),od(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,n,u,r,s))},c.prototype.getArea=function(){return Vy(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)},c.prototype.getCoordinates=function(){return vl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)},c.prototype.getSimplifiedGeometryInternal=function(n){var u=[];return u.length=ld(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,n,u,0),new c(u,An.XY)},c.prototype.getType=function(){return Pt.LINEAR_RING},c.prototype.intersectsExtent=function(n){return!1},c.prototype.setCoordinates=function(n,u){this.setLayout(u,n,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Yh(this.flatCoordinates,0,n,this.stride),this.changed()},c}(Es),jy=iw;var nw=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),ow=function(_){nw(c,_);function c(n,u){var r=_.call(this)||this;return r.setCoordinates(n,u),r}return c.prototype.clone=function(){var n=new c(this.flatCoordinates.slice(),this.layout);return n.applyProperties(this),n},c.prototype.closestPointXY=function(n,u,r,s){var P=this.flatCoordinates,z=ql(n,u,P[0],P[1]);if(z<s){for(var F=this.stride,N=0;N<F;++N)r[N]=P[N];return r.length=F,z}else return s},c.prototype.getCoordinates=function(){return this.flatCoordinates?this.flatCoordinates.slice():[]},c.prototype.computeExtent=function(n){return Yp(this.flatCoordinates,n)},c.prototype.getType=function(){return Pt.POINT},c.prototype.intersectsExtent=function(n){return Jf(n,this.flatCoordinates[0],this.flatCoordinates[1])},c.prototype.setCoordinates=function(n,u){this.setLayout(u,n,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=_x(this.flatCoordinates,0,n,this.stride),this.changed()},c}(Es),ya=ow;function Ex(_,c,n,u,r){var s=Zv(r,function(P){return!fh(_,c,n,u,P[0],P[1])});return!s}function fh(_,c,n,u,r,s){for(var P=0,z=_[n-u],F=_[n-u+1];c<n;c+=u){var N=_[c],V=_[c+1];F<=s?V>s&&(N-z)*(s-F)-(r-z)*(V-F)>0&&P++:V<=s&&(N-z)*(s-F)-(r-z)*(V-F)<0&&P--,z=N,F=V}return P!==0}function cd(_,c,n,u,r,s){if(n.length===0||!fh(_,c,n[0],u,r,s))return!1;for(var P=1,z=n.length;P<z;++P)if(fh(_,n[P-1],n[P],u,r,s))return!1;return!0}function Tx(_,c,n,u,r,s){if(n.length===0)return!1;for(var P=0,z=n.length;P<z;++P){var F=n[P];if(cd(_,c,F,u,r,s))return!0;c=F[F.length-1]}return!1}function qy(_,c,n,u,r,s,P){for(var z,F,N,V,me,be,Se,Ve=r[s+1],Ke=[],Ie=0,Ge=n.length;Ie<Ge;++Ie){var et=n[Ie];for(V=_[et-u],be=_[et-u+1],z=c;z<et;z+=u)me=_[z],Se=_[z+1],(Ve<=be&&Se<=Ve||be<=Ve&&Ve<=Se)&&(N=(Ve-be)/(Se-be)*(me-V)+V,Ke.push(N)),V=me,be=Se}var rt=NaN,_t=-1/0;for(Ke.sort(rh),V=Ke[0],z=1,F=Ke.length;z<F;++z){me=Ke[z];var yt=Math.abs(me-V);yt>_t&&(N=(V+me)/2,cd(_,c,n,u,N,Ve)&&(rt=N,_t=yt)),V=me}return isNaN(rt)&&(rt=r[s]),P?(P.push(rt,Ve,_t),P):[rt,Ve,_t]}function Sx(_,c,n,u,r){for(var s=[],P=0,z=n.length;P<z;++P){var F=n[P];s=qy(_,c,F,u,r,2*P,s),c=F[F.length-1]}return s}function Wm(_,c,n,u,r){var s;for(c+=u;c<n;c+=u)if(s=r(_.slice(c-u,c),_.slice(c,c+u)),s)return s;return!1}function hd(_,c,n,u,r){var s=gy(Ya(),_,c,n,u);return ko(r,s)?sc(r,s)||s[0]>=r[0]&&s[2]<=r[2]||s[1]>=r[1]&&s[3]<=r[3]?!0:Wm(_,c,n,u,function(P,z){return $v(r,P,z)}):!1}function Ix(_,c,n,u,r){for(var s=0,P=n.length;s<P;++s){if(hd(_,c,n[s],u,r))return!0;c=n[s]}return!1}function aw(_,c,n,u,r){return!!(hd(_,c,n,u,r)||fh(_,c,n,u,r[0],r[1])||fh(_,c,n,u,r[0],r[3])||fh(_,c,n,u,r[2],r[1])||fh(_,c,n,u,r[2],r[3]))}function Zy(_,c,n,u,r){if(!aw(_,c,n[0],u,r))return!1;if(n.length===1)return!0;for(var s=1,P=n.length;s<P;++s)if(Ex(_,n[s-1],n[s],u,r)&&!hd(_,n[s-1],n[s],u,r))return!1;return!0}function Cx(_,c,n,u,r){for(var s=0,P=n.length;s<P;++s){var z=n[s];if(Zy(_,c,z,u,r))return!0;c=z[z.length-1]}return!1}function Ax(_,c,n,u){for(;c<n-u;){for(var r=0;r<u;++r){var s=_[c+r];_[c+r]=_[n-u+r],_[n-u+r]=s}c+=u,n-=u}}function Px(_,c,n,u){for(var r=0,s=_[n-u],P=_[n-u+1];c<n;c+=u){var z=_[c],F=_[c+1];r+=(z-s)*(F+P),s=z,P=F}return r===0?void 0:r>0}function Xy(_,c,n,u,r){for(var s=r!==void 0?r:!1,P=0,z=n.length;P<z;++P){var F=n[P],N=Px(_,c,F,u);if(P===0){if(s&&N||!s&&!N)return!1}else if(s&&!N||!s&&N)return!1;c=F}return!0}function Mx(_,c,n,u,r){for(var s=0,P=n.length;s<P;++s){var z=n[s];if(!Xy(_,c,z,u,r))return!1;z.length&&(c=z[z.length-1])}return!0}function $m(_,c,n,u,r){for(var s=r!==void 0?r:!1,P=0,z=n.length;P<z;++P){var F=n[P],N=Px(_,c,F,u),V=P===0?s&&N||!s&&!N:s&&!N||!s&&N;V&&Ax(_,c,F,u),c=F}return c}function Wy(_,c,n,u,r){for(var s=0,P=n.length;s<P;++s)c=$m(_,c,n[s],u,r);return c}var sw=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),kx=function(_){sw(c,_);function c(n,u,r){var s=_.call(this)||this;return s.ends_=[],s.flatInteriorPointRevision_=-1,s.flatInteriorPoint_=null,s.maxDelta_=-1,s.maxDeltaRevision_=-1,s.orientedRevision_=-1,s.orientedFlatCoordinates_=null,u!==void 0&&r?(s.setFlatCoordinates(u,n),s.ends_=r):s.setCoordinates(n,u),s}return c.prototype.appendLinearRing=function(n){this.flatCoordinates?Ha(this.flatCoordinates,n.getFlatCoordinates()):this.flatCoordinates=n.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()},c.prototype.clone=function(){var n=new c(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return n.applyProperties(this),n},c.prototype.closestPointXY=function(n,u,r,s){return s<xs(this.getExtent(),n,u)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(nd(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),ad(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,n,u,r,s))},c.prototype.containsXY=function(n,u){return cd(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,n,u)},c.prototype.getArea=function(){return Gy(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)},c.prototype.getCoordinates=function(n){var u;return n!==void 0?(u=this.getOrientedFlatCoordinates().slice(),$m(u,0,this.ends_,this.stride,n)):u=this.flatCoordinates,ph(u,0,this.ends_,this.stride)},c.prototype.getEnds=function(){return this.ends_},c.prototype.getFlatInteriorPoint=function(){if(this.flatInteriorPointRevision_!=this.getRevision()){var n=$h(this.getExtent());this.flatInteriorPoint_=qy(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,n,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_},c.prototype.getInteriorPoint=function(){return new ya(this.getFlatInteriorPoint(),An.XYM)},c.prototype.getLinearRingCount=function(){return this.ends_.length},c.prototype.getLinearRing=function(n){return n<0||this.ends_.length<=n?null:new jy(this.flatCoordinates.slice(n===0?0:this.ends_[n-1],this.ends_[n]),this.layout)},c.prototype.getLinearRings=function(){for(var n=this.layout,u=this.flatCoordinates,r=this.ends_,s=[],P=0,z=0,F=r.length;z<F;++z){var N=r[z],V=new jy(u.slice(P,N),n);s.push(V),P=N}return s},c.prototype.getOrientedFlatCoordinates=function(){if(this.orientedRevision_!=this.getRevision()){var n=this.flatCoordinates;Xy(n,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=n:(this.orientedFlatCoordinates_=n.slice(),this.orientedFlatCoordinates_.length=$m(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_},c.prototype.getSimplifiedGeometryInternal=function(n){var u=[],r=[];return u.length=Ny(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(n),u,0,r),new c(u,An.XY,r)},c.prototype.getType=function(){return Pt.POLYGON},c.prototype.intersectsExtent=function(n){return Zy(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,n)},c.prototype.setCoordinates=function(n,u){this.setLayout(u,n,2),this.flatCoordinates||(this.flatCoordinates=[]);var r=sd(this.flatCoordinates,0,n,this.stride,this.ends_);this.flatCoordinates.length=r.length===0?0:r[r.length-1],this.changed()},c}(Es),pd=kx;function $y(_,c,n){for(var u=c||32,r=_.getStride(),s=_.getLayout(),P=_.getCenter(),z=r*(u+1),F=new Array(z),N=0;N<z;N+=r){F[N]=0,F[N+1]=0;for(var V=2;V<r;V++)F[N+V]=P[V]}var me=[F.length],be=new kx(F,s,me);return lw(be,P,_.getRadius(),n),be}function lw(_,c,n,u){for(var r=_.getFlatCoordinates(),s=_.getStride(),P=r.length/s-1,z=u||0,F=0;F<=P;++F){var N=F*s,V=z+zm(F,P)*2*Math.PI/P;r[N]=c[0]+n*Math.cos(V),r[N+1]=c[1]+n*Math.sin(V)}_.changed()}var uw=function(){function _(c){var n=c||{};this.color_=n.color!==void 0?n.color:null}return _.prototype.clone=function(){var c=this.getColor();return new _({color:Array.isArray(c)?c.slice():c||void 0})},_.prototype.getColor=function(){return this.color_},_.prototype.setColor=function(c){this.color_=c},_}(),Hs=uw;function Km(_,c,n,u,r,s,P){var z,F,N=(n-c)/u;if(N===1)z=c;else if(N===2)z=c,F=r;else if(N!==0){for(var V=_[c],me=_[c+1],be=0,Se=[0],Ve=c+u;Ve<n;Ve+=u){var Ke=_[Ve],Ie=_[Ve+1];be+=Math.sqrt((Ke-V)*(Ke-V)+(Ie-me)*(Ie-me)),Se.push(be),V=Ke,me=Ie}var Ge=r*be,et=mv(Se,Ge);et<0?(F=(Ge-Se[-et-2])/(Se[-et-1]-Se[-et-2]),z=c+(-et-2)*u):z=c+et*u}for(var rt=P>1?P:2,_t=s||new Array(rt),Ve=0;Ve<rt;++Ve)_t[Ve]=z===void 0?NaN:F===void 0?_[z+Ve]:gl(_[z+Ve],_[z+u+Ve],F);return _t}function Hm(_,c,n,u,r,s){if(n==c)return null;var P;if(r<_[c+u-1])return s?(P=_.slice(c,c+u),P[u-1]=r,P):null;if(_[n-1]<r)return s?(P=_.slice(n-u,n),P[u-1]=r,P):null;if(r==_[c+u-1])return _.slice(c,c+u);for(var z=c/u,F=n/u;z<F;){var N=z+F>>1;r<_[(N+1)*u-1]?F=N:z=N+1}var V=_[z*u-1];if(r==V)return _.slice((z-1)*u,(z-1)*u+u);var me=_[(z+1)*u-1],be=(r-V)/(me-V);P=[];for(var Se=0;Se<u-1;++Se)P.push(gl(_[(z-1)*u+Se],_[z*u+Se],be));return P.push(r),P}function Lx(_,c,n,u,r,s,P){if(P)return Hm(_,c,n[n.length-1],u,r,s);var z;if(r<_[u-1])return s?(z=_.slice(0,u),z[u-1]=r,z):null;if(_[_.length-1]<r)return s?(z=_.slice(_.length-u),z[u-1]=r,z):null;for(var F=0,N=n.length;F<N;++F){var V=n[F];if(c!=V){if(r<_[c+u-1])return null;if(r<=_[V-1])return Hm(_,c,V,u,r,!1);c=V}}return null}function Ym(_,c,n,u){for(var r=_[c],s=_[c+1],P=0,z=c+u;z<n;z+=u){var F=_[z],N=_[z+1];P+=Math.sqrt((F-r)*(F-r)+(N-s)*(N-s)),r=F,s=N}return P}var cw=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),hw=function(_){cw(c,_);function c(n,u){var r=_.call(this)||this;return r.flatMidpoint_=null,r.flatMidpointRevision_=-1,r.maxDelta_=-1,r.maxDeltaRevision_=-1,u!==void 0&&!Array.isArray(n[0])?r.setFlatCoordinates(u,n):r.setCoordinates(n,u),r}return c.prototype.appendCoordinate=function(n){this.flatCoordinates?Ha(this.flatCoordinates,n):this.flatCoordinates=n.slice(),this.changed()},c.prototype.clone=function(){var n=new c(this.flatCoordinates.slice(),this.layout);return n.applyProperties(this),n},c.prototype.closestPointXY=function(n,u,r,s){return s<xs(this.getExtent(),n,u)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(id(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),od(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,n,u,r,s))},c.prototype.forEachSegment=function(n){return Wm(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,n)},c.prototype.getCoordinateAtM=function(n,u){if(this.layout!=An.XYM&&this.layout!=An.XYZM)return null;var r=u!==void 0?u:!1;return Hm(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,n,r)},c.prototype.getCoordinates=function(){return vl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)},c.prototype.getCoordinateAt=function(n,u){return Km(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,n,u,this.stride)},c.prototype.getLength=function(){return Ym(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)},c.prototype.getFlatMidpoint=function(){return this.flatMidpointRevision_!=this.getRevision()&&(this.flatMidpoint_=this.getCoordinateAt(.5,this.flatMidpoint_),this.flatMidpointRevision_=this.getRevision()),this.flatMidpoint_},c.prototype.getSimplifiedGeometryInternal=function(n){var u=[];return u.length=ld(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,n,u,0),new c(u,An.XY)},c.prototype.getType=function(){return Pt.LINE_STRING},c.prototype.intersectsExtent=function(n){return hd(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,n)},c.prototype.setCoordinates=function(n,u){this.setLayout(u,n,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Yh(this.flatCoordinates,0,n,this.stride),this.changed()},c}(Es),uc=hw;var pw=function(){function _(c){var n=c||{};this.color_=n.color!==void 0?n.color:null,this.lineCap_=n.lineCap,this.lineDash_=n.lineDash!==void 0?n.lineDash:null,this.lineDashOffset_=n.lineDashOffset,this.lineJoin_=n.lineJoin,this.miterLimit_=n.miterLimit,this.width_=n.width}return _.prototype.clone=function(){var c=this.getColor();return new _({color:Array.isArray(c)?c.slice():c||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),width:this.getWidth()})},_.prototype.getColor=function(){return this.color_},_.prototype.getLineCap=function(){return this.lineCap_},_.prototype.getLineDash=function(){return this.lineDash_},_.prototype.getLineDashOffset=function(){return this.lineDashOffset_},_.prototype.getLineJoin=function(){return this.lineJoin_},_.prototype.getMiterLimit=function(){return this.miterLimit_},_.prototype.getWidth=function(){return this.width_},_.prototype.setColor=function(c){this.color_=c},_.prototype.setLineCap=function(c){this.lineCap_=c},_.prototype.setLineDash=function(c){this.lineDash_=c},_.prototype.setLineDashOffset=function(c){this.lineDashOffset_=c},_.prototype.setLineJoin=function(c){this.lineJoin_=c},_.prototype.setMiterLimit=function(c){this.miterLimit_=c},_.prototype.setWidth=function(c){this.width_=c},_}(),_a=pw;var qi={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function Hy(_,c){return Array.isArray(_)?_:(c===void 0?c=[_,_]:(c[0]=_,c[1]=_),c)}var fw=function(){function _(c){this.opacity_=c.opacity,this.rotateWithView_=c.rotateWithView,this.rotation_=c.rotation,this.scale_=c.scale,this.scaleArray_=Hy(c.scale),this.displacement_=c.displacement}return _.prototype.clone=function(){var c=this.getScale();return new _({opacity:this.getOpacity(),scale:Array.isArray(c)?c.slice():c,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice()})},_.prototype.getOpacity=function(){return this.opacity_},_.prototype.getRotateWithView=function(){return this.rotateWithView_},_.prototype.getRotation=function(){return this.rotation_},_.prototype.getScale=function(){return this.scale_},_.prototype.getScaleArray=function(){return this.scaleArray_},_.prototype.getDisplacement=function(){return this.displacement_},_.prototype.getAnchor=function(){return jr()},_.prototype.getImage=function(c){return jr()},_.prototype.getHitDetectionImage=function(){return jr()},_.prototype.getPixelRatio=function(c){return 1},_.prototype.getImageState=function(){return jr()},_.prototype.getImageSize=function(){return jr()},_.prototype.getOrigin=function(){return jr()},_.prototype.getSize=function(){return jr()},_.prototype.setDisplacement=function(c){this.displacement_=c},_.prototype.setOpacity=function(c){this.opacity_=c},_.prototype.setRotateWithView=function(c){this.rotateWithView_=c},_.prototype.setRotation=function(c){this.rotation_=c},_.prototype.setScale=function(c){this.scale_=c,this.scaleArray_=Hy(c)},_.prototype.listenImageChange=function(c){jr()},_.prototype.load=function(){jr()},_.prototype.unlistenImageChange=function(c){jr()},_}(),Jm=fw;var dw=/^#([a-f0-9]{3}|[a-f0-9]{4}(?:[a-f0-9]{2}){0,2})$/i,mw=/^([a-z]*)$|^hsla?\(.*\)$/i;function Qm(_){return typeof _=="string"?_:Ky(_)}function gw(_){var c=document.createElement("div");if(c.style.color=_,c.style.color!==""){document.body.appendChild(c);var n=getComputedStyle(c).color;return document.body.removeChild(c),n}else return""}var yw=function(){var _=1024,c={},n=0;return function(u){var r;if(c.hasOwnProperty(u))r=c[u];else{if(n>=_){var s=0;for(var P in c)(s++&3)===0&&(delete c[P],--n)}r=_w(u),c[u]=r,++n}return r}}();function Jh(_){return Array.isArray(_)?_:yw(_)}function _w(_){var c,n,u,r,s;if(mw.exec(_)&&(_=gw(_)),dw.exec(_)){var P=_.length-1,z=void 0;P<=4?z=1:z=2;var F=P===4||P===8;c=parseInt(_.substr(1+0*z,z),16),n=parseInt(_.substr(1+1*z,z),16),u=parseInt(_.substr(1+2*z,z),16),F?r=parseInt(_.substr(1+3*z,z),16):r=255,z==1&&(c=(c<<4)+c,n=(n<<4)+n,u=(u<<4)+u,F&&(r=(r<<4)+r)),s=[c,n,u,r/255]}else _.indexOf("rgba(")==0?(s=_.slice(5,-1).split(",").map(Number),Rx(s)):_.indexOf("rgb(")==0?(s=_.slice(4,-1).split(",").map(Number),s.push(1),Rx(s)):wn(!1,14);return s}function Rx(_){return _[0]=jl(_[0]+.5|0,0,255),_[1]=jl(_[1]+.5|0,0,255),_[2]=jl(_[2]+.5|0,0,255),_[3]=jl(_[3],0,1),_}function Ky(_){var c=_[0];c!=(c|0)&&(c=c+.5|0);var n=_[1];n!=(n|0)&&(n=n+.5|0);var u=_[2];u!=(u|0)&&(u=u+.5|0);var r=_[3]===void 0?1:Math.round(_[3]*100)/100;return"rgba("+c+","+n+","+u+","+r+")"}function Ts(_){return Array.isArray(_)?Ky(_):_}function Ja(_,c,n,u){var r;return n&&n.length?r=n.shift():ah?r=new OffscreenCanvas(_||300,c||300):r=document.createElement("canvas"),_&&(r.width=_),c&&(r.height=c),r.getContext("2d",u)}var vw=new RegExp(["^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)","(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?","(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))","(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))",`?\\s*([-,\\"\\'\\sa-z]+?)\\s*$`].join(""),"i"),zx=["style","variant","weight","size","lineHeight","family"],Yy=function(_){var c=_.match(vw);if(!c)return null;for(var n={lineHeight:"normal",size:"1.2em",style:"normal",weight:"normal",variant:"normal"},u=0,r=zx.length;u<r;++u){var s=c[u+1];s!==void 0&&(n[zx[u]]=s)}return n.families=n.family.split(/,\s?/),n};function Dx(_){return _===1?"":String(Math.round(_*100)/100)}var tg="10px sans-serif",Ss="#000",Qh="round",cc=[],hc=0,Iu="round",pc=10,fc="#000",mh="center",ep="middle",dc=[0,0,0,0],mc=1,dh=new Po,xw=new nh;xw.setSize=function(){console.warn("labelCache is deprecated.")};var sf=null,Jy,Qy={},Ox=function(){var _=100,c="32px ",n=["monospace","serif"],u=n.length,r="wmytzilWMYTZIL@#/&?$%10\uF013",s,P;function z(N,V,me){for(var be=!0,Se=0;Se<u;++Se){var Ve=n[Se];if(P=eg(N+" "+V+" "+c+Ve,r),me!=Ve){var Ke=eg(N+" "+V+" "+c+me+","+Ve,r);be=be&&Ke!=P}}return!!be}function F(){for(var N=!0,V=dh.getKeys(),me=0,be=V.length;me<be;++me){var Se=V[me];dh.get(Se)<_&&(z.apply(this,Se.split(`
1076
1076
  `))?(ih(Qy),sf=null,Jy=void 0,dh.set(Se,_)):(dh.set(Se,dh.get(Se)+1,!0),N=!1))}N&&(clearInterval(s),s=void 0)}return function(N){var V=Yy(N);if(!!V)for(var me=V.families,be=0,Se=me.length;be<Se;++be){var Ve=me[be],Ke=V.style+`
1077
1077
  `+V.weight+`
1078
1078
  `+Ve;dh.get(Ke)===void 0&&(dh.set(Ke,_,!0),z(V.style,V.weight,Ve)||(dh.set(Ke,0,!0),s===void 0&&(s=setInterval(F,32))))}}}(),bw=function(){var _;return function(c){var n=Qy[c];if(n==null){if(ah){var u=Yy(c),r=Fx(c,"\u017Dg"),s=isNaN(Number(u.lineHeight))?1.2:Number(u.lineHeight);n=s*(r.actualBoundingBoxAscent+r.actualBoundingBoxDescent)}else _||(_=document.createElement("div"),_.innerHTML="M",_.style.minHeight="0",_.style.maxHeight="none",_.style.height="auto",_.style.padding="0",_.style.border="none",_.style.position="absolute",_.style.display="block",_.style.left="-99999px"),_.style.font=c,document.body.appendChild(_),n=_.offsetHeight,document.body.removeChild(_);Qy[c]=n}return n}}();function Fx(_,c){return sf||(sf=Ja(1,1)),_!=Jy&&(sf.font=_,Jy=sf.font),sf.measureText(c)}function eg(_,c){return Fx(_,c).width}function e_(_,c,n){if(c in n)return n[c];var u=eg(_,c);return n[c]=u,u}function Bx(_,c){for(var n=[],u=[],r=[],s=0,P=0,z=0,F=0,N=0,V=c.length;N<=V;N+=2){var me=c[N];if(me===`
1079
1079
  `||N===V){s=Math.max(s,P),r.push(P),P=0,z+=F;continue}var be=c[N+1]||_.font,Se=eg(be,me);n.push(Se),P+=Se;var Ve=bw(be);u.push(Ve),F=Math.max(F,Ve)}return{width:s,height:z,widths:n,heights:u,lineWidths:r}}function Ux(_,c,n,u,r,s,P,z,F,N,V){_.save(),n!==1&&(_.globalAlpha*=n),c&&_.setTransform.apply(_,c),u.contextInstructions?(_.translate(F,N),_.scale(V[0],V[1]),ww(u,_)):V[0]<0||V[1]<0?(_.translate(F,N),_.scale(V[0],V[1]),_.drawImage(u,r,s,P,z,0,0,P,z)):_.drawImage(u,r,s,P,z,F,N,P*V[0],z*V[1]),_.restore()}function ww(_,c){for(var n=_.contextInstructions,u=0,r=n.length;u<r;u+=2)Array.isArray(n[u+1])?c[n[u]].apply(c,n[u+1]):c[n[u]]=n[u+1]}var Ew=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Tw=function(_){Ew(c,_);function c(n){var u=this,r=n.rotateWithView!==void 0?n.rotateWithView:!1;return u=_.call(this,{opacity:1,rotateWithView:r,rotation:n.rotation!==void 0?n.rotation:0,scale:n.scale!==void 0?n.scale:1,displacement:n.displacement!==void 0?n.displacement:[0,0]})||this,u.canvas_=void 0,u.hitDetectionCanvas_=null,u.fill_=n.fill!==void 0?n.fill:null,u.origin_=[0,0],u.points_=n.points,u.radius_=n.radius!==void 0?n.radius:n.radius1,u.radius2_=n.radius2,u.angle_=n.angle!==void 0?n.angle:0,u.stroke_=n.stroke!==void 0?n.stroke:null,u.size_=null,u.renderOptions_=null,u.render(),u}return c.prototype.clone=function(){var n=this.getScale(),u=new c({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(n)?n.slice():n,displacement:this.getDisplacement().slice()});return u.setOpacity(this.getOpacity()),u},c.prototype.getAnchor=function(){var n=this.size_;if(!n)return null;var u=this.getDisplacement();return[n[0]/2-u[0],n[1]/2+u[1]]},c.prototype.getAngle=function(){return this.angle_},c.prototype.getFill=function(){return this.fill_},c.prototype.getHitDetectionImage=function(){return this.hitDetectionCanvas_||this.createHitDetectionCanvas_(this.renderOptions_),this.hitDetectionCanvas_},c.prototype.getImage=function(n){var u=this.canvas_[n];if(!u){var r=this.renderOptions_,s=Ja(r.size*n,r.size*n);this.draw_(r,s,n),u=s.canvas,this.canvas_[n]=u}return u},c.prototype.getPixelRatio=function(n){return n},c.prototype.getImageSize=function(){return this.size_},c.prototype.getImageState=function(){return qi.LOADED},c.prototype.getOrigin=function(){return this.origin_},c.prototype.getPoints=function(){return this.points_},c.prototype.getRadius=function(){return this.radius_},c.prototype.getRadius2=function(){return this.radius2_},c.prototype.getSize=function(){return this.size_},c.prototype.getStroke=function(){return this.stroke_},c.prototype.listenImageChange=function(n){},c.prototype.load=function(){},c.prototype.unlistenImageChange=function(n){},c.prototype.calculateLineJoinSize_=function(n,u,r){if(u===0||this.points_===1/0||n!=="bevel"&&n!=="miter")return u;var s=this.radius_,P=this.radius2_===void 0?s:this.radius2_;if(s<P){var z=s;s=P,P=z}var F=this.radius2_===void 0?this.points_:this.points_*2,N=2*Math.PI/F,V=P*Math.sin(N),me=Math.sqrt(P*P-V*V),be=s-me,Se=Math.sqrt(V*V+be*be),Ve=Se/V;if(n==="miter"&&Ve<=r)return Ve*u;var Ke=u/2/Ve,Ie=u/2*(be/Se),Ge=Math.sqrt((s+Ke)*(s+Ke)+Ie*Ie),et=Ge-s;if(this.radius2_===void 0||n==="bevel")return et*2;var rt=s*Math.sin(N),_t=Math.sqrt(s*s-rt*rt),yt=P-_t,ct=Math.sqrt(rt*rt+yt*yt),Tt=ct/rt;if(Tt<=r){var St=Tt*u/2-P-s;return 2*Math.max(et,St)}return et*2},c.prototype.createRenderOptions=function(){var n=Iu,u=0,r=null,s=0,P,z=0;this.stroke_&&(P=this.stroke_.getColor(),P===null&&(P=fc),P=Ts(P),z=this.stroke_.getWidth(),z===void 0&&(z=mc),r=this.stroke_.getLineDash(),s=this.stroke_.getLineDashOffset(),n=this.stroke_.getLineJoin(),n===void 0&&(n=Iu),u=this.stroke_.getMiterLimit(),u===void 0&&(u=pc));var F=this.calculateLineJoinSize_(n,z,u),N=Math.max(this.radius_,this.radius2_||0),V=Math.ceil(2*N+F);return{strokeStyle:P,strokeWidth:z,size:V,lineDash:r,lineDashOffset:s,lineJoin:n,miterLimit:u}},c.prototype.render=function(){this.renderOptions_=this.createRenderOptions();var n=this.renderOptions_.size;this.canvas_={},this.size_=[n,n]},c.prototype.draw_=function(n,u,r){if(u.scale(r,r),u.translate(n.size/2,n.size/2),this.createPath_(u),this.fill_){var s=this.fill_.getColor();s===null&&(s=Ss),u.fillStyle=Ts(s),u.fill()}this.stroke_&&(u.strokeStyle=n.strokeStyle,u.lineWidth=n.strokeWidth,u.setLineDash&&n.lineDash&&(u.setLineDash(n.lineDash),u.lineDashOffset=n.lineDashOffset),u.lineJoin=n.lineJoin,u.miterLimit=n.miterLimit,u.stroke())},c.prototype.createHitDetectionCanvas_=function(n){if(this.fill_){var u=this.fill_.getColor(),r=0;if(typeof u=="string"&&(u=Jh(u)),u===null?r=1:Array.isArray(u)&&(r=u.length===4?u[3]:1),r===0){var s=Ja(n.size,n.size);this.hitDetectionCanvas_=s.canvas,this.drawHitDetectionCanvas_(n,s)}}this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.getImage(1))},c.prototype.createPath_=function(n){var u=this.points_,r=this.radius_;if(u===1/0)n.arc(0,0,r,0,2*Math.PI);else{var s=this.radius2_===void 0?r:this.radius2_;this.radius2_!==void 0&&(u*=2);for(var P=this.angle_-Math.PI/2,z=2*Math.PI/u,F=0;F<u;F++){var N=P+F*z,V=F%2===0?r:s;n.lineTo(V*Math.cos(N),V*Math.sin(N))}n.closePath()}},c.prototype.drawHitDetectionCanvas_=function(n,u){u.translate(n.size/2,n.size/2),this.createPath_(u),u.fillStyle=Ss,u.fill(),this.stroke_&&(u.strokeStyle=n.strokeStyle,u.lineWidth=n.strokeWidth,n.lineDash&&(u.setLineDash(n.lineDash),u.lineDashOffset=n.lineDashOffset),u.lineJoin=n.lineJoin,u.miterLimit=n.miterLimit,u.stroke())},c}(Jm),Nx=Tw;var Sw=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Iw=function(_){Sw(c,_);function c(n){var u=n||{};return _.call(this,{points:1/0,fill:u.fill,radius:u.radius,stroke:u.stroke,scale:u.scale!==void 0?u.scale:1,rotation:u.rotation!==void 0?u.rotation:0,rotateWithView:u.rotateWithView!==void 0?u.rotateWithView:!1,displacement:u.displacement!==void 0?u.displacement:[0,0]})||this}return c.prototype.clone=function(){var n=this.getScale(),u=new c({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),scale:Array.isArray(n)?n.slice():n,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice()});return u.setOpacity(this.getOpacity()),u},c.prototype.setRadius=function(n){this.radius_=n,this.render()},c}(Nx),xl=Iw;var lf=function(){function _(c){var n=c||{};this.geometry_=null,this.geometryFunction_=Vx,n.geometry!==void 0&&this.setGeometry(n.geometry),this.fill_=n.fill!==void 0?n.fill:null,this.image_=n.image!==void 0?n.image:null,this.renderer_=n.renderer!==void 0?n.renderer:null,this.hitDetectionRenderer_=n.hitDetectionRenderer!==void 0?n.hitDetectionRenderer:null,this.stroke_=n.stroke!==void 0?n.stroke:null,this.text_=n.text!==void 0?n.text:null,this.zIndex_=n.zIndex}return _.prototype.clone=function(){var c=this.getGeometry();return c&&typeof c=="object"&&(c=c.clone()),new _({geometry:c,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,renderer:this.getRenderer(),stroke:this.getStroke()?this.getStroke().clone():void 0,text:this.getText()?this.getText().clone():void 0,zIndex:this.getZIndex()})},_.prototype.getRenderer=function(){return this.renderer_},_.prototype.setRenderer=function(c){this.renderer_=c},_.prototype.setHitDetectionRenderer=function(c){this.hitDetectionRenderer_=c},_.prototype.getHitDetectionRenderer=function(){return this.hitDetectionRenderer_},_.prototype.getGeometry=function(){return this.geometry_},_.prototype.getGeometryFunction=function(){return this.geometryFunction_},_.prototype.getFill=function(){return this.fill_},_.prototype.setFill=function(c){this.fill_=c},_.prototype.getImage=function(){return this.image_},_.prototype.setImage=function(c){this.image_=c},_.prototype.getStroke=function(){return this.stroke_},_.prototype.setStroke=function(c){this.stroke_=c},_.prototype.getText=function(){return this.text_},_.prototype.setText=function(c){this.text_=c},_.prototype.getZIndex=function(){return this.zIndex_},_.prototype.setGeometry=function(c){typeof c=="function"?this.geometryFunction_=c:typeof c=="string"?this.geometryFunction_=function(n){return n.get(c)}:c?c!==void 0&&(this.geometryFunction_=function(){return c}):this.geometryFunction_=Vx,this.geometry_=c},_.prototype.setZIndex=function(c){this.zIndex_=c},_}();function Gx(_){var c;if(typeof _=="function")c=_;else{var n;if(Array.isArray(_))n=_;else{wn(typeof _.getZIndex=="function",41);var u=_;n=[u]}c=function(){return n}}return c}var t_=null;function jx(_,c){if(!t_){var n=new Hs({color:"rgba(255,255,255,0.4)"}),u=new _a({color:"#3399CC",width:1.25});t_=[new lf({image:new xl({fill:n,stroke:u,radius:5}),fill:n,stroke:u})]}return t_}function qx(){var _={},c=[255,255,255,1],n=[0,153,255,1],u=3;return _[Pt.POLYGON]=[new lf({fill:new Hs({color:[255,255,255,.5]})})],_[Pt.MULTI_POLYGON]=_[Pt.POLYGON],_[Pt.LINE_STRING]=[new lf({stroke:new _a({color:c,width:u+2})}),new lf({stroke:new _a({color:n,width:u})})],_[Pt.MULTI_LINE_STRING]=_[Pt.LINE_STRING],_[Pt.CIRCLE]=_[Pt.POLYGON].concat(_[Pt.LINE_STRING]),_[Pt.POINT]=[new lf({image:new xl({radius:u*2,fill:new Hs({color:n}),stroke:new _a({color:c,width:u/2})}),zIndex:1/0})],_[Pt.MULTI_POINT]=_[Pt.POINT],_[Pt.GEOMETRY_COLLECTION]=_[Pt.POLYGON].concat(_[Pt.LINE_STRING],_[Pt.POINT]),_}function Vx(_){return _.getGeometry()}var Wl=lf;var Zx={POINT:"point",LINE:"line"};var Wx=Gp(n_(),1);var Cw=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Xx={RENDER_ORDER:"renderOrder"},Aw=function(_){Cw(c,_);function c(n){var u=this,r=n||{},s=Ra({},r);return delete s.style,delete s.renderBuffer,delete s.updateWhileAnimating,delete s.updateWhileInteracting,u=_.call(this,s)||this,u.declutter_=r.declutter!==void 0?r.declutter:!1,u.renderBuffer_=r.renderBuffer!==void 0?r.renderBuffer:100,u.style_=null,u.styleFunction_=void 0,u.setStyle(r.style),u.updateWhileAnimating_=r.updateWhileAnimating!==void 0?r.updateWhileAnimating:!1,u.updateWhileInteracting_=r.updateWhileInteracting!==void 0?r.updateWhileInteracting:!1,u}return c.prototype.getDeclutter=function(){return this.declutter_},c.prototype.getFeatures=function(n){return _.prototype.getFeatures.call(this,n)},c.prototype.getRenderBuffer=function(){return this.renderBuffer_},c.prototype.getRenderOrder=function(){return this.get(Xx.RENDER_ORDER)},c.prototype.getStyle=function(){return this.style_},c.prototype.getStyleFunction=function(){return this.styleFunction_},c.prototype.getUpdateWhileAnimating=function(){return this.updateWhileAnimating_},c.prototype.getUpdateWhileInteracting=function(){return this.updateWhileInteracting_},c.prototype.renderDeclutter=function(n){n.declutterTree||(n.declutterTree=new Wx.default(9)),this.getRenderer().renderDeclutter(n)},c.prototype.setRenderOrder=function(n){this.set(Xx.RENDER_ORDER,n)},c.prototype.setStyle=function(n){this.style_=n!==void 0?n:jx,this.styleFunction_=n===null?void 0:Gx(this.style_),this.changed()},c}(Kh),$x=Aw;var fd={BEGIN_GEOMETRY:0,BEGIN_PATH:1,CIRCLE:2,CLOSE_PATH:3,CUSTOM:4,DRAW_CHARS:5,DRAW_IMAGE:6,END_GEOMETRY:7,FILL:8,MOVE_TO_LINE_TO:9,SET_FILL_STYLE:10,SET_STROKE_STYLE:11,STROKE:12},dd=[fd.FILL],Cu=[fd.STROKE],gc=[fd.BEGIN_PATH],o_=[fd.CLOSE_PATH],qr=fd;var Pw=function(){function _(){}return _.prototype.drawCustom=function(c,n,u,r){},_.prototype.drawGeometry=function(c){},_.prototype.setStyle=function(c){},_.prototype.drawCircle=function(c,n){},_.prototype.drawFeature=function(c,n){},_.prototype.drawGeometryCollection=function(c,n){},_.prototype.drawLineString=function(c,n){},_.prototype.drawMultiLineString=function(c,n){},_.prototype.drawMultiPoint=function(c,n){},_.prototype.drawMultiPolygon=function(c,n){},_.prototype.drawPoint=function(c,n){},_.prototype.drawPolygon=function(c,n){},_.prototype.drawText=function(c,n){},_.prototype.setFillStrokeStyle=function(c,n){},_.prototype.setImageStyle=function(c,n){},_.prototype.setTextStyle=function(c,n){},_}(),rg=Pw;var Mw=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),kw=function(_){Mw(c,_);function c(n,u,r,s){var P=_.call(this)||this;return P.tolerance=n,P.maxExtent=u,P.pixelRatio=s,P.maxLineWidth=0,P.resolution=r,P.beginGeometryInstruction1_=null,P.beginGeometryInstruction2_=null,P.bufferedMaxExtent_=null,P.instructions=[],P.coordinates=[],P.tmpCoordinate_=[],P.hitDetectionInstructions=[],P.state={},P}return c.prototype.applyPixelRatio=function(n){var u=this.pixelRatio;return u==1?n:n.map(function(r){return r*u})},c.prototype.appendFlatPointCoordinates=function(n,u){for(var r=this.getBufferedMaxExtent(),s=this.tmpCoordinate_,P=this.coordinates,z=P.length,F=0,N=n.length;F<N;F+=u)s[0]=n[F],s[1]=n[F+1],Hp(r,s)&&(P[z++]=s[0],P[z++]=s[1]);return z},c.prototype.appendFlatLineCoordinates=function(n,u,r,s,P,z){var F=this.coordinates,N=F.length,V=this.getBufferedMaxExtent();z&&(u+=s);var me=n[u],be=n[u+1],Se=this.tmpCoordinate_,Ve=!0,Ke,Ie,Ge;for(Ke=u+s;Ke<r;Ke+=s)Se[0]=n[Ke],Se[1]=n[Ke+1],Ge=Om(V,Se),Ge!==Ie?(Ve&&(F[N++]=me,F[N++]=be,Ve=!1),F[N++]=Se[0],F[N++]=Se[1]):Ge===Mo.INTERSECTING?(F[N++]=Se[0],F[N++]=Se[1],Ve=!1):Ve=!0,me=Se[0],be=Se[1],Ie=Ge;return(P&&Ve||Ke===u+s)&&(F[N++]=me,F[N++]=be),N},c.prototype.drawCustomCoordinates_=function(n,u,r,s,P){for(var z=0,F=r.length;z<F;++z){var N=r[z],V=this.appendFlatLineCoordinates(n,u,N,s,!1,!1);P.push(V),u=N}return u},c.prototype.drawCustom=function(n,u,r,s){this.beginGeometry(n,u);var P=n.getType(),z=n.getStride(),F=this.coordinates.length,N,V,me,be,Se;switch(P){case Pt.MULTI_POLYGON:N=n.getOrientedFlatCoordinates(),be=[];var Ve=n.getEndss();Se=0;for(var Ke=0,Ie=Ve.length;Ke<Ie;++Ke){var Ge=[];Se=this.drawCustomCoordinates_(N,Se,Ve[Ke],z,Ge),be.push(Ge)}this.instructions.push([qr.CUSTOM,F,be,n,r,ud]),this.hitDetectionInstructions.push([qr.CUSTOM,F,be,n,s||r,ud]);break;case Pt.POLYGON:case Pt.MULTI_LINE_STRING:me=[],N=P==Pt.POLYGON?n.getOrientedFlatCoordinates():n.getFlatCoordinates(),Se=this.drawCustomCoordinates_(N,0,n.getEnds(),z,me),this.instructions.push([qr.CUSTOM,F,me,n,r,ph]),this.hitDetectionInstructions.push([qr.CUSTOM,F,me,n,s||r,ph]);break;case Pt.LINE_STRING:case Pt.CIRCLE:N=n.getFlatCoordinates(),V=this.appendFlatLineCoordinates(N,0,N.length,z,!1,!1),this.instructions.push([qr.CUSTOM,F,V,n,r,vl]),this.hitDetectionInstructions.push([qr.CUSTOM,F,V,n,s||r,vl]);break;case Pt.MULTI_POINT:N=n.getFlatCoordinates(),V=this.appendFlatPointCoordinates(N,z),V>F&&(this.instructions.push([qr.CUSTOM,F,V,n,r,vl]),this.hitDetectionInstructions.push([qr.CUSTOM,F,V,n,s||r,vl]));break;case Pt.POINT:N=n.getFlatCoordinates(),this.coordinates.push(N[0],N[1]),V=this.coordinates.length,this.instructions.push([qr.CUSTOM,F,V,n,r]),this.hitDetectionInstructions.push([qr.CUSTOM,F,V,n,s||r]);break;default:}this.endGeometry(u)},c.prototype.beginGeometry=function(n,u){this.beginGeometryInstruction1_=[qr.BEGIN_GEOMETRY,u,0,n],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[qr.BEGIN_GEOMETRY,u,0,n],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)},c.prototype.finish=function(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}},c.prototype.reverseHitDetectionInstructions=function(){var n=this.hitDetectionInstructions;n.reverse();var u,r=n.length,s,P,z=-1;for(u=0;u<r;++u)s=n[u],P=s[0],P==qr.END_GEOMETRY?z=u:P==qr.BEGIN_GEOMETRY&&(s[2]=u,yv(this.hitDetectionInstructions,z,u),z=-1)},c.prototype.setFillStrokeStyle=function(n,u){var r=this.state;if(n){var s=n.getColor();r.fillStyle=Ts(s||Ss)}else r.fillStyle=void 0;if(u){var P=u.getColor();r.strokeStyle=Ts(P||fc);var z=u.getLineCap();r.lineCap=z!==void 0?z:Qh;var F=u.getLineDash();r.lineDash=F?F.slice():cc;var N=u.getLineDashOffset();r.lineDashOffset=N||hc;var V=u.getLineJoin();r.lineJoin=V!==void 0?V:Iu;var me=u.getWidth();r.lineWidth=me!==void 0?me:mc;var be=u.getMiterLimit();r.miterLimit=be!==void 0?be:pc,r.lineWidth>this.maxLineWidth&&(this.maxLineWidth=r.lineWidth,this.bufferedMaxExtent_=null)}else r.strokeStyle=void 0,r.lineCap=void 0,r.lineDash=null,r.lineDashOffset=void 0,r.lineJoin=void 0,r.lineWidth=void 0,r.miterLimit=void 0},c.prototype.createFill=function(n){var u=n.fillStyle,r=[qr.SET_FILL_STYLE,u];return typeof u!="string"&&r.push(!0),r},c.prototype.applyStroke=function(n){this.instructions.push(this.createStroke(n))},c.prototype.createStroke=function(n){return[qr.SET_STROKE_STYLE,n.strokeStyle,n.lineWidth*this.pixelRatio,n.lineCap,n.lineJoin,n.miterLimit,this.applyPixelRatio(n.lineDash),n.lineDashOffset*this.pixelRatio]},c.prototype.updateFillStyle=function(n,u){var r=n.fillStyle;(typeof r!="string"||n.currentFillStyle!=r)&&(r!==void 0&&this.instructions.push(u.call(this,n)),n.currentFillStyle=r)},c.prototype.updateStrokeStyle=function(n,u){var r=n.strokeStyle,s=n.lineCap,P=n.lineDash,z=n.lineDashOffset,F=n.lineJoin,N=n.lineWidth,V=n.miterLimit;(n.currentStrokeStyle!=r||n.currentLineCap!=s||P!=n.currentLineDash&&!_s(n.currentLineDash,P)||n.currentLineDashOffset!=z||n.currentLineJoin!=F||n.currentLineWidth!=N||n.currentMiterLimit!=V)&&(r!==void 0&&u.call(this,n),n.currentStrokeStyle=r,n.currentLineCap=s,n.currentLineDash=P,n.currentLineDashOffset=z,n.currentLineJoin=F,n.currentLineWidth=N,n.currentMiterLimit=V)},c.prototype.endGeometry=function(n){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;var u=[qr.END_GEOMETRY,n];this.instructions.push(u),this.hitDetectionInstructions.push(u)},c.prototype.getBufferedMaxExtent=function(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=jv(this.maxExtent),this.maxLineWidth>0)){var n=this.resolution*(this.maxLineWidth+1)/2;yl(this.bufferedMaxExtent_,n,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_},c}(rg),Au=kw;var Lw=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Rw=function(_){Lw(c,_);function c(n,u,r,s){var P=_.call(this,n,u,r,s)||this;return P.hitDetectionImage_=null,P.image_=null,P.imagePixelRatio_=void 0,P.anchorX_=void 0,P.anchorY_=void 0,P.height_=void 0,P.opacity_=void 0,P.originX_=void 0,P.originY_=void 0,P.rotateWithView_=void 0,P.rotation_=void 0,P.scale_=void 0,P.width_=void 0,P.declutterImageWithText_=void 0,P}return c.prototype.drawPoint=function(n,u){if(!!this.image_){this.beginGeometry(n,u);var r=n.getFlatCoordinates(),s=n.getStride(),P=this.coordinates.length,z=this.appendFlatPointCoordinates(r,s);this.instructions.push([qr.DRAW_IMAGE,P,z,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterImageWithText_]),this.hitDetectionInstructions.push([qr.DRAW_IMAGE,P,z,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterImageWithText_]),this.endGeometry(u)}},c.prototype.drawMultiPoint=function(n,u){if(!!this.image_){this.beginGeometry(n,u);var r=n.getFlatCoordinates(),s=n.getStride(),P=this.coordinates.length,z=this.appendFlatPointCoordinates(r,s);this.instructions.push([qr.DRAW_IMAGE,P,z,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterImageWithText_]),this.hitDetectionInstructions.push([qr.DRAW_IMAGE,P,z,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterImageWithText_]),this.endGeometry(u)}},c.prototype.finish=function(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,_.prototype.finish.call(this)},c.prototype.setImageStyle=function(n,u){var r=n.getAnchor(),s=n.getSize(),P=n.getHitDetectionImage(),z=n.getImage(this.pixelRatio),F=n.getOrigin();this.imagePixelRatio_=n.getPixelRatio(this.pixelRatio),this.anchorX_=r[0],this.anchorY_=r[1],this.hitDetectionImage_=P,this.image_=z,this.height_=s[1],this.opacity_=n.getOpacity(),this.originX_=F[0]*this.imagePixelRatio_,this.originY_=F[1]*this.imagePixelRatio_,this.rotateWithView_=n.getRotateWithView(),this.rotation_=n.getRotation(),this.scale_=n.getScaleArray(),this.width_=s[0],this.declutterImageWithText_=u},c}(Au),Hx=Rw;var zw=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Dw=function(_){zw(c,_);function c(n,u,r,s){return _.call(this,n,u,r,s)||this}return c.prototype.drawFlatCoordinates_=function(n,u,r,s){var P=this.coordinates.length,z=this.appendFlatLineCoordinates(n,u,r,s,!1,!1),F=[qr.MOVE_TO_LINE_TO,P,z];return this.instructions.push(F),this.hitDetectionInstructions.push(F),r},c.prototype.drawLineString=function(n,u){var r=this.state,s=r.strokeStyle,P=r.lineWidth;if(!(s===void 0||P===void 0)){this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(n,u),this.hitDetectionInstructions.push([qr.SET_STROKE_STYLE,r.strokeStyle,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,cc,hc],gc);var z=n.getFlatCoordinates(),F=n.getStride();this.drawFlatCoordinates_(z,0,z.length,F),this.hitDetectionInstructions.push(Cu),this.endGeometry(u)}},c.prototype.drawMultiLineString=function(n,u){var r=this.state,s=r.strokeStyle,P=r.lineWidth;if(!(s===void 0||P===void 0)){this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(n,u),this.hitDetectionInstructions.push([qr.SET_STROKE_STYLE,r.strokeStyle,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,r.lineDash,r.lineDashOffset],gc);for(var z=n.getEnds(),F=n.getFlatCoordinates(),N=n.getStride(),V=0,me=0,be=z.length;me<be;++me)V=this.drawFlatCoordinates_(F,V,z[me],N);this.hitDetectionInstructions.push(Cu),this.endGeometry(u)}},c.prototype.finish=function(){var n=this.state;return n.lastStroke!=null&&n.lastStroke!=this.coordinates.length&&this.instructions.push(Cu),this.reverseHitDetectionInstructions(),this.state=null,_.prototype.finish.call(this)},c.prototype.applyStroke=function(n){n.lastStroke!=null&&n.lastStroke!=this.coordinates.length&&(this.instructions.push(Cu),n.lastStroke=this.coordinates.length),n.lastStroke=0,_.prototype.applyStroke.call(this,n),this.instructions.push(gc)},c}(Au),Kx=Dw;var Ow=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Fw=function(_){Ow(c,_);function c(n,u,r,s){return _.call(this,n,u,r,s)||this}return c.prototype.drawFlatCoordinatess_=function(n,u,r,s){var P=this.state,z=P.fillStyle!==void 0,F=P.strokeStyle!==void 0,N=r.length;this.instructions.push(gc),this.hitDetectionInstructions.push(gc);for(var V=0;V<N;++V){var me=r[V],be=this.coordinates.length,Se=this.appendFlatLineCoordinates(n,u,me,s,!0,!F),Ve=[qr.MOVE_TO_LINE_TO,be,Se];this.instructions.push(Ve),this.hitDetectionInstructions.push(Ve),F&&(this.instructions.push(o_),this.hitDetectionInstructions.push(o_)),u=me}return z&&(this.instructions.push(dd),this.hitDetectionInstructions.push(dd)),F&&(this.instructions.push(Cu),this.hitDetectionInstructions.push(Cu)),u},c.prototype.drawCircle=function(n,u){var r=this.state,s=r.fillStyle,P=r.strokeStyle;if(!(s===void 0&&P===void 0)){this.setFillStrokeStyles_(),this.beginGeometry(n,u),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([qr.SET_FILL_STYLE,Ss]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([qr.SET_STROKE_STYLE,r.strokeStyle,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,r.lineDash,r.lineDashOffset]);var z=n.getFlatCoordinates(),F=n.getStride(),N=this.coordinates.length;this.appendFlatLineCoordinates(z,0,z.length,F,!1,!1);var V=[qr.CIRCLE,N];this.instructions.push(gc,V),this.hitDetectionInstructions.push(gc,V),r.fillStyle!==void 0&&(this.instructions.push(dd),this.hitDetectionInstructions.push(dd)),r.strokeStyle!==void 0&&(this.instructions.push(Cu),this.hitDetectionInstructions.push(Cu)),this.endGeometry(u)}},c.prototype.drawPolygon=function(n,u){var r=this.state,s=r.fillStyle,P=r.strokeStyle;if(!(s===void 0&&P===void 0)){this.setFillStrokeStyles_(),this.beginGeometry(n,u),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([qr.SET_FILL_STYLE,Ss]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([qr.SET_STROKE_STYLE,r.strokeStyle,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,r.lineDash,r.lineDashOffset]);var z=n.getEnds(),F=n.getOrientedFlatCoordinates(),N=n.getStride();this.drawFlatCoordinatess_(F,0,z,N),this.endGeometry(u)}},c.prototype.drawMultiPolygon=function(n,u){var r=this.state,s=r.fillStyle,P=r.strokeStyle;if(!(s===void 0&&P===void 0)){this.setFillStrokeStyles_(),this.beginGeometry(n,u),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([qr.SET_FILL_STYLE,Ss]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([qr.SET_STROKE_STYLE,r.strokeStyle,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,r.lineDash,r.lineDashOffset]);for(var z=n.getEndss(),F=n.getOrientedFlatCoordinates(),N=n.getStride(),V=0,me=0,be=z.length;me<be;++me)V=this.drawFlatCoordinatess_(F,V,z[me],N);this.endGeometry(u)}},c.prototype.finish=function(){this.reverseHitDetectionInstructions(),this.state=null;var n=this.tolerance;if(n!==0)for(var u=this.coordinates,r=0,s=u.length;r<s;++r)u[r]=hh(u[r],n);return _.prototype.finish.call(this)},c.prototype.setFillStrokeStyles_=function(){var n=this.state,u=n.fillStyle;u!==void 0&&this.updateFillStyle(n,this.createFill),n.strokeStyle!==void 0&&this.updateStrokeStyle(n,this.applyStroke)},c}(Au),a_=Fw;function Yx(_,c,n,u,r){var s=n,P=n,z=0,F=0,N=n,V,me,be,Se,Ve,Ke,Ie,Ge,et,rt;for(me=n;me<u;me+=r){var _t=c[me],yt=c[me+1];Ve!==void 0&&(et=_t-Ve,rt=yt-Ke,Se=Math.sqrt(et*et+rt*rt),Ie!==void 0&&(F+=be,V=Math.acos((Ie*et+Ge*rt)/(be*Se)),V>_&&(F>z&&(z=F,s=N,P=me),F=0,N=me-r)),be=Se,Ie=et,Ge=rt),Ve=_t,Ke=yt}return F+=Se,F>z?[N,me]:[s,P]}var Bw=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),md={left:0,end:0,center:.5,right:1,start:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},Uw=function(_){Bw(c,_);function c(n,u,r,s){var P=_.call(this,n,u,r,s)||this;return P.labels_=null,P.text_="",P.textOffsetX_=0,P.textOffsetY_=0,P.textRotateWithView_=void 0,P.textRotation_=0,P.textFillState_=null,P.fillStates={},P.textStrokeState_=null,P.strokeStates={},P.textState_={},P.textStates={},P.textKey_="",P.fillKey_="",P.strokeKey_="",P.declutterImageWithText_=void 0,P}return c.prototype.finish=function(){var n=_.prototype.finish.call(this);return n.textStates=this.textStates,n.fillStates=this.fillStates,n.strokeStates=this.strokeStates,n},c.prototype.drawText=function(n,u){var r=this.textFillState_,s=this.textStrokeState_,P=this.textState_;if(!(this.text_===""||!P||!r&&!s)){var z=this.coordinates,F=z.length,N=n.getType(),V=null,me=n.getStride();if(P.placement===Zx.LINE&&(N==Pt.LINE_STRING||N==Pt.MULTI_LINE_STRING||N==Pt.POLYGON||N==Pt.MULTI_POLYGON)){if(!ko(this.getBufferedMaxExtent(),n.getExtent()))return;var be=void 0;if(V=n.getFlatCoordinates(),N==Pt.LINE_STRING)be=[V.length];else if(N==Pt.MULTI_LINE_STRING)be=n.getEnds();else if(N==Pt.POLYGON)be=n.getEnds().slice(0,1);else if(N==Pt.MULTI_POLYGON){var Se=n.getEndss();be=[];for(var Ve=0,Ke=Se.length;Ve<Ke;++Ve)be.push(Se[Ve][0])}this.beginGeometry(n,u);for(var Ie=P.textAlign,Ge=0,et=void 0,rt=0,_t=be.length;rt<_t;++rt){if(Ie==null){var yt=Yx(P.maxAngle,V,Ge,be[rt],me);Ge=yt[0],et=yt[1]}else et=be[rt];for(var Ve=Ge;Ve<et;Ve+=me)z.push(V[Ve],V[Ve+1]);var ct=z.length;Ge=be[rt],this.drawChars_(F,ct),F=ct}this.endGeometry(u)}else{var Tt=P.overflow?null:[];switch(N){case Pt.POINT:case Pt.MULTI_POINT:V=n.getFlatCoordinates();break;case Pt.LINE_STRING:V=n.getFlatMidpoint();break;case Pt.CIRCLE:V=n.getCenter();break;case Pt.MULTI_LINE_STRING:V=n.getFlatMidpoints(),me=2;break;case Pt.POLYGON:V=n.getFlatInteriorPoint(),P.overflow||Tt.push(V[2]/this.resolution),me=3;break;case Pt.MULTI_POLYGON:var St=n.getFlatInteriorPoints();V=[];for(var Ve=0,Ke=St.length;Ve<Ke;Ve+=3)P.overflow||Tt.push(St[Ve+2]/this.resolution),V.push(St[Ve],St[Ve+1]);if(V.length===0)return;me=2;break;default:}var ct=this.appendFlatPointCoordinates(V,me);if(ct===F)return;if(Tt&&(ct-F)/2!==V.length/me){var Lt=F/2;Tt=Tt.filter(function(Mr,Ir){var xr=z[(Lt+Ir)*2]===V[Ir*me]&&z[(Lt+Ir)*2+1]===V[Ir*me+1];return xr||--Lt,xr})}this.saveTextStates_(),(P.backgroundFill||P.backgroundStroke)&&(this.setFillStrokeStyle(P.backgroundFill,P.backgroundStroke),P.backgroundFill&&(this.updateFillStyle(this.state,this.createFill),this.hitDetectionInstructions.push(this.createFill(this.state))),P.backgroundStroke&&(this.updateStrokeStyle(this.state,this.applyStroke),this.hitDetectionInstructions.push(this.createStroke(this.state)))),this.beginGeometry(n,u);var ur=P.padding;if(ur!=dc&&(P.scale[0]<0||P.scale[1]<0)){var Vt=P.padding[0],Qt=P.padding[1],or=P.padding[2],Mt=P.padding[3];P.scale[0]<0&&(Qt=-Qt,Mt=-Mt),P.scale[1]<0&&(Vt=-Vt,or=-or),ur=[Vt,Qt,or,Mt]}var Br=this.pixelRatio;this.instructions.push([qr.DRAW_IMAGE,F,ct,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterImageWithText_,ur==dc?dc:ur.map(function(Mr){return Mr*Br}),!!P.backgroundFill,!!P.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,Tt]);var Tr=1/Br;this.hitDetectionInstructions.push([qr.DRAW_IMAGE,F,ct,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[Tr,Tr],NaN,this.declutterImageWithText_,ur,!!P.backgroundFill,!!P.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,Tt]),this.endGeometry(u)}}},c.prototype.saveTextStates_=function(){var n=this.textStrokeState_,u=this.textState_,r=this.textFillState_,s=this.strokeKey_;n&&(s in this.strokeStates||(this.strokeStates[s]={strokeStyle:n.strokeStyle,lineCap:n.lineCap,lineDashOffset:n.lineDashOffset,lineWidth:n.lineWidth,lineJoin:n.lineJoin,miterLimit:n.miterLimit,lineDash:n.lineDash}));var P=this.textKey_;P in this.textStates||(this.textStates[P]={font:u.font,textAlign:u.textAlign||mh,textBaseline:u.textBaseline||ep,scale:u.scale});var z=this.fillKey_;r&&(z in this.fillStates||(this.fillStates[z]={fillStyle:r.fillStyle}))},c.prototype.drawChars_=function(n,u){var r=this.textStrokeState_,s=this.textState_,P=this.strokeKey_,z=this.textKey_,F=this.fillKey_;this.saveTextStates_();var N=this.pixelRatio,V=md[s.textBaseline],me=this.textOffsetY_*N,be=this.text_,Se=r?r.lineWidth*Math.abs(s.scale[0])/2:0;this.instructions.push([qr.DRAW_CHARS,n,u,V,s.overflow,F,s.maxAngle,N,me,P,Se*N,be,z,1]),this.hitDetectionInstructions.push([qr.DRAW_CHARS,n,u,V,s.overflow,F,s.maxAngle,1,me,P,Se,be,z,1/N])},c.prototype.setTextStyle=function(n,u){var r,s,P;if(!n)this.text_="";else{var z=n.getFill();z?(s=this.textFillState_,s||(s={},this.textFillState_=s),s.fillStyle=Ts(z.getColor()||Ss)):(s=null,this.textFillState_=s);var F=n.getStroke();if(!F)P=null,this.textStrokeState_=P;else{P=this.textStrokeState_,P||(P={},this.textStrokeState_=P);var N=F.getLineDash(),V=F.getLineDashOffset(),me=F.getWidth(),be=F.getMiterLimit();P.lineCap=F.getLineCap()||Qh,P.lineDash=N?N.slice():cc,P.lineDashOffset=V===void 0?hc:V,P.lineJoin=F.getLineJoin()||Iu,P.lineWidth=me===void 0?mc:me,P.miterLimit=be===void 0?pc:be,P.strokeStyle=Ts(F.getColor()||fc)}r=this.textState_;var Se=n.getFont()||tg;Ox(Se);var Ve=n.getScaleArray();r.overflow=n.getOverflow(),r.font=Se,r.maxAngle=n.getMaxAngle(),r.placement=n.getPlacement(),r.textAlign=n.getTextAlign(),r.textBaseline=n.getTextBaseline()||ep,r.backgroundFill=n.getBackgroundFill(),r.backgroundStroke=n.getBackgroundStroke(),r.padding=n.getPadding()||dc,r.scale=Ve===void 0?[1,1]:Ve;var Ke=n.getOffsetX(),Ie=n.getOffsetY(),Ge=n.getRotateWithView(),et=n.getRotation();this.text_=n.getText()||"",this.textOffsetX_=Ke===void 0?0:Ke,this.textOffsetY_=Ie===void 0?0:Ie,this.textRotateWithView_=Ge===void 0?!1:Ge,this.textRotation_=et===void 0?0:et,this.strokeKey_=P?(typeof P.strokeStyle=="string"?P.strokeStyle:Ai(P.strokeStyle))+P.lineCap+P.lineDashOffset+"|"+P.lineWidth+P.lineJoin+P.miterLimit+"["+P.lineDash.join()+"]":"",this.textKey_=r.font+r.scale+(r.textAlign||"?")+(r.textBaseline||"?"),this.fillKey_=s?typeof s.fillStyle=="string"?s.fillStyle:"|"+Ai(s.fillStyle):""}this.declutterImageWithText_=u},c}(Au),Jx=Uw;var Nw={Circle:a_,Default:Au,Image:Hx,LineString:Kx,Polygon:a_,Text:Jx},Vw=function(){function _(c,n,u,r){this.tolerance_=c,this.maxExtent_=n,this.pixelRatio_=r,this.resolution_=u,this.buildersByZIndex_={}}return _.prototype.finish=function(){var c={};for(var n in this.buildersByZIndex_){c[n]=c[n]||{};var u=this.buildersByZIndex_[n];for(var r in u){var s=u[r].finish();c[n][r]=s}}return c},_.prototype.getBuilder=function(c,n){var u=c!==void 0?c.toString():"0",r=this.buildersByZIndex_[u];r===void 0&&(r={},this.buildersByZIndex_[u]=r);var s=r[n];if(s===void 0){var P=Nw[n];s=new P(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),r[n]=s}return s},_}(),s_=Vw;var Gw=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),jw=function(_){Gw(c,_);function c(n){var u=_.call(this)||this;return u.ready=!0,u.boundHandleImageChange_=u.handleImageChange_.bind(u),u.layer_=n,u.declutterExecutorGroup=null,u}return c.prototype.getFeatures=function(n){return jr()},c.prototype.getData=function(n){return null},c.prototype.prepareFrame=function(n){return jr()},c.prototype.renderFrame=function(n,u){return jr()},c.prototype.loadedTileCallback=function(n,u,r){n[u]||(n[u]={}),n[u][r.tileCoord.toString()]=r},c.prototype.createLoadedTileFinder=function(n,u,r){return function(s,P){var z=this.loadedTileCallback.bind(this,r,s);return n.forEachLoadedTile(u,s,P,z)}.bind(this)},c.prototype.forEachFeatureAtCoordinate=function(n,u,r,s,P){},c.prototype.getDataAtPixel=function(n,u,r){return null},c.prototype.getLayer=function(){return this.layer_},c.prototype.handleFontsChanged=function(){},c.prototype.handleImageChange_=function(n){var u=n.target;u.getState()===qi.LOADED&&this.renderIfReadyAndVisible()},c.prototype.loadImage=function(n){var u=n.getState();return u!=qi.LOADED&&u!=qi.ERROR&&n.addEventListener(Ji.CHANGE,this.boundHandleImageChange_),u==qi.IDLE&&(n.load(),u=n.getState()),u==qi.LOADED},c.prototype.renderIfReadyAndVisible=function(){var n=this.getLayer();n.getVisible()&&n.getSourceState()==Su.READY&&n.changed()},c.prototype.disposeInternal=function(){delete this.layer_,_.prototype.disposeInternal.call(this)},c}(Am),Qx=jw;var qw=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Zw=function(_){qw(c,_);function c(n,u,r,s){var P=_.call(this,n)||this;return P.inversePixelTransform=u,P.frameState=r,P.context=s,P}return c}(La),e0=Zw;var Xw=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),gd=null;function Ww(){var _=document.createElement("canvas");_.width=1,_.height=1,gd=_.getContext("2d")}var $w=function(_){Xw(c,_);function c(n){var u=_.call(this,n)||this;return u.container=null,u.renderedResolution,u.tempTransform=za(),u.pixelTransform=za(),u.inversePixelTransform=za(),u.context=null,u.containerReused=!1,u.pixelContext_=null,u.frameState=null,u}return c.prototype.getImageData=function(n,u,r){gd||Ww(),gd.clearRect(0,0,1,1);var s;try{gd.drawImage(n,u,r,1,1,0,0,1,1),s=gd.getImageData(0,0,1,1).data}catch{return null}return s},c.prototype.getBackground=function(n){var u=this.getLayer(),r=u.getBackground();return typeof r=="function"&&(r=r(n.viewState.resolution)),r||void 0},c.prototype.useContainer=function(n,u,r,s){var P=this.getLayer().getClassName(),z,F;if(n&&n.className===P&&n.style.opacity===""&&r===1&&(!s||n.style.backgroundColor&&_s(Jh(n.style.backgroundColor),Jh(s)))){var N=n.firstElementChild;N instanceof HTMLCanvasElement&&(F=N.getContext("2d"))}if(F&&F.canvas.style.transform===u?(this.container=n,this.context=F,this.containerReused=!0):this.containerReused&&(this.container=null,this.context=null,this.containerReused=!1),!this.container){z=document.createElement("div"),z.className=P;var V=z.style;V.position="absolute",V.width="100%",V.height="100%",s&&(V.backgroundColor=s),F=Ja();var N=F.canvas;z.appendChild(N),V=N.style,V.position="absolute",V.left="0",V.transformOrigin="top left",this.container=z,this.context=F}},c.prototype.clipUnrotated=function(n,u,r){var s=vy(r),P=xy(r),z=_y(r),F=yy(r);xo(u.coordinateToPixelTransform,s),xo(u.coordinateToPixelTransform,P),xo(u.coordinateToPixelTransform,z),xo(u.coordinateToPixelTransform,F);var N=this.inversePixelTransform;xo(N,s),xo(N,P),xo(N,z),xo(N,F),n.save(),n.beginPath(),n.moveTo(Math.round(s[0]),Math.round(s[1])),n.lineTo(Math.round(P[0]),Math.round(P[1])),n.lineTo(Math.round(z[0]),Math.round(z[1])),n.lineTo(Math.round(F[0]),Math.round(F[1])),n.clip()},c.prototype.dispatchRenderEvent_=function(n,u,r){var s=this.getLayer();if(s.hasListener(n)){var P=new e0(n,this.inversePixelTransform,r,u);s.dispatchEvent(P)}},c.prototype.preRender=function(n,u){this.frameState=u,this.dispatchRenderEvent_(rd.PRERENDER,n,u)},c.prototype.postRender=function(n,u){this.dispatchRenderEvent_(rd.POSTRENDER,n,u)},c.prototype.getRenderTransform=function(n,u,r,s,P,z,F){var N=P/2,V=z/2,me=s/u,be=-me,Se=-n[0]+F,Ve=-n[1];return vs(this.tempTransform,N,V,me,be,-r,Se,Ve)},c.prototype.getDataAtPixel=function(n,u,r){var s=xo(this.inversePixelTransform,n.slice()),P=this.context,z=this.getLayer(),F=z.getExtent();if(F){var N=xo(u.pixelToCoordinateTransform,n.slice());if(!Hp(F,N))return null}var V=Math.round(s[0]),me=Math.round(s[1]),be=this.pixelContext_;if(!be){var Se=document.createElement("canvas");Se.width=1,Se.height=1,be=Se.getContext("2d"),this.pixelContext_=be}be.clearRect(0,0,1,1);var Ve;try{be.drawImage(P.canvas,V,me,1,1,0,0,1,1),Ve=be.getImageData(0,0,1,1).data}catch(Ke){return Ke.name==="SecurityError"?(this.pixelContext_=null,new Uint8Array):Ve}return Ve[3]===0?null:Ve},c.prototype.disposeInternal=function(){delete this.frameState,_.prototype.disposeInternal.call(this)},c}(Qx),t0=$w;var Dn={CIRCLE:"Circle",DEFAULT:"Default",IMAGE:"Image",LINE_STRING:"LineString",POLYGON:"Polygon",TEXT:"Text"};function r0(_,c,n,u,r,s,P,z,F,N,V,me){var be=_[c],Se=_[c+1],Ve=0,Ke=0,Ie=0,Ge=0;function et(){Ve=be,Ke=Se,c+=u,be=_[c],Se=_[c+1],Ge+=Ie,Ie=Math.sqrt((be-Ve)*(be-Ve)+(Se-Ke)*(Se-Ke))}do et();while(c<n-u&&Ge+Ie<s);for(var rt=Ie===0?0:(s-Ge)/Ie,_t=gl(Ve,be,rt),yt=gl(Ke,Se,rt),ct=c-u,Tt=Ge,St=s+z*F(N,r,V);c<n-u&&Ge+Ie<St;)et();rt=Ie===0?0:(St-Ge)/Ie;var Lt=gl(Ve,be,rt),ur=gl(Ke,Se,rt),Vt;if(me){var Qt=[_t,yt,Lt,ur];Zm(Qt,0,4,2,me,Qt,Qt),Vt=Qt[0]>Qt[2]}else Vt=_t>Lt;var or=Math.PI,Mt=[],Br=ct+u===c;c=ct,Ie=0,Ge=Tt,be=_[c],Se=_[c+1];var Tr;if(Br){et(),Tr=Math.atan2(Se-Ke,be-Ve),Vt&&(Tr+=Tr>0?-or:or);var br=(Lt+_t)/2,Mr=(ur+yt)/2;return Mt[0]=[br,Mr,(St-s)/2,Tr,r],Mt}for(var Ir=0,xr=r.length;Ir<xr;){et();var ai=Math.atan2(Se-Ke,be-Ve);if(Vt&&(ai+=ai>0?-or:or),Tr!==void 0){var jt=ai-Tr;if(jt+=jt>or?-2*or:jt<-or?2*or:0,Math.abs(jt)>P)return null}Tr=ai;for(var Yr=Ir,vi=0;Ir<xr;++Ir){var di=Vt?xr-Ir-1:Ir,en=z*F(N,r[di],V);if(c+u<n&&Ge+Ie<s+vi+en/2)break;vi+=en}if(Ir!==Yr){var Ur=Vt?r.substring(xr-Yr,xr-Ir):r.substring(Yr,Ir);rt=Ie===0?0:(s+vi/2-Ge)/Ie;var br=gl(Ve,be,rt),Mr=gl(Ke,Se,rt);Mt.push([br,Mr,vi/2,ai,Ur]),s+=vi}}return Mt}var uf=Ya(),gh=[],yc=[],_c=[],yh=[];function i0(_){return _[3].declutterBox}var Hw=new RegExp("["+String.fromCharCode(1425)+"-"+String.fromCharCode(2303)+String.fromCharCode(64285)+"-"+String.fromCharCode(65023)+String.fromCharCode(65136)+"-"+String.fromCharCode(65276)+String.fromCharCode(67584)+"-"+String.fromCharCode(69631)+String.fromCharCode(124928)+"-"+String.fromCharCode(126975)+"]");function n0(_,c){return(c==="start"||c==="end")&&!Hw.test(_)&&(c=c==="start"?"left":"right"),md[c]}function Kw(_,c,n){return n>0&&_.push(`
1080
1080
  `,""),_.push(c,""),_}var Yw=function(){function _(c,n,u,r){this.overlaps=u,this.pixelRatio=n,this.resolution=c,this.alignFill_,this.instructions=r.instructions,this.coordinates=r.coordinates,this.coordinateCache_={},this.renderedTransform_=za(),this.hitDetectionInstructions=r.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=r.fillStates||{},this.strokeStates=r.strokeStates||{},this.textStates=r.textStates||{},this.widths_={},this.labels_={}}return _.prototype.createLabel=function(c,n,u,r){var s=c+n+u+r;if(this.labels_[s])return this.labels_[s];var P=r?this.strokeStates[r]:null,z=u?this.fillStates[u]:null,F=this.textStates[n],N=this.pixelRatio,V=[F.scale[0]*N,F.scale[1]*N],me=Array.isArray(c),be=n0(me?c[0]:c,F.textAlign||mh),Se=r&&P.lineWidth?P.lineWidth:0,Ve=me?c:c.split(`
1081
1081
  `).reduce(Kw,[]),Ke=Bx(F,Ve),Ie=Ke.width,Ge=Ke.height,et=Ke.widths,rt=Ke.heights,_t=Ke.lineWidths,yt=Ie+Se,ct=[],Tt=(yt+2)*V[0],St=(Ge+Se)*V[1],Lt={width:Tt<0?Math.floor(Tt):Math.ceil(Tt),height:St<0?Math.floor(St):Math.ceil(St),contextInstructions:ct};if((V[0]!=1||V[1]!=1)&&ct.push("scale",V),r){ct.push("strokeStyle",P.strokeStyle),ct.push("lineWidth",Se),ct.push("lineCap",P.lineCap),ct.push("lineJoin",P.lineJoin),ct.push("miterLimit",P.miterLimit);var ur=ah?OffscreenCanvasRenderingContext2D:CanvasRenderingContext2D;ur.prototype.setLineDash&&(ct.push("setLineDash",[P.lineDash]),ct.push("lineDashOffset",P.lineDashOffset))}u&&ct.push("fillStyle",z.fillStyle),ct.push("textBaseline","middle"),ct.push("textAlign","center");for(var Vt=.5-be,Qt=be*yt+Vt*Se,or=[],Mt=[],Br=0,Tr=0,br=0,Mr=0,Ir,xr=0,ai=Ve.length;xr<ai;xr+=2){var jt=Ve[xr];if(jt===`
1082
- `){Tr+=Br,Br=0,Qt=be*yt+Vt*Se,++Mr;continue}var Yr=Ve[xr+1]||F.font;Yr!==Ir&&(r&&or.push("font",Yr),u&&Mt.push("font",Yr),Ir=Yr),Br=Math.max(Br,rt[br]);var vi=[jt,Qt+Vt*et[br]+be*(et[br]-_t[Mr]),.5*(Se+Br)+Tr];Qt+=et[br],r&&or.push("strokeText",vi),u&&Mt.push("fillText",vi),++br}return Array.prototype.push.apply(ct,or),Array.prototype.push.apply(ct,Mt),this.labels_[s]=Lt,Lt},_.prototype.replayTextBackground_=function(c,n,u,r,s,P,z){c.beginPath(),c.moveTo.apply(c,n),c.lineTo.apply(c,u),c.lineTo.apply(c,r),c.lineTo.apply(c,s),c.lineTo.apply(c,n),P&&(this.alignFill_=P[2],this.fill_(c)),z&&(this.setStrokeStyle_(c,z),c.stroke())},_.prototype.calculateImageOrLabelDimensions_=function(c,n,u,r,s,P,z,F,N,V,me,be,Se,Ve,Ke,Ie){z*=be[0],F*=be[1];var Ge=u-z,et=r-F,rt=s+N>c?c-N:s,_t=P+V>n?n-V:P,yt=Ve[3]+rt*be[0]+Ve[1],ct=Ve[0]+_t*be[1]+Ve[2],Tt=Ge-Ve[3],St=et-Ve[0];(Ke||me!==0)&&(gh[0]=Tt,yh[0]=Tt,gh[1]=St,yc[1]=St,yc[0]=Tt+yt,_c[0]=yc[0],_c[1]=St+ct,yh[1]=_c[1]);var Lt;return me!==0?(Lt=vs(za(),u,r,1,1,me,-u,-r),xo(Lt,gh),xo(Lt,yc),xo(Lt,_c),xo(Lt,yh),sh(Math.min(gh[0],yc[0],_c[0],yh[0]),Math.min(gh[1],yc[1],_c[1],yh[1]),Math.max(gh[0],yc[0],_c[0],yh[0]),Math.max(gh[1],yc[1],_c[1],yh[1]),uf)):sh(Math.min(Tt,Tt+yt),Math.min(St,St+ct),Math.max(Tt,Tt+yt),Math.max(St,St+ct),uf),Se&&(Ge=Math.round(Ge),et=Math.round(et)),{drawImageX:Ge,drawImageY:et,drawImageW:rt,drawImageH:_t,originX:N,originY:V,declutterBox:{minX:uf[0],minY:uf[1],maxX:uf[2],maxY:uf[3],value:Ie},canvasTransform:Lt,scale:be}},_.prototype.replayImageOrLabel_=function(c,n,u,r,s,P,z){var F=!!(P||z),N=r.declutterBox,V=c.canvas,me=z?z[2]*r.scale[0]/2:0,be=N.minX-me<=V.width/n&&N.maxX+me>=0&&N.minY-me<=V.height/n&&N.maxY+me>=0;return be&&(F&&this.replayTextBackground_(c,gh,yc,_c,yh,P,z),Ux(c,r.canvasTransform,s,u,r.originX,r.originY,r.drawImageW,r.drawImageH,r.drawImageX,r.drawImageY,r.scale)),!0},_.prototype.fill_=function(c){if(this.alignFill_){var n=xo(this.renderedTransform_,[0,0]),u=512*this.pixelRatio;c.save(),c.translate(n[0]%u,n[1]%u),c.rotate(this.viewRotation_)}c.fill(),this.alignFill_&&c.restore()},_.prototype.setStrokeStyle_=function(c,n){c.strokeStyle=n[1],c.lineWidth=n[2],c.lineCap=n[3],c.lineJoin=n[4],c.miterLimit=n[5],c.setLineDash&&(c.lineDashOffset=n[7],c.setLineDash(n[6]))},_.prototype.drawLabelWithPointPlacement_=function(c,n,u,r){var s=this.textStates[n],P=this.createLabel(c,n,r,u),z=this.strokeStates[u],F=this.pixelRatio,N=n0(Array.isArray(c)?c[0]:c,s.textAlign||mh),V=md[s.textBaseline||ep],me=z&&z.lineWidth?z.lineWidth:0,be=P.width/F-2*s.scale[0],Se=N*be+2*(.5-N)*me,Ve=V*P.height/F+2*(.5-V)*me;return{label:P,anchorX:Se,anchorY:Ve}},_.prototype.execute_=function(c,n,u,r,s,P,z,F){var N;this.pixelCoordinates_&&_s(u,this.renderedTransform_)?N=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),N=_l(this.coordinates,0,this.coordinates.length,2,u,this.pixelCoordinates_),Pv(this.renderedTransform_,u));for(var V=0,me=r.length,be=0,Se,Ve,Ke,Ie,Ge,et,rt,_t,yt,ct,Tt,St,Lt=0,ur=0,Vt=null,Qt=null,or=this.coordinateCache_,Mt=this.viewRotation_,Br=Math.round(Math.atan2(-u[1],u[0])*1e12)/1e12,Tr={context:c,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:Mt},br=this.instructions!=r||this.overlaps?0:200,Mr,Ir,xr,ai;V<me;){var jt=r[V],Yr=jt[0];switch(Yr){case qr.BEGIN_GEOMETRY:Mr=jt[1],ai=jt[3],Mr.getGeometry()?z!==void 0&&!ko(z,ai.getExtent())?V=jt[2]+1:++V:V=jt[2];break;case qr.BEGIN_PATH:Lt>br&&(this.fill_(c),Lt=0),ur>br&&(c.stroke(),ur=0),!Lt&&!ur&&(c.beginPath(),Ie=NaN,Ge=NaN),++V;break;case qr.CIRCLE:be=jt[1];var vi=N[be],di=N[be+1],en=N[be+2],Ur=N[be+3],Li=en-vi,Pn=Ur-di,Ni=Math.sqrt(Li*Li+Pn*Pn);c.moveTo(vi+Ni,di),c.arc(vi,di,Ni,0,2*Math.PI,!0),++V;break;case qr.CLOSE_PATH:c.closePath(),++V;break;case qr.CUSTOM:be=jt[1],Se=jt[2];var Cr=jt[3],Zn=jt[4],Zi=jt.length==6?jt[5]:void 0;Tr.geometry=Cr,Tr.feature=Mr,V in or||(or[V]=[]);var sn=or[V];Zi?Zi(N,be,Se,2,sn):(sn[0]=N[be],sn[1]=N[be+1],sn.length=2),Zn(sn,Tr),++V;break;case qr.DRAW_IMAGE:be=jt[1],Se=jt[2],_t=jt[3],Ve=jt[4],Ke=jt[5];var jo=jt[6],Xn=jt[7],Jr=jt[8],ln=jt[9],Wn=jt[10],$n=jt[11],On=jt[12],Xi=jt[13],mn=jt[14];if(!_t&&jt.length>=19){yt=jt[18],ct=jt[19],Tt=jt[20],St=jt[21];var En=this.drawLabelWithPointPlacement_(yt,ct,Tt,St);_t=En.label,jt[3]=_t;var bo=jt[22];Ve=(En.anchorX-bo)*this.pixelRatio,jt[4]=Ve;var wt=jt[23];Ke=(En.anchorY-wt)*this.pixelRatio,jt[5]=Ke,jo=_t.height,jt[6]=jo,Xi=_t.width,jt[13]=Xi}var Wt=void 0;jt.length>24&&(Wt=jt[24]);var co=void 0,gn=void 0,Xr=void 0;jt.length>16?(co=jt[15],gn=jt[16],Xr=jt[17]):(co=dc,gn=!1,Xr=!1),Wn&&Br?$n+=Mt:!Wn&&!Br&&($n-=Mt);for(var Mn=0;be<Se;be+=2)if(!(Wt&&Wt[Mn++]<Xi/this.pixelRatio)){var Oi=this.calculateImageOrLabelDimensions_(_t.width,_t.height,N[be],N[be+1],Xi,jo,Ve,Ke,Jr,ln,$n,On,s,co,gn||Xr,Mr),fn=[c,n,_t,Oi,Xn,gn?Vt:null,Xr?Qt:null],Hn=void 0,Zt=void 0;if(F&&mn){var Nr=Se-be;if(!mn[Nr]){mn[Nr]=fn;continue}if(Hn=mn[Nr],delete mn[Nr],Zt=i0(Hn),F.collides(Zt))continue}F&&F.collides(Oi.declutterBox)||(Hn&&(F&&F.insert(Zt),this.replayImageOrLabel_.apply(this,Hn)),F&&F.insert(Oi.declutterBox),this.replayImageOrLabel_.apply(this,fn))}++V;break;case qr.DRAW_CHARS:var Dr=jt[1],Vi=jt[2],Tn=jt[3],Ar=jt[4];St=jt[5];var to=jt[6],Wi=jt[7],bi=jt[8];Tt=jt[9];var te=jt[10];yt=jt[11],ct=jt[12];var he=[jt[13],jt[13]],de=this.textStates[ct],Te=de.font,Re=[de.scale[0]*Wi,de.scale[1]*Wi],We=void 0;Te in this.widths_?We=this.widths_[Te]:(We={},this.widths_[Te]=We);var Je=Ym(N,Dr,Vi,2),we=Math.abs(Re[0])*e_(Te,yt,We);if(Ar||we<=Je){var Ue=this.textStates[ct].textAlign,ie=(Je-we)*md[Ue],X=r0(N,Dr,Vi,2,yt,ie,to,Math.abs(Re[0]),e_,Te,We,Br?0:this.viewRotation_);e:if(X){var J=[],re=void 0,le=void 0,Ae=void 0,ke=void 0,ge=void 0;if(Tt)for(re=0,le=X.length;re<le;++re){ge=X[re],Ae=ge[4],ke=this.createLabel(Ae,ct,"",Tt),Ve=ge[2]+(Re[0]<0?-te:te),Ke=Tn*ke.height+(.5-Tn)*2*te*Re[1]/Re[0]-bi;var Oi=this.calculateImageOrLabelDimensions_(ke.width,ke.height,ge[0],ge[1],ke.width,ke.height,Ve,Ke,0,0,ge[3],he,!1,dc,!1,Mr);if(F&&F.collides(Oi.declutterBox))break e;J.push([c,n,ke,Oi,1,null,null])}if(St)for(re=0,le=X.length;re<le;++re){ge=X[re],Ae=ge[4],ke=this.createLabel(Ae,ct,St,""),Ve=ge[2],Ke=Tn*ke.height-bi;var Oi=this.calculateImageOrLabelDimensions_(ke.width,ke.height,ge[0],ge[1],ke.width,ke.height,Ve,Ke,0,0,ge[3],he,!1,dc,!1,Mr);if(F&&F.collides(Oi.declutterBox))break e;J.push([c,n,ke,Oi,1,null,null])}F&&F.load(J.map(i0));for(var Ce=0,Le=J.length;Ce<Le;++Ce)this.replayImageOrLabel_.apply(this,J[Ce])}}++V;break;case qr.END_GEOMETRY:if(P!==void 0){Mr=jt[1];var He=P(Mr,ai);if(He)return He}++V;break;case qr.FILL:br?Lt++:this.fill_(c),++V;break;case qr.MOVE_TO_LINE_TO:for(be=jt[1],Se=jt[2],Ir=N[be],xr=N[be+1],et=Ir+.5|0,rt=xr+.5|0,(et!==Ie||rt!==Ge)&&(c.moveTo(Ir,xr),Ie=et,Ge=rt),be+=2;be<Se;be+=2)Ir=N[be],xr=N[be+1],et=Ir+.5|0,rt=xr+.5|0,(be==Se-2||et!==Ie||rt!==Ge)&&(c.lineTo(Ir,xr),Ie=et,Ge=rt);++V;break;case qr.SET_FILL_STYLE:Vt=jt,this.alignFill_=jt[2],Lt&&(this.fill_(c),Lt=0,ur&&(c.stroke(),ur=0)),c.fillStyle=jt[1],++V;break;case qr.SET_STROKE_STYLE:Qt=jt,ur&&(c.stroke(),ur=0),this.setStrokeStyle_(c,jt),++V;break;case qr.STROKE:br?ur++:c.stroke(),++V;break;default:++V;break}}Lt&&this.fill_(c),ur&&c.stroke()},_.prototype.execute=function(c,n,u,r,s,P){this.viewRotation_=r,this.execute_(c,n,u,this.instructions,s,void 0,void 0,P)},_.prototype.executeHitDetection=function(c,n,u,r,s){return this.viewRotation_=u,this.execute_(c,1,n,this.hitDetectionInstructions,!0,r,s)},_}(),o0=Yw;var l_=[Dn.POLYGON,Dn.CIRCLE,Dn.LINE_STRING,Dn.IMAGE,Dn.TEXT,Dn.DEFAULT],Jw=function(){function _(c,n,u,r,s,P){this.maxExtent_=c,this.overlaps_=r,this.pixelRatio_=u,this.resolution_=n,this.renderBuffer_=P,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=za(),this.createExecutors_(s)}return _.prototype.clip=function(c,n){var u=this.getClipCoords(n);c.beginPath(),c.moveTo(u[0],u[1]),c.lineTo(u[2],u[3]),c.lineTo(u[4],u[5]),c.lineTo(u[6],u[7]),c.clip()},_.prototype.createExecutors_=function(c){for(var n in c){var u=this.executorsByZIndex_[n];u===void 0&&(u={},this.executorsByZIndex_[n]=u);var r=c[n];for(var s in r){var P=r[s];u[s]=new o0(this.resolution_,this.pixelRatio_,this.overlaps_,P)}}},_.prototype.hasExecutors=function(c){for(var n in this.executorsByZIndex_)for(var u=this.executorsByZIndex_[n],r=0,s=c.length;r<s;++r)if(c[r]in u)return!0;return!1},_.prototype.forEachFeatureAtCoordinate=function(c,n,u,r,s,P){r=Math.round(r);var z=r*2+1,F=vs(this.hitDetectionTransform_,r+.5,r+.5,1/n,-1/n,-u,-c[0],-c[1]),N=!this.hitDetectionContext_;N&&(this.hitDetectionContext_=Ja(z,z));var V=this.hitDetectionContext_;V.canvas.width!==z||V.canvas.height!==z?(V.canvas.width=z,V.canvas.height=z):N||V.clearRect(0,0,z,z);var me;this.renderBuffer_!==void 0&&(me=Ya(),my(me,c),yl(me,n*(this.renderBuffer_+r),me));var be=Qw(r),Se;function Ve(ct,Tt){for(var St=V.getImageData(0,0,z,z).data,Lt=0,ur=be.length;Lt<ur;Lt++)if(St[be[Lt]]>0){if(!P||Se!==Dn.IMAGE&&Se!==Dn.TEXT||P.indexOf(ct)!==-1){var Vt=(be[Lt]-3)/4,Qt=r-Vt%z,or=r-(Vt/z|0),Mt=s(ct,Tt,Qt*Qt+or*or);if(Mt)return Mt}V.clearRect(0,0,z,z);break}}var Ke=Object.keys(this.executorsByZIndex_).map(Number);Ke.sort(rh);var Ie,Ge,et,rt,_t;for(Ie=Ke.length-1;Ie>=0;--Ie){var yt=Ke[Ie].toString();for(et=this.executorsByZIndex_[yt],Ge=l_.length-1;Ge>=0;--Ge)if(Se=l_[Ge],rt=et[Se],rt!==void 0&&(_t=rt.executeHitDetection(V,F,u,Ve,me),_t))return _t}},_.prototype.getClipCoords=function(c){var n=this.maxExtent_;if(!n)return null;var u=n[0],r=n[1],s=n[2],P=n[3],z=[u,r,u,P,s,P,s,r];return _l(z,0,8,2,c,z),z},_.prototype.isEmpty=function(){return Vl(this.executorsByZIndex_)},_.prototype.execute=function(c,n,u,r,s,P,z){var F=Object.keys(this.executorsByZIndex_).map(Number);F.sort(rh),this.maxExtent_&&(c.save(),this.clip(c,u));var N=P||l_,V,me,be,Se,Ve,Ke;for(z&&F.reverse(),V=0,me=F.length;V<me;++V){var Ie=F[V].toString();for(Ve=this.executorsByZIndex_[Ie],be=0,Se=N.length;be<Se;++be){var Ge=N[be];Ke=Ve[Ge],Ke!==void 0&&Ke.execute(c,n,u,r,s,z)}}this.maxExtent_&&c.restore()},_}(),u_={};function Qw(_){if(u_[_]!==void 0)return u_[_];for(var c=_*2+1,n=_*_,u=new Array(n+1),r=0;r<=_;++r)for(var s=0;s<=_;++s){var P=r*r+s*s;if(P>n)break;var z=u[P];z||(z=[],u[P]=z),z.push(((_+r)*c+(_+s))*4+3),r>0&&z.push(((_-r)*c+(_+s))*4+3),s>0&&(z.push(((_+r)*c+(_-s))*4+3),r>0&&z.push(((_-r)*c+(_-s))*4+3))}for(var F=[],r=0,N=u.length;r<N;++r)u[r]&&F.push.apply(F,u[r]);return u_[_]=F,F}var c_=Jw;var yd={ANIMATING:0,INTERACTING:1};var e2=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),t2=function(_){e2(c,_);function c(n,u,r,s,P,z,F){var N=_.call(this)||this;return N.context_=n,N.pixelRatio_=u,N.extent_=r,N.transform_=s,N.viewRotation_=P,N.squaredTolerance_=z,N.userTransform_=F,N.contextFillState_=null,N.contextStrokeState_=null,N.contextTextState_=null,N.fillState_=null,N.strokeState_=null,N.image_=null,N.imageAnchorX_=0,N.imageAnchorY_=0,N.imageHeight_=0,N.imageOpacity_=0,N.imageOriginX_=0,N.imageOriginY_=0,N.imageRotateWithView_=!1,N.imageRotation_=0,N.imageScale_=[0,0],N.imageWidth_=0,N.text_="",N.textOffsetX_=0,N.textOffsetY_=0,N.textRotateWithView_=!1,N.textRotation_=0,N.textScale_=[0,0],N.textFillState_=null,N.textStrokeState_=null,N.textState_=null,N.pixelCoordinates_=[],N.tmpLocalTransform_=za(),N}return c.prototype.drawImages_=function(n,u,r,s){if(!!this.image_){var P=_l(n,u,r,s,this.transform_,this.pixelCoordinates_),z=this.context_,F=this.tmpLocalTransform_,N=z.globalAlpha;this.imageOpacity_!=1&&(z.globalAlpha=N*this.imageOpacity_);var V=this.imageRotation_;this.imageRotateWithView_&&(V+=this.viewRotation_);for(var me=0,be=P.length;me<be;me+=2){var Se=P[me]-this.imageAnchorX_,Ve=P[me+1]-this.imageAnchorY_;if(V!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){var Ke=Se+this.imageAnchorX_,Ie=Ve+this.imageAnchorY_;vs(F,Ke,Ie,1,1,V,-Ke,-Ie),z.setTransform.apply(z,F),z.translate(Ke,Ie),z.scale(this.imageScale_[0],this.imageScale_[1]),z.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),z.setTransform(1,0,0,1,0,0)}else z.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,Se,Ve,this.imageWidth_,this.imageHeight_)}this.imageOpacity_!=1&&(z.globalAlpha=N)}},c.prototype.drawText_=function(n,u,r,s){if(!(!this.textState_||this.text_==="")){this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);var P=_l(n,u,r,s,this.transform_,this.pixelCoordinates_),z=this.context_,F=this.textRotation_;for(this.textRotateWithView_&&(F+=this.viewRotation_);u<r;u+=s){var N=P[u]+this.textOffsetX_,V=P[u+1]+this.textOffsetY_;if(F!==0||this.textScale_[0]!=1||this.textScale_[1]!=1){var me=vs(this.tmpLocalTransform_,N,V,1,1,F,-N,-V);z.setTransform.apply(z,me),z.translate(N,V),z.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&z.strokeText(this.text_,0,0),this.textFillState_&&z.fillText(this.text_,0,0),z.setTransform(1,0,0,1,0,0)}else this.textStrokeState_&&z.strokeText(this.text_,N,V),this.textFillState_&&z.fillText(this.text_,N,V)}}},c.prototype.moveToLineTo_=function(n,u,r,s,P){var z=this.context_,F=_l(n,u,r,s,this.transform_,this.pixelCoordinates_);z.moveTo(F[0],F[1]);var N=F.length;P&&(N-=2);for(var V=2;V<N;V+=2)z.lineTo(F[V],F[V+1]);return P&&z.closePath(),r},c.prototype.drawRings_=function(n,u,r,s){for(var P=0,z=r.length;P<z;++P)u=this.moveToLineTo_(n,u,r[P],s,!0);return u},c.prototype.drawCircle=function(n){if(!!ko(this.extent_,n.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);var u=dx(n,this.transform_,this.pixelCoordinates_),r=u[2]-u[0],s=u[3]-u[1],P=Math.sqrt(r*r+s*s),z=this.context_;z.beginPath(),z.arc(u[0],u[1],P,0,2*Math.PI),this.fillState_&&z.fill(),this.strokeState_&&z.stroke()}this.text_!==""&&this.drawText_(n.getCenter(),0,2,2)}},c.prototype.setStyle=function(n){this.setFillStrokeStyle(n.getFill(),n.getStroke()),this.setImageStyle(n.getImage()),this.setTextStyle(n.getText())},c.prototype.setTransform=function(n){this.transform_=n},c.prototype.drawGeometry=function(n){var u=n.getType();switch(u){case Pt.POINT:this.drawPoint(n);break;case Pt.LINE_STRING:this.drawLineString(n);break;case Pt.POLYGON:this.drawPolygon(n);break;case Pt.MULTI_POINT:this.drawMultiPoint(n);break;case Pt.MULTI_LINE_STRING:this.drawMultiLineString(n);break;case Pt.MULTI_POLYGON:this.drawMultiPolygon(n);break;case Pt.GEOMETRY_COLLECTION:this.drawGeometryCollection(n);break;case Pt.CIRCLE:this.drawCircle(n);break;default:}},c.prototype.drawFeature=function(n,u){var r=u.getGeometryFunction()(n);!r||!ko(this.extent_,r.getExtent())||(this.setStyle(u),this.drawGeometry(r))},c.prototype.drawGeometryCollection=function(n){for(var u=n.getGeometriesArray(),r=0,s=u.length;r<s;++r)this.drawGeometry(u[r])},c.prototype.drawPoint=function(n){this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_));var u=n.getFlatCoordinates(),r=n.getStride();this.image_&&this.drawImages_(u,0,u.length,r),this.text_!==""&&this.drawText_(u,0,u.length,r)},c.prototype.drawMultiPoint=function(n){this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_));var u=n.getFlatCoordinates(),r=n.getStride();this.image_&&this.drawImages_(u,0,u.length,r),this.text_!==""&&this.drawText_(u,0,u.length,r)},c.prototype.drawLineString=function(n){if(this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!ko(this.extent_,n.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);var u=this.context_,r=n.getFlatCoordinates();u.beginPath(),this.moveToLineTo_(r,0,r.length,n.getStride(),!1),u.stroke()}if(this.text_!==""){var s=n.getFlatMidpoint();this.drawText_(s,0,2,2)}}},c.prototype.drawMultiLineString=function(n){this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_));var u=n.getExtent();if(!!ko(this.extent_,u)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);var r=this.context_,s=n.getFlatCoordinates(),P=0,z=n.getEnds(),F=n.getStride();r.beginPath();for(var N=0,V=z.length;N<V;++N)P=this.moveToLineTo_(s,P,z[N],F,!1);r.stroke()}if(this.text_!==""){var me=n.getFlatMidpoints();this.drawText_(me,0,me.length,2)}}},c.prototype.drawPolygon=function(n){if(this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!ko(this.extent_,n.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);var u=this.context_;u.beginPath(),this.drawRings_(n.getOrientedFlatCoordinates(),0,n.getEnds(),n.getStride()),this.fillState_&&u.fill(),this.strokeState_&&u.stroke()}if(this.text_!==""){var r=n.getFlatInteriorPoint();this.drawText_(r,0,2,2)}}},c.prototype.drawMultiPolygon=function(n){if(this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!ko(this.extent_,n.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);var u=this.context_,r=n.getOrientedFlatCoordinates(),s=0,P=n.getEndss(),z=n.getStride();u.beginPath();for(var F=0,N=P.length;F<N;++F){var V=P[F];s=this.drawRings_(r,s,V,z)}this.fillState_&&u.fill(),this.strokeState_&&u.stroke()}if(this.text_!==""){var me=n.getFlatInteriorPoints();this.drawText_(me,0,me.length,2)}}},c.prototype.setContextFillState_=function(n){var u=this.context_,r=this.contextFillState_;r?r.fillStyle!=n.fillStyle&&(r.fillStyle=n.fillStyle,u.fillStyle=n.fillStyle):(u.fillStyle=n.fillStyle,this.contextFillState_={fillStyle:n.fillStyle})},c.prototype.setContextStrokeState_=function(n){var u=this.context_,r=this.contextStrokeState_;r?(r.lineCap!=n.lineCap&&(r.lineCap=n.lineCap,u.lineCap=n.lineCap),u.setLineDash&&(_s(r.lineDash,n.lineDash)||u.setLineDash(r.lineDash=n.lineDash),r.lineDashOffset!=n.lineDashOffset&&(r.lineDashOffset=n.lineDashOffset,u.lineDashOffset=n.lineDashOffset)),r.lineJoin!=n.lineJoin&&(r.lineJoin=n.lineJoin,u.lineJoin=n.lineJoin),r.lineWidth!=n.lineWidth&&(r.lineWidth=n.lineWidth,u.lineWidth=n.lineWidth),r.miterLimit!=n.miterLimit&&(r.miterLimit=n.miterLimit,u.miterLimit=n.miterLimit),r.strokeStyle!=n.strokeStyle&&(r.strokeStyle=n.strokeStyle,u.strokeStyle=n.strokeStyle)):(u.lineCap=n.lineCap,u.setLineDash&&(u.setLineDash(n.lineDash),u.lineDashOffset=n.lineDashOffset),u.lineJoin=n.lineJoin,u.lineWidth=n.lineWidth,u.miterLimit=n.miterLimit,u.strokeStyle=n.strokeStyle,this.contextStrokeState_={lineCap:n.lineCap,lineDash:n.lineDash,lineDashOffset:n.lineDashOffset,lineJoin:n.lineJoin,lineWidth:n.lineWidth,miterLimit:n.miterLimit,strokeStyle:n.strokeStyle})},c.prototype.setContextTextState_=function(n){var u=this.context_,r=this.contextTextState_,s=n.textAlign?n.textAlign:mh;r?(r.font!=n.font&&(r.font=n.font,u.font=n.font),r.textAlign!=s&&(r.textAlign=s,u.textAlign=s),r.textBaseline!=n.textBaseline&&(r.textBaseline=n.textBaseline,u.textBaseline=n.textBaseline)):(u.font=n.font,u.textAlign=s,u.textBaseline=n.textBaseline,this.contextTextState_={font:n.font,textAlign:s,textBaseline:n.textBaseline})},c.prototype.setFillStrokeStyle=function(n,u){var r=this;if(!n)this.fillState_=null;else{var s=n.getColor();this.fillState_={fillStyle:Ts(s||Ss)}}if(!u)this.strokeState_=null;else{var P=u.getColor(),z=u.getLineCap(),F=u.getLineDash(),N=u.getLineDashOffset(),V=u.getLineJoin(),me=u.getWidth(),be=u.getMiterLimit(),Se=F||cc;this.strokeState_={lineCap:z!==void 0?z:Qh,lineDash:this.pixelRatio_===1?Se:Se.map(function(Ve){return Ve*r.pixelRatio_}),lineDashOffset:(N||hc)*this.pixelRatio_,lineJoin:V!==void 0?V:Iu,lineWidth:(me!==void 0?me:mc)*this.pixelRatio_,miterLimit:be!==void 0?be:pc,strokeStyle:Ts(P||fc)}}},c.prototype.setImageStyle=function(n){var u;if(!n||!(u=n.getSize())){this.image_=null;return}var r=n.getAnchor(),s=n.getOrigin();this.image_=n.getImage(this.pixelRatio_),this.imageAnchorX_=r[0]*this.pixelRatio_,this.imageAnchorY_=r[1]*this.pixelRatio_,this.imageHeight_=u[1]*this.pixelRatio_,this.imageOpacity_=n.getOpacity(),this.imageOriginX_=s[0],this.imageOriginY_=s[1],this.imageRotateWithView_=n.getRotateWithView(),this.imageRotation_=n.getRotation(),this.imageScale_=n.getScaleArray(),this.imageWidth_=u[0]*this.pixelRatio_},c.prototype.setTextStyle=function(n){if(!n)this.text_="";else{var u=n.getFill();if(!u)this.textFillState_=null;else{var r=u.getColor();this.textFillState_={fillStyle:Ts(r||Ss)}}var s=n.getStroke();if(!s)this.textStrokeState_=null;else{var P=s.getColor(),z=s.getLineCap(),F=s.getLineDash(),N=s.getLineDashOffset(),V=s.getLineJoin(),me=s.getWidth(),be=s.getMiterLimit();this.textStrokeState_={lineCap:z!==void 0?z:Qh,lineDash:F||cc,lineDashOffset:N||hc,lineJoin:V!==void 0?V:Iu,lineWidth:me!==void 0?me:mc,miterLimit:be!==void 0?be:pc,strokeStyle:Ts(P||fc)}}var Se=n.getFont(),Ve=n.getOffsetX(),Ke=n.getOffsetY(),Ie=n.getRotateWithView(),Ge=n.getRotation(),et=n.getScaleArray(),rt=n.getText(),_t=n.getTextAlign(),yt=n.getTextBaseline();this.textState_={font:Se!==void 0?Se:tg,textAlign:_t!==void 0?_t:mh,textBaseline:yt!==void 0?yt:ep},this.text_=rt!==void 0?Array.isArray(rt)?rt.reduce(function(ct,Tt,St){return ct+=St%2?" ":Tt},""):rt:"",this.textOffsetX_=Ve!==void 0?this.pixelRatio_*Ve:0,this.textOffsetY_=Ke!==void 0?this.pixelRatio_*Ke:0,this.textRotateWithView_=Ie!==void 0?Ie:!1,this.textRotation_=Ge!==void 0?Ge:0,this.textScale_=[this.pixelRatio_*et[0],this.pixelRatio_*et[1]]}},c}(rg),a0=t2;var Pu={FRACTION:"fraction",PIXELS:"pixels"};var Ks={BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right",TOP_LEFT:"top-left",TOP_RIGHT:"top-right"};var r2=function(){function _(){this.cache_={},this.cacheSize_=0,this.maxCacheSize_=32}return _.prototype.clear=function(){this.cache_={},this.cacheSize_=0},_.prototype.canExpireCache=function(){return this.cacheSize_>this.maxCacheSize_},_.prototype.expire=function(){if(this.canExpireCache()){var c=0;for(var n in this.cache_){var u=this.cache_[n];(c++&3)===0&&!u.hasListener()&&(delete this.cache_[n],--this.cacheSize_)}}},_.prototype.get=function(c,n,u){var r=s0(c,n,u);return r in this.cache_?this.cache_[r]:null},_.prototype.set=function(c,n,u,r){var s=s0(c,n,u);this.cache_[s]=r,++this.cacheSize_},_.prototype.setSize=function(c){this.maxCacheSize_=c,this.expire()},_}();function s0(_,c,n){var u=n?Qm(n):"null";return c+":"+_+":"+u}var h_=new r2;var i2=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),n2=function(_){i2(c,_);function c(n,u,r,s){var P=_.call(this)||this;return P.extent=n,P.pixelRatio_=r,P.resolution=u,P.state=s,P}return c.prototype.changed=function(){this.dispatchEvent(Ji.CHANGE)},c.prototype.getExtent=function(){return this.extent},c.prototype.getImage=function(){return jr()},c.prototype.getPixelRatio=function(){return this.pixelRatio_},c.prototype.getResolution=function(){return this.resolution},c.prototype.getState=function(){return this.state},c.prototype.load=function(){jr()},c}(nh),l0=n2;var o2=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),nL=function(_){o2(c,_);function c(n,u,r,s,P,z){var F=_.call(this,n,u,r,qi.IDLE)||this;return F.src_=s,F.image_=new Image,P!==null&&(F.image_.crossOrigin=P),F.unlisten_=null,F.state=qi.IDLE,F.imageLoadFunction_=z,F}return c.prototype.getImage=function(){return this.image_},c.prototype.handleImageError_=function(){this.state=qi.ERROR,this.unlistenImage_(),this.changed()},c.prototype.handleImageLoad_=function(){this.resolution===void 0&&(this.resolution=Eu(this.extent)/this.image_.height),this.state=qi.LOADED,this.unlistenImage_(),this.changed()},c.prototype.load=function(){(this.state==qi.IDLE||this.state==qi.ERROR)&&(this.state=qi.LOADING,this.changed(),this.imageLoadFunction_(this,this.src_),this.unlisten_=p_(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))},c.prototype.setImage=function(n){this.image_=n,this.resolution=Eu(this.extent)/this.image_.height},c.prototype.unlistenImage_=function(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)},c}(l0);function p_(_,c,n){var u=_,r=!0,s=!1,P=!1,z=[qp(u,Ji.LOAD,function(){P=!0,s||c()})];return u.src&&Cv?(s=!0,u.decode().then(function(){r&&c()}).catch(function(F){r&&(P?c():n())})):z.push(qp(u,Ji.ERROR,n)),function(){r=!1,z.forEach(Ao)}}var a2=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),_d=null,s2=function(_){a2(c,_);function c(n,u,r,s,P,z){var F=_.call(this)||this;return F.hitDetectionImage_=null,F.image_=n||new Image,s!==null&&(F.image_.crossOrigin=s),F.canvas_={},F.color_=z,F.unlisten_=null,F.imageState_=P,F.size_=r,F.src_=u,F.tainted_,F}return c.prototype.isTainted_=function(){if(this.tainted_===void 0&&this.imageState_===qi.LOADED){_d||(_d=Ja(1,1)),_d.drawImage(this.image_,0,0);try{_d.getImageData(0,0,1,1),this.tainted_=!1}catch{_d=null,this.tainted_=!0}}return this.tainted_===!0},c.prototype.dispatchChangeEvent_=function(){this.dispatchEvent(Ji.CHANGE)},c.prototype.handleImageError_=function(){this.imageState_=qi.ERROR,this.unlistenImage_(),this.dispatchChangeEvent_()},c.prototype.handleImageLoad_=function(){this.imageState_=qi.LOADED,this.size_?(this.image_.width=this.size_[0],this.image_.height=this.size_[1]):this.size_=[this.image_.width,this.image_.height],this.unlistenImage_(),this.dispatchChangeEvent_()},c.prototype.getImage=function(n){return this.replaceColor_(n),this.canvas_[n]?this.canvas_[n]:this.image_},c.prototype.getPixelRatio=function(n){return this.replaceColor_(n),this.canvas_[n]?n:1},c.prototype.getImageState=function(){return this.imageState_},c.prototype.getHitDetectionImage=function(){if(!this.hitDetectionImage_)if(this.isTainted_()){var n=this.size_[0],u=this.size_[1],r=Ja(n,u);r.fillRect(0,0,n,u),this.hitDetectionImage_=r.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_},c.prototype.getSize=function(){return this.size_},c.prototype.getSrc=function(){return this.src_},c.prototype.load=function(){if(this.imageState_==qi.IDLE){this.imageState_=qi.LOADING;try{this.image_.src=this.src_}catch{this.handleImageError_()}this.unlisten_=p_(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this))}},c.prototype.replaceColor_=function(n){if(!(!this.color_||this.canvas_[n]||this.imageState_!==qi.LOADED)){var u=document.createElement("canvas");this.canvas_[n]=u,u.width=Math.ceil(this.image_.width*n),u.height=Math.ceil(this.image_.height*n);var r=u.getContext("2d");if(r.scale(n,n),r.drawImage(this.image_,0,0),r.globalCompositeOperation="multiply",r.globalCompositeOperation==="multiply"||this.isTainted_())r.fillStyle=Qm(this.color_),r.fillRect(0,0,u.width/n,u.height/n),r.globalCompositeOperation="destination-in",r.drawImage(this.image_,0,0);else{for(var s=r.getImageData(0,0,u.width,u.height),P=s.data,z=this.color_[0]/255,F=this.color_[1]/255,N=this.color_[2]/255,V=this.color_[3],me=0,be=P.length;me<be;me+=4)P[me]*=z,P[me+1]*=F,P[me+2]*=N,P[me+3]*=V;r.putImageData(s,0,0)}}},c.prototype.unlistenImage_=function(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)},c}(nh);function u0(_,c,n,u,r,s){var P=h_.get(c,u,s);return P||(P=new s2(_,c,n,u,r,s),h_.set(c,u,s,P)),P}var l2=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),u2=function(_){l2(c,_);function c(n){var u=this,r=n||{},s=r.opacity!==void 0?r.opacity:1,P=r.rotation!==void 0?r.rotation:0,z=r.scale!==void 0?r.scale:1,F=r.rotateWithView!==void 0?r.rotateWithView:!1;u=_.call(this,{opacity:s,rotation:P,scale:z,displacement:r.displacement!==void 0?r.displacement:[0,0],rotateWithView:F})||this,u.anchor_=r.anchor!==void 0?r.anchor:[.5,.5],u.normalizedAnchor_=null,u.anchorOrigin_=r.anchorOrigin!==void 0?r.anchorOrigin:Ks.TOP_LEFT,u.anchorXUnits_=r.anchorXUnits!==void 0?r.anchorXUnits:Pu.FRACTION,u.anchorYUnits_=r.anchorYUnits!==void 0?r.anchorYUnits:Pu.FRACTION,u.crossOrigin_=r.crossOrigin!==void 0?r.crossOrigin:null;var N=r.img!==void 0?r.img:null;u.imgSize_=r.imgSize;var V=r.src;wn(!(V!==void 0&&N),4),wn(!N||N&&u.imgSize_,5),(V===void 0||V.length===0)&&N&&(V=N.src||Ai(N)),wn(V!==void 0&&V.length>0,6);var me=r.src!==void 0?qi.IDLE:qi.LOADED;return u.color_=r.color!==void 0?Jh(r.color):null,u.iconImage_=u0(N,V,u.imgSize_!==void 0?u.imgSize_:null,u.crossOrigin_,me,u.color_),u.offset_=r.offset!==void 0?r.offset:[0,0],u.offsetOrigin_=r.offsetOrigin!==void 0?r.offsetOrigin:Ks.TOP_LEFT,u.origin_=null,u.size_=r.size!==void 0?r.size:null,u}return c.prototype.clone=function(){var n=this.getScale();return new c({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,crossOrigin:this.crossOrigin_,imgSize:this.imgSize_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:Array.isArray(n)?n.slice():n,size:this.size_!==null?this.size_.slice():void 0,src:this.getSrc()})},c.prototype.getAnchor=function(){var n=this.normalizedAnchor_;if(!n){n=this.anchor_;var u=this.getSize();if(this.anchorXUnits_==Pu.FRACTION||this.anchorYUnits_==Pu.FRACTION){if(!u)return null;n=this.anchor_.slice(),this.anchorXUnits_==Pu.FRACTION&&(n[0]*=u[0]),this.anchorYUnits_==Pu.FRACTION&&(n[1]*=u[1])}if(this.anchorOrigin_!=Ks.TOP_LEFT){if(!u)return null;n===this.anchor_&&(n=this.anchor_.slice()),(this.anchorOrigin_==Ks.TOP_RIGHT||this.anchorOrigin_==Ks.BOTTOM_RIGHT)&&(n[0]=-n[0]+u[0]),(this.anchorOrigin_==Ks.BOTTOM_LEFT||this.anchorOrigin_==Ks.BOTTOM_RIGHT)&&(n[1]=-n[1]+u[1])}this.normalizedAnchor_=n}var r=this.getDisplacement();return[n[0]-r[0],n[1]+r[1]]},c.prototype.setAnchor=function(n){this.anchor_=n,this.normalizedAnchor_=null},c.prototype.getColor=function(){return this.color_},c.prototype.getImage=function(n){return this.iconImage_.getImage(n)},c.prototype.getPixelRatio=function(n){return this.iconImage_.getPixelRatio(n)},c.prototype.getImageSize=function(){return this.iconImage_.getSize()},c.prototype.getImageState=function(){return this.iconImage_.getImageState()},c.prototype.getHitDetectionImage=function(){return this.iconImage_.getHitDetectionImage()},c.prototype.getOrigin=function(){if(this.origin_)return this.origin_;var n=this.offset_;if(this.offsetOrigin_!=Ks.TOP_LEFT){var u=this.getSize(),r=this.iconImage_.getSize();if(!u||!r)return null;n=n.slice(),(this.offsetOrigin_==Ks.TOP_RIGHT||this.offsetOrigin_==Ks.BOTTOM_RIGHT)&&(n[0]=r[0]-u[0]-n[0]),(this.offsetOrigin_==Ks.BOTTOM_LEFT||this.offsetOrigin_==Ks.BOTTOM_RIGHT)&&(n[1]=r[1]-u[1]-n[1])}return this.origin_=n,this.origin_},c.prototype.getSrc=function(){return this.iconImage_.getSrc()},c.prototype.getSize=function(){return this.size_?this.size_:this.iconImage_.getSize()},c.prototype.listenImageChange=function(n){this.iconImage_.addEventListener(Ji.CHANGE,n)},c.prototype.load=function(){this.iconImage_.load()},c.prototype.unlistenImageChange=function(n){this.iconImage_.removeEventListener(Ji.CHANGE,n)},c}(Jm),f_=u2;var $l=.5;function c0(_,c,n,u,r,s,P){var z=_[0]*$l,F=_[1]*$l,N=Ja(z,F);N.imageSmoothingEnabled=!1;for(var V=N.canvas,me=new a0(N,$l,r,null,P),be=n.length,Se=Math.floor((256*256*256-1)/be),Ve={},Ke=1;Ke<=be;++Ke){var Ie=n[Ke-1],Ge=Ie.getStyleFunction()||u;if(!!u){var et=Ge(Ie,s);if(!!et){Array.isArray(et)||(et=[et]);for(var rt=Ke*Se,_t="#"+("000000"+rt.toString(16)).slice(-6),yt=0,ct=et.length;yt<ct;++yt){var Tt=et[yt],St=Tt.getGeometryFunction()(Ie);if(!(!St||!ko(r,St.getExtent()))){var Lt=Tt.clone(),ur=Lt.getFill();ur&&ur.setColor(_t);var Vt=Lt.getStroke();Vt&&(Vt.setColor(_t),Vt.setLineDash(null)),Lt.setText(void 0);var Qt=Tt.getImage();if(Qt&&Qt.getOpacity()!==0){var or=Qt.getImageSize();if(!or)continue;var Mt=Ja(or[0],or[1],void 0,{alpha:!1}),Br=Mt.canvas;Mt.fillStyle=_t,Mt.fillRect(0,0,Br.width,Br.height),Lt.setImage(new f_({img:Br,imgSize:or,anchor:Qt.getAnchor(),anchorXUnits:Pu.PIXELS,anchorYUnits:Pu.PIXELS,offset:Qt.getOrigin(),opacity:1,size:Qt.getSize(),scale:Qt.getScale(),rotation:Qt.getRotation(),rotateWithView:Qt.getRotateWithView()}))}var Tr=Lt.getZIndex()||0,br=Ve[Tr];br||(br={},Ve[Tr]=br,br[Pt.POLYGON]=[],br[Pt.CIRCLE]=[],br[Pt.LINE_STRING]=[],br[Pt.POINT]=[]),br[St.getType().replace("Multi","")].push(St,Lt)}}}}}for(var Mr=Object.keys(Ve).map(Number).sort(rh),Ke=0,Ir=Mr.length;Ke<Ir;++Ke){var br=Ve[Mr[Ke]];for(var xr in br)for(var ai=br[xr],yt=0,ct=ai.length;yt<ct;yt+=2){me.setStyle(ai[yt+1]);for(var jt=0,Yr=c.length;jt<Yr;++jt)me.setTransform(c[jt]),me.drawGeometry(ai[yt])}}return N.getImageData(0,0,V.width,V.height)}function h0(_,c,n){var u=[];if(n){var r=Math.floor(Math.round(_[0])*$l),s=Math.floor(Math.round(_[1])*$l),P=(jl(r,0,n.width-1)+jl(s,0,n.height-1)*n.width)*4,z=n.data[P],F=n.data[P+1],N=n.data[P+2],V=N+256*(F+256*z),me=Math.floor((256*256*256-1)/c.length);V&&V%me===0&&u.push(c[V/me-1])}return u}var c2=.5,p0={Point:y2,LineString:d2,Polygon:v2,MultiPoint:_2,MultiLineString:m2,MultiPolygon:g2,GeometryCollection:f2,Circle:h2};function f0(_,c){return parseInt(Ai(_),10)-parseInt(Ai(c),10)}function d0(_,c){var n=ig(_,c);return n*n}function ig(_,c){return c2*_/c}function h2(_,c,n,u,r){var s=n.getFill(),P=n.getStroke();if(s||P){var z=_.getBuilder(n.getZIndex(),Dn.CIRCLE);z.setFillStrokeStyle(s,P),z.drawCircle(c,u)}var F=n.getText();if(F&&F.getText()){var N=(r||_).getBuilder(n.getZIndex(),Dn.TEXT);N.setTextStyle(F),N.drawText(c,u)}}function d_(_,c,n,u,r,s,P){var z=!1,F=n.getImage();if(F){var N=F.getImageState();N==qi.LOADED||N==qi.ERROR?F.unlistenImageChange(r):(N==qi.IDLE&&F.load(),N=F.getImageState(),F.listenImageChange(r),z=!0)}return p2(_,c,n,u,s,P),z}function p2(_,c,n,u,r,s){var P=n.getGeometryFunction()(c);if(!!P){var z=P.simplifyTransformed(u,r),F=n.getRenderer();if(F)m0(_,z,n,c);else{var N=p0[z.getType()];N(_,z,n,c,s)}}}function m0(_,c,n,u){if(c.getType()==Pt.GEOMETRY_COLLECTION){for(var r=c.getGeometries(),s=0,P=r.length;s<P;++s)m0(_,r[s],n,u);return}var z=_.getBuilder(n.getZIndex(),Dn.DEFAULT);z.drawCustom(c,u,n.getRenderer(),n.getHitDetectionRenderer())}function f2(_,c,n,u,r){var s=c.getGeometriesArray(),P,z;for(P=0,z=s.length;P<z;++P){var F=p0[s[P].getType()];F(_,s[P],n,u,r)}}function d2(_,c,n,u,r){var s=n.getStroke();if(s){var P=_.getBuilder(n.getZIndex(),Dn.LINE_STRING);P.setFillStrokeStyle(null,s),P.drawLineString(c,u)}var z=n.getText();if(z&&z.getText()){var F=(r||_).getBuilder(n.getZIndex(),Dn.TEXT);F.setTextStyle(z),F.drawText(c,u)}}function m2(_,c,n,u,r){var s=n.getStroke();if(s){var P=_.getBuilder(n.getZIndex(),Dn.LINE_STRING);P.setFillStrokeStyle(null,s),P.drawMultiLineString(c,u)}var z=n.getText();if(z&&z.getText()){var F=(r||_).getBuilder(n.getZIndex(),Dn.TEXT);F.setTextStyle(z),F.drawText(c,u)}}function g2(_,c,n,u,r){var s=n.getFill(),P=n.getStroke();if(P||s){var z=_.getBuilder(n.getZIndex(),Dn.POLYGON);z.setFillStrokeStyle(s,P),z.drawMultiPolygon(c,u)}var F=n.getText();if(F&&F.getText()){var N=(r||_).getBuilder(n.getZIndex(),Dn.TEXT);N.setTextStyle(F),N.drawText(c,u)}}function y2(_,c,n,u,r){var s=n.getImage(),P=n.getText(),z;if(r&&(_=r,z=s&&P&&P.getText()?{}:void 0),s){if(s.getImageState()!=qi.LOADED)return;var F=_.getBuilder(n.getZIndex(),Dn.IMAGE);F.setImageStyle(s,z),F.drawPoint(c,u)}if(P&&P.getText()){var N=_.getBuilder(n.getZIndex(),Dn.TEXT);N.setTextStyle(P,z),N.drawText(c,u)}}function _2(_,c,n,u,r){var s=n.getImage(),P=n.getText(),z;if(r&&(_=r,z=s&&P&&P.getText()?{}:void 0),s){if(s.getImageState()!=qi.LOADED)return;var F=_.getBuilder(n.getZIndex(),Dn.IMAGE);F.setImageStyle(s,z),F.drawMultiPoint(c,u)}if(P&&P.getText()){var N=(r||_).getBuilder(n.getZIndex(),Dn.TEXT);N.setTextStyle(P,z),N.drawText(c,u)}}function v2(_,c,n,u,r){var s=n.getFill(),P=n.getStroke();if(s||P){var z=_.getBuilder(n.getZIndex(),Dn.POLYGON);z.setFillStrokeStyle(s,P),z.drawPolygon(c,u)}var F=n.getText();if(F&&F.getText()){var N=(r||_).getBuilder(n.getZIndex(),Dn.TEXT);N.setTextStyle(F),N.drawText(c,u)}}var x2=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),b2=function(_){x2(c,_);function c(n){var u=_.call(this,n)||this;return u.boundHandleStyleImageChange_=u.handleStyleImageChange_.bind(u),u.animatingOrInteracting_,u.dirty_=!1,u.hitDetectionImageData_=null,u.renderedFeatures_=null,u.renderedRevision_=-1,u.renderedResolution_=NaN,u.renderedExtent_=Ya(),u.wrappedRenderedExtent_=Ya(),u.renderedRotation_,u.renderedCenter_=null,u.renderedProjection_=null,u.renderedRenderOrder_=null,u.replayGroup_=null,u.replayGroupChanged=!0,u.declutterExecutorGroup=null,u.clipping=!0,u}return c.prototype.renderWorlds=function(n,u,r){var s=u.extent,P=u.viewState,z=P.center,F=P.resolution,N=P.projection,V=P.rotation,me=N.getExtent(),be=this.getLayer().getSource(),Se=u.pixelRatio,Ve=u.viewHints,Ke=!(Ve[yd.ANIMATING]||Ve[yd.INTERACTING]),Ie=this.context,Ge=Math.round(u.size[0]*Se),et=Math.round(u.size[1]*Se),rt=be.getWrapX()&&N.canWrapX(),_t=rt?bs(me):null,yt=rt?Math.ceil((s[2]-me[2])/_t)+1:1,ct=rt?Math.floor((s[0]-me[0])/_t):0;do{var Tt=this.getRenderTransform(z,F,V,Se,Ge,et,ct*_t);n.execute(Ie,1,Tt,V,Ke,void 0,r)}while(++ct<yt)},c.prototype.renderDeclutter=function(n){this.declutterExecutorGroup&&this.renderWorlds(this.declutterExecutorGroup,n,n.declutterTree)},c.prototype.renderFrame=function(n,u){var r=n.pixelRatio,s=n.layerStatesArray[n.layerIndex];Mv(this.pixelTransform,1/r,1/r),Lv(this.inversePixelTransform,this.pixelTransform);var P=hy(this.pixelTransform);this.useContainer(u,P,s.opacity,this.getBackground(n));var z=this.context,F=z.canvas,N=this.replayGroup_,V=this.declutterExecutorGroup;if((!N||N.isEmpty())&&(!V||V.isEmpty()))return null;var me=Math.round(n.size[0]*r),be=Math.round(n.size[1]*r);F.width!=me||F.height!=be?(F.width=me,F.height=be,F.style.transform!==P&&(F.style.transform=P)):this.containerReused||z.clearRect(0,0,me,be),this.preRender(z,n);var Se=n.viewState,Ve=Se.projection,Ke=!1,Ie=!0;if(s.extent&&this.clipping){var Ge=td(s.extent,Ve);Ie=ko(Ge,n.extent),Ke=Ie&&!sc(Ge,n.extent),Ke&&this.clipUnrotated(z,n,Ge)}Ie&&this.renderWorlds(N,n),Ke&&z.restore(),this.postRender(z,n);var et=Dx(s.opacity),rt=this.container;return et!==rt.style.opacity&&(rt.style.opacity=et),this.renderedRotation_!==Se.rotation&&(this.renderedRotation_=Se.rotation,this.hitDetectionImageData_=null),this.container},c.prototype.getFeatures=function(n){return new Promise(function(u){if(!this.hitDetectionImageData_&&!this.animatingOrInteracting_){var r=[this.context.canvas.width,this.context.canvas.height];xo(this.pixelTransform,r);var s=this.renderedCenter_,P=this.renderedResolution_,z=this.renderedRotation_,F=this.renderedProjection_,N=this.wrappedRenderedExtent_,V=this.getLayer(),me=[],be=r[0]*$l,Se=r[1]*$l;me.push(this.getRenderTransform(s,P,z,$l,be,Se,0).slice());var Ve=V.getSource(),Ke=F.getExtent();if(Ve.getWrapX()&&F.canWrapX()&&!sc(Ke,N)){for(var Ie=N[0],Ge=bs(Ke),et=0,rt=void 0;Ie<Ke[0];)--et,rt=Ge*et,me.push(this.getRenderTransform(s,P,z,$l,be,Se,rt).slice()),Ie+=Ge;for(et=0,Ie=N[2];Ie>Ke[2];)++et,rt=Ge*et,me.push(this.getRenderTransform(s,P,z,$l,be,Se,rt).slice()),Ie-=Ge}this.hitDetectionImageData_=c0(r,me,this.renderedFeatures_,V.getStyleFunction(),N,P,z)}u(h0(n,this.renderedFeatures_,this.hitDetectionImageData_))}.bind(this))},c.prototype.forEachFeatureAtCoordinate=function(n,u,r,s,P){var z=this;if(!!this.replayGroup_){var F=u.viewState.resolution,N=u.viewState.rotation,V=this.getLayer(),me={},be=function(Ke,Ie,Ge){var et=Ai(Ke),rt=me[et];if(rt){if(rt!==!0&&Ge<rt.distanceSq){if(Ge===0)return me[et]=!0,P.splice(P.lastIndexOf(rt),1),s(Ke,V,Ie);rt.geometry=Ie,rt.distanceSq=Ge}}else{if(Ge===0)return me[et]=!0,s(Ke,V,Ie);P.push(me[et]={feature:Ke,layer:V,geometry:Ie,distanceSq:Ge,callback:s})}},Se,Ve=[this.replayGroup_];return this.declutterExecutorGroup&&Ve.push(this.declutterExecutorGroup),Ve.some(function(Ke){return Se=Ke.forEachFeatureAtCoordinate(n,F,N,r,be,Ke===z.declutterExecutorGroup&&u.declutterTree?u.declutterTree.all().map(function(Ie){return Ie.value}):null)}),Se}},c.prototype.handleFontsChanged=function(){var n=this.getLayer();n.getVisible()&&this.replayGroup_&&n.changed()},c.prototype.handleStyleImageChange_=function(n){this.renderIfReadyAndVisible()},c.prototype.prepareFrame=function(n){var u=this.getLayer(),r=u.getSource();if(!r)return!1;var s=n.viewHints[yd.ANIMATING],P=n.viewHints[yd.INTERACTING],z=u.getUpdateWhileAnimating(),F=u.getUpdateWhileInteracting();if(!this.dirty_&&!z&&s||!F&&P)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;var N=n.extent,V=n.viewState,me=V.projection,be=V.resolution,Se=n.pixelRatio,Ve=u.getRevision(),Ke=u.getRenderBuffer(),Ie=u.getRenderOrder();Ie===void 0&&(Ie=f0);var Ge=V.center.slice(),et=yl(N,Ke*be),rt=et.slice(),_t=[et.slice()],yt=me.getExtent();if(r.getWrapX()&&me.canWrapX()&&!sc(yt,n.extent)){var ct=bs(yt),Tt=Math.max(bs(et)/2,ct);et[0]=yt[0]-Tt,et[2]=yt[2]+Tt,Jv(Ge,me);var St=Kv(_t[0],me);St[0]<yt[0]&&St[2]<yt[2]?_t.push([St[0]+ct,St[1],St[2]+ct,St[3]]):St[0]>yt[0]&&St[2]>yt[2]&&_t.push([St[0]-ct,St[1],St[2]-ct,St[3]])}if(!this.dirty_&&this.renderedResolution_==be&&this.renderedRevision_==Ve&&this.renderedRenderOrder_==Ie&&sc(this.wrappedRenderedExtent_,et))return _s(this.renderedExtent_,rt)||(this.hitDetectionImageData_=null,this.renderedExtent_=rt),this.renderedCenter_=Ge,this.replayGroupChanged=!1,!0;this.replayGroup_=null,this.dirty_=!1;var Lt=new s_(ig(be,Se),et,be,Se),ur;this.getLayer().getDeclutter()&&(ur=new s_(ig(be,Se),et,be,Se));var Vt=uh(),Qt;if(Vt){for(var or=0,Mt=_t.length;or<Mt;++or){var Br=_t[or],Tr=Qp(Br,me);r.loadFeatures(Tr,rx(be,me),Vt)}Qt=Um(Vt,me)}else for(var or=0,Mt=_t.length;or<Mt;++or)r.loadFeatures(_t[or],be,me);var br=d0(be,Se),Mr=function(Yr){var vi,di=Yr.getStyleFunction()||u.getStyleFunction();if(di&&(vi=di(Yr,be)),vi){var en=this.renderFeature(Yr,br,vi,Lt,Qt,ur);this.dirty_=this.dirty_||en}}.bind(this),Ir=Qp(et,me),xr=r.getFeaturesInExtent(Ir);Ie&&xr.sort(Ie);for(var or=0,Mt=xr.length;or<Mt;++or)Mr(xr[or]);this.renderedFeatures_=xr;var ai=Lt.finish(),jt=new c_(et,be,Se,r.getOverlaps(),ai,u.getRenderBuffer());return ur&&(this.declutterExecutorGroup=new c_(et,be,Se,r.getOverlaps(),ur.finish(),u.getRenderBuffer())),this.renderedResolution_=be,this.renderedRevision_=Ve,this.renderedRenderOrder_=Ie,this.renderedExtent_=rt,this.wrappedRenderedExtent_=et,this.renderedCenter_=Ge,this.renderedProjection_=me,this.replayGroup_=jt,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0},c.prototype.renderFeature=function(n,u,r,s,P,z){if(!r)return!1;var F=!1;if(Array.isArray(r))for(var N=0,V=r.length;N<V;++N)F=d_(s,n,r[N],u,this.boundHandleStyleImageChange_,P,z)||F;else F=d_(s,n,r,u,this.boundHandleStyleImageChange_,P,z);return F},c}(t0),g0=b2;var w2=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),E2=function(_){w2(c,_);function c(n){return _.call(this,n)||this}return c.prototype.createRenderer=function(){return new g0(this)},c}($x),tp=E2;var y0=Gp(n_(),1);var T2=function(){function _(c){this.rbush_=new y0.default(c),this.items_={}}return _.prototype.insert=function(c,n){var u={minX:c[0],minY:c[1],maxX:c[2],maxY:c[3],value:n};this.rbush_.insert(u),this.items_[Ai(n)]=u},_.prototype.load=function(c,n){for(var u=new Array(n.length),r=0,s=n.length;r<s;r++){var P=c[r],z=n[r],F={minX:P[0],minY:P[1],maxX:P[2],maxY:P[3],value:z};u[r]=F,this.items_[Ai(z)]=F}this.rbush_.load(u)},_.prototype.remove=function(c){var n=Ai(c),u=this.items_[n];return delete this.items_[n],this.rbush_.remove(u)!==null},_.prototype.update=function(c,n){var u=this.items_[Ai(n)],r=[u.minX,u.minY,u.maxX,u.maxY];Bm(r,c)||(this.remove(n),this.insert(c,n))},_.prototype.getAll=function(){var c=this.rbush_.all();return c.map(function(n){return n.value})},_.prototype.getInExtent=function(c){var n={minX:c[0],minY:c[1],maxX:c[2],maxY:c[3]},u=this.rbush_.search(n);return u.map(function(r){return r.value})},_.prototype.forEach=function(c){return this.forEach_(this.getAll(),c)},_.prototype.forEachInExtent=function(c,n){return this.forEach_(this.getInExtent(c),n)},_.prototype.forEach_=function(c,n){for(var u,r=0,s=c.length;r<s;r++)if(u=n(c[r]),u)return u;return u},_.prototype.isEmpty=function(){return Vl(this.items_)},_.prototype.clear=function(){this.rbush_.clear(),this.items_={}},_.prototype.getExtent=function(c){var n=this.rbush_.toJSON();return sh(n.minX,n.minY,n.maxX,n.maxY,c)},_.prototype.concat=function(c){this.rbush_.load(c.rbush_.all());for(var n in c.items_)this.items_[n]=c.items_[n]},_}(),vd=T2;var S2=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),I2=function(_){S2(c,_);function c(n){var u=_.call(this)||this;u.projection=ga(n.projection),u.attributions_=_0(n.attributions),u.attributionsCollapsible_=n.attributionsCollapsible!==void 0?n.attributionsCollapsible:!0,u.loading=!1,u.state_=n.state!==void 0?n.state:Su.READY,u.wrapX_=n.wrapX!==void 0?n.wrapX:!1,u.interpolate_=!!n.interpolate,u.viewResolver=null,u.viewRejector=null;var r=u;return u.viewPromise_=new Promise(function(s,P){r.viewResolver=s,r.viewRejector=P}),u}return c.prototype.getAttributions=function(){return this.attributions_},c.prototype.getAttributionsCollapsible=function(){return this.attributionsCollapsible_},c.prototype.getProjection=function(){return this.projection},c.prototype.getResolutions=function(){return jr()},c.prototype.getView=function(){return this.viewPromise_},c.prototype.getState=function(){return this.state_},c.prototype.getWrapX=function(){return this.wrapX_},c.prototype.getInterpolate=function(){return this.interpolate_},c.prototype.refresh=function(){this.changed()},c.prototype.setAttributions=function(n){this.attributions_=_0(n),this.changed()},c.prototype.setState=function(n){this.state_=n,this.changed()},c}(Po);function _0(_){return _?Array.isArray(_)?function(c){return _}:typeof _=="function"?_:function(c){return[_]}:null}var cf=I2;var Qa={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};function v0(_,c){return[[-1/0,-1/0,1/0,1/0]]}var _h={ARRAY_BUFFER:"arraybuffer",JSON:"json",TEXT:"text",XML:"xml"};var C2=!1;function A2(_,c,n,u,r,s,P){var z=new XMLHttpRequest;z.open("GET",typeof _=="function"?_(n,u,r):_,!0),c.getType()==_h.ARRAY_BUFFER&&(z.responseType="arraybuffer"),z.withCredentials=C2,z.onload=function(F){if(!z.status||z.status>=200&&z.status<300){var N=c.getType(),V=void 0;N==_h.JSON||N==_h.TEXT?V=z.responseText:N==_h.XML?(V=z.responseXML,V||(V=new DOMParser().parseFromString(z.responseText,"application/xml"))):N==_h.ARRAY_BUFFER&&(V=z.response),V?s(c.readFeatures(V,{extent:n,featureProjection:r}),c.readProjection(V)):P()}else P()},z.onerror=P,z.send()}function m_(_,c){return function(n,u,r,s,P){var z=this;A2(_,c,n,u,r,function(F,N){z.addFeatures(F),s!==void 0&&s(F)},P||qh)}}var x0=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),vh=function(_){x0(c,_);function c(n,u,r){var s=_.call(this,n)||this;return s.feature=u,s.features=r,s}return c}(La);var P2=function(_){x0(c,_);function c(n){var u=this,r=n||{};u=_.call(this,{attributions:r.attributions,interpolate:!0,projection:void 0,state:Su.READY,wrapX:r.wrapX!==void 0?r.wrapX:!0})||this,u.on,u.once,u.un,u.loader_=qh,u.format_=r.format,u.overlaps_=r.overlaps===void 0?!0:r.overlaps,u.url_=r.url,r.loader!==void 0?u.loader_=r.loader:u.url_!==void 0&&(wn(u.format_,7),u.loader_=m_(u.url_,u.format_)),u.strategy_=r.strategy!==void 0?r.strategy:v0;var s=r.useSpatialIndex!==void 0?r.useSpatialIndex:!0;u.featuresRtree_=s?new vd:null,u.loadedExtentsRtree_=new vd,u.loadingExtentsCount_=0,u.nullGeometryFeatures_={},u.idIndex_={},u.uidIndex_={},u.featureChangeKeys_={},u.featuresCollection_=null;var P,z;return Array.isArray(r.features)?z=r.features:r.features&&(P=r.features,z=P.getArray()),!s&&P===void 0&&(P=new ch(z)),z!==void 0&&u.addFeaturesInternal(z),P!==void 0&&u.bindFeaturesCollection_(P),u}return c.prototype.addFeature=function(n){this.addFeatureInternal(n),this.changed()},c.prototype.addFeatureInternal=function(n){var u=Ai(n);if(!this.addToIndex_(u,n)){this.featuresCollection_&&this.featuresCollection_.remove(n);return}this.setupChangeEvents_(u,n);var r=n.getGeometry();if(r){var s=r.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(s,n)}else this.nullGeometryFeatures_[u]=n;this.dispatchEvent(new vh(Qa.ADDFEATURE,n))},c.prototype.setupChangeEvents_=function(n,u){this.featureChangeKeys_[n]=[lo(u,Ji.CHANGE,this.handleFeatureChange_,this),lo(u,jp.PROPERTYCHANGE,this.handleFeatureChange_,this)]},c.prototype.addToIndex_=function(n,u){var r=!0,s=u.getId();return s!==void 0&&(s.toString()in this.idIndex_?r=!1:this.idIndex_[s.toString()]=u),r&&(wn(!(n in this.uidIndex_),30),this.uidIndex_[n]=u),r},c.prototype.addFeatures=function(n){this.addFeaturesInternal(n),this.changed()},c.prototype.addFeaturesInternal=function(n){for(var u=[],r=[],s=[],P=0,z=n.length;P<z;P++){var F=n[P],N=Ai(F);this.addToIndex_(N,F)&&r.push(F)}for(var P=0,V=r.length;P<V;P++){var F=r[P],N=Ai(F);this.setupChangeEvents_(N,F);var me=F.getGeometry();if(me){var be=me.getExtent();u.push(be),s.push(F)}else this.nullGeometryFeatures_[N]=F}if(this.featuresRtree_&&this.featuresRtree_.load(u,s),this.hasListener(Qa.ADDFEATURE))for(var P=0,Se=r.length;P<Se;P++)this.dispatchEvent(new vh(Qa.ADDFEATURE,r[P]))},c.prototype.bindFeaturesCollection_=function(n){var u=!1;this.addEventListener(Qa.ADDFEATURE,function(r){u||(u=!0,n.push(r.feature),u=!1)}),this.addEventListener(Qa.REMOVEFEATURE,function(r){u||(u=!0,n.remove(r.feature),u=!1)}),n.addEventListener(ws.ADD,function(r){u||(u=!0,this.addFeature(r.element),u=!1)}.bind(this)),n.addEventListener(ws.REMOVE,function(r){u||(u=!0,this.removeFeature(r.element),u=!1)}.bind(this)),this.featuresCollection_=n},c.prototype.clear=function(n){if(n){for(var u in this.featureChangeKeys_){var r=this.featureChangeKeys_[u];r.forEach(Ao)}this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){var s=function(F){this.removeFeatureInternal(F)}.bind(this);this.featuresRtree_.forEach(s);for(var P in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[P])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};var z=new vh(Qa.CLEAR);this.dispatchEvent(z),this.changed()},c.prototype.forEachFeature=function(n){if(this.featuresRtree_)return this.featuresRtree_.forEach(n);this.featuresCollection_&&this.featuresCollection_.forEach(n)},c.prototype.forEachFeatureAtCoordinateDirect=function(n,u){var r=[n[0],n[1],n[0],n[1]];return this.forEachFeatureInExtent(r,function(s){var P=s.getGeometry();if(P.intersectsCoordinate(n))return u(s)})},c.prototype.forEachFeatureInExtent=function(n,u){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(n,u);this.featuresCollection_&&this.featuresCollection_.forEach(u)},c.prototype.forEachFeatureIntersectingExtent=function(n,u){return this.forEachFeatureInExtent(n,function(r){var s=r.getGeometry();if(s.intersectsExtent(n)){var P=u(r);if(P)return P}})},c.prototype.getFeaturesCollection=function(){return this.featuresCollection_},c.prototype.getFeatures=function(){var n;return this.featuresCollection_?n=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(n=this.featuresRtree_.getAll(),Vl(this.nullGeometryFeatures_)||Ha(n,Im(this.nullGeometryFeatures_))),n},c.prototype.getFeaturesAtCoordinate=function(n){var u=[];return this.forEachFeatureAtCoordinateDirect(n,function(r){u.push(r)}),u},c.prototype.getFeaturesInExtent=function(n){return this.featuresRtree_?this.featuresRtree_.getInExtent(n):this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]},c.prototype.getClosestFeatureToCoordinate=function(n,u){var r=n[0],s=n[1],P=null,z=[NaN,NaN],F=1/0,N=[-1/0,-1/0,1/0,1/0],V=u||Sm;return this.featuresRtree_.forEachInExtent(N,function(me){if(V(me)){var be=me.getGeometry(),Se=F;if(F=be.closestPointXY(r,s,z,F),F<Se){P=me;var Ve=Math.sqrt(F);N[0]=r-Ve,N[1]=s-Ve,N[2]=r+Ve,N[3]=s+Ve}}}),P},c.prototype.getExtent=function(n){return this.featuresRtree_.getExtent(n)},c.prototype.getFeatureById=function(n){var u=this.idIndex_[n.toString()];return u!==void 0?u:null},c.prototype.getFeatureByUid=function(n){var u=this.uidIndex_[n];return u!==void 0?u:null},c.prototype.getFormat=function(){return this.format_},c.prototype.getOverlaps=function(){return this.overlaps_},c.prototype.getUrl=function(){return this.url_},c.prototype.handleFeatureChange_=function(n){var u=n.target,r=Ai(u),s=u.getGeometry();if(!s)r in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(u),this.nullGeometryFeatures_[r]=u);else{var P=s.getExtent();r in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[r],this.featuresRtree_&&this.featuresRtree_.insert(P,u)):this.featuresRtree_&&this.featuresRtree_.update(P,u)}var z=u.getId();if(z!==void 0){var F=z.toString();this.idIndex_[F]!==u&&(this.removeFromIdIndex_(u),this.idIndex_[F]=u)}else this.removeFromIdIndex_(u),this.uidIndex_[r]=u;this.changed(),this.dispatchEvent(new vh(Qa.CHANGEFEATURE,u))},c.prototype.hasFeature=function(n){var u=n.getId();return u!==void 0?u in this.idIndex_:Ai(n)in this.uidIndex_},c.prototype.isEmpty=function(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&Vl(this.nullGeometryFeatures_):this.featuresCollection_?this.featuresCollection_.getLength()===0:!0},c.prototype.loadFeatures=function(n,u,r){for(var s=this.loadedExtentsRtree_,P=this.strategy_(n,u,r),z=function(me,be){var Se=P[me],Ve=s.forEachInExtent(Se,function(Ke){return sc(Ke.extent,Se)});Ve||(++F.loadingExtentsCount_,F.dispatchEvent(new vh(Qa.FEATURESLOADSTART)),F.loader_.call(F,Se,u,r,function(Ke){--this.loadingExtentsCount_,this.dispatchEvent(new vh(Qa.FEATURESLOADEND,void 0,Ke))}.bind(F),function(){--this.loadingExtentsCount_,this.dispatchEvent(new vh(Qa.FEATURESLOADERROR))}.bind(F)),s.insert(Se,{extent:Se.slice()}))},F=this,N=0,V=P.length;N<V;++N)z(N,V);this.loading=this.loader_.length<4?!1:this.loadingExtentsCount_>0},c.prototype.refresh=function(){this.clear(!0),this.loadedExtentsRtree_.clear(),_.prototype.refresh.call(this)},c.prototype.removeLoadedExtent=function(n){var u=this.loadedExtentsRtree_,r;u.forEachInExtent(n,function(s){if(Bm(s.extent,n))return r=s,!0}),r&&u.remove(r)},c.prototype.removeFeature=function(n){if(!!n){var u=Ai(n);u in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[u]:this.featuresRtree_&&this.featuresRtree_.remove(n);var r=this.removeFeatureInternal(n);r&&this.changed()}},c.prototype.removeFeatureInternal=function(n){var u=Ai(n),r=this.featureChangeKeys_[u];if(!!r){r.forEach(Ao),delete this.featureChangeKeys_[u];var s=n.getId();return s!==void 0&&delete this.idIndex_[s.toString()],delete this.uidIndex_[u],this.dispatchEvent(new vh(Qa.REMOVEFEATURE,n)),n}},c.prototype.removeFromIdIndex_=function(n){var u=!1;for(var r in this.idIndex_)if(this.idIndex_[r]===n){delete this.idIndex_[r],u=!0;break}return u},c.prototype.setLoader=function(n){this.loader_=n},c.prototype.setUrl=function(n){wn(this.format_,7),this.url_=n,this.setLoader(m_(n,this.format_))},c}(cf),rp=P2;var b0=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),hf=function(_){b0(c,_);function c(n,u){var r=_.call(this,n)||this;return r.layer=u,r}return c}(La);var g_={LAYERS:"layers"},M2=function(_){b0(c,_);function c(n){var u=this,r=n||{},s=Ra({},r);delete s.layers;var P=r.layers;return u=_.call(this,s)||this,u.on,u.once,u.un,u.layersListenerKeys_=[],u.listenerKeys_={},u.addChangeListener(g_.LAYERS,u.handleLayersChanged_),P?Array.isArray(P)?P=new ch(P.slice(),{unique:!0}):wn(typeof P.getArray=="function",43):P=new ch(void 0,{unique:!0}),u.setLayers(P),u}return c.prototype.handleLayerChange_=function(){this.changed()},c.prototype.handleLayersChanged_=function(){this.layersListenerKeys_.forEach(Ao),this.layersListenerKeys_.length=0;var n=this.getLayers();this.layersListenerKeys_.push(lo(n,ws.ADD,this.handleLayersAdd_,this),lo(n,ws.REMOVE,this.handleLayersRemove_,this));for(var u in this.listenerKeys_)this.listenerKeys_[u].forEach(Ao);ih(this.listenerKeys_);for(var r=n.getArray(),s=0,P=r.length;s<P;s++){var z=r[s];this.registerLayerListeners_(z),this.dispatchEvent(new hf("addlayer",z))}this.changed()},c.prototype.registerLayerListeners_=function(n){var u=[lo(n,jp.PROPERTYCHANGE,this.handleLayerChange_,this),lo(n,Ji.CHANGE,this.handleLayerChange_,this)];n instanceof c&&u.push(lo(n,"addlayer",this.handleLayerGroupAdd_,this),lo(n,"removelayer",this.handleLayerGroupRemove_,this)),this.listenerKeys_[Ai(n)]=u},c.prototype.handleLayerGroupAdd_=function(n){this.dispatchEvent(new hf("addlayer",n.layer))},c.prototype.handleLayerGroupRemove_=function(n){this.dispatchEvent(new hf("removelayer",n.layer))},c.prototype.handleLayersAdd_=function(n){var u=n.element;this.registerLayerListeners_(u),this.dispatchEvent(new hf("addlayer",u)),this.changed()},c.prototype.handleLayersRemove_=function(n){var u=n.element,r=Ai(u);this.listenerKeys_[r].forEach(Ao),delete this.listenerKeys_[r],this.dispatchEvent(new hf("removelayer",u)),this.changed()},c.prototype.getLayers=function(){return this.get(g_.LAYERS)},c.prototype.setLayers=function(n){var u=this.getLayers();if(u)for(var r=u.getArray(),s=0,P=r.length;s<P;++s)this.dispatchEvent(new hf("removelayer",r[s]));this.set(g_.LAYERS,n)},c.prototype.getLayersArray=function(n){var u=n!==void 0?n:[];return this.getLayers().forEach(function(r){r.getLayersArray(u)}),u},c.prototype.getLayerStatesArray=function(n){var u=n!==void 0?n:[],r=u.length;this.getLayers().forEach(function(V){V.getLayerStatesArray(u)});var s=this.getLayerState(),P=s.zIndex;!n&&s.zIndex===void 0&&(P=0);for(var z=r,F=u.length;z<F;z++){var N=u[z];N.opacity*=s.opacity,N.visible=N.visible&&s.visible,N.maxResolution=Math.min(N.maxResolution,s.maxResolution),N.minResolution=Math.max(N.minResolution,s.minResolution),N.minZoom=Math.max(N.minZoom,s.minZoom),N.maxZoom=Math.min(N.maxZoom,s.maxZoom),s.extent!==void 0&&(N.extent!==void 0?N.extent=Xv(N.extent,s.extent):N.extent=s.extent),N.zIndex===void 0&&(N.zIndex=P)}return u},c.prototype.getSourceState=function(){return Su.READY},c}(Gm),y_=M2;var ia={SINGLECLICK:"singleclick",CLICK:Ji.CLICK,DBLCLICK:Ji.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var __={ACTIVE:"active"};var k2=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),L2=function(_){k2(c,_);function c(n){var u=_.call(this)||this;return u.on,u.once,u.un,n&&n.handleEvent&&(u.handleEvent=n.handleEvent),u.map_=null,u.setActive(!0),u}return c.prototype.getActive=function(){return this.get(__.ACTIVE)},c.prototype.getMap=function(){return this.map_},c.prototype.handleEvent=function(n){return!0},c.prototype.setActive=function(n){this.set(__.ACTIVE,n)},c.prototype.setMap=function(n){this.map_=n},c}(Po);var w0=L2;var R2=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),z2=function(_){R2(c,_);function c(n){var u=this,r=n||{};return u=_.call(this,r)||this,r.handleDownEvent&&(u.handleDownEvent=r.handleDownEvent),r.handleDragEvent&&(u.handleDragEvent=r.handleDragEvent),r.handleMoveEvent&&(u.handleMoveEvent=r.handleMoveEvent),r.handleUpEvent&&(u.handleUpEvent=r.handleUpEvent),r.stopDown&&(u.stopDown=r.stopDown),u.handlingDownUpSequence=!1,u.trackedPointers_={},u.targetPointers=[],u}return c.prototype.getPointerCount=function(){return this.targetPointers.length},c.prototype.handleDownEvent=function(n){return!1},c.prototype.handleDragEvent=function(n){},c.prototype.handleEvent=function(n){if(!n.originalEvent)return!0;var u=!1;if(this.updateTrackedPointers_(n),this.handlingDownUpSequence){if(n.type==ia.POINTERDRAG)this.handleDragEvent(n),n.originalEvent.preventDefault();else if(n.type==ia.POINTERUP){var r=this.handleUpEvent(n);this.handlingDownUpSequence=r&&this.targetPointers.length>0}}else if(n.type==ia.POINTERDOWN){var s=this.handleDownEvent(n);this.handlingDownUpSequence=s,u=this.stopDown(s)}else n.type==ia.POINTERMOVE&&this.handleMoveEvent(n);return!u},c.prototype.handleMoveEvent=function(n){},c.prototype.handleUpEvent=function(n){return!1},c.prototype.stopDown=function(n){return n},c.prototype.updateTrackedPointers_=function(n){if(D2(n)){var u=n.originalEvent,r=u.pointerId.toString();n.type==ia.POINTERUP?delete this.trackedPointers_[r]:n.type==ia.POINTERDOWN?this.trackedPointers_[r]=u:r in this.trackedPointers_&&(this.trackedPointers_[r]=u),this.targetPointers=Im(this.trackedPointers_)}},c}(w0);function D2(_){var c=_.type;return c===ia.POINTERDOWN||c===ia.POINTERDRAG||c===ia.POINTERUP}var E0=z2;var T0=function(_){var c=_.originalEvent;return c.altKey&&!(c.metaKey||c.ctrlKey)&&!c.shiftKey};var S0=Sm,I0=function(_){return _.type==ia.CLICK};var C0=function(_){return _.type==ia.SINGLECLICK};var A0=function(_){var c=_.originalEvent;return wn(c!==void 0,56),c.isPrimary&&c.button===0};var O2=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),F2=function(_){O2(c,_);function c(n,u,r){var s=_.call(this)||this;if(s.ends_=[],s.maxDelta_=-1,s.maxDeltaRevision_=-1,Array.isArray(n[0]))s.setCoordinates(n,u);else if(u!==void 0&&r)s.setFlatCoordinates(u,n),s.ends_=r;else{for(var P=s.getLayout(),z=n,F=[],N=[],V=0,me=z.length;V<me;++V){var be=z[V];V===0&&(P=be.getLayout()),Ha(F,be.getFlatCoordinates()),N.push(F.length)}s.setFlatCoordinates(P,F),s.ends_=N}return s}return c.prototype.appendLineString=function(n){this.flatCoordinates?Ha(this.flatCoordinates,n.getFlatCoordinates().slice()):this.flatCoordinates=n.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()},c.prototype.clone=function(){var n=new c(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return n.applyProperties(this),n},c.prototype.closestPointXY=function(n,u,r,s){return s<xs(this.getExtent(),n,u)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(nd(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),ad(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,n,u,r,s))},c.prototype.getCoordinateAtM=function(n,u,r){if(this.layout!=An.XYM&&this.layout!=An.XYZM||this.flatCoordinates.length===0)return null;var s=u!==void 0?u:!1,P=r!==void 0?r:!1;return Lx(this.flatCoordinates,0,this.ends_,this.stride,n,s,P)},c.prototype.getCoordinates=function(){return ph(this.flatCoordinates,0,this.ends_,this.stride)},c.prototype.getEnds=function(){return this.ends_},c.prototype.getLineString=function(n){return n<0||this.ends_.length<=n?null:new uc(this.flatCoordinates.slice(n===0?0:this.ends_[n-1],this.ends_[n]),this.layout)},c.prototype.getLineStrings=function(){for(var n=this.flatCoordinates,u=this.ends_,r=this.layout,s=[],P=0,z=0,F=u.length;z<F;++z){var N=u[z],V=new uc(n.slice(P,N),r);s.push(V),P=N}return s},c.prototype.getFlatMidpoints=function(){for(var n=[],u=this.flatCoordinates,r=0,s=this.ends_,P=this.stride,z=0,F=s.length;z<F;++z){var N=s[z],V=Km(u,r,N,P,.5);Ha(n,V),r=N}return n},c.prototype.getSimplifiedGeometryInternal=function(n){var u=[],r=[];return u.length=xx(this.flatCoordinates,0,this.ends_,this.stride,n,u,0,r),new c(u,An.XY,r)},c.prototype.getType=function(){return Pt.MULTI_LINE_STRING},c.prototype.intersectsExtent=function(n){return Ix(this.flatCoordinates,0,this.ends_,this.stride,n)},c.prototype.setCoordinates=function(n,u){this.setLayout(u,n,2),this.flatCoordinates||(this.flatCoordinates=[]);var r=sd(this.flatCoordinates,0,n,this.stride,this.ends_);this.flatCoordinates.length=r.length===0?0:r[r.length-1],this.changed()},c}(Es),P0=F2;var B2=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),U2=function(_){B2(c,_);function c(n,u){var r=_.call(this)||this;return u&&!Array.isArray(n[0])?r.setFlatCoordinates(u,n):r.setCoordinates(n,u),r}return c.prototype.appendPoint=function(n){this.flatCoordinates?Ha(this.flatCoordinates,n.getFlatCoordinates()):this.flatCoordinates=n.getFlatCoordinates().slice(),this.changed()},c.prototype.clone=function(){var n=new c(this.flatCoordinates.slice(),this.layout);return n.applyProperties(this),n},c.prototype.closestPointXY=function(n,u,r,s){if(s<xs(this.getExtent(),n,u))return s;for(var P=this.flatCoordinates,z=this.stride,F=0,N=P.length;F<N;F+=z){var V=ql(n,u,P[F],P[F+1]);if(V<s){s=V;for(var me=0;me<z;++me)r[me]=P[F+me];r.length=z}}return s},c.prototype.getCoordinates=function(){return vl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)},c.prototype.getPoint=function(n){var u=this.flatCoordinates?this.flatCoordinates.length/this.stride:0;return n<0||u<=n?null:new ya(this.flatCoordinates.slice(n*this.stride,(n+1)*this.stride),this.layout)},c.prototype.getPoints=function(){for(var n=this.flatCoordinates,u=this.layout,r=this.stride,s=[],P=0,z=n.length;P<z;P+=r){var F=new ya(n.slice(P,P+r),u);s.push(F)}return s},c.prototype.getType=function(){return Pt.MULTI_POINT},c.prototype.intersectsExtent=function(n){for(var u=this.flatCoordinates,r=this.stride,s=0,P=u.length;s<P;s+=r){var z=u[s],F=u[s+1];if(Jf(n,z,F))return!0}return!1},c.prototype.setCoordinates=function(n,u){this.setLayout(u,n,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Yh(this.flatCoordinates,0,n,this.stride),this.changed()},c}(Es),ng=U2;function M0(_,c,n,u){for(var r=[],s=Ya(),P=0,z=n.length;P<z;++P){var F=n[P];s=Fm(_,c,F[0],u),r.push((s[0]+s[2])/2,(s[1]+s[3])/2),c=F[F.length-1]}return r}var N2=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),V2=function(_){N2(c,_);function c(n,u,r){var s=_.call(this)||this;if(s.endss_=[],s.flatInteriorPointsRevision_=-1,s.flatInteriorPoints_=null,s.maxDelta_=-1,s.maxDeltaRevision_=-1,s.orientedRevision_=-1,s.orientedFlatCoordinates_=null,!r&&!Array.isArray(n[0])){for(var P=s.getLayout(),z=n,F=[],N=[],V=0,me=z.length;V<me;++V){var be=z[V];V===0&&(P=be.getLayout());for(var Se=F.length,Ve=be.getEnds(),Ke=0,Ie=Ve.length;Ke<Ie;++Ke)Ve[Ke]+=Se;Ha(F,be.getFlatCoordinates()),N.push(Ve)}u=P,n=F,r=N}return u!==void 0&&r?(s.setFlatCoordinates(u,n),s.endss_=r):s.setCoordinates(n,u),s}return c.prototype.appendPolygon=function(n){var u;if(!this.flatCoordinates)this.flatCoordinates=n.getFlatCoordinates().slice(),u=n.getEnds().slice(),this.endss_.push();else{var r=this.flatCoordinates.length;Ha(this.flatCoordinates,n.getFlatCoordinates()),u=n.getEnds().slice();for(var s=0,P=u.length;s<P;++s)u[s]+=r}this.endss_.push(u),this.changed()},c.prototype.clone=function(){for(var n=this.endss_.length,u=new Array(n),r=0;r<n;++r)u[r]=this.endss_[r].slice();var s=new c(this.flatCoordinates.slice(),this.layout,u);return s.applyProperties(this),s},c.prototype.closestPointXY=function(n,u,r,s){return s<xs(this.getExtent(),n,u)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(gx(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),yx(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,n,u,r,s))},c.prototype.containsXY=function(n,u){return Tx(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,n,u)},c.prototype.getArea=function(){return wx(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)},c.prototype.getCoordinates=function(n){var u;return n!==void 0?(u=this.getOrientedFlatCoordinates().slice(),Wy(u,0,this.endss_,this.stride,n)):u=this.flatCoordinates,ud(u,0,this.endss_,this.stride)},c.prototype.getEndss=function(){return this.endss_},c.prototype.getFlatInteriorPoints=function(){if(this.flatInteriorPointsRevision_!=this.getRevision()){var n=M0(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=Sx(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,n),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_},c.prototype.getInteriorPoints=function(){return new ng(this.getFlatInteriorPoints().slice(),An.XYM)},c.prototype.getOrientedFlatCoordinates=function(){if(this.orientedRevision_!=this.getRevision()){var n=this.flatCoordinates;Mx(n,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=n:(this.orientedFlatCoordinates_=n.slice(),this.orientedFlatCoordinates_.length=Wy(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_},c.prototype.getSimplifiedGeometryInternal=function(n){var u=[],r=[];return u.length=bx(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(n),u,0,r),new c(u,An.XY,r)},c.prototype.getPolygon=function(n){if(n<0||this.endss_.length<=n)return null;var u;if(n===0)u=0;else{var r=this.endss_[n-1];u=r[r.length-1]}var s=this.endss_[n].slice(),P=s[s.length-1];if(u!==0)for(var z=0,F=s.length;z<F;++z)s[z]-=u;return new pd(this.flatCoordinates.slice(u,P),this.layout,s)},c.prototype.getPolygons=function(){for(var n=this.layout,u=this.flatCoordinates,r=this.endss_,s=[],P=0,z=0,F=r.length;z<F;++z){var N=r[z].slice(),V=N[N.length-1];if(P!==0)for(var me=0,be=N.length;me<be;++me)N[me]-=P;var Se=new pd(u.slice(P,V),n,N);s.push(Se),P=V}return s},c.prototype.getType=function(){return Pt.MULTI_POLYGON},c.prototype.intersectsExtent=function(n){return Cx(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,n)},c.prototype.setCoordinates=function(n,u){this.setLayout(u,n,3),this.flatCoordinates||(this.flatCoordinates=[]);var r=vx(this.flatCoordinates,0,n,this.stride,this.endss_);if(r.length===0)this.flatCoordinates.length=0;else{var s=r[r.length-1];this.flatCoordinates.length=s.length===0?0:s[s.length-1]}this.changed()},c}(Es),k0=V2;var O0=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),L0=0,xd=1,R0=[0,0,0,0],pf=[],v_={MODIFYSTART:"modifystart",MODIFYEND:"modifyend"},x_=function(_){O0(c,_);function c(n,u,r){var s=_.call(this,n)||this;return s.features=u,s.mapBrowserEvent=r,s}return c}(La);var G2=function(_){O0(c,_);function c(n){var u=_.call(this,n)||this;u.on,u.once,u.un,u.boundHandleFeatureChange_=u.handleFeatureChange_.bind(u),u.condition_=n.condition?n.condition:A0,u.defaultDeleteCondition_=function(s){return T0(s)&&C0(s)},u.deleteCondition_=n.deleteCondition?n.deleteCondition:u.defaultDeleteCondition_,u.insertVertexCondition_=n.insertVertexCondition?n.insertVertexCondition:S0,u.vertexFeature_=null,u.vertexSegments_=null,u.lastPixel_=[0,0],u.ignoreNextSingleClick_=!1,u.featuresBeingModified_=null,u.rBush_=new vd,u.pixelTolerance_=n.pixelTolerance!==void 0?n.pixelTolerance:10,u.snappedToVertex_=!1,u.changingFeature_=!1,u.dragSegments_=[],u.overlay_=new tp({source:new rp({useSpatialIndex:!1,wrapX:!!n.wrapX}),style:n.style?n.style:q2(),updateWhileAnimating:!0,updateWhileInteracting:!0}),u.SEGMENT_WRITERS_={Point:u.writePointGeometry_.bind(u),LineString:u.writeLineStringGeometry_.bind(u),LinearRing:u.writeLineStringGeometry_.bind(u),Polygon:u.writePolygonGeometry_.bind(u),MultiPoint:u.writeMultiPointGeometry_.bind(u),MultiLineString:u.writeMultiLineStringGeometry_.bind(u),MultiPolygon:u.writeMultiPolygonGeometry_.bind(u),Circle:u.writeCircleGeometry_.bind(u),GeometryCollection:u.writeGeometryCollectionGeometry_.bind(u)},u.source_=null,u.hitDetection_=null;var r;if(n.features?r=n.features:n.source&&(u.source_=n.source,r=new ch(u.source_.getFeatures()),u.source_.addEventListener(Qa.ADDFEATURE,u.handleSourceAdd_.bind(u)),u.source_.addEventListener(Qa.REMOVEFEATURE,u.handleSourceRemove_.bind(u))),!r)throw new Error("The modify interaction requires features, a source or a layer");return n.hitDetection&&(u.hitDetection_=n.hitDetection),u.features_=r,u.features_.forEach(u.addFeature_.bind(u)),u.features_.addEventListener(ws.ADD,u.handleFeatureAdd_.bind(u)),u.features_.addEventListener(ws.REMOVE,u.handleFeatureRemove_.bind(u)),u.lastPointerEvent_=null,u.delta_=[0,0],u.snapToPointer_=n.snapToPointer===void 0?!u.hitDetection_:n.snapToPointer,u}return c.prototype.addFeature_=function(n){var u=n.getGeometry();if(u){var r=this.SEGMENT_WRITERS_[u.getType()];r&&r(n,u)}var s=this.getMap();s&&s.isRendered()&&this.getActive()&&this.handlePointerAtPixel_(this.lastPixel_,s),n.addEventListener(Ji.CHANGE,this.boundHandleFeatureChange_)},c.prototype.willModifyFeatures_=function(n,u){if(!this.featuresBeingModified_){this.featuresBeingModified_=new ch;for(var r=this.featuresBeingModified_.getArray(),s=0,P=u.length;s<P;++s)for(var z=u[s],F=0,N=z.length;F<N;++F){var V=z[F].feature;V&&r.indexOf(V)===-1&&this.featuresBeingModified_.push(V)}this.featuresBeingModified_.getLength()===0?this.featuresBeingModified_=null:this.dispatchEvent(new x_(v_.MODIFYSTART,this.featuresBeingModified_,n))}},c.prototype.removeFeature_=function(n){this.removeFeatureSegmentData_(n),this.vertexFeature_&&this.features_.getLength()===0&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),n.removeEventListener(Ji.CHANGE,this.boundHandleFeatureChange_)},c.prototype.removeFeatureSegmentData_=function(n){var u=this.rBush_,r=[];u.forEach(function(F){n===F.feature&&r.push(F)});for(var s=r.length-1;s>=0;--s){for(var P=r[s],z=this.dragSegments_.length-1;z>=0;--z)this.dragSegments_[z][0]===P&&this.dragSegments_.splice(z,1);u.remove(P)}},c.prototype.setActive=function(n){this.vertexFeature_&&!n&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),_.prototype.setActive.call(this,n)},c.prototype.setMap=function(n){this.overlay_.setMap(n),_.prototype.setMap.call(this,n)},c.prototype.getOverlay=function(){return this.overlay_},c.prototype.handleSourceAdd_=function(n){n.feature&&this.features_.push(n.feature)},c.prototype.handleSourceRemove_=function(n){n.feature&&this.features_.remove(n.feature)},c.prototype.handleFeatureAdd_=function(n){this.addFeature_(n.element)},c.prototype.handleFeatureChange_=function(n){if(!this.changingFeature_){var u=n.target;this.removeFeature_(u),this.addFeature_(u)}},c.prototype.handleFeatureRemove_=function(n){var u=n.element;this.removeFeature_(u)},c.prototype.writePointGeometry_=function(n,u){var r=u.getCoordinates(),s={feature:n,geometry:u,segment:[r,r]};this.rBush_.insert(u.getExtent(),s)},c.prototype.writeMultiPointGeometry_=function(n,u){for(var r=u.getCoordinates(),s=0,P=r.length;s<P;++s){var z=r[s],F={feature:n,geometry:u,depth:[s],index:s,segment:[z,z]};this.rBush_.insert(u.getExtent(),F)}},c.prototype.writeLineStringGeometry_=function(n,u){for(var r=u.getCoordinates(),s=0,P=r.length-1;s<P;++s){var z=r.slice(s,s+2),F={feature:n,geometry:u,index:s,segment:z};this.rBush_.insert(wu(z),F)}},c.prototype.writeMultiLineStringGeometry_=function(n,u){for(var r=u.getCoordinates(),s=0,P=r.length;s<P;++s)for(var z=r[s],F=0,N=z.length-1;F<N;++F){var V=z.slice(F,F+2),me={feature:n,geometry:u,depth:[s],index:F,segment:V};this.rBush_.insert(wu(V),me)}},c.prototype.writePolygonGeometry_=function(n,u){for(var r=u.getCoordinates(),s=0,P=r.length;s<P;++s)for(var z=r[s],F=0,N=z.length-1;F<N;++F){var V=z.slice(F,F+2),me={feature:n,geometry:u,depth:[s],index:F,segment:V};this.rBush_.insert(wu(V),me)}},c.prototype.writeMultiPolygonGeometry_=function(n,u){for(var r=u.getCoordinates(),s=0,P=r.length;s<P;++s)for(var z=r[s],F=0,N=z.length;F<N;++F)for(var V=z[F],me=0,be=V.length-1;me<be;++me){var Se=V.slice(me,me+2),Ve={feature:n,geometry:u,depth:[F,s],index:me,segment:Se};this.rBush_.insert(wu(Se),Ve)}},c.prototype.writeCircleGeometry_=function(n,u){var r=u.getCenter(),s={feature:n,geometry:u,index:L0,segment:[r,r]},P={feature:n,geometry:u,index:xd,segment:[r,r]},z=[s,P];s.featureSegments=z,P.featureSegments=z,this.rBush_.insert(Yp(r),s);var F=u,N=uh();if(N&&this.getMap()){var V=this.getMap().getView().getProjection();F=F.clone().transform(N,V),F=$y(F).transform(V,N)}this.rBush_.insert(F.getExtent(),P)},c.prototype.writeGeometryCollectionGeometry_=function(n,u){for(var r=u.getGeometriesArray(),s=0;s<r.length;++s){var P=r[s],z=this.SEGMENT_WRITERS_[P.getType()];z(n,P)}},c.prototype.createOrUpdateVertexFeature_=function(n,u,r){var s=this.vertexFeature_;if(!s)s=new lc(new ya(n)),this.vertexFeature_=s,this.overlay_.getSource().addFeature(s);else{var P=s.getGeometry();P.setCoordinates(n)}return s.set("features",u),s.set("geometries",r),s},c.prototype.handleEvent=function(n){if(!n.originalEvent)return!0;this.lastPointerEvent_=n;var u;return!n.map.getView().getInteracting()&&n.type==ia.POINTERMOVE&&!this.handlingDownUpSequence&&this.handlePointerMove_(n),this.vertexFeature_&&this.deleteCondition_(n)&&(n.type!=ia.SINGLECLICK||!this.ignoreNextSingleClick_?u=this.removePoint():u=!0),n.type==ia.SINGLECLICK&&(this.ignoreNextSingleClick_=!1),_.prototype.handleEvent.call(this,n)&&!u},c.prototype.handleDragEvent=function(n){this.ignoreNextSingleClick_=!1,this.willModifyFeatures_(n,this.dragSegments_);for(var u=[n.coordinate[0]+this.delta_[0],n.coordinate[1]+this.delta_[1]],r=[],s=[],P=0,z=this.dragSegments_.length;P<z;++P){var F=this.dragSegments_[P],N=F[0],V=N.feature;r.indexOf(V)===-1&&r.push(V);var me=N.geometry;s.indexOf(me)===-1&&s.push(me);for(var be=N.depth,Se=void 0,Ve=N.segment,Ke=F[1];u.length<me.getStride();)u.push(Ve[Ke][u.length]);switch(me.getType()){case Pt.POINT:Se=u,Ve[0]=u,Ve[1]=u;break;case Pt.MULTI_POINT:Se=me.getCoordinates(),Se[N.index]=u,Ve[0]=u,Ve[1]=u;break;case Pt.LINE_STRING:Se=me.getCoordinates(),Se[N.index+Ke]=u,Ve[Ke]=u;break;case Pt.MULTI_LINE_STRING:Se=me.getCoordinates(),Se[be[0]][N.index+Ke]=u,Ve[Ke]=u;break;case Pt.POLYGON:Se=me.getCoordinates(),Se[be[0]][N.index+Ke]=u,Ve[Ke]=u;break;case Pt.MULTI_POLYGON:Se=me.getCoordinates(),Se[be[1]][be[0]][N.index+Ke]=u,Ve[Ke]=u;break;case Pt.CIRCLE:if(Ve[0]=u,Ve[1]=u,N.index===L0)this.changingFeature_=!0,me.setCenter(u),this.changingFeature_=!1;else{this.changingFeature_=!0;var Ie=n.map.getView().getProjection(),Ge=wy(Xl(me.getCenter(),Ie),Xl(u,Ie)),et=uh();if(et){var rt=me.clone().transform(et,Ie);rt.setRadius(Ge),Ge=rt.transform(Ie,et).getRadius()}me.setRadius(Ge),this.changingFeature_=!1}break;default:}Se&&this.setGeometryCoordinates_(me,Se)}this.createOrUpdateVertexFeature_(u,r,s)},c.prototype.handleDownEvent=function(n){if(!this.condition_(n))return!1;var u=n.coordinate;this.handlePointerAtPixel_(n.pixel,n.map,u),this.dragSegments_.length=0,this.featuresBeingModified_=null;var r=this.vertexFeature_;if(r){var s=n.map.getView().getProjection(),P=[],z=r.getGeometry().getCoordinates(),F=wu([z]),N=this.rBush_.getInExtent(F),V={};N.sort(j2);for(var me=0,be=N.length;me<be;++me){var Se=N[me],Ve=Se.segment,Ke=Ai(Se.geometry),Ie=Se.depth;if(Ie&&(Ke+="-"+Ie.join("-")),V[Ke]||(V[Ke]=new Array(2)),Se.geometry.getType()===Pt.CIRCLE&&Se.index===xd){var Ge=D0(u,Se,s);Tu(Ge,z)&&!V[Ke][0]&&(this.dragSegments_.push([Se,0]),V[Ke][0]=Se);continue}if(Tu(Ve[0],z)&&!V[Ke][0]){this.dragSegments_.push([Se,0]),V[Ke][0]=Se;continue}if(Tu(Ve[1],z)&&!V[Ke][1]){if((Se.geometry.getType()===Pt.LINE_STRING||Se.geometry.getType()===Pt.MULTI_LINE_STRING)&&V[Ke][0]&&V[Ke][0].index===0)continue;this.dragSegments_.push([Se,1]),V[Ke][1]=Se;continue}Ai(Ve)in this.vertexSegments_&&!V[Ke][0]&&!V[Ke][1]&&this.insertVertexCondition_(n)&&P.push(Se)}P.length&&this.willModifyFeatures_(n,[P]);for(var et=P.length-1;et>=0;--et)this.insertVertex_(P[et],z)}return!!this.vertexFeature_},c.prototype.handleUpEvent=function(n){for(var u=this.dragSegments_.length-1;u>=0;--u){var r=this.dragSegments_[u][0],s=r.geometry;if(s.getType()===Pt.CIRCLE){var P=s.getCenter(),z=r.featureSegments[0],F=r.featureSegments[1];z.segment[0]=P,z.segment[1]=P,F.segment[0]=P,F.segment[1]=P,this.rBush_.update(Yp(P),z);var N=s,V=uh();if(V){var me=n.map.getView().getProjection();N=N.clone().transform(V,me),N=$y(N).transform(me,V)}this.rBush_.update(N.getExtent(),F)}else this.rBush_.update(wu(r.segment),r)}return this.featuresBeingModified_&&(this.dispatchEvent(new x_(v_.MODIFYEND,this.featuresBeingModified_,n)),this.featuresBeingModified_=null),!1},c.prototype.handlePointerMove_=function(n){this.lastPixel_=n.pixel,this.handlePointerAtPixel_(n.pixel,n.map,n.coordinate)},c.prototype.handlePointerAtPixel_=function(n,u,r){var s=this,P=r||u.getCoordinateFromPixel(n),z=u.getView().getProjection(),F=function(Mt,Br){return z0(P,Mt,z)-z0(P,Br,z)},N,V;if(this.hitDetection_){var me=typeof this.hitDetection_=="object"?function(Mt){return Mt===s.hitDetection_}:void 0;u.forEachFeatureAtPixel(n,function(Mt,Br,Tr){if(Tr=Tr||Mt.getGeometry(),Tr.getType()===Pt.POINT&&gv(s.features_.getArray(),Mt)){V=Tr;var br=Tr.getFlatCoordinates().slice(0,2);N=[{feature:Mt,geometry:Tr,segment:[br,br]}]}return!0},{layerFilter:me})}if(!N){var be=td(Yp(P,R0),z),Se=u.getView().getResolution()*this.pixelTolerance_,Ve=Qp(yl(be,Se,R0),z);N=this.rBush_.getInExtent(Ve)}if(N&&N.length>0){var Ke=N.sort(F)[0],Ie=Ke.segment,Ge=D0(P,Ke,z),et=u.getPixelFromCoordinate(Ge),rt=wy(n,et);if(V||rt<=this.pixelTolerance_){var _t={};if(_t[Ai(Ie)]=!0,this.snapToPointer_||(this.delta_[0]=Ge[0]-P[0],this.delta_[1]=Ge[1]-P[1]),Ke.geometry.getType()===Pt.CIRCLE&&Ke.index===xd)this.snappedToVertex_=!0,this.createOrUpdateVertexFeature_(Ge,[Ke.feature],[Ke.geometry]);else{var yt=u.getPixelFromCoordinate(Ie[0]),ct=u.getPixelFromCoordinate(Ie[1]),Tt=Jp(et,yt),St=Jp(et,ct);rt=Math.sqrt(Math.min(Tt,St)),this.snappedToVertex_=rt<=this.pixelTolerance_,this.snappedToVertex_&&(Ge=Tt>St?Ie[1]:Ie[0]),this.createOrUpdateVertexFeature_(Ge,[Ke.feature],[Ke.geometry]);var Lt={};Lt[Ai(Ke.geometry)]=!0;for(var ur=1,Vt=N.length;ur<Vt;++ur){var Qt=N[ur].segment;if(Tu(Ie[0],Qt[0])&&Tu(Ie[1],Qt[1])||Tu(Ie[0],Qt[1])&&Tu(Ie[1],Qt[0])){var or=Ai(N[ur].geometry);or in Lt||(Lt[or]=!0,_t[Ai(Qt)]=!0)}else break}}this.vertexSegments_=_t;return}}this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null)},c.prototype.insertVertex_=function(n,u){for(var r=n.segment,s=n.feature,P=n.geometry,z=n.depth,F=n.index,N;u.length<P.getStride();)u.push(0);switch(P.getType()){case Pt.MULTI_LINE_STRING:N=P.getCoordinates(),N[z[0]].splice(F+1,0,u);break;case Pt.POLYGON:N=P.getCoordinates(),N[z[0]].splice(F+1,0,u);break;case Pt.MULTI_POLYGON:N=P.getCoordinates(),N[z[1]][z[0]].splice(F+1,0,u);break;case Pt.LINE_STRING:N=P.getCoordinates(),N.splice(F+1,0,u);break;default:return}this.setGeometryCoordinates_(P,N);var V=this.rBush_;V.remove(n),this.updateSegmentIndices_(P,F,z,1);var me={segment:[r[0],u],feature:s,geometry:P,depth:z,index:F};V.insert(wu(me.segment),me),this.dragSegments_.push([me,1]);var be={segment:[u,r[1]],feature:s,geometry:P,depth:z,index:F+1};V.insert(wu(be.segment),be),this.dragSegments_.push([be,0]),this.ignoreNextSingleClick_=!0},c.prototype.removePoint=function(){if(this.lastPointerEvent_&&this.lastPointerEvent_.type!=ia.POINTERDRAG){var n=this.lastPointerEvent_;this.willModifyFeatures_(n,this.dragSegments_);var u=this.removeVertex_();return this.featuresBeingModified_&&this.dispatchEvent(new x_(v_.MODIFYEND,this.featuresBeingModified_,n)),this.featuresBeingModified_=null,u}return!1},c.prototype.removeVertex_=function(){var n=this.dragSegments_,u={},r=!1,s,P,z,F,N,V,me,be,Se,Ve,Ke;for(N=n.length-1;N>=0;--N)z=n[N],Ve=z[0],Ke=Ai(Ve.feature),Ve.depth&&(Ke+="-"+Ve.depth.join("-")),Ke in u||(u[Ke]={}),z[1]===0?(u[Ke].right=Ve,u[Ke].index=Ve.index):z[1]==1&&(u[Ke].left=Ve,u[Ke].index=Ve.index+1);for(Ke in u){switch(Se=u[Ke].right,me=u[Ke].left,V=u[Ke].index,be=V-1,me!==void 0?Ve=me:Ve=Se,be<0&&(be=0),F=Ve.geometry,P=F.getCoordinates(),s=P,r=!1,F.getType()){case Pt.MULTI_LINE_STRING:P[Ve.depth[0]].length>2&&(P[Ve.depth[0]].splice(V,1),r=!0);break;case Pt.LINE_STRING:P.length>2&&(P.splice(V,1),r=!0);break;case Pt.MULTI_POLYGON:s=s[Ve.depth[1]];case Pt.POLYGON:s=s[Ve.depth[0]],s.length>4&&(V==s.length-1&&(V=0),s.splice(V,1),r=!0,V===0&&(s.pop(),s.push(s[0]),be=s.length-1));break;default:}if(r){this.setGeometryCoordinates_(F,P);var Ie=[];if(me!==void 0&&(this.rBush_.remove(me),Ie.push(me.segment[0])),Se!==void 0&&(this.rBush_.remove(Se),Ie.push(Se.segment[1])),me!==void 0&&Se!==void 0){var Ge={depth:Ve.depth,feature:Ve.feature,geometry:Ve.geometry,index:be,segment:Ie};this.rBush_.insert(wu(Ge.segment),Ge)}this.updateSegmentIndices_(F,V,Ve.depth,-1),this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),n.length=0}}return r},c.prototype.setGeometryCoordinates_=function(n,u){this.changingFeature_=!0,n.setCoordinates(u),this.changingFeature_=!1},c.prototype.updateSegmentIndices_=function(n,u,r,s){this.rBush_.forEachInExtent(n.getExtent(),function(P){P.geometry===n&&(r===void 0||P.depth===void 0||_s(P.depth,r))&&P.index>u&&(P.index+=s)})},c}(E0);function j2(_,c){return _.index-c.index}function z0(_,c,n){var u=c.geometry;if(u.getType()===Pt.CIRCLE){var r=u;if(c.index===xd){var s=uh();s&&(r=r.clone().transform(s,n));var P=Jp(r.getCenter(),Xl(_,n)),z=Math.sqrt(P)-r.getRadius();return z*z}}var F=Xl(_,n);return pf[0]=Xl(c.segment[0],n),pf[1]=Xl(c.segment[1],n),Yv(F,pf)}function D0(_,c,n){var u=c.geometry;if(u.getType()===Pt.CIRCLE&&c.index===xd){var r=u,s=uh();return s&&(r=r.clone().transform(s,n)),Sy(r.getClosestPoint(Xl(_,n)),n)}var P=Xl(_,n);return pf[0]=Xl(c.segment[0],n),pf[1]=Xl(c.segment[1],n),Sy(by(P,pf),n)}function q2(){var _=qx();return function(c,n){return _[Pt.POINT]}}var b_=G2;var Z2=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),X2=function(_){Z2(c,_);function c(n){var u=_.call(this)||this;return u.geometries_=n||null,u.changeEventsKeys_=[],u.listenGeometriesChange_(),u}return c.prototype.unlistenGeometriesChange_=function(){this.changeEventsKeys_.forEach(Ao),this.changeEventsKeys_.length=0},c.prototype.listenGeometriesChange_=function(){if(!!this.geometries_)for(var n=0,u=this.geometries_.length;n<u;++n)this.changeEventsKeys_.push(lo(this.geometries_[n],Ji.CHANGE,this.changed,this))},c.prototype.clone=function(){var n=new c(null);return n.setGeometries(this.geometries_),n.applyProperties(this),n},c.prototype.closestPointXY=function(n,u,r,s){if(s<xs(this.getExtent(),n,u))return s;for(var P=this.geometries_,z=0,F=P.length;z<F;++z)s=P[z].closestPointXY(n,u,r,s);return s},c.prototype.containsXY=function(n,u){for(var r=this.geometries_,s=0,P=r.length;s<P;++s)if(r[s].containsXY(n,u))return!0;return!1},c.prototype.computeExtent=function(n){Kp(n);for(var u=this.geometries_,r=0,s=u.length;r<s;++r)qv(n,u[r].getExtent());return n},c.prototype.getGeometries=function(){return F0(this.geometries_)},c.prototype.getGeometriesArray=function(){return this.geometries_},c.prototype.getGeometriesArrayRecursive=function(){for(var n=[],u=this.geometries_,r=0,s=u.length;r<s;++r)u[r].getType()===this.getType()?n=n.concat(u[r].getGeometriesArrayRecursive()):n.push(u[r]);return n},c.prototype.getSimplifiedGeometry=function(n){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),n<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&n<this.simplifiedGeometryMaxMinSquaredTolerance)return this;for(var u=[],r=this.geometries_,s=!1,P=0,z=r.length;P<z;++P){var F=r[P],N=F.getSimplifiedGeometry(n);u.push(N),N!==F&&(s=!0)}if(s){var V=new c(null);return V.setGeometriesArray(u),V}else return this.simplifiedGeometryMaxMinSquaredTolerance=n,this},c.prototype.getType=function(){return Pt.GEOMETRY_COLLECTION},c.prototype.intersectsExtent=function(n){for(var u=this.geometries_,r=0,s=u.length;r<s;++r)if(u[r].intersectsExtent(n))return!0;return!1},c.prototype.isEmpty=function(){return this.geometries_.length===0},c.prototype.rotate=function(n,u){for(var r=this.geometries_,s=0,P=r.length;s<P;++s)r[s].rotate(n,u);this.changed()},c.prototype.scale=function(n,u,r){var s=r;s||(s=$h(this.getExtent()));for(var P=this.geometries_,z=0,F=P.length;z<F;++z)P[z].scale(n,u,s);this.changed()},c.prototype.setGeometries=function(n){this.setGeometriesArray(F0(n))},c.prototype.setGeometriesArray=function(n){this.unlistenGeometriesChange_(),this.geometries_=n,this.listenGeometriesChange_(),this.changed()},c.prototype.applyTransform=function(n){for(var u=this.geometries_,r=0,s=u.length;r<s;++r)u[r].applyTransform(n);this.changed()},c.prototype.translate=function(n,u){for(var r=this.geometries_,s=0,P=r.length;s<P;++s)r[s].translate(n,u);this.changed()},c.prototype.disposeInternal=function(){this.unlistenGeometriesChange_(),_.prototype.disposeInternal.call(this)},c}(Xm);function F0(_){for(var c=[],n=0,u=_.length;n<u;++n)c.push(_[n].clone());return c}var B0=X2;var W2=function(){function _(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.supportedMediaTypes=null}return _.prototype.getReadOptions=function(c,n){var u;if(n){var r=n.dataProjection?ga(n.dataProjection):this.readProjection(c);n.extent&&r&&r.getUnits()===ac.TILE_PIXELS&&(r=ga(r),r.setWorldExtent(n.extent)),u={dataProjection:r,featureProjection:n.featureProjection}}return this.adaptOptions(u)},_.prototype.adaptOptions=function(c){return Ra({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection},c)},_.prototype.getType=function(){return jr()},_.prototype.readFeature=function(c,n){return jr()},_.prototype.readFeatures=function(c,n){return jr()},_.prototype.readGeometry=function(c,n){return jr()},_.prototype.readProjection=function(c){return jr()},_.prototype.writeFeature=function(c,n){return jr()},_.prototype.writeFeatures=function(c,n){return jr()},_.prototype.writeGeometry=function(c,n){return jr()},_}(),U0=W2;function w_(_,c,n){var u=n?ga(n.featureProjection):null,r=n?ga(n.dataProjection):null,s;if(u&&r&&!tx(u,r)?s=(c?_.clone():_).transform(c?u:r,c?r:u):s=_,c&&n&&n.decimals!==void 0){var P=Math.pow(10,n.decimals),z=function(F){for(var N=0,V=F.length;N<V;++N)F[N]=Math.round(F[N]*P)/P;return F};s===_&&(s=_.clone()),s.applyTransform(z)}return s}var $2=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),H2=function(_){$2(c,_);function c(){return _.call(this)||this}return c.prototype.getType=function(){return _h.JSON},c.prototype.readFeature=function(n,u){return this.readFeatureFromObject(og(n),this.getReadOptions(n,u))},c.prototype.readFeatures=function(n,u){return this.readFeaturesFromObject(og(n),this.getReadOptions(n,u))},c.prototype.readFeatureFromObject=function(n,u){return jr()},c.prototype.readFeaturesFromObject=function(n,u){return jr()},c.prototype.readGeometry=function(n,u){return this.readGeometryFromObject(og(n),this.getReadOptions(n,u))},c.prototype.readGeometryFromObject=function(n,u){return jr()},c.prototype.readProjection=function(n){return this.readProjectionFromObject(og(n))},c.prototype.readProjectionFromObject=function(n){return jr()},c.prototype.writeFeature=function(n,u){return JSON.stringify(this.writeFeatureObject(n,u))},c.prototype.writeFeatureObject=function(n,u){return jr()},c.prototype.writeFeatures=function(n,u){return JSON.stringify(this.writeFeaturesObject(n,u))},c.prototype.writeFeaturesObject=function(n,u){return jr()},c.prototype.writeGeometry=function(n,u){return JSON.stringify(this.writeGeometryObject(n,u))},c.prototype.writeGeometryObject=function(n,u){return jr()},c}(U0);function og(_){if(typeof _=="string"){var c=JSON.parse(_);return c||null}else return _!==null?_:null}var N0=H2;var K2=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Y2=function(_){K2(c,_);function c(n){var u=this,r=n||{};return u=_.call(this)||this,u.dataProjection=ga(r.dataProjection?r.dataProjection:"EPSG:4326"),r.featureProjection&&(u.defaultFeatureProjection=ga(r.featureProjection)),u.geometryName_=r.geometryName,u.extractGeometryName_=r.extractGeometryName,u.supportedMediaTypes=["application/geo+json","application/vnd.geo+json"],u}return c.prototype.readFeatureFromObject=function(n,u){var r=null;n.type==="Feature"?r=n:r={type:"Feature",geometry:n,properties:null};var s=E_(r.geometry,u),P=new lc;return this.geometryName_?P.setGeometryName(this.geometryName_):this.extractGeometryName_&&"geometry_name"in r!==void 0&&P.setGeometryName(r.geometry_name),P.setGeometry(s),"id"in r&&P.setId(r.id),r.properties&&P.setProperties(r.properties,!0),P},c.prototype.readFeaturesFromObject=function(n,u){var r=n,s=null;if(r.type==="FeatureCollection"){var P=n;s=[];for(var z=P.features,F=0,N=z.length;F<N;++F)s.push(this.readFeatureFromObject(z[F],u))}else s=[this.readFeatureFromObject(n,u)];return s},c.prototype.readGeometryFromObject=function(n,u){return E_(n,u)},c.prototype.readProjectionFromObject=function(n){var u=n.crs,r;return u?u.type=="name"?r=ga(u.properties.name):u.type==="EPSG"?r=ga("EPSG:"+u.properties.code):wn(!1,36):r=this.dataProjection,r},c.prototype.writeFeatureObject=function(n,u){u=this.adaptOptions(u);var r={type:"Feature",geometry:null,properties:null},s=n.getId();if(s!==void 0&&(r.id=s),!n.hasProperties())return r;var P=n.getProperties(),z=n.getGeometry();return z&&(r.geometry=T_(z,u),delete P[n.getGeometryName()]),Vl(P)||(r.properties=P),r},c.prototype.writeFeaturesObject=function(n,u){u=this.adaptOptions(u);for(var r=[],s=0,P=n.length;s<P;++s)r.push(this.writeFeatureObject(n[s],u));return{type:"FeatureCollection",features:r}},c.prototype.writeGeometryObject=function(n,u){return T_(n,this.adaptOptions(u))},c}(N0);function E_(_,c){if(!_)return null;var n;switch(_.type){case Pt.POINT:{n=Q2(_);break}case Pt.LINE_STRING:{n=eE(_);break}case Pt.POLYGON:{n=nE(_);break}case Pt.MULTI_POINT:{n=rE(_);break}case Pt.MULTI_LINE_STRING:{n=tE(_);break}case Pt.MULTI_POLYGON:{n=iE(_);break}case Pt.GEOMETRY_COLLECTION:{n=J2(_);break}default:throw new Error("Unsupported GeoJSON type: "+_.type)}return w_(n,!1,c)}function J2(_,c){var n=_.geometries.map(function(u){return E_(u,c)});return new B0(n)}function Q2(_){return new ya(_.coordinates)}function eE(_){return new uc(_.coordinates)}function tE(_){return new P0(_.coordinates)}function rE(_){return new ng(_.coordinates)}function iE(_){return new k0(_.coordinates)}function nE(_){return new pd(_.coordinates)}function T_(_,c){_=w_(_,!0,c);var n=_.getType(),u;switch(n){case Pt.POINT:{u=cE(_,c);break}case Pt.LINE_STRING:{u=aE(_,c);break}case Pt.POLYGON:{u=hE(_,c);break}case Pt.MULTI_POINT:{u=lE(_,c);break}case Pt.MULTI_LINE_STRING:{u=sE(_,c);break}case Pt.MULTI_POLYGON:{u=uE(_,c);break}case Pt.GEOMETRY_COLLECTION:{u=oE(_,c);break}case Pt.CIRCLE:{u={type:"GeometryCollection",geometries:[]};break}default:throw new Error("Unsupported geometry type: "+n)}return u}function oE(_,c){var n=_.getGeometriesArray().map(function(u){var r=Ra({},c);return delete r.featureProjection,T_(u,r)});return{type:"GeometryCollection",geometries:n}}function aE(_,c){return{type:"LineString",coordinates:_.getCoordinates()}}function sE(_,c){return{type:"MultiLineString",coordinates:_.getCoordinates()}}function lE(_,c){return{type:"MultiPoint",coordinates:_.getCoordinates()}}function uE(_,c){var n;return c&&(n=c.rightHanded),{type:"MultiPolygon",coordinates:_.getCoordinates(n)}}function cE(_,c){return{type:"Point",coordinates:_.getCoordinates()}}function hE(_,c){var n;return c&&(n=c.rightHanded),{type:"Polygon",coordinates:_.getCoordinates(n)}}var bl=Y2;var ag,pE=new Uint8Array(16);function S_(){if(!ag&&(ag=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!ag))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ag(pE)}var V0=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function fE(_){return typeof _=="string"&&V0.test(_)}var G0=fE;var va=[];for(sg=0;sg<256;++sg)va.push((sg+256).toString(16).substr(1));var sg;function dE(_){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=(va[_[c+0]]+va[_[c+1]]+va[_[c+2]]+va[_[c+3]]+"-"+va[_[c+4]]+va[_[c+5]]+"-"+va[_[c+6]]+va[_[c+7]]+"-"+va[_[c+8]]+va[_[c+9]]+"-"+va[_[c+10]]+va[_[c+11]]+va[_[c+12]]+va[_[c+13]]+va[_[c+14]]+va[_[c+15]]).toLowerCase();if(!G0(n))throw TypeError("Stringified UUID is invalid");return n}var j0=dE;function mE(_,c,n){_=_||{};var u=_.random||(_.rng||S_)();if(u[6]=u[6]&15|64,u[8]=u[8]&63|128,c){n=n||0;for(var r=0;r<16;++r)c[n+r]=u[r];return c}return j0(u)}var I_=mE;var ip=class extends Po{constructor(n={}){super();this.defineProperties(n),n.properties&&this.setProperties(n.properties),this.visible=n.visible===void 0?!0:!!n.visible,this.group=n.group,this.copyrights=n.copyrights,this.children=n.children,this.on("change:visible:group",u=>{this.group===u.target.group&&this!==u.target&&this.visible?this.visible=!1:this.children&&this.children.forEach(r=>r.dispatchEvent(u))})}defineProperties(n={}){let{name:u,key:r,properties:s,hitTolerance:P}={...n},z=I_();Object.defineProperties(this,{name:{value:u},key:{value:r||u||z},group:{get:()=>this.get("group"),set:F=>{this.set("group",F)}},copyrights:{get:()=>this.get("copyrights"),set:F=>{let N=F&&!Array.isArray(F)?[F]:F;this.set("copyrights",N||[])}},options:{value:n},map:{writable:!0},visible:{get:()=>this.get("visible"),set:F=>{if(F!==this.visible)if(this.set("visible",F),this.visible){if(this.parent&&(this.parent.visible=!0),this.children&&!this.children.some(N=>N.visible)&&this.children.forEach(N=>{N.visible=!0}),this.parent&&this.group){let N=this.parent;for(;N.parent;)N=N.parent;let V=new La("change:visible:group");V.target=this,N.dispatchEvent(V)}}else this.visible||(this.children&&this.children.forEach(N=>{N.visible=!1}),this.parent&&this.parent.visible&&this.parent.children&&!this.parent.children.find(N=>N.visible)&&(this.parent.visible=!1))}},disabled:{get:()=>this.get("disabled"),set:F=>{this.set("disabled",F)}},parent:{value:null,writable:!0},children:{get:()=>this.get("children")||[],set:F=>{(this.children||[]).forEach(N=>{N.parent=void 0}),Array.isArray(F)&&F.forEach(N=>{N.parent=this}),this.set("children",F||[])}},hitTolerance:{value:P||5,writable:!0},properties:{value:{...s||{}}}})}attachToMap(n){this.detachFromMap(),this.map=n,this.children&&this.children.forEach(u=>{u.attachToMap(n)})}detachFromMap(){this.map=void 0}getFeatureInfoAtCoordinate(n,u){return console.error("getFeatureInfoAtCoordinate must be implemented by inheriting layers",this.key),Promise.resolve({layer:this,features:[],coordinate:n})}flat(){return $f(this)}};function gE(_){return class extends _{constructor(n={}){super(n);let{userInteractions:u=!0,userClickInteractions:r=!0,userHoverInteractions:s=!0,defaultUserInteractions:P=!0}=n;this.userInteractions=u,this.userClickInteractions=r,this.userHoverInteractions=s,this.defaultUserInteractions=P,this.userClickCallbacks=[],this.userHoverCallbacks=[],this.userClickEventsKeys=[],this.userHoverEventsKeys=[],this.onUserClickCallback=this.onUserClickCallback.bind(this),this.onUserMoveCallback=this.onUserMoveCallback.bind(this);let{onClick:z,onHover:F}=n;this.userInteractions&&this.userClickInteractions&&z&&this.onClick(z),this.userInteractions&&this.userHoverInteractions&&F&&this.onHover(F)}attachToMap(n){super.attachToMap(n),this.userInteractions&&this.defaultUserInteractions&&this.userClickInteractions&&this.onFeatureClick&&this.onClick(this.onFeatureClick),this.userInteractions&&this.defaultUserInteractions&&this.userHoverInteractions&&this.onFeatureHover&&this.onHover(this.onFeatureHover),this.listenEvents()}detachFromMap(){this.unlistenEvents(),super.detachFromMap()}listenEvents(){this.unlistenEvents(),this.userClickCallbacks.forEach(n=>{this.userClickEventsKeys.push(this.on("user:click",({target:{features:u,layer:r,coordinate:s,event:P}})=>{n(u,r,s,P)}))}),this.userHoverCallbacks.forEach(n=>{this.userHoverEventsKeys.push(this.on("user:hover",({target:{features:u,layer:r,coordinate:s,event:P}})=>{n(u,r,s,P)}))})}unlistenEvents(){Ka(this.userClickEventsKeys),Ka(this.userHoverEventsKeys),this.userClickEventsKeys=[],this.userHoverEventsKeys=[]}onClick(n){this.userClickCallbacks.push(n),this.activateUserInteractions(),this.map&&this.listenEvents()}onHover(n){this.userHoverCallbacks.push(n),this.activateUserInteractions(),this.map&&this.listenEvents()}unClick(n){let u=this.userClickCallbacks.indexOf(n);u===-1&&(this.userClickCallbacks=this.userClickCallbacks.slice(u,1),this.map&&this.listenEvents())}unHover(n){let u=this.userHoverCallbacks.indexOf(n);u===-1&&(this.userHoverCallbacks=this.userHoverCallbacks.slice(u,1),this.map&&this.listenEvents())}onUserClickCallback(n){let u=n.coordinate||uo(n.lngLat.toArray()),r={features:[],layer:this,coordinate:u,event:n};return this.getFeatureInfoAtCoordinate(u).then(s=>(this.dispatchEvent({type:"user:click",target:s}),s)).catch(()=>r)}onUserMoveCallback(n){let u=n.coordinate||uo(n.lngLat.toArray()),r={features:[],layer:this,coordinate:u,event:n};return this.getFeatureInfoAtCoordinate(u).then(s=>(this.dispatchEvent({type:"user:hover",target:s}),s)).catch(()=>r)}activateUserInteractions(){}deactivateUserInteractions(){}}}var lg=gE;var bd=class extends lg(ip){constructor(n){super(n);this.olLayer&&this.olLayer.setVisible(this.visible)}defineProperties(n){super.defineProperties(n),Object.defineProperties(this,{olLayer:{value:n.olLayer,writable:!0},olListenersKeys:{value:[]}})}attachToMap(n){if(super.attachToMap(n),!!this.map&&(this.olLayer&&!this.map?.getLayers()?.getArray()?.includes(this.olLayer)&&this.map.addLayer(this.olLayer),this.olListenersKeys.push(this.on("change:visible",()=>{this.olLayer&&this.olLayer.setVisible(this.visible)})),this.olListenersKeys.push(this.map.getLayers().on("remove",u=>{u.element===this.olLayer&&this.detachFromMap()})),this.toggleVisibleListeners(),this.olListenersKeys.push(this.on("change:visible",this.toggleVisibleListeners)),this.copyrights&&this.olLayer)){let u=this.copyrights||[];this.olLayer.getLayers?this.olLayer.getLayers().getArray().forEach(r=>{r.getSource&&r.getSource()?.setAttributions(u)}):this.olLayer.getSource&&this.olLayer.getSource()?.setAttributions(u)}}detachFromMap(){this.deactivateUserInteractions(),Ka(this.olListenersKeys),this.olLayer&&this.map?.getLayers()?.getArray()?.includes(this.olLayer)&&this.map.removeLayer(this.olLayer),super.detachFromMap()}activateUserInteractions(){this.deactivateUserInteractions(),this.map&&this.userInteractions&&this.userClickInteractions&&this.userClickCallbacks?.length&&(this.singleClickListenerKey=this.map.on("singleclick",this.onUserClickCallback),this.olListenersKeys.push(this.singleClickListenerKey)),this.map&&this.userInteractions&&this.userHoverInteractions&&this.userHoverCallbacks?.length&&(this.pointerMoveListenerKey=this.map.on("pointermove",this.onUserMoveCallback))}deactivateUserInteractions(){Ka([this.pointerMoveListenerKey,this.singleClickListenerKey])}toggleVisibleListeners(){this.visible?this.activateUserInteractions():this.deactivateUserInteractions()}clone(n){return new bd({...this.options,...n})}},Is=bd;var q0=new xl({radius:6,fill:new Hs({color:[255,0,0,1]}),stroke:new _a({color:[0,0,0,1],width:1})}),yE=new Wl({stroke:new _a({color:[0,0,0,1],width:5})}),_E=new Wl({image:q0,stroke:new _a({color:[255,0,0,1],width:3})}),vE=new Wl({image:q0,stroke:new _a({color:[255,0,0,1],width:3,lineDash:[1,10]})}),xE=(_,c)=>{let n=_.get("minResolution"),u=_.get("maxResolution"),r=c<=n&&c>u;return n&&u&&!r?null:_.get("mot")!=="foot"?[yE,_E]:[vE]},wd=class extends Is{constructor(c={}){super(c),this.olLayer=c.olLayer||new tp({source:new rp,style:c.style||xE})}clone(c){return new wd({...this.options,...c})}},ug=wd;var bE=/^([^@$!\n]*)(@?([\d.]+),([\d.]+))?(\$?([a-zA-Z0-9]{0,2}))$/,Z0=/^([\d.]+),([\d.]+)$/,X0=/^!([^$]*)(\$?([a-zA-Z0-9]{0,2}))$/,cg="stop-fetch",W0=_=>{let c=[];return _.forEach(n=>{c.push(...n.getGeometry().getCoordinates())}),c},Ed=class extends af{constructor(c={}){super(c),Object.defineProperties(this,{mot:{get:()=>this.get("mot"),set:n=>{n&&(this.set("mot",n),this.viaPoints&&this.drawRoute())}},loading:{get:()=>this.get("loading"),set:n=>{this.set("loading",n)}},modify:{get:()=>this.get("modify"),set:n=>{this.set("modify",n)}}}),this.loading=!1,this.graphs=c.graphs||[["osm",0,99]],this.mot=c.mot||"bus",this.modify=c.modify!==!1,this.routingApiParams=c.routingApiParams||{},this.useRawViaPoints=c.useRawViaPoints||!1,this.snapToClosestStation=c.snapToClosestStation||!1,this.cacheStationData={},this.abortControllers=[],this.apiKey=c.apiKey,this.stopsApiKey=c.stopsApiKey||this.apiKey,this.segments=[],this.stopsApiUrl=c.stopsApiUrl||"https://api.geops.io/stops/v1/",this.api=new Zf({...c}),this.routingLayer=c.routingLayer||new ug({name:"routing-layer",style:c.style}),this.onRouteError=c.onRouteError||(n=>{this.dispatchEvent({type:"change:route",target:this}),this.reset(),console.error(n)}),this.viaPoints=[],this.onMapClick=this.onMapClick.bind(this),this.onModifyEnd=this.onModifyEnd.bind(this),this.onModifyStart=this.onModifyStart.bind(this),this.apiChangeListener=()=>this.drawRoute(),this.createModifyInteraction()}static getGraphsResolutions(c,n){let u=n.getView();return c.map(([,r,s])=>[u.getResolutionForZoom(r),u.getResolutionForZoom(s||r+1)])}addViaPoint(c,n=-1,u=0){this.viaPoints.splice(n===-1?this.viaPoints.length:n,u,c),this.drawRoute(),this.dispatchEvent({type:"change:route",target:this})}removeViaPoint(c=this.viaPoints.length-1){this.viaPoints.length&&this.viaPoints[c]&&this.viaPoints.splice(c,1),this.drawRoute(),this.dispatchEvent({type:"change:route",target:this})}setViaPoints(c){this.viaPoints=[...c],this.drawRoute(),this.dispatchEvent({type:"change:route",target:this})}reset(){this.abortRequests(),this.viaPoints=[],this.routingLayer.olLayer.getSource().clear(),this.dispatchEvent({type:"change:route",target:this})}abortRequests(){this.graphs.forEach(([c])=>{this.abortControllers[c]&&this.abortControllers[c].abort(),this.abortControllers[c]=new AbortController}),this.abortControllers[cg]?.abort(),this.abortControllers[cg]=new AbortController,this.loading=!1}drawRoute(){if(this.abortRequests(),this.routingLayer.olLayer.getSource().clear(),!this.viaPoints.length)return null;if(this.viaPoints.length===1)return this.drawViaPoint(this.viaPoints[0],0,this.abortControllers[cg]);let c=this.viaPoints.map(n=>{if(Array.isArray(n)){let u=this.map.getView().getProjection(),[r,s]=lh(n,u);return this.snapToClosestStation?[`@${s}`,r]:[s,r]}return this.useRawViaPoints?n:`!${n}`});return this.loading=!0,this.routingLayer.olLayer.getSource().clear(),this.viaPoints.forEach((n,u)=>this.drawViaPoint(n,u,this.abortControllers[cg])),Promise.all(this.graphs.map(([n],u)=>{let{signal:r}=this.abortControllers[n];return this.api.route({graph:n,via:`${c.join("|")}`,mot:`${this.mot}`,"resolve-hops":!1,elevation:!1,"coord-radius":100,"coord-punish":1e3,...this.routingApiParams},{signal:r}).then(s=>{if(this.segments=this.format.readFeatures(s),this.mot==="foot"){let F=this.segments.reduce((N,V)=>{let me=V.get("trg");return N.find(be=>be[0]===me[0]&&be[1]===me[1])?N:[...N,me]},[]);this.segments=F.map(N=>{let V=this.segments.filter(be=>{let Se=be.get("trg");return Se[0]===N[0]&&Se[1]===N[1]}),me=W0(V);return new lc({geometry:new uc(me)})})}let P=W0(this.segments),z=new lc({geometry:new uc(P)});z.set("graph",n),z.set("mot",this.mot),z.set("minResolution",this.graphsResolutions[u][0]),z.set("maxResolution",this.graphsResolutions[u][1]),this.routingLayer.olLayer.getSource().addFeature(z),this.loading=!1}).catch(s=>{s.name!=="AbortError"&&(this.segments=[],this.dispatchEvent({type:"error",target:this}),this.onRouteError(s,this),this.loading=!1)})}))}drawViaPoint(c,n,u){let r=new lc;if(r.set("viaPointIdx",n),Array.isArray(c))return r.setGeometry(new ya(c)),this.routingLayer.olLayer.getSource().addFeature(r),Promise.resolve(r);if(!this.useRawViaPoints||X0.test(c)){let N,V;return this.useRawViaPoints?[,N,,V]=X0.exec(c):[N,V]=c.split("$"),fetch(`${this.stopsApiUrl}lookup/${N}?key=${this.stopsApiKey}`,{signal:u.signal}).then(me=>me.json()).then(me=>{let{coordinates:be}=me.features[0].geometry;return this.cacheStationData[c]=uo(be),r.set("viaPointTrack",V),r.setGeometry(new ya(uo(be))),this.routingLayer.olLayer.getSource().addFeature(r),r}).catch(me=>{me.name!=="AbortError"&&(this.dispatchEvent({type:"error",target:this}),this.onRouteError(me,this),this.loading=!1)})}if(this.useRawViaPoints&&Z0.test(c)){let[N,V]=Z0.exec(c),me=uo([parseFloat(V),parseFloat(N)],this.map.getView().getProjection());return r.setGeometry(new ya(me)),this.routingLayer.olLayer.getSource().addFeature(r),Promise.resolve(r)}let[,s,,P,z,,F]=bE.exec(c);if(z&&P){let N=uo([parseFloat(z),parseFloat(P)],this.map.getView().getProjection());return r.set("viaPointTrack",F),r.setGeometry(new ya(N)),this.routingLayer.olLayer.getSource().addFeature(r),Promise.resolve(r)}return s?fetch(`${this.stopsApiUrl}?key=${this.stopsApiKey}&q=${s}&limit=1`,{signal:u.signal}).then(N=>N.json()).then(N=>{let{coordinates:V}=N.features[0].geometry;return this.cacheStationData[c]=uo(V),r.set("viaPointTrack",F),r.setGeometry(new ya(uo(V))),this.routingLayer.olLayer.getSource().addFeature(r),r}).catch(N=>(this.dispatchEvent({type:"error",target:this}),this.onRouteError(N,this),this.loading=!1,null)):Promise.resolve(null)}onMapClick(c){let u=c.target.getFeaturesAtPixel(c.pixel).find(r=>r.getGeometry()?.getType()===Pt.POINT&&r.get("viaPointIdx")!==void 0);if(u){this.removeViaPoint(u.get("viaPointIdx"));return}this.addViaPoint(c.coordinate)}onModifyStart(c){let n=-1,u=c.features.getArray().find(s=>s.getGeometry()?.getType()===Pt.LINE_STRING);if(u){let s=yl(new ya(u.getGeometry().getClosestPoint(c.mapBrowserEvent.coordinate)).getExtent(),.001);n=this.segments.findIndex(P=>P.getGeometry().intersectsExtent(s))}let r=(c.features.getArray().filter(s=>s.getGeometry()?.getType()===Pt.POINT)||[])[0];this.initialRouteDrag={viaPoint:r,oldRoute:u&&u.clone(),segmentIndex:n}}onModifyEnd(c){let n=c.mapBrowserEvent.coordinate,{oldRoute:u,viaPoint:r,segmentIndex:s}=this.initialRouteDrag;return r?this.addViaPoint(n,r.get("viaPointIdx"),1):u?s===-1?Promise.reject(new Error("No segment found")):this.addViaPoint(n,s+1):this.addViaPoint(n,0,1)}createDefaultElement(){this.element=document.createElement("button"),this.element.id="ol-toggle-routing",this.element.innerHTML="Toggle Route Control",this.element.onclick=()=>this.active?this.deactivate():this.activate(),Object.assign(this.element.style,{position:"absolute",right:"10px",top:"10px"})}createModifyInteraction(){this.modifyInteraction=new b_({source:this.routingLayer.olLayer.getSource(),pixelTolerance:4,hitDetection:this.routingLayer.olLayer,deleteCondition:c=>{let u=c.target.getFeaturesAtPixel(c.pixel,{hitTolerance:5}).find(r=>r.getGeometry()?.getType()===Pt.POINT&&r.get("index"));return I0(c)&&u?(this.removeViaPoint(u.get("index")),!0):!1}}),this.modifyInteraction.on("modifystart",this.onModifyStart),this.modifyInteraction.on("modifyend",this.onModifyEnd),this.modifyInteraction.setActive(!1)}addListeners(){!this.modify||(this.removeListeners(),this.onMapClickKey=this.map.on("singleclick",this.onMapClick))}removeListeners(){Ka(this.onMapClickKey)}activate(){super.activate(),this.map?(this.format=new bl({featureProjection:this.map.getView().getProjection()}),this.graphsResolutions=Ed.getGraphsResolutions(this.graphs,this.map),this.map.removeInteraction(this.modifyInteraction),this.routingLayer.attachToMap(this.map),this.map.addInteraction(this.modifyInteraction),this.modifyInteraction.setActive(this.modify),this.addListeners()):(this.format=new bl({featureProjection:"EPSG:3857"}),this.graphsResolutions=this.graphs)}deactivate(){this.map&&(this.routingLayer.detachFromMap(this.map),this.map.removeInteraction(this.modifyInteraction),this.removeListeners(),this.reset()),super.deactivate()}},$0=Ed;var C_=class extends af{constructor(n){super(n);let{apiParams:u,apiKey:r,url:s}=n;this.apiParams={limit:20,...u||{}},this.placeholder=n.placeholder||"Search for a stop...";let P={apiKey:r};s&&(P.url=s),this.api=new Xf(P),this.abortController=new AbortController}render(n){let u=n?.features||[];!this.suggestionsElt||(this.suggestionsElt.style.display=u.length?"block":"none",this.suggestionsElt.innerHTML="",u.forEach(r=>{let s=document.createElement("div");s.innerHTML=r?.properties?.name,s.onclick=()=>{this.onSuggestionClick(r)},Object.assign(s.style,{padding:"5px 12px"}),this.suggestionsElt?.appendChild(s)}))}createDefaultElement(){this.element=document.createElement("div"),this.element.id="mbt-search",Object.assign(this.element.style,{position:"absolute",top:0,left:"50px",margin:"10px",display:"flex",flexDirection:"column",width:"320px"}),this.inputElt=document.createElement("input"),this.inputElt.type="text",this.inputElt.placeholder=this.placeholder,this.inputElt.autocomplete="off",this.inputElt.onkeyup=n=>{this.abortController?.abort(),this.abortController=new AbortController,this.search(n.target.value,this.abortController)},Object.assign(this.inputElt.style,{padding:"10px 30px 10px 10px"}),this.element.appendChild(this.inputElt),this.suggestionsElt=document.createElement("div"),Object.assign(this.suggestionsElt.style,{backgroundColor:"white",overflowY:"auto",cursor:"pointer"}),this.element.appendChild(this.suggestionsElt),this.clearElt=document.createElement("div"),Object.assign(this.clearElt.style,{display:"none",position:"absolute",right:"0",padding:"0 10px",fontSize:"200%",cursor:"pointer"}),this.clearElt.innerHTML="\xD7",this.clearElt.onclick=()=>this.clear(),this.element.appendChild(this.clearElt)}search(n,u){return(n!==void 0||n!==null)&&(this.apiParams.q=n),this.clearElt&&(this.clearElt.style.display="block"),this.api.search(this.apiParams,u&&{signal:u.signal}).then(r=>{this.render(r)}).catch(()=>{this.render()})}onSuggestionClick(n){}clear(){!this.suggestionsElt||!this.inputElt||!this.clearElt||(this.inputElt.value="",this.suggestionsElt.innerHTML="",this.clearElt.style.display="none")}},H0=C_;var A_=class extends H0{onSuggestionClick(c){let n=uo(c.geometry.coordinates);this.map.getView().setCenter(n)}},K0=A_;var J0=Gp(Y0());var k_=class extends Is{constructor(n){super(n);this.olLayer=new Kh({source:new cf({}),render:this.getOlLayerRender()}),this.styleUrl=n.url,this.apiKey=n.apiKey,this.apiKeyName=n.apiKeyName||"key",this.updateAttribution=this.updateAttribution.bind(this)}attachToMap(n){super.attachToMap(n),this.map&&(this.format=new bl({featureProjection:this.map.getView().getProjection()}),this.loadMbMap())}detachFromMap(){this.mbMap&&(this.mbMap.off("idle",this.updateAttribution),this.mbMap.triggerRepaint=()=>{},this.mbMap.remove(),this.mbMap=void 0),this.loaded=!1,super.detachFromMap()}loadMbMap(){if(this.olListenersKeys.push(this.map?.on("change:target",()=>{this.loadMbMap()})),!this.map?.getTargetElement())return;if(!this.visible){this.olListenersKeys.push(this.once("change:visible",()=>{this.loadMbMap()}));return}let n=document.createElement("div");if(n.style.position="absolute",n.style.width="100%",n.style.height="100%",!this.styleUrl){console.error(`No styleUrl defined for mapbox layer: ${this.styleUrl}`);return}!this.apiKey&&!this.styleUrl?.includes(this.apiKeyName)&&console.error(`No apiKey defined for mapbox layer with style url to ${this.styleUrl}`);let u=this.getMapboxMapClass();this.mbMap=new u({style:Zh(this.styleUrl,{[this.apiKeyName]:this.apiKey}).toString(),container:n,interactive:!1,trackResize:!1,attributionControl:!1,...this.options.mapOptions||{}}),this.mbMap.once("load",()=>{this.loaded=!0,this.dispatchEvent({type:"load",target:this})}),this.mbMap.on("idle",this.updateAttribution)}updateAttribution(n){let u=oc(n.target)||[];this.copyrights?.toString()!==u.toString()&&(this.copyrights=u,this.olLayer?.getSource()?.setAttributions(u))}getFeatureInfoAtCoordinate(n,u){if(!u||!this.format||!this.mbMap||!this.mbMap.isStyleLoaded())return Promise.resolve({coordinate:n,features:[],layer:this});let r=n&&this.mbMap.project(lh(n)),s;if(this.hitTolerance){let{x:z,y:F}=r;s=[{x:z-this.hitTolerance,y:F-this.hitTolerance},{x:z+this.hitTolerance,y:F+this.hitTolerance}]}let P=this.mbMap.queryRenderedFeatures(s||r,u).map(z=>{let F=this.format.readFeature(z);return F&&F.set("mapboxFeature",z),F});return Promise.resolve({layer:this,features:P,coordinate:n})}getOlLayerRender(){console.error("This function must be implemented in subclasses");let n=document.createElement("div");return()=>n}getMapboxMapClass(){return console.error("This function must be implemented in subclasses"),null}},hg=k_;var np=class extends hg{attachToMap(n){super.attachToMap(n),this.map&&this.olListenersKeys.push(this.map.on("change:size",()=>{try{this.mbMap&&this.mbMap.resize()}catch(u){console.warn(u)}}))}loadMbMap(){let[n,u]=this.map?.getView().getCenter()||[];if((!n||!u)&&(n=0,u=0),this.renderState={center:[n,u],zoom:void 0,rotation:void 0,visible:void 0,opacity:void 0,size:[0,0]},super.loadMbMap(),!this.mbMap)return;this.mbMap.once("load",()=>{!this.mbMap||(this.mbMap.resize(),this.copyrights=oc(this.mbMap)||[],this.olLayer?.getSource()?.setAttributions(this.copyrights))});let r=this.mbMap.getCanvas();r&&(this.options.tabIndex?r.setAttribute("tabindex",`${this.options.tabIndex}`):r.removeAttribute("tabindex"))}getOlLayerRender(){return tf(this)}getMapboxMapClass(){return J0.Map}clone(n){return new np({...this.options,...n})}};var t1=Gp(e1());var op=class extends hg{getOlLayerRender(){return ef(this)}getMapboxMapClass(){return t1.Map}clone(c){return new op({...this.options,...c})}};var Td=class extends Is{constructor(n){super(n);if(this.mapboxLayer=n.mapboxLayer,this.disabled=!1,this.styleLayersFilter=n.styleLayersFilter,this.beforeId=n.beforeId,this.featureInfoFilter=n.featureInfoFilter||(u=>u),this.queryRenderedLayersFilter=n.queryRenderedLayersFilter,this.highlightedFeatures=[],this.selectedFeatures=[],this.styleLayers=(n.styleLayer?[n.styleLayer]:n.styleLayers)||[],this.addStyleLayers=this.addStyleLayers.bind(this),this.onLoad=this.onLoad.bind(this),n.filters&&(this.addDynamicFilters=()=>{this.setFilter(typeof n.filters=="function"?n.filters(this):n.filters)}),!this.styleLayersFilter&&this.styleLayers){let u=this.styleLayers.map(r=>r.id);this.styleLayersFilter=r=>u.includes(r.id)}}attachToMap(n){if(this.mapboxLayer&&!this.mapboxLayer.map&&this.mapboxLayer?.attachToMap(n),super.attachToMap(n),!this.map||!this.mapboxLayer)return;let{mbMap:u}=this.mapboxLayer;if(!u){this.olListenersKeys.push(this.map.on("change:target",()=>{this.attachToMap(n)}));return}this.mapboxLayer.loaded||u.isStyleLoaded()||u.loaded()?this.onLoad():u.once("load",this.onLoad),this.olListenersKeys.push(this.on("change:visible",r=>{this.applyLayoutVisibility(r)})),this.olListenersKeys.push(this.mapboxLayer.on("load",()=>{this.onLoad()}))}detachFromMap(){if(this.mapboxLayer?.mbMap){let{mbMap:n}=this.mapboxLayer;n.off("load",this.onLoad),this.removeStyleLayers()}super.detachFromMap()}addStyleLayers(){if(!this.mapboxLayer?.mbMap)return;let{mbMap:n}=this.mapboxLayer;this.styleLayers.forEach(u=>{let{id:r,source:s}=u;n.getSource(s)&&r&&!n.getLayer(r)&&n.addLayer(u,this.beforeId)}),this.applyLayoutVisibility()}removeStyleLayers(){if(!this.mapboxLayer?.mbMap)return;let{mbMap:n}=this.mapboxLayer;this.styleLayers.forEach(u=>{let{id:r}=u;r&&n.getLayer(r)&&n.removeLayer(r)})}onLoad(){if(this.addStyleLayers(),this.addDynamicFilters&&this.addDynamicFilters(),!this.mapboxLayer?.mbMap)return;let{mbMap:n}=this.mapboxLayer,u=n.getStyle();if(u&&this.styleLayersFilter){let r=u.layers.filter(this.styleLayersFilter);this.disabled=!r.length}}getFeatureInfoAtCoordinate(n){if(!this.mapboxLayer?.mbMap)return Promise.resolve({coordinate:n,features:[],layer:this});let{mbMap:u}=this.mapboxLayer;if(!u.isStyleLoaded())return Promise.resolve({coordinate:n,features:[],layer:this});let r=this.styleLayers||[];return this.styleLayersFilter&&(r=u.getStyle().layers.filter(this.styleLayersFilter)),this.queryRenderedLayersFilter&&(r=u.getStyle().layers.filter(this.queryRenderedLayersFilter)),this.mapboxLayer.getFeatureInfoAtCoordinate(n,{layers:r.map(s=>s&&s.id),validate:!1}).then(s=>{let P=s.features.filter(z=>this.featureInfoFilter(z,this.map?.getView().getResolution()));return this.highlight(P),{...s,features:P,layer:this}})}setFilter(n){if(!this.mapboxLayer?.mbMap)return;let{mbMap:u}=this.mapboxLayer;this.styleLayers.forEach(({id:r})=>{r&&n&&u.getLayer(r)&&u.setFilter(r,n)})}setHoverState(n,u){if(!this.mapboxLayer?.mbMap)return;let{mbMap:r}=this.mapboxLayer;!n||!r||n.forEach(s=>{let{source:P,sourceLayer:z}=s.get("mapboxFeature")||{};if(!P&&!z||!s.getId()){s.getId()||console.warn("No feature's id found. To use the feature state functionnality, tiles must be generated with --generate-ids. See https://github.com/mapbox/tippecanoe#adding-calculated-attributes.",s.getId(),s.getProperties());return}r.setFeatureState({id:s.getId(),source:P,sourceLayer:z},{hover:u})})}select(n=[]){this.setHoverState(this.selectedFeatures||[],!1),this.selectedFeatures=n,this.setHoverState(this.selectedFeatures||[],!0)}highlight(n=[]){let u=this.highlightedFeatures?.filter(r=>!(this.selectedFeatures||[]).map(s=>s.getId()).includes(r.getId()))||[];this.setHoverState(u,!1),this.highlightedFeatures=n,this.setHoverState(this.highlightedFeatures,!0)}applyLayoutVisibility(n){let{visible:u}=this,r=this.styleLayersFilter;if(!this.mapboxLayer?.mbMap)return;let{mbMap:s}=this.mapboxLayer,P=s.getStyle();if(!!P&&r){let z=u?"visible":"none";for(let F=0;F<P.layers.length;F+=1){let N=P.layers[F];r(N)&&s.getLayer(N.id)&&s.setLayoutProperty(N.id,"visibility",z)}}}clone(n){return new Td({...this.options,...n})}},r1=Td;var F_=Gp(a1()),B_=Gp(h1());function rT(_){return class extends _{constructor(u){super({hitTolerance:10,...u});this.debug=u.debug||!1,this.mode=u.mode||ra.TOPOGRAPHIC,this.api=u.api||new Wf(u),this.tenant=u.tenant||"",this.minZoomNonTrain=u.minZoomNonTrain||9,this.minZoomInterpolation=u.minZoomInterpolation||8,this.format=new bl,this.generalizationLevelByZoom=u.generalizationLevelByZoom||[5,5,5,5,5,5,5,5,10,30,30,100,100,100],this.getGeneralizationLevelByZoom=r=>u.getGeneralizationLevelByZoom&&u.getGeneralizationLevelByZoom(r,this.generalizationLevelByZoom)||this.generalizationLevelByZoom[r],this.renderTimeIntervalByZoom=u.renderTimeIntervalByZoom||[1e5,5e4,4e4,3e4,2e4,15e3,1e4,5e3,2e3,1e3,400,300,250,180,90,60,50,50,50,50,50],this.getRenderTimeIntervalByZoom=r=>u.getRenderTimeIntervalByZoom&&u.getRenderTimeIntervalByZoom(r,this.renderTimeIntervalByZoom)||this.renderTimeIntervalByZoom[r],this.isUpdateBboxOnMoveEnd=u.isUpdateBboxOnMoveEnd!==!1,this.throttleRenderTrajectories=(0,B_.default)(this.renderTrajectoriesInternal,50,{leading:!1,trailing:!0}),this.debounceRenderTrajectories=(0,F_.default)(this.renderTrajectoriesInternal,50,{leading:!0,trailing:!0,maxWait:5e3}),this.onFeatureHover=this.onFeatureHover.bind(this),this.onFeatureClick=this.onFeatureClick.bind(this),this.renderTrajectoriesInternal=this.renderTrajectoriesInternal.bind(this),this.onTrajectoryMessage=this.onTrajectoryMessage.bind(this),this.onDeleteTrajectoryMessage=this.onDeleteTrajectoryMessage.bind(this),this.onDocumentVisibilityChange=this.onDocumentVisibilityChange.bind(this)}defineProperties(u){let{style:r,speed:s,pixelRatio:P,hoverVehicleId:z,selectedVehicleId:F,filter:N,sort:V,time:me,live:be,canvas:Se,styleOptions:Ve}=u,Ke=s||1,Ie=me||new Date;super.defineProperties(u),Object.defineProperties(this,{isTrackerLayer:{value:!0},canvas:{value:Se||document.createElement("canvas")},style:{value:r||Hh},styleOptions:{value:{...rf,...Ve||{}}},speed:{get:()=>Ke,set:Ge=>{Ke=Ge,this.start()}},filter:{value:N,writable:!0},sort:{value:V,writable:!0},live:{value:be===!1?be:!0,writable:!0},time:{get:()=>Ie,set:Ge=>{Ie=Ge&&Ge.getTime?Ge:new Date(Ge),this.renderTrajectories()}},trajectories:{value:{},writable:!0},hoverVehicleId:{value:z,writable:!0},selectedVehicleId:{value:F,writable:!0},pixelRatio:{value:P||(typeof window<"u"?window.devicePixelRatio:1),writable:!0},useRequestAnimationFrame:{value:u.useRequestAnimationFrame||!1,writable:!0},useThrottle:{value:u.useThrottle!==!1,writable:!0},useDebounce:{value:u.useDebounce||!1,writable:!0}})}attachToMap(u){super.attachToMap(u),this.visible&&this.start(),this.visibilityRef=this.on("change:visible",r=>{r.target.visible?this.start():this.stop()}),document.addEventListener("visibilitychange",this.onDocumentVisibilityChange)}detachFromMap(){document.removeEventListener("visibilitychange",this.onDocumentVisibilityChange),this.stop(),Ka(this.visibilityRef),this.canvas&&(this.canvas.getContext("2d")?.clearRect(0,0,this.canvas.width,this.canvas.height),super.detachFromMap())}start(){this.stop(),this.renderTrajectories(),this.startUpdateTime(),this.api.open(),this.api.subscribeTrajectory(this.mode,this.onTrajectoryMessage,this.isUpdateBboxOnMoveEnd),this.api.subscribeDeletedVehicles(this.mode,this.onDeleteTrajectoryMessage,this.isUpdateBboxOnMoveEnd),this.isUpdateBboxOnMoveEnd&&this.setBbox()}startUpdateTime(){this.stopUpdateTime(),this.updateTimeDelay=this.getRefreshTimeInMs()||0,this.updateTimeInterval=window.setInterval(()=>{this.live?this.time=new Date:this.time&&this.updateTimeDelay&&this.speed&&(this.time=new Date(this.time.getTime()+this.updateTimeDelay*this.speed))},this.updateTimeDelay)}stop(){this.api.unsubscribeTrajectory(this.onTrajectoryMessage),this.api.unsubscribeDeletedVehicles(this.onDeleteTrajectoryMessage),this.api.close()}stopUpdateTime(){this.updateTimeInterval&&(clearInterval(this.updateTimeInterval),this.updateTimeInterval=void 0)}renderTrajectoriesInternal(u,r=!1){if(!this.map||!this.trajectories)return!1;let s=this.live?Date.now():this.time?.getTime(),P=Object.values(this.trajectories);return this.sort&&P.sort(this.sort),!this.canvas||!this.style||(this.renderState=Hf(this.canvas,P,this.style,{...u,pixelRatio:this.pixelRatio||1,time:s},{noInterpolate:(u.zoom||0)<this.minZoomInterpolation?!0:r,hoverVehicleId:this.hoverVehicleId,selectedVehicleId:this.selectedVehicleId,...this.styleOptions})),!0}renderTrajectories(u,r){this.requestId&&(cancelAnimationFrame(this.requestId),this.requestId=void 0),u&&(!r&&this.useRequestAnimationFrame?this.requestId=requestAnimationFrame(()=>{this.renderTrajectoriesInternal(u,r)}):!r&&this.useDebounce?this.debounceRenderTrajectories(u,r):!r&&this.useThrottle?this.throttleRenderTrajectories(u,r):this.renderTrajectoriesInternal(u,r))}setBbox(u,r){if(this.trajectories&&u&&r){let P=Object.keys(this.trajectories);for(let z=P.length-1;z>=0;z-=1)this.purgeTrajectory(this.trajectories[P[z]],u,r)}if(!u)return;let s=[...u];this.isUpdateBboxOnMoveEnd&&r&&(s.push(r),this.tenant&&s.push(`tenant=${this.tenant}`),this.generalizationLevel=this.getGeneralizationLevelByZoom(r),this.generalizationLevel&&s.push(`gen=${this.generalizationLevel}`)),this.api.bbox=s}setMode(u){this.mode!==u&&(this.mode=u,this.api.subscribeTrajectory(this.mode,this.onTrajectoryMessage,this.isUpdateBboxOnMoveEnd),this.api.subscribeDeletedVehicles(this.mode,this.onDeleteTrajectoryMessage,this.isUpdateBboxOnMoveEnd))}getRefreshTimeInMs(u=0){let r=u!==void 0?Math.round(u):-1,s=this.getRenderTimeIntervalByZoom(r)||25,P=Math.max(25,s/(this.speed||1)),z=Math.min(P,500);if(this.useThrottle?this.throttleRenderTrajectories=(0,B_.default)(this.renderTrajectoriesInternal,z,{leading:!0,trailing:!0}):this.useDebounce&&(this.debounceRenderTrajectories=(0,F_.default)(this.renderTrajectoriesInternal,z,{leading:!0,trailing:!0,maxWait:5e3})),this.api?.buffer){let[,F]=this.api.buffer;this.api.buffer=[z,F]}return P}getVehicle(u){return this.trajectories&&Object.values(this.trajectories).filter(u)||[]}getFeatureInfoAtCoordinate(u,r){let{resolution:s,nb:P}=r,z=yl([...u,...u],this.hitTolerance*s),F=Object.values(this.trajectories||{});this.sort&&(F=F.sort(this.sort));let N=[];for(let V=0;V<F.length&&(F[V].properties.coordinate&&Hp(z,F[V].properties.coordinate)&&N.push(F[V]),N.length!==P);V+=1);return Promise.resolve({layer:this,features:N.map(V=>this.format.readFeature(V)),coordinate:u})}getTrajectoryInfos(u){let r=[this.api.getStopSequence(u),this.api.getFullTrajectory(u,this.mode,this.generalizationLevel)];return Promise.all(r).then(([s,P])=>({stopSequence:s,fullTrajectory:P}))}purgeTrajectory(u,r,s){let{type:P,bounds:z}=u.properties;return!ko(r,z)||P!=="rail"&&s<(this.minZoomNonTrain||9)?(this.removeTrajectory(u),!0):!1}addTrajectory(u){this.filter&&!this.filter(u)||(this.trajectories||(this.trajectories={}),this.trajectories[u.properties.train_id]=u,this.renderTrajectories())}removeTrajectory(u){let r;typeof u!="string"?r=u?.properties?.train_id:r=u,this.trajectories&&delete this.trajectories[r]}onZoomEnd(){this.startUpdateTime()}onDocumentVisibilityChange(){!this.visible||(document.hidden?this.stop():this.start())}onTrajectoryMessage(u){if(!u.content)return;let r=u.content,{geometry:s,properties:{train_id:P,time_since_update:z,raw_coordinates:F}}=r;z<0||this.purgeTrajectory(r)||(this.debug&&this.mode===ra.TOPOGRAPHIC&&F?r.properties.olGeometry={type:"Point",coordinates:uo(F,this.map.getView().getProjection())}:r.properties.olGeometry=this.format.readGeometry(s),r.properties.timeOffset=Date.now()-u.timestamp,this.addTrajectory(r))}onDeleteTrajectoryMessage(u){!u.content||this.removeTrajectory(u.content)}onFeatureHover(u,r,s){let[P]=u,z=null;P&&(z=P.get("train_id")),this.hoverVehicleId!==z&&(this.hoverVehicleId=z,this.renderTrajectories(!0))}onFeatureClick(u,r,s){let[P]=u,z=null;P&&(z=P.get("train_id")),this.selectedVehicleId!==z&&(this.selectedVehicleId=z,this.selectedVehicle=P,this.renderTrajectories(!0))}}}var fg=rT;var iT=new Wl({zIndex:2,image:new xl({radius:5,fill:new Hs({color:"#000000"})}),stroke:new _a({color:"#000000",width:6})}),nT=(_,c,n)=>{let u="#ffffff",r=_.get("type"),s=_.get("stroke");return s&&s[0]!=="#"&&(s=`#${s}`),u=s||n?.getBgColor(r),u=/#ffffff/i.test(u)?"#ff0000":u,[iT,new Wl({zIndex:3,image:new xl({radius:4,fill:new Hs({color:u})}),stroke:new _a({color:u,width:4})})]},dg=nT;var oT=new Wl({zIndex:2,image:new xl({radius:5,fill:new Hs({color:"#000000"})}),stroke:new _a({color:"#000000",width:6})}),aT=new Wl({zIndex:3,image:new xl({radius:4,fill:new Hs({color:"#a0a0a0"})}),stroke:new _a({color:"#a0a0a0",width:4})}),sT=()=>[oT,aT],p1=sT;var lT=new bl,Sd=class extends fg(Is){constructor(c){super({...c}),this.olLayer=c.olLayer||new y_({layers:[new tp({source:new rp({features:[]}),style:(n,u)=>(c.fullTrajectoryStyle||dg)(n,u,this.styleOptions)}),new Kh({source:new cf({}),render:n=>{if(this.container||(this.container=document.createElement("div"),this.container.style.position="absolute",this.container.style.width="100%",this.container.style.height="100%",this.transformContainer=document.createElement("div"),this.transformContainer.style.position="absolute",this.transformContainer.style.width="100%",this.transformContainer.style.height="100%",this.container.appendChild(this.transformContainer),this.canvas&&(this.canvas.style.position="absolute",this.canvas.style.top="0",this.canvas.style.left="0",this.canvas.style.transformOrigin="top left",this.transformContainer.appendChild(this.canvas))),this.renderedViewState){let{center:u,resolution:r,rotation:s}=n.viewState,{center:P,resolution:z,rotation:F}=this.renderedViewState;if(z/r>=3)this.canvas?.getContext("2d")?.clearRect(0,0,this.canvas?.width,this.canvas?.height);else{let N=this.map.getPixelFromCoordinate(P),V=this.map.getPixelFromCoordinate(u);this.transformContainer.style.transform=kv(N[0]-V[0],N[1]-V[1],z/r,z/r,s-F,0,0)}}return this.container}})]}),this.vectorLayer=this.olLayer.getLayers().item(0),this.renderState={center:[0,0],zoom:void 0,rotation:0}}attachToMap(c){super.attachToMap(c),this.map&&this.olListenersKeys.push(...this.map.on(["moveend","change:target"],n=>{let u=n.map.getView();if(u.getAnimating()||u.getInteracting())return;let r=u.getZoom();this.currentZoom!==r&&this.onZoomEnd(),this.currentZoom=r,this.onMoveEnd(n)}))}detachFromMap(){super.detachFromMap(),this.container=null}hasFeatureInfoAtCoordinate(c){if(this.map&&this.canvas){let n=this.canvas.getContext("2d"),u=this.map.getPixelFromCoordinate(c);return!!n?.getImageData(u[0]*(this.pixelRatio||1),u[1]*(this.pixelRatio||1),1,1).data[3]}return!1}renderTrajectories(c){if(!this.map)return;let n=this.map.getView();super.renderTrajectories({size:this.map.getSize(),center:this.map.getView().getCenter(),extent:n.calculateExtent(),resolution:n.getResolution(),rotation:n.getRotation(),zoom:n.getZoom(),pixelRatio:this.pixelRatio},c)}renderTrajectoriesInternal(c,n){if(!this.map)return!1;let u=!1;return u=this.map.getView().getAnimating()||this.map.getView().getInteracting()?!1:super.renderTrajectoriesInternal(c,n),u&&(this.renderedViewState={...c},this.transformContainer&&(this.transformContainer.style.transform="")),u}getRefreshTimeInMs(){return super.getRefreshTimeInMs(this.map.getView().getZoom())}getFeatureInfoAtCoordinate(c,n={}){let u=this.map.getView().getResolution();return super.getFeatureInfoAtCoordinate(c,{resolution:u,...n})}onMoveEnd(c){this.visible&&this.isUpdateBboxOnMoveEnd&&this.setBbox(),this.visible&&this.isUpdateBboxOnMoveEnd&&this.userClickInteractions&&this.selectedVehicleId&&this.highlightTrajectory(this.selectedVehicleId)}onZoomEnd(){super.onZoomEnd()}onFeatureHover(c,n,u){super.onFeatureHover(c,n,u),this.map.getTargetElement().style.cursor=c.length?"pointer":"auto"}onFeatureClick(c,n,u){super.onFeatureClick(c,n,u),!c.length&&this.vectorLayer&&this.vectorLayer.getSource().clear(),this.selectedVehicleId&&this.highlightTrajectory(this.selectedVehicleId)}purgeTrajectory(c,n,u){return super.purgeTrajectory(c,n||this.map.getView().calculateExtent(),u||this.map.getView().getZoom())}setBbox(c,n){let u=c,r=n;!u&&this.isUpdateBboxOnMoveEnd&&(u=c||this.map.getView().calculateExtent(),r=Math.floor(this.map.getView().getZoom())),super.setBbox(u,r)}highlightTrajectory(c){this.api.getFullTrajectory(c,this.mode,this.generalizationLevel).then(n=>{if(this.vectorLayer.getSource().clear(),!n||!n.features||!n.features.length)return;let r=lT.readFeatures(n);this.vectorLayer.getSource().addFeatures(r)})}clone(c){return new Sd({...this.options,...c})}},f1=Sd;var Id=class extends Is{getFeatureInfoAtCoordinate(c){let n=[];if(this.map){let u=this.map.getPixelFromCoordinate(c);n=this.map.getFeaturesAtPixel(u,{layerFilter:r=>r===this.olLayer,hitTolerance:this.hitTolerance})}return Promise.resolve({features:n,layer:this,coordinate:c})}clone(c){return new Id({...this.options,...c})}},d1=Id;var Cd=class extends Is{constructor(n){super(n);this.abortController=new AbortController,this.format=new bl}getFeatureInfoUrl(n){if(!this.map)return;let u=this.map.getView().getProjection(),r=this.map.getView().getResolution();if(r&&u&&this.olLayer?.getSource()?.getFeatureInfoUrl)return this.olLayer?.getSource()?.getFeatureInfoUrl(n,r,u,{info_format:"application/json",query_layers:this.olLayer?.getSource()?.getParams().layers})}getFeatureInfoAtCoordinate(n){this.abortController?.abort(),this.abortController=new AbortController;let{signal:u}=this.abortController,r=this.getFeatureInfoUrl(n);return r?fetch(r,{signal:u}).then(s=>s.json()).then(s=>s.features).then(s=>({layer:this,coordinate:n,features:s.map(P=>this.format.readFeature(P))})).catch(()=>Promise.resolve({features:[],coordinate:n,layer:this})):(console.error("No url for the WMS layer."),Promise.resolve({features:[],coordinate:n,layer:this}))}clone(n){return new Cd({...this.options,...n})}},m1=Cd;var vg={};iy(vg,{CopyrightControl:()=>g1,Layer:()=>gg,RealtimeAPI:()=>Wf,RealtimeLayer:()=>M1,RealtimeModes:()=>ra,RoutingAPI:()=>Zf,StopsAPI:()=>Xf,createTrackerFilters:()=>uy,getCircleCanvas:()=>Ry,getDelayBgCanvas:()=>ky,getDelayTextCanvas:()=>Ly,getHoursAndMinutes:()=>Iv,getLayersAsFlatArray:()=>$f,getMapboxMapCopyrights:()=>oc,getMapboxRender:()=>tf,getMaplibreRender:()=>ef,getMercatorResolution:()=>_g,getSourceCoordinates:()=>Md,getTextCanvas:()=>zy,getUTCDateString:()=>Tv,getUTCTimeString:()=>Sv,getUrlWithParams:()=>Zh,pad:()=>km,realtimeDefaultStyle:()=>Hh,realtimeDelayStyle:()=>Dy,realtimeSimpleStyle:()=>Oy,removeDuplicate:()=>Xh,renderTrajectories:()=>Hf,sortByDelay:()=>cy,trackerConfig:()=>rf});var U_=class extends jm{constructor(c){super(c),this.render=this.render.bind(this)}activate(){super.activate(),this.map&&(this.map.on("sourcedata",this.render),this.map.on("styledata",this.render),this.map.on("idle",this.render))}deactivate(){this.map&&(this.map.off("sourcedata",this.render),this.map.off("styledata",this.render),this.map.off("idle",this.render)),super.deactivate()}getCopyrights(){return oc(this.map)}},g1=U_;var Ad=class extends lg(ip){attachToMap(n){super.attachToMap(n),!!this.map&&this.userInteractions&&(this.toggleVisibleListeners(),this.onChangeVisibleKey=this.on("change:visible",this.toggleVisibleListeners))}detachFromMap(){this.map&&(this.deactivateUserInteractions(),Ka(this.onChangeVisibleKey)),super.detachFromMap()}activateUserInteractions(){this.deactivateUserInteractions(),this.map&&this.userInteractions&&this.userClickInteractions&&this.userClickCallbacks?.length&&this.map.on("click",this.onUserClickCallback),this.map&&this.userInteractions&&this.userHoverInteractions&&this.userHoverCallbacks?.length&&this.map.on("mousemove",this.onUserMoveCallback)}deactivateUserInteractions(){this.map&&(this.map.off("mousemove",this.onUserMoveCallback),this.map.off("click",this.onUserClickCallback))}toggleVisibleListeners(){this.visible?this.activateUserInteractions():this.deactivateUserInteractions()}getMercatorExtent(){let n=this.map.getBounds().toArray();return ed([...n[0],...n[1]],"EPSG:4326","EPSG:3857")}getOlZoom(){return this.map.getZoom()+1}clone(n){return new Ad({...this.options,...n})}},gg=Ad;var Go=63710088e-1,y1={centimeters:Go*100,centimetres:Go*100,degrees:Go/111325,feet:Go*3.28084,inches:Go*39.37,kilometers:Go/1e3,kilometres:Go/1e3,meters:Go,metres:Go,miles:Go/1609.344,millimeters:Go*1e3,millimetres:Go*1e3,nauticalmiles:Go/1852,radians:1,yards:Go*1.0936},y5={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/Go,yards:1.0936133};function _1(_,c,n){n===void 0&&(n={});var u={type:"Feature"};return(n.id===0||n.id)&&(u.id=n.id),n.bbox&&(u.bbox=n.bbox),u.properties=c||{},u.geometry=_,u}function xh(_,c,n){if(n===void 0&&(n={}),!_)throw new Error("coordinates is required");if(!Array.isArray(_))throw new Error("coordinates must be an Array");if(_.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!N_(_[0])||!N_(_[1]))throw new Error("coordinates must contain numbers");var u={type:"Point",coordinates:_};return _1(u,c,n)}function uT(_,c){c===void 0&&(c="kilometers");var n=y1[c];if(!n)throw new Error(c+" units is invalid");return _*n}function cT(_,c){c===void 0&&(c="kilometers");var n=y1[c];if(!n)throw new Error(c+" units is invalid");return _/n}function v1(_){var c=_%(2*Math.PI);return c*180/Math.PI}function ap(_){var c=_%360;return c*Math.PI/180}function yg(_,c,n){if(c===void 0&&(c="kilometers"),n===void 0&&(n="kilometers"),!(_>=0))throw new Error("length must be a positive number");return uT(cT(_,c),n)}function N_(_){return!isNaN(_)&&_!==null&&!Array.isArray(_)}function V_(_){return!!_&&_.constructor===Object}function Pd(_,c,n){if(_!==null)for(var u,r,s,P,z,F,N,V=0,me=0,be,Se=_.type,Ve=Se==="FeatureCollection",Ke=Se==="Feature",Ie=Ve?_.features.length:1,Ge=0;Ge<Ie;Ge++){N=Ve?_.features[Ge].geometry:Ke?_.geometry:_,be=N?N.type==="GeometryCollection":!1,z=be?N.geometries.length:1;for(var et=0;et<z;et++){var rt=0,_t=0;if(P=be?N.geometries[et]:N,P!==null){F=P.coordinates;var yt=P.type;switch(V=n&&(yt==="Polygon"||yt==="MultiPolygon")?1:0,yt){case null:break;case"Point":if(c(F,me,Ge,rt,_t)===!1)return!1;me++,rt++;break;case"LineString":case"MultiPoint":for(u=0;u<F.length;u++){if(c(F[u],me,Ge,rt,_t)===!1)return!1;me++,yt==="MultiPoint"&&rt++}yt==="LineString"&&rt++;break;case"Polygon":case"MultiLineString":for(u=0;u<F.length;u++){for(r=0;r<F[u].length-V;r++){if(c(F[u][r],me,Ge,rt,_t)===!1)return!1;me++}yt==="MultiLineString"&&rt++,yt==="Polygon"&&_t++}yt==="Polygon"&&rt++;break;case"MultiPolygon":for(u=0;u<F.length;u++){for(_t=0,r=0;r<F[u].length;r++){for(s=0;s<F[u][r].length-V;s++){if(c(F[u][r][s],me,Ge,rt,_t)===!1)return!1;me++}_t++}rt++}break;case"GeometryCollection":for(u=0;u<P.geometries.length;u++)if(Pd(P.geometries[u],c,n)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function hT(_,c){c===void 0&&(c={});var n=0,u=0,r=0;return Pd(_,function(s){n+=s[0],u+=s[1],r++},!0),xh([n/r,u/r],c.properties)}var x1=hT;function Mu(_){if(!_)throw new Error("coord is required");if(!Array.isArray(_)){if(_.type==="Feature"&&_.geometry!==null&&_.geometry.type==="Point")return _.geometry.coordinates;if(_.type==="Point")return _.coordinates}if(Array.isArray(_)&&_.length>=2&&!Array.isArray(_[0])&&!Array.isArray(_[1]))return _;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function b1(_){if(Array.isArray(_))return _;if(_.type==="Feature"){if(_.geometry!==null)return _.geometry.coordinates}else if(_.coordinates)return _.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function pT(_,c,n){n===void 0&&(n={});var u;n.final?u=w1(Mu(c),Mu(_)):u=w1(Mu(_),Mu(c));var r=u>180?-(360-u):u;return r}function w1(_,c){var n=ap(_[1]),u=ap(c[1]),r=ap(c[0]-_[0]);r>Math.PI&&(r-=2*Math.PI),r<-Math.PI&&(r+=2*Math.PI);var s=Math.log(Math.tan(u/2+Math.PI/4)/Math.tan(n/2+Math.PI/4)),P=Math.atan2(r,s);return(v1(P)+360)%360}var E1=pT;function fT(_,c,n){n===void 0&&(n={});var u=Mu(_),r=Mu(c);r[0]+=r[0]-u[0]>180?-360:u[0]-r[0]>180?360:0;var s=dT(u,r),P=yg(s,"meters",n.units);return P}function dT(_,c,n){n=n===void 0?Go:Number(n);var u=n,r=_[1]*Math.PI/180,s=c[1]*Math.PI/180,P=s-r,z=Math.abs(c[0]-_[0])*Math.PI/180;z>Math.PI&&(z-=2*Math.PI);var F=Math.log(Math.tan(s/2+Math.PI/4)/Math.tan(r/2+Math.PI/4)),N=Math.abs(F)>1e-11?P/F:Math.cos(r),V=Math.sqrt(P*P+N*N*z*z),me=V*u;return me}var T1=fT;function mT(_,c,n,u){u===void 0&&(u={});var r=c<0,s=yg(Math.abs(c),u.units,"meters");r&&(s=-Math.abs(s));var P=Mu(_),z=gT(P,s,n);return z[0]+=z[0]-P[0]>180?-360:P[0]-z[0]>180?360:0,xh(z,u.properties)}function gT(_,c,n,u){u=u===void 0?Go:Number(u);var r=c/u,s=_[0]*Math.PI/180,P=ap(_[1]),z=ap(n),F=r*Math.cos(z),N=P+F;Math.abs(N)>Math.PI/2&&(N=N>0?Math.PI-N:-Math.PI-N);var V=Math.log(Math.tan(N/2+Math.PI/4)/Math.tan(P/2+Math.PI/4)),me=Math.abs(V)>1e-11?F/V:Math.cos(P),be=r*Math.sin(z)/me,Se=s+be;return[(Se*180/Math.PI+540)%360-180,N*180/Math.PI]}var S1=mT;function yT(_){if(!_)throw new Error("geojson is required");switch(_.type){case"Feature":return I1(_);case"FeatureCollection":return _T(_);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return G_(_);default:throw new Error("unknown GeoJSON type")}}function I1(_){var c={type:"Feature"};return Object.keys(_).forEach(function(n){switch(n){case"type":case"properties":case"geometry":return;default:c[n]=_[n]}}),c.properties=C1(_.properties),c.geometry=G_(_.geometry),c}function C1(_){var c={};return _&&Object.keys(_).forEach(function(n){var u=_[n];typeof u=="object"?u===null?c[n]=null:Array.isArray(u)?c[n]=u.map(function(r){return r}):c[n]=C1(u):c[n]=u}),c}function _T(_){var c={type:"FeatureCollection"};return Object.keys(_).forEach(function(n){switch(n){case"type":case"features":return;default:c[n]=_[n]}}),c.features=_.features.map(function(n){return I1(n)}),c}function G_(_){var c={type:_.type};return _.bbox&&(c.bbox=_.bbox),_.type==="GeometryCollection"?(c.geometries=_.geometries.map(function(n){return G_(n)}),c):(c.coordinates=A1(_.coordinates),c)}function A1(_){var c=_;return typeof c[0]!="object"?c.slice():c.map(function(n){return A1(n)})}var P1=yT;function vT(_,c,n){if(n=n||{},!V_(n))throw new Error("options is invalid");var u=n.pivot,r=n.mutate;if(!_)throw new Error("geojson is required");if(c==null||isNaN(c))throw new Error("angle is required");return c===0||(u||(u=x1(_)),(r===!1||r===void 0)&&(_=P1(_)),Pd(_,function(s){var P=E1(u,s),z=P+c,F=T1(u,s),N=b1(S1(u,F,z));s[0]=N[0],s[1]=N[1]})),_}var j_=vT;var xT=(_,c=1)=>{let{width:n,height:u}=_.getCanvas(),r=_.unproject({x:0,y:0}),s=_.unproject({x:0,y:u/c}),P=_.unproject({x:n/c,y:u/c}),z=_.unproject({x:n/c,y:0});return[[r.lng,r.lat],[z.lng,z.lat],[P.lng,P.lat],[s.lng,s.lat]]},Md=xT;var bT=_=>{let c=_.getBounds().toArray(),n=uo(c[0]),u=uo(c[1]),r=[...n,...u],{width:s,height:P}=_.getCanvas(),z=bs(r)/s,F=Eu(r)/P;return Math.max(z,F)},_g=bT;var q_=class extends fg(gg){constructor(c={}){super({...c}),this.onLoad=this.onLoad.bind(this),this.onMove=this.onMove.bind(this),this.onMoveEnd=this.onMoveEnd.bind(this),this.onZoomEnd=this.onZoomEnd.bind(this),this.onVisibilityChange=this.onVisibilityChange.bind(this)}attachToMap(c,n){!c||(super.attachToMap(c),this.source={type:"canvas",canvas:this.canvas,coordinates:Md(c,this.pixelRatio),animate:!0,attribution:this.copyrights&&this.copyrights.join(", ")},this.beforeId=n,this.layer={id:this.key,type:"raster",source:this.key,layout:{visibility:this.visible?"visible":"none"},paint:{"raster-opacity":1,"raster-fade-duration":0,"raster-resampling":"nearest"}},c.isStyleLoaded()&&this.onLoad(),this.map.on("load",this.onLoad),this.listeners=[this.on("change:visible",this.onVisibilityChange)])}detachFromMap(){this.map&&(this.map.off("load",this.onLoad),this.listeners.forEach(c=>{Ka(c)}),this.map.style&&this.map.getLayer(this.key)&&this.map.removeLayer(this.key),this.map.style&&this.map.getSource(this.key)&&this.map.removeSource(this.key)),super.detachFromMap()}start(){super.start(),this.map.on("move",this.onMove),this.map.on("moveend",this.onMoveEnd),this.map.on("zoomend",this.onZoomEnd)}stop(){super.stop(),this.map&&(this.map.off("move",this.onMove),this.map.off("moveend",this.onMoveEnd),this.map.off("zoomend",this.onZoomEnd))}onLoad(){this.map.getSource(this.key)||this.map.addSource(this.key,this.source),this.map.getLayer(this.key)||this.map.addLayer(this.layer,this.beforeId)}onUserMoveCallback(c){super.onUserMoveCallback({coordinate:uo(c.lngLat.toArray()),...c})}renderTrajectories(c=!1){if(!this.map)return;this.pixelRatio||(this.pixelRatio=1);let{width:n,height:u}=this.map.getCanvas(),r=this.map.getCenter(),s=this.map.unproject({x:0,y:u/this.pixelRatio}),P=this.map.unproject({x:n/this.pixelRatio,y:0}),z=j_(xh([s.lng,s.lat]),-this.map.getBearing(),{pivot:[r.lng,r.lat]}).geometry.coordinates,F=j_(xh([P.lng,P.lat]),-this.map.getBearing(),{pivot:[r.lng,r.lat]}).geometry.coordinates,N=[...uo(z),...uo(F)],V=bs(N)/(n/this.pixelRatio),me=Eu(N)/(u/this.pixelRatio),be=Math.max(V,me),Se={size:[n/this.pixelRatio,u/this.pixelRatio],center:uo([r.lng,r.lat]),extent:N,resolution:be,zoom:this.map.getZoom(),rotation:-(this.map.getBearing()*Math.PI)/180,pixelRatio:this.pixelRatio};super.renderTrajectories(Se,c)}getRefreshTimeInMs(){return super.getRefreshTimeInMs(this.map.getZoom())}getFeatureInfoAtCoordinate(c,n={}){let u=_g(this.map);return super.getFeatureInfoAtCoordinate(c,{resolution:u,...n})}onVisibilityChange(){this.visible&&!this.map.getLayer(this.key)?this.map.addLayer(this.layer,this.beforeId):this.map.getLayer(this.key)&&this.map.removeLayer(this.key)}purgeTrajectory(c,n,u){return super.purgeTrajectory(c,n||this.getMercatorExtent(),u||Math.floor(this.map.getZoom()+1))}setBbox(c,n){let u=c,r=n;!u&&this.isUpdateBboxOnMoveEnd&&(u=c||this.getMercatorExtent(),r=Math.floor(this.getOlZoom())),super.setBbox(u,r)}onMove(){this.renderTrajectories()}renderTrajectoriesInternal(c,n=!1){let u=super.renderTrajectoriesInternal(c,n);if(u&&this.map.style){let r=Md(this.map,this.pixelRatio),s=this.map.getSource(this.key);s&&s.setCoordinates(r)}return u}onMoveEnd(){this.renderTrajectories(),this.visible&&this.isUpdateBboxOnMoveEnd&&this.setBbox()}onFeatureHover(c,n,u){super.onFeatureHover(c,n,u),this.map.getCanvasContainer().style.cursor=c.length?"pointer":"auto"}},M1=q_;var Z_={ol:mg,mapbox:vg};typeof window<"u"&&(window.mbt=Z_);var _3=Z_;})();
1082
+ `){Tr+=Br,Br=0,Qt=be*yt+Vt*Se,++Mr;continue}var Yr=Ve[xr+1]||F.font;Yr!==Ir&&(r&&or.push("font",Yr),u&&Mt.push("font",Yr),Ir=Yr),Br=Math.max(Br,rt[br]);var vi=[jt,Qt+Vt*et[br]+be*(et[br]-_t[Mr]),.5*(Se+Br)+Tr];Qt+=et[br],r&&or.push("strokeText",vi),u&&Mt.push("fillText",vi),++br}return Array.prototype.push.apply(ct,or),Array.prototype.push.apply(ct,Mt),this.labels_[s]=Lt,Lt},_.prototype.replayTextBackground_=function(c,n,u,r,s,P,z){c.beginPath(),c.moveTo.apply(c,n),c.lineTo.apply(c,u),c.lineTo.apply(c,r),c.lineTo.apply(c,s),c.lineTo.apply(c,n),P&&(this.alignFill_=P[2],this.fill_(c)),z&&(this.setStrokeStyle_(c,z),c.stroke())},_.prototype.calculateImageOrLabelDimensions_=function(c,n,u,r,s,P,z,F,N,V,me,be,Se,Ve,Ke,Ie){z*=be[0],F*=be[1];var Ge=u-z,et=r-F,rt=s+N>c?c-N:s,_t=P+V>n?n-V:P,yt=Ve[3]+rt*be[0]+Ve[1],ct=Ve[0]+_t*be[1]+Ve[2],Tt=Ge-Ve[3],St=et-Ve[0];(Ke||me!==0)&&(gh[0]=Tt,yh[0]=Tt,gh[1]=St,yc[1]=St,yc[0]=Tt+yt,_c[0]=yc[0],_c[1]=St+ct,yh[1]=_c[1]);var Lt;return me!==0?(Lt=vs(za(),u,r,1,1,me,-u,-r),xo(Lt,gh),xo(Lt,yc),xo(Lt,_c),xo(Lt,yh),sh(Math.min(gh[0],yc[0],_c[0],yh[0]),Math.min(gh[1],yc[1],_c[1],yh[1]),Math.max(gh[0],yc[0],_c[0],yh[0]),Math.max(gh[1],yc[1],_c[1],yh[1]),uf)):sh(Math.min(Tt,Tt+yt),Math.min(St,St+ct),Math.max(Tt,Tt+yt),Math.max(St,St+ct),uf),Se&&(Ge=Math.round(Ge),et=Math.round(et)),{drawImageX:Ge,drawImageY:et,drawImageW:rt,drawImageH:_t,originX:N,originY:V,declutterBox:{minX:uf[0],minY:uf[1],maxX:uf[2],maxY:uf[3],value:Ie},canvasTransform:Lt,scale:be}},_.prototype.replayImageOrLabel_=function(c,n,u,r,s,P,z){var F=!!(P||z),N=r.declutterBox,V=c.canvas,me=z?z[2]*r.scale[0]/2:0,be=N.minX-me<=V.width/n&&N.maxX+me>=0&&N.minY-me<=V.height/n&&N.maxY+me>=0;return be&&(F&&this.replayTextBackground_(c,gh,yc,_c,yh,P,z),Ux(c,r.canvasTransform,s,u,r.originX,r.originY,r.drawImageW,r.drawImageH,r.drawImageX,r.drawImageY,r.scale)),!0},_.prototype.fill_=function(c){if(this.alignFill_){var n=xo(this.renderedTransform_,[0,0]),u=512*this.pixelRatio;c.save(),c.translate(n[0]%u,n[1]%u),c.rotate(this.viewRotation_)}c.fill(),this.alignFill_&&c.restore()},_.prototype.setStrokeStyle_=function(c,n){c.strokeStyle=n[1],c.lineWidth=n[2],c.lineCap=n[3],c.lineJoin=n[4],c.miterLimit=n[5],c.setLineDash&&(c.lineDashOffset=n[7],c.setLineDash(n[6]))},_.prototype.drawLabelWithPointPlacement_=function(c,n,u,r){var s=this.textStates[n],P=this.createLabel(c,n,r,u),z=this.strokeStates[u],F=this.pixelRatio,N=n0(Array.isArray(c)?c[0]:c,s.textAlign||mh),V=md[s.textBaseline||ep],me=z&&z.lineWidth?z.lineWidth:0,be=P.width/F-2*s.scale[0],Se=N*be+2*(.5-N)*me,Ve=V*P.height/F+2*(.5-V)*me;return{label:P,anchorX:Se,anchorY:Ve}},_.prototype.execute_=function(c,n,u,r,s,P,z,F){var N;this.pixelCoordinates_&&_s(u,this.renderedTransform_)?N=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),N=_l(this.coordinates,0,this.coordinates.length,2,u,this.pixelCoordinates_),Pv(this.renderedTransform_,u));for(var V=0,me=r.length,be=0,Se,Ve,Ke,Ie,Ge,et,rt,_t,yt,ct,Tt,St,Lt=0,ur=0,Vt=null,Qt=null,or=this.coordinateCache_,Mt=this.viewRotation_,Br=Math.round(Math.atan2(-u[1],u[0])*1e12)/1e12,Tr={context:c,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:Mt},br=this.instructions!=r||this.overlaps?0:200,Mr,Ir,xr,ai;V<me;){var jt=r[V],Yr=jt[0];switch(Yr){case qr.BEGIN_GEOMETRY:Mr=jt[1],ai=jt[3],Mr.getGeometry()?z!==void 0&&!ko(z,ai.getExtent())?V=jt[2]+1:++V:V=jt[2];break;case qr.BEGIN_PATH:Lt>br&&(this.fill_(c),Lt=0),ur>br&&(c.stroke(),ur=0),!Lt&&!ur&&(c.beginPath(),Ie=NaN,Ge=NaN),++V;break;case qr.CIRCLE:be=jt[1];var vi=N[be],di=N[be+1],en=N[be+2],Ur=N[be+3],Li=en-vi,Pn=Ur-di,Ni=Math.sqrt(Li*Li+Pn*Pn);c.moveTo(vi+Ni,di),c.arc(vi,di,Ni,0,2*Math.PI,!0),++V;break;case qr.CLOSE_PATH:c.closePath(),++V;break;case qr.CUSTOM:be=jt[1],Se=jt[2];var Cr=jt[3],Zn=jt[4],Zi=jt.length==6?jt[5]:void 0;Tr.geometry=Cr,Tr.feature=Mr,V in or||(or[V]=[]);var sn=or[V];Zi?Zi(N,be,Se,2,sn):(sn[0]=N[be],sn[1]=N[be+1],sn.length=2),Zn(sn,Tr),++V;break;case qr.DRAW_IMAGE:be=jt[1],Se=jt[2],_t=jt[3],Ve=jt[4],Ke=jt[5];var jo=jt[6],Xn=jt[7],Jr=jt[8],ln=jt[9],Wn=jt[10],$n=jt[11],On=jt[12],Xi=jt[13],mn=jt[14];if(!_t&&jt.length>=19){yt=jt[18],ct=jt[19],Tt=jt[20],St=jt[21];var En=this.drawLabelWithPointPlacement_(yt,ct,Tt,St);_t=En.label,jt[3]=_t;var bo=jt[22];Ve=(En.anchorX-bo)*this.pixelRatio,jt[4]=Ve;var wt=jt[23];Ke=(En.anchorY-wt)*this.pixelRatio,jt[5]=Ke,jo=_t.height,jt[6]=jo,Xi=_t.width,jt[13]=Xi}var Wt=void 0;jt.length>24&&(Wt=jt[24]);var co=void 0,gn=void 0,Xr=void 0;jt.length>16?(co=jt[15],gn=jt[16],Xr=jt[17]):(co=dc,gn=!1,Xr=!1),Wn&&Br?$n+=Mt:!Wn&&!Br&&($n-=Mt);for(var Mn=0;be<Se;be+=2)if(!(Wt&&Wt[Mn++]<Xi/this.pixelRatio)){var Oi=this.calculateImageOrLabelDimensions_(_t.width,_t.height,N[be],N[be+1],Xi,jo,Ve,Ke,Jr,ln,$n,On,s,co,gn||Xr,Mr),fn=[c,n,_t,Oi,Xn,gn?Vt:null,Xr?Qt:null],Hn=void 0,Zt=void 0;if(F&&mn){var Nr=Se-be;if(!mn[Nr]){mn[Nr]=fn;continue}if(Hn=mn[Nr],delete mn[Nr],Zt=i0(Hn),F.collides(Zt))continue}F&&F.collides(Oi.declutterBox)||(Hn&&(F&&F.insert(Zt),this.replayImageOrLabel_.apply(this,Hn)),F&&F.insert(Oi.declutterBox),this.replayImageOrLabel_.apply(this,fn))}++V;break;case qr.DRAW_CHARS:var Dr=jt[1],Vi=jt[2],Tn=jt[3],Ar=jt[4];St=jt[5];var to=jt[6],Wi=jt[7],bi=jt[8];Tt=jt[9];var te=jt[10];yt=jt[11],ct=jt[12];var he=[jt[13],jt[13]],de=this.textStates[ct],Te=de.font,Re=[de.scale[0]*Wi,de.scale[1]*Wi],We=void 0;Te in this.widths_?We=this.widths_[Te]:(We={},this.widths_[Te]=We);var Je=Ym(N,Dr,Vi,2),we=Math.abs(Re[0])*e_(Te,yt,We);if(Ar||we<=Je){var Ue=this.textStates[ct].textAlign,ie=(Je-we)*md[Ue],X=r0(N,Dr,Vi,2,yt,ie,to,Math.abs(Re[0]),e_,Te,We,Br?0:this.viewRotation_);e:if(X){var J=[],re=void 0,le=void 0,Ae=void 0,ke=void 0,ge=void 0;if(Tt)for(re=0,le=X.length;re<le;++re){ge=X[re],Ae=ge[4],ke=this.createLabel(Ae,ct,"",Tt),Ve=ge[2]+(Re[0]<0?-te:te),Ke=Tn*ke.height+(.5-Tn)*2*te*Re[1]/Re[0]-bi;var Oi=this.calculateImageOrLabelDimensions_(ke.width,ke.height,ge[0],ge[1],ke.width,ke.height,Ve,Ke,0,0,ge[3],he,!1,dc,!1,Mr);if(F&&F.collides(Oi.declutterBox))break e;J.push([c,n,ke,Oi,1,null,null])}if(St)for(re=0,le=X.length;re<le;++re){ge=X[re],Ae=ge[4],ke=this.createLabel(Ae,ct,St,""),Ve=ge[2],Ke=Tn*ke.height-bi;var Oi=this.calculateImageOrLabelDimensions_(ke.width,ke.height,ge[0],ge[1],ke.width,ke.height,Ve,Ke,0,0,ge[3],he,!1,dc,!1,Mr);if(F&&F.collides(Oi.declutterBox))break e;J.push([c,n,ke,Oi,1,null,null])}F&&F.load(J.map(i0));for(var Ce=0,Le=J.length;Ce<Le;++Ce)this.replayImageOrLabel_.apply(this,J[Ce])}}++V;break;case qr.END_GEOMETRY:if(P!==void 0){Mr=jt[1];var He=P(Mr,ai);if(He)return He}++V;break;case qr.FILL:br?Lt++:this.fill_(c),++V;break;case qr.MOVE_TO_LINE_TO:for(be=jt[1],Se=jt[2],Ir=N[be],xr=N[be+1],et=Ir+.5|0,rt=xr+.5|0,(et!==Ie||rt!==Ge)&&(c.moveTo(Ir,xr),Ie=et,Ge=rt),be+=2;be<Se;be+=2)Ir=N[be],xr=N[be+1],et=Ir+.5|0,rt=xr+.5|0,(be==Se-2||et!==Ie||rt!==Ge)&&(c.lineTo(Ir,xr),Ie=et,Ge=rt);++V;break;case qr.SET_FILL_STYLE:Vt=jt,this.alignFill_=jt[2],Lt&&(this.fill_(c),Lt=0,ur&&(c.stroke(),ur=0)),c.fillStyle=jt[1],++V;break;case qr.SET_STROKE_STYLE:Qt=jt,ur&&(c.stroke(),ur=0),this.setStrokeStyle_(c,jt),++V;break;case qr.STROKE:br?ur++:c.stroke(),++V;break;default:++V;break}}Lt&&this.fill_(c),ur&&c.stroke()},_.prototype.execute=function(c,n,u,r,s,P){this.viewRotation_=r,this.execute_(c,n,u,this.instructions,s,void 0,void 0,P)},_.prototype.executeHitDetection=function(c,n,u,r,s){return this.viewRotation_=u,this.execute_(c,1,n,this.hitDetectionInstructions,!0,r,s)},_}(),o0=Yw;var l_=[Dn.POLYGON,Dn.CIRCLE,Dn.LINE_STRING,Dn.IMAGE,Dn.TEXT,Dn.DEFAULT],Jw=function(){function _(c,n,u,r,s,P){this.maxExtent_=c,this.overlaps_=r,this.pixelRatio_=u,this.resolution_=n,this.renderBuffer_=P,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=za(),this.createExecutors_(s)}return _.prototype.clip=function(c,n){var u=this.getClipCoords(n);c.beginPath(),c.moveTo(u[0],u[1]),c.lineTo(u[2],u[3]),c.lineTo(u[4],u[5]),c.lineTo(u[6],u[7]),c.clip()},_.prototype.createExecutors_=function(c){for(var n in c){var u=this.executorsByZIndex_[n];u===void 0&&(u={},this.executorsByZIndex_[n]=u);var r=c[n];for(var s in r){var P=r[s];u[s]=new o0(this.resolution_,this.pixelRatio_,this.overlaps_,P)}}},_.prototype.hasExecutors=function(c){for(var n in this.executorsByZIndex_)for(var u=this.executorsByZIndex_[n],r=0,s=c.length;r<s;++r)if(c[r]in u)return!0;return!1},_.prototype.forEachFeatureAtCoordinate=function(c,n,u,r,s,P){r=Math.round(r);var z=r*2+1,F=vs(this.hitDetectionTransform_,r+.5,r+.5,1/n,-1/n,-u,-c[0],-c[1]),N=!this.hitDetectionContext_;N&&(this.hitDetectionContext_=Ja(z,z));var V=this.hitDetectionContext_;V.canvas.width!==z||V.canvas.height!==z?(V.canvas.width=z,V.canvas.height=z):N||V.clearRect(0,0,z,z);var me;this.renderBuffer_!==void 0&&(me=Ya(),my(me,c),yl(me,n*(this.renderBuffer_+r),me));var be=Qw(r),Se;function Ve(ct,Tt){for(var St=V.getImageData(0,0,z,z).data,Lt=0,ur=be.length;Lt<ur;Lt++)if(St[be[Lt]]>0){if(!P||Se!==Dn.IMAGE&&Se!==Dn.TEXT||P.indexOf(ct)!==-1){var Vt=(be[Lt]-3)/4,Qt=r-Vt%z,or=r-(Vt/z|0),Mt=s(ct,Tt,Qt*Qt+or*or);if(Mt)return Mt}V.clearRect(0,0,z,z);break}}var Ke=Object.keys(this.executorsByZIndex_).map(Number);Ke.sort(rh);var Ie,Ge,et,rt,_t;for(Ie=Ke.length-1;Ie>=0;--Ie){var yt=Ke[Ie].toString();for(et=this.executorsByZIndex_[yt],Ge=l_.length-1;Ge>=0;--Ge)if(Se=l_[Ge],rt=et[Se],rt!==void 0&&(_t=rt.executeHitDetection(V,F,u,Ve,me),_t))return _t}},_.prototype.getClipCoords=function(c){var n=this.maxExtent_;if(!n)return null;var u=n[0],r=n[1],s=n[2],P=n[3],z=[u,r,u,P,s,P,s,r];return _l(z,0,8,2,c,z),z},_.prototype.isEmpty=function(){return Vl(this.executorsByZIndex_)},_.prototype.execute=function(c,n,u,r,s,P,z){var F=Object.keys(this.executorsByZIndex_).map(Number);F.sort(rh),this.maxExtent_&&(c.save(),this.clip(c,u));var N=P||l_,V,me,be,Se,Ve,Ke;for(z&&F.reverse(),V=0,me=F.length;V<me;++V){var Ie=F[V].toString();for(Ve=this.executorsByZIndex_[Ie],be=0,Se=N.length;be<Se;++be){var Ge=N[be];Ke=Ve[Ge],Ke!==void 0&&Ke.execute(c,n,u,r,s,z)}}this.maxExtent_&&c.restore()},_}(),u_={};function Qw(_){if(u_[_]!==void 0)return u_[_];for(var c=_*2+1,n=_*_,u=new Array(n+1),r=0;r<=_;++r)for(var s=0;s<=_;++s){var P=r*r+s*s;if(P>n)break;var z=u[P];z||(z=[],u[P]=z),z.push(((_+r)*c+(_+s))*4+3),r>0&&z.push(((_-r)*c+(_+s))*4+3),s>0&&(z.push(((_+r)*c+(_-s))*4+3),r>0&&z.push(((_-r)*c+(_-s))*4+3))}for(var F=[],r=0,N=u.length;r<N;++r)u[r]&&F.push.apply(F,u[r]);return u_[_]=F,F}var c_=Jw;var yd={ANIMATING:0,INTERACTING:1};var e2=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),t2=function(_){e2(c,_);function c(n,u,r,s,P,z,F){var N=_.call(this)||this;return N.context_=n,N.pixelRatio_=u,N.extent_=r,N.transform_=s,N.viewRotation_=P,N.squaredTolerance_=z,N.userTransform_=F,N.contextFillState_=null,N.contextStrokeState_=null,N.contextTextState_=null,N.fillState_=null,N.strokeState_=null,N.image_=null,N.imageAnchorX_=0,N.imageAnchorY_=0,N.imageHeight_=0,N.imageOpacity_=0,N.imageOriginX_=0,N.imageOriginY_=0,N.imageRotateWithView_=!1,N.imageRotation_=0,N.imageScale_=[0,0],N.imageWidth_=0,N.text_="",N.textOffsetX_=0,N.textOffsetY_=0,N.textRotateWithView_=!1,N.textRotation_=0,N.textScale_=[0,0],N.textFillState_=null,N.textStrokeState_=null,N.textState_=null,N.pixelCoordinates_=[],N.tmpLocalTransform_=za(),N}return c.prototype.drawImages_=function(n,u,r,s){if(!!this.image_){var P=_l(n,u,r,s,this.transform_,this.pixelCoordinates_),z=this.context_,F=this.tmpLocalTransform_,N=z.globalAlpha;this.imageOpacity_!=1&&(z.globalAlpha=N*this.imageOpacity_);var V=this.imageRotation_;this.imageRotateWithView_&&(V+=this.viewRotation_);for(var me=0,be=P.length;me<be;me+=2){var Se=P[me]-this.imageAnchorX_,Ve=P[me+1]-this.imageAnchorY_;if(V!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){var Ke=Se+this.imageAnchorX_,Ie=Ve+this.imageAnchorY_;vs(F,Ke,Ie,1,1,V,-Ke,-Ie),z.setTransform.apply(z,F),z.translate(Ke,Ie),z.scale(this.imageScale_[0],this.imageScale_[1]),z.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),z.setTransform(1,0,0,1,0,0)}else z.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,Se,Ve,this.imageWidth_,this.imageHeight_)}this.imageOpacity_!=1&&(z.globalAlpha=N)}},c.prototype.drawText_=function(n,u,r,s){if(!(!this.textState_||this.text_==="")){this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);var P=_l(n,u,r,s,this.transform_,this.pixelCoordinates_),z=this.context_,F=this.textRotation_;for(this.textRotateWithView_&&(F+=this.viewRotation_);u<r;u+=s){var N=P[u]+this.textOffsetX_,V=P[u+1]+this.textOffsetY_;if(F!==0||this.textScale_[0]!=1||this.textScale_[1]!=1){var me=vs(this.tmpLocalTransform_,N,V,1,1,F,-N,-V);z.setTransform.apply(z,me),z.translate(N,V),z.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&z.strokeText(this.text_,0,0),this.textFillState_&&z.fillText(this.text_,0,0),z.setTransform(1,0,0,1,0,0)}else this.textStrokeState_&&z.strokeText(this.text_,N,V),this.textFillState_&&z.fillText(this.text_,N,V)}}},c.prototype.moveToLineTo_=function(n,u,r,s,P){var z=this.context_,F=_l(n,u,r,s,this.transform_,this.pixelCoordinates_);z.moveTo(F[0],F[1]);var N=F.length;P&&(N-=2);for(var V=2;V<N;V+=2)z.lineTo(F[V],F[V+1]);return P&&z.closePath(),r},c.prototype.drawRings_=function(n,u,r,s){for(var P=0,z=r.length;P<z;++P)u=this.moveToLineTo_(n,u,r[P],s,!0);return u},c.prototype.drawCircle=function(n){if(!!ko(this.extent_,n.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);var u=dx(n,this.transform_,this.pixelCoordinates_),r=u[2]-u[0],s=u[3]-u[1],P=Math.sqrt(r*r+s*s),z=this.context_;z.beginPath(),z.arc(u[0],u[1],P,0,2*Math.PI),this.fillState_&&z.fill(),this.strokeState_&&z.stroke()}this.text_!==""&&this.drawText_(n.getCenter(),0,2,2)}},c.prototype.setStyle=function(n){this.setFillStrokeStyle(n.getFill(),n.getStroke()),this.setImageStyle(n.getImage()),this.setTextStyle(n.getText())},c.prototype.setTransform=function(n){this.transform_=n},c.prototype.drawGeometry=function(n){var u=n.getType();switch(u){case Pt.POINT:this.drawPoint(n);break;case Pt.LINE_STRING:this.drawLineString(n);break;case Pt.POLYGON:this.drawPolygon(n);break;case Pt.MULTI_POINT:this.drawMultiPoint(n);break;case Pt.MULTI_LINE_STRING:this.drawMultiLineString(n);break;case Pt.MULTI_POLYGON:this.drawMultiPolygon(n);break;case Pt.GEOMETRY_COLLECTION:this.drawGeometryCollection(n);break;case Pt.CIRCLE:this.drawCircle(n);break;default:}},c.prototype.drawFeature=function(n,u){var r=u.getGeometryFunction()(n);!r||!ko(this.extent_,r.getExtent())||(this.setStyle(u),this.drawGeometry(r))},c.prototype.drawGeometryCollection=function(n){for(var u=n.getGeometriesArray(),r=0,s=u.length;r<s;++r)this.drawGeometry(u[r])},c.prototype.drawPoint=function(n){this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_));var u=n.getFlatCoordinates(),r=n.getStride();this.image_&&this.drawImages_(u,0,u.length,r),this.text_!==""&&this.drawText_(u,0,u.length,r)},c.prototype.drawMultiPoint=function(n){this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_));var u=n.getFlatCoordinates(),r=n.getStride();this.image_&&this.drawImages_(u,0,u.length,r),this.text_!==""&&this.drawText_(u,0,u.length,r)},c.prototype.drawLineString=function(n){if(this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!ko(this.extent_,n.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);var u=this.context_,r=n.getFlatCoordinates();u.beginPath(),this.moveToLineTo_(r,0,r.length,n.getStride(),!1),u.stroke()}if(this.text_!==""){var s=n.getFlatMidpoint();this.drawText_(s,0,2,2)}}},c.prototype.drawMultiLineString=function(n){this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_));var u=n.getExtent();if(!!ko(this.extent_,u)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);var r=this.context_,s=n.getFlatCoordinates(),P=0,z=n.getEnds(),F=n.getStride();r.beginPath();for(var N=0,V=z.length;N<V;++N)P=this.moveToLineTo_(s,P,z[N],F,!1);r.stroke()}if(this.text_!==""){var me=n.getFlatMidpoints();this.drawText_(me,0,me.length,2)}}},c.prototype.drawPolygon=function(n){if(this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!ko(this.extent_,n.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);var u=this.context_;u.beginPath(),this.drawRings_(n.getOrientedFlatCoordinates(),0,n.getEnds(),n.getStride()),this.fillState_&&u.fill(),this.strokeState_&&u.stroke()}if(this.text_!==""){var r=n.getFlatInteriorPoint();this.drawText_(r,0,2,2)}}},c.prototype.drawMultiPolygon=function(n){if(this.squaredTolerance_&&(n=n.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!ko(this.extent_,n.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);var u=this.context_,r=n.getOrientedFlatCoordinates(),s=0,P=n.getEndss(),z=n.getStride();u.beginPath();for(var F=0,N=P.length;F<N;++F){var V=P[F];s=this.drawRings_(r,s,V,z)}this.fillState_&&u.fill(),this.strokeState_&&u.stroke()}if(this.text_!==""){var me=n.getFlatInteriorPoints();this.drawText_(me,0,me.length,2)}}},c.prototype.setContextFillState_=function(n){var u=this.context_,r=this.contextFillState_;r?r.fillStyle!=n.fillStyle&&(r.fillStyle=n.fillStyle,u.fillStyle=n.fillStyle):(u.fillStyle=n.fillStyle,this.contextFillState_={fillStyle:n.fillStyle})},c.prototype.setContextStrokeState_=function(n){var u=this.context_,r=this.contextStrokeState_;r?(r.lineCap!=n.lineCap&&(r.lineCap=n.lineCap,u.lineCap=n.lineCap),u.setLineDash&&(_s(r.lineDash,n.lineDash)||u.setLineDash(r.lineDash=n.lineDash),r.lineDashOffset!=n.lineDashOffset&&(r.lineDashOffset=n.lineDashOffset,u.lineDashOffset=n.lineDashOffset)),r.lineJoin!=n.lineJoin&&(r.lineJoin=n.lineJoin,u.lineJoin=n.lineJoin),r.lineWidth!=n.lineWidth&&(r.lineWidth=n.lineWidth,u.lineWidth=n.lineWidth),r.miterLimit!=n.miterLimit&&(r.miterLimit=n.miterLimit,u.miterLimit=n.miterLimit),r.strokeStyle!=n.strokeStyle&&(r.strokeStyle=n.strokeStyle,u.strokeStyle=n.strokeStyle)):(u.lineCap=n.lineCap,u.setLineDash&&(u.setLineDash(n.lineDash),u.lineDashOffset=n.lineDashOffset),u.lineJoin=n.lineJoin,u.lineWidth=n.lineWidth,u.miterLimit=n.miterLimit,u.strokeStyle=n.strokeStyle,this.contextStrokeState_={lineCap:n.lineCap,lineDash:n.lineDash,lineDashOffset:n.lineDashOffset,lineJoin:n.lineJoin,lineWidth:n.lineWidth,miterLimit:n.miterLimit,strokeStyle:n.strokeStyle})},c.prototype.setContextTextState_=function(n){var u=this.context_,r=this.contextTextState_,s=n.textAlign?n.textAlign:mh;r?(r.font!=n.font&&(r.font=n.font,u.font=n.font),r.textAlign!=s&&(r.textAlign=s,u.textAlign=s),r.textBaseline!=n.textBaseline&&(r.textBaseline=n.textBaseline,u.textBaseline=n.textBaseline)):(u.font=n.font,u.textAlign=s,u.textBaseline=n.textBaseline,this.contextTextState_={font:n.font,textAlign:s,textBaseline:n.textBaseline})},c.prototype.setFillStrokeStyle=function(n,u){var r=this;if(!n)this.fillState_=null;else{var s=n.getColor();this.fillState_={fillStyle:Ts(s||Ss)}}if(!u)this.strokeState_=null;else{var P=u.getColor(),z=u.getLineCap(),F=u.getLineDash(),N=u.getLineDashOffset(),V=u.getLineJoin(),me=u.getWidth(),be=u.getMiterLimit(),Se=F||cc;this.strokeState_={lineCap:z!==void 0?z:Qh,lineDash:this.pixelRatio_===1?Se:Se.map(function(Ve){return Ve*r.pixelRatio_}),lineDashOffset:(N||hc)*this.pixelRatio_,lineJoin:V!==void 0?V:Iu,lineWidth:(me!==void 0?me:mc)*this.pixelRatio_,miterLimit:be!==void 0?be:pc,strokeStyle:Ts(P||fc)}}},c.prototype.setImageStyle=function(n){var u;if(!n||!(u=n.getSize())){this.image_=null;return}var r=n.getAnchor(),s=n.getOrigin();this.image_=n.getImage(this.pixelRatio_),this.imageAnchorX_=r[0]*this.pixelRatio_,this.imageAnchorY_=r[1]*this.pixelRatio_,this.imageHeight_=u[1]*this.pixelRatio_,this.imageOpacity_=n.getOpacity(),this.imageOriginX_=s[0],this.imageOriginY_=s[1],this.imageRotateWithView_=n.getRotateWithView(),this.imageRotation_=n.getRotation(),this.imageScale_=n.getScaleArray(),this.imageWidth_=u[0]*this.pixelRatio_},c.prototype.setTextStyle=function(n){if(!n)this.text_="";else{var u=n.getFill();if(!u)this.textFillState_=null;else{var r=u.getColor();this.textFillState_={fillStyle:Ts(r||Ss)}}var s=n.getStroke();if(!s)this.textStrokeState_=null;else{var P=s.getColor(),z=s.getLineCap(),F=s.getLineDash(),N=s.getLineDashOffset(),V=s.getLineJoin(),me=s.getWidth(),be=s.getMiterLimit();this.textStrokeState_={lineCap:z!==void 0?z:Qh,lineDash:F||cc,lineDashOffset:N||hc,lineJoin:V!==void 0?V:Iu,lineWidth:me!==void 0?me:mc,miterLimit:be!==void 0?be:pc,strokeStyle:Ts(P||fc)}}var Se=n.getFont(),Ve=n.getOffsetX(),Ke=n.getOffsetY(),Ie=n.getRotateWithView(),Ge=n.getRotation(),et=n.getScaleArray(),rt=n.getText(),_t=n.getTextAlign(),yt=n.getTextBaseline();this.textState_={font:Se!==void 0?Se:tg,textAlign:_t!==void 0?_t:mh,textBaseline:yt!==void 0?yt:ep},this.text_=rt!==void 0?Array.isArray(rt)?rt.reduce(function(ct,Tt,St){return ct+=St%2?" ":Tt},""):rt:"",this.textOffsetX_=Ve!==void 0?this.pixelRatio_*Ve:0,this.textOffsetY_=Ke!==void 0?this.pixelRatio_*Ke:0,this.textRotateWithView_=Ie!==void 0?Ie:!1,this.textRotation_=Ge!==void 0?Ge:0,this.textScale_=[this.pixelRatio_*et[0],this.pixelRatio_*et[1]]}},c}(rg),a0=t2;var Pu={FRACTION:"fraction",PIXELS:"pixels"};var Ks={BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right",TOP_LEFT:"top-left",TOP_RIGHT:"top-right"};var r2=function(){function _(){this.cache_={},this.cacheSize_=0,this.maxCacheSize_=32}return _.prototype.clear=function(){this.cache_={},this.cacheSize_=0},_.prototype.canExpireCache=function(){return this.cacheSize_>this.maxCacheSize_},_.prototype.expire=function(){if(this.canExpireCache()){var c=0;for(var n in this.cache_){var u=this.cache_[n];(c++&3)===0&&!u.hasListener()&&(delete this.cache_[n],--this.cacheSize_)}}},_.prototype.get=function(c,n,u){var r=s0(c,n,u);return r in this.cache_?this.cache_[r]:null},_.prototype.set=function(c,n,u,r){var s=s0(c,n,u);this.cache_[s]=r,++this.cacheSize_},_.prototype.setSize=function(c){this.maxCacheSize_=c,this.expire()},_}();function s0(_,c,n){var u=n?Qm(n):"null";return c+":"+_+":"+u}var h_=new r2;var i2=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),n2=function(_){i2(c,_);function c(n,u,r,s){var P=_.call(this)||this;return P.extent=n,P.pixelRatio_=r,P.resolution=u,P.state=s,P}return c.prototype.changed=function(){this.dispatchEvent(Ji.CHANGE)},c.prototype.getExtent=function(){return this.extent},c.prototype.getImage=function(){return jr()},c.prototype.getPixelRatio=function(){return this.pixelRatio_},c.prototype.getResolution=function(){return this.resolution},c.prototype.getState=function(){return this.state},c.prototype.load=function(){jr()},c}(nh),l0=n2;var o2=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),nL=function(_){o2(c,_);function c(n,u,r,s,P,z){var F=_.call(this,n,u,r,qi.IDLE)||this;return F.src_=s,F.image_=new Image,P!==null&&(F.image_.crossOrigin=P),F.unlisten_=null,F.state=qi.IDLE,F.imageLoadFunction_=z,F}return c.prototype.getImage=function(){return this.image_},c.prototype.handleImageError_=function(){this.state=qi.ERROR,this.unlistenImage_(),this.changed()},c.prototype.handleImageLoad_=function(){this.resolution===void 0&&(this.resolution=Eu(this.extent)/this.image_.height),this.state=qi.LOADED,this.unlistenImage_(),this.changed()},c.prototype.load=function(){(this.state==qi.IDLE||this.state==qi.ERROR)&&(this.state=qi.LOADING,this.changed(),this.imageLoadFunction_(this,this.src_),this.unlisten_=p_(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))},c.prototype.setImage=function(n){this.image_=n,this.resolution=Eu(this.extent)/this.image_.height},c.prototype.unlistenImage_=function(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)},c}(l0);function p_(_,c,n){var u=_,r=!0,s=!1,P=!1,z=[qp(u,Ji.LOAD,function(){P=!0,s||c()})];return u.src&&Cv?(s=!0,u.decode().then(function(){r&&c()}).catch(function(F){r&&(P?c():n())})):z.push(qp(u,Ji.ERROR,n)),function(){r=!1,z.forEach(Ao)}}var a2=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),_d=null,s2=function(_){a2(c,_);function c(n,u,r,s,P,z){var F=_.call(this)||this;return F.hitDetectionImage_=null,F.image_=n||new Image,s!==null&&(F.image_.crossOrigin=s),F.canvas_={},F.color_=z,F.unlisten_=null,F.imageState_=P,F.size_=r,F.src_=u,F.tainted_,F}return c.prototype.isTainted_=function(){if(this.tainted_===void 0&&this.imageState_===qi.LOADED){_d||(_d=Ja(1,1)),_d.drawImage(this.image_,0,0);try{_d.getImageData(0,0,1,1),this.tainted_=!1}catch{_d=null,this.tainted_=!0}}return this.tainted_===!0},c.prototype.dispatchChangeEvent_=function(){this.dispatchEvent(Ji.CHANGE)},c.prototype.handleImageError_=function(){this.imageState_=qi.ERROR,this.unlistenImage_(),this.dispatchChangeEvent_()},c.prototype.handleImageLoad_=function(){this.imageState_=qi.LOADED,this.size_?(this.image_.width=this.size_[0],this.image_.height=this.size_[1]):this.size_=[this.image_.width,this.image_.height],this.unlistenImage_(),this.dispatchChangeEvent_()},c.prototype.getImage=function(n){return this.replaceColor_(n),this.canvas_[n]?this.canvas_[n]:this.image_},c.prototype.getPixelRatio=function(n){return this.replaceColor_(n),this.canvas_[n]?n:1},c.prototype.getImageState=function(){return this.imageState_},c.prototype.getHitDetectionImage=function(){if(!this.hitDetectionImage_)if(this.isTainted_()){var n=this.size_[0],u=this.size_[1],r=Ja(n,u);r.fillRect(0,0,n,u),this.hitDetectionImage_=r.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_},c.prototype.getSize=function(){return this.size_},c.prototype.getSrc=function(){return this.src_},c.prototype.load=function(){if(this.imageState_==qi.IDLE){this.imageState_=qi.LOADING;try{this.image_.src=this.src_}catch{this.handleImageError_()}this.unlisten_=p_(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this))}},c.prototype.replaceColor_=function(n){if(!(!this.color_||this.canvas_[n]||this.imageState_!==qi.LOADED)){var u=document.createElement("canvas");this.canvas_[n]=u,u.width=Math.ceil(this.image_.width*n),u.height=Math.ceil(this.image_.height*n);var r=u.getContext("2d");if(r.scale(n,n),r.drawImage(this.image_,0,0),r.globalCompositeOperation="multiply",r.globalCompositeOperation==="multiply"||this.isTainted_())r.fillStyle=Qm(this.color_),r.fillRect(0,0,u.width/n,u.height/n),r.globalCompositeOperation="destination-in",r.drawImage(this.image_,0,0);else{for(var s=r.getImageData(0,0,u.width,u.height),P=s.data,z=this.color_[0]/255,F=this.color_[1]/255,N=this.color_[2]/255,V=this.color_[3],me=0,be=P.length;me<be;me+=4)P[me]*=z,P[me+1]*=F,P[me+2]*=N,P[me+3]*=V;r.putImageData(s,0,0)}}},c.prototype.unlistenImage_=function(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)},c}(nh);function u0(_,c,n,u,r,s){var P=h_.get(c,u,s);return P||(P=new s2(_,c,n,u,r,s),h_.set(c,u,s,P)),P}var l2=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),u2=function(_){l2(c,_);function c(n){var u=this,r=n||{},s=r.opacity!==void 0?r.opacity:1,P=r.rotation!==void 0?r.rotation:0,z=r.scale!==void 0?r.scale:1,F=r.rotateWithView!==void 0?r.rotateWithView:!1;u=_.call(this,{opacity:s,rotation:P,scale:z,displacement:r.displacement!==void 0?r.displacement:[0,0],rotateWithView:F})||this,u.anchor_=r.anchor!==void 0?r.anchor:[.5,.5],u.normalizedAnchor_=null,u.anchorOrigin_=r.anchorOrigin!==void 0?r.anchorOrigin:Ks.TOP_LEFT,u.anchorXUnits_=r.anchorXUnits!==void 0?r.anchorXUnits:Pu.FRACTION,u.anchorYUnits_=r.anchorYUnits!==void 0?r.anchorYUnits:Pu.FRACTION,u.crossOrigin_=r.crossOrigin!==void 0?r.crossOrigin:null;var N=r.img!==void 0?r.img:null;u.imgSize_=r.imgSize;var V=r.src;wn(!(V!==void 0&&N),4),wn(!N||N&&u.imgSize_,5),(V===void 0||V.length===0)&&N&&(V=N.src||Ai(N)),wn(V!==void 0&&V.length>0,6);var me=r.src!==void 0?qi.IDLE:qi.LOADED;return u.color_=r.color!==void 0?Jh(r.color):null,u.iconImage_=u0(N,V,u.imgSize_!==void 0?u.imgSize_:null,u.crossOrigin_,me,u.color_),u.offset_=r.offset!==void 0?r.offset:[0,0],u.offsetOrigin_=r.offsetOrigin!==void 0?r.offsetOrigin:Ks.TOP_LEFT,u.origin_=null,u.size_=r.size!==void 0?r.size:null,u}return c.prototype.clone=function(){var n=this.getScale();return new c({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,crossOrigin:this.crossOrigin_,imgSize:this.imgSize_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:Array.isArray(n)?n.slice():n,size:this.size_!==null?this.size_.slice():void 0,src:this.getSrc()})},c.prototype.getAnchor=function(){var n=this.normalizedAnchor_;if(!n){n=this.anchor_;var u=this.getSize();if(this.anchorXUnits_==Pu.FRACTION||this.anchorYUnits_==Pu.FRACTION){if(!u)return null;n=this.anchor_.slice(),this.anchorXUnits_==Pu.FRACTION&&(n[0]*=u[0]),this.anchorYUnits_==Pu.FRACTION&&(n[1]*=u[1])}if(this.anchorOrigin_!=Ks.TOP_LEFT){if(!u)return null;n===this.anchor_&&(n=this.anchor_.slice()),(this.anchorOrigin_==Ks.TOP_RIGHT||this.anchorOrigin_==Ks.BOTTOM_RIGHT)&&(n[0]=-n[0]+u[0]),(this.anchorOrigin_==Ks.BOTTOM_LEFT||this.anchorOrigin_==Ks.BOTTOM_RIGHT)&&(n[1]=-n[1]+u[1])}this.normalizedAnchor_=n}var r=this.getDisplacement();return[n[0]-r[0],n[1]+r[1]]},c.prototype.setAnchor=function(n){this.anchor_=n,this.normalizedAnchor_=null},c.prototype.getColor=function(){return this.color_},c.prototype.getImage=function(n){return this.iconImage_.getImage(n)},c.prototype.getPixelRatio=function(n){return this.iconImage_.getPixelRatio(n)},c.prototype.getImageSize=function(){return this.iconImage_.getSize()},c.prototype.getImageState=function(){return this.iconImage_.getImageState()},c.prototype.getHitDetectionImage=function(){return this.iconImage_.getHitDetectionImage()},c.prototype.getOrigin=function(){if(this.origin_)return this.origin_;var n=this.offset_;if(this.offsetOrigin_!=Ks.TOP_LEFT){var u=this.getSize(),r=this.iconImage_.getSize();if(!u||!r)return null;n=n.slice(),(this.offsetOrigin_==Ks.TOP_RIGHT||this.offsetOrigin_==Ks.BOTTOM_RIGHT)&&(n[0]=r[0]-u[0]-n[0]),(this.offsetOrigin_==Ks.BOTTOM_LEFT||this.offsetOrigin_==Ks.BOTTOM_RIGHT)&&(n[1]=r[1]-u[1]-n[1])}return this.origin_=n,this.origin_},c.prototype.getSrc=function(){return this.iconImage_.getSrc()},c.prototype.getSize=function(){return this.size_?this.size_:this.iconImage_.getSize()},c.prototype.listenImageChange=function(n){this.iconImage_.addEventListener(Ji.CHANGE,n)},c.prototype.load=function(){this.iconImage_.load()},c.prototype.unlistenImageChange=function(n){this.iconImage_.removeEventListener(Ji.CHANGE,n)},c}(Jm),f_=u2;var $l=.5;function c0(_,c,n,u,r,s,P){var z=_[0]*$l,F=_[1]*$l,N=Ja(z,F);N.imageSmoothingEnabled=!1;for(var V=N.canvas,me=new a0(N,$l,r,null,P),be=n.length,Se=Math.floor((256*256*256-1)/be),Ve={},Ke=1;Ke<=be;++Ke){var Ie=n[Ke-1],Ge=Ie.getStyleFunction()||u;if(!!u){var et=Ge(Ie,s);if(!!et){Array.isArray(et)||(et=[et]);for(var rt=Ke*Se,_t="#"+("000000"+rt.toString(16)).slice(-6),yt=0,ct=et.length;yt<ct;++yt){var Tt=et[yt],St=Tt.getGeometryFunction()(Ie);if(!(!St||!ko(r,St.getExtent()))){var Lt=Tt.clone(),ur=Lt.getFill();ur&&ur.setColor(_t);var Vt=Lt.getStroke();Vt&&(Vt.setColor(_t),Vt.setLineDash(null)),Lt.setText(void 0);var Qt=Tt.getImage();if(Qt&&Qt.getOpacity()!==0){var or=Qt.getImageSize();if(!or)continue;var Mt=Ja(or[0],or[1],void 0,{alpha:!1}),Br=Mt.canvas;Mt.fillStyle=_t,Mt.fillRect(0,0,Br.width,Br.height),Lt.setImage(new f_({img:Br,imgSize:or,anchor:Qt.getAnchor(),anchorXUnits:Pu.PIXELS,anchorYUnits:Pu.PIXELS,offset:Qt.getOrigin(),opacity:1,size:Qt.getSize(),scale:Qt.getScale(),rotation:Qt.getRotation(),rotateWithView:Qt.getRotateWithView()}))}var Tr=Lt.getZIndex()||0,br=Ve[Tr];br||(br={},Ve[Tr]=br,br[Pt.POLYGON]=[],br[Pt.CIRCLE]=[],br[Pt.LINE_STRING]=[],br[Pt.POINT]=[]),br[St.getType().replace("Multi","")].push(St,Lt)}}}}}for(var Mr=Object.keys(Ve).map(Number).sort(rh),Ke=0,Ir=Mr.length;Ke<Ir;++Ke){var br=Ve[Mr[Ke]];for(var xr in br)for(var ai=br[xr],yt=0,ct=ai.length;yt<ct;yt+=2){me.setStyle(ai[yt+1]);for(var jt=0,Yr=c.length;jt<Yr;++jt)me.setTransform(c[jt]),me.drawGeometry(ai[yt])}}return N.getImageData(0,0,V.width,V.height)}function h0(_,c,n){var u=[];if(n){var r=Math.floor(Math.round(_[0])*$l),s=Math.floor(Math.round(_[1])*$l),P=(jl(r,0,n.width-1)+jl(s,0,n.height-1)*n.width)*4,z=n.data[P],F=n.data[P+1],N=n.data[P+2],V=N+256*(F+256*z),me=Math.floor((256*256*256-1)/c.length);V&&V%me===0&&u.push(c[V/me-1])}return u}var c2=.5,p0={Point:y2,LineString:d2,Polygon:v2,MultiPoint:_2,MultiLineString:m2,MultiPolygon:g2,GeometryCollection:f2,Circle:h2};function f0(_,c){return parseInt(Ai(_),10)-parseInt(Ai(c),10)}function d0(_,c){var n=ig(_,c);return n*n}function ig(_,c){return c2*_/c}function h2(_,c,n,u,r){var s=n.getFill(),P=n.getStroke();if(s||P){var z=_.getBuilder(n.getZIndex(),Dn.CIRCLE);z.setFillStrokeStyle(s,P),z.drawCircle(c,u)}var F=n.getText();if(F&&F.getText()){var N=(r||_).getBuilder(n.getZIndex(),Dn.TEXT);N.setTextStyle(F),N.drawText(c,u)}}function d_(_,c,n,u,r,s,P){var z=!1,F=n.getImage();if(F){var N=F.getImageState();N==qi.LOADED||N==qi.ERROR?F.unlistenImageChange(r):(N==qi.IDLE&&F.load(),N=F.getImageState(),F.listenImageChange(r),z=!0)}return p2(_,c,n,u,s,P),z}function p2(_,c,n,u,r,s){var P=n.getGeometryFunction()(c);if(!!P){var z=P.simplifyTransformed(u,r),F=n.getRenderer();if(F)m0(_,z,n,c);else{var N=p0[z.getType()];N(_,z,n,c,s)}}}function m0(_,c,n,u){if(c.getType()==Pt.GEOMETRY_COLLECTION){for(var r=c.getGeometries(),s=0,P=r.length;s<P;++s)m0(_,r[s],n,u);return}var z=_.getBuilder(n.getZIndex(),Dn.DEFAULT);z.drawCustom(c,u,n.getRenderer(),n.getHitDetectionRenderer())}function f2(_,c,n,u,r){var s=c.getGeometriesArray(),P,z;for(P=0,z=s.length;P<z;++P){var F=p0[s[P].getType()];F(_,s[P],n,u,r)}}function d2(_,c,n,u,r){var s=n.getStroke();if(s){var P=_.getBuilder(n.getZIndex(),Dn.LINE_STRING);P.setFillStrokeStyle(null,s),P.drawLineString(c,u)}var z=n.getText();if(z&&z.getText()){var F=(r||_).getBuilder(n.getZIndex(),Dn.TEXT);F.setTextStyle(z),F.drawText(c,u)}}function m2(_,c,n,u,r){var s=n.getStroke();if(s){var P=_.getBuilder(n.getZIndex(),Dn.LINE_STRING);P.setFillStrokeStyle(null,s),P.drawMultiLineString(c,u)}var z=n.getText();if(z&&z.getText()){var F=(r||_).getBuilder(n.getZIndex(),Dn.TEXT);F.setTextStyle(z),F.drawText(c,u)}}function g2(_,c,n,u,r){var s=n.getFill(),P=n.getStroke();if(P||s){var z=_.getBuilder(n.getZIndex(),Dn.POLYGON);z.setFillStrokeStyle(s,P),z.drawMultiPolygon(c,u)}var F=n.getText();if(F&&F.getText()){var N=(r||_).getBuilder(n.getZIndex(),Dn.TEXT);N.setTextStyle(F),N.drawText(c,u)}}function y2(_,c,n,u,r){var s=n.getImage(),P=n.getText(),z;if(r&&(_=r,z=s&&P&&P.getText()?{}:void 0),s){if(s.getImageState()!=qi.LOADED)return;var F=_.getBuilder(n.getZIndex(),Dn.IMAGE);F.setImageStyle(s,z),F.drawPoint(c,u)}if(P&&P.getText()){var N=_.getBuilder(n.getZIndex(),Dn.TEXT);N.setTextStyle(P,z),N.drawText(c,u)}}function _2(_,c,n,u,r){var s=n.getImage(),P=n.getText(),z;if(r&&(_=r,z=s&&P&&P.getText()?{}:void 0),s){if(s.getImageState()!=qi.LOADED)return;var F=_.getBuilder(n.getZIndex(),Dn.IMAGE);F.setImageStyle(s,z),F.drawMultiPoint(c,u)}if(P&&P.getText()){var N=(r||_).getBuilder(n.getZIndex(),Dn.TEXT);N.setTextStyle(P,z),N.drawText(c,u)}}function v2(_,c,n,u,r){var s=n.getFill(),P=n.getStroke();if(s||P){var z=_.getBuilder(n.getZIndex(),Dn.POLYGON);z.setFillStrokeStyle(s,P),z.drawPolygon(c,u)}var F=n.getText();if(F&&F.getText()){var N=(r||_).getBuilder(n.getZIndex(),Dn.TEXT);N.setTextStyle(F),N.drawText(c,u)}}var x2=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),b2=function(_){x2(c,_);function c(n){var u=_.call(this,n)||this;return u.boundHandleStyleImageChange_=u.handleStyleImageChange_.bind(u),u.animatingOrInteracting_,u.dirty_=!1,u.hitDetectionImageData_=null,u.renderedFeatures_=null,u.renderedRevision_=-1,u.renderedResolution_=NaN,u.renderedExtent_=Ya(),u.wrappedRenderedExtent_=Ya(),u.renderedRotation_,u.renderedCenter_=null,u.renderedProjection_=null,u.renderedRenderOrder_=null,u.replayGroup_=null,u.replayGroupChanged=!0,u.declutterExecutorGroup=null,u.clipping=!0,u}return c.prototype.renderWorlds=function(n,u,r){var s=u.extent,P=u.viewState,z=P.center,F=P.resolution,N=P.projection,V=P.rotation,me=N.getExtent(),be=this.getLayer().getSource(),Se=u.pixelRatio,Ve=u.viewHints,Ke=!(Ve[yd.ANIMATING]||Ve[yd.INTERACTING]),Ie=this.context,Ge=Math.round(u.size[0]*Se),et=Math.round(u.size[1]*Se),rt=be.getWrapX()&&N.canWrapX(),_t=rt?bs(me):null,yt=rt?Math.ceil((s[2]-me[2])/_t)+1:1,ct=rt?Math.floor((s[0]-me[0])/_t):0;do{var Tt=this.getRenderTransform(z,F,V,Se,Ge,et,ct*_t);n.execute(Ie,1,Tt,V,Ke,void 0,r)}while(++ct<yt)},c.prototype.renderDeclutter=function(n){this.declutterExecutorGroup&&this.renderWorlds(this.declutterExecutorGroup,n,n.declutterTree)},c.prototype.renderFrame=function(n,u){var r=n.pixelRatio,s=n.layerStatesArray[n.layerIndex];Mv(this.pixelTransform,1/r,1/r),Lv(this.inversePixelTransform,this.pixelTransform);var P=hy(this.pixelTransform);this.useContainer(u,P,s.opacity,this.getBackground(n));var z=this.context,F=z.canvas,N=this.replayGroup_,V=this.declutterExecutorGroup;if((!N||N.isEmpty())&&(!V||V.isEmpty()))return null;var me=Math.round(n.size[0]*r),be=Math.round(n.size[1]*r);F.width!=me||F.height!=be?(F.width=me,F.height=be,F.style.transform!==P&&(F.style.transform=P)):this.containerReused||z.clearRect(0,0,me,be),this.preRender(z,n);var Se=n.viewState,Ve=Se.projection,Ke=!1,Ie=!0;if(s.extent&&this.clipping){var Ge=td(s.extent,Ve);Ie=ko(Ge,n.extent),Ke=Ie&&!sc(Ge,n.extent),Ke&&this.clipUnrotated(z,n,Ge)}Ie&&this.renderWorlds(N,n),Ke&&z.restore(),this.postRender(z,n);var et=Dx(s.opacity),rt=this.container;return et!==rt.style.opacity&&(rt.style.opacity=et),this.renderedRotation_!==Se.rotation&&(this.renderedRotation_=Se.rotation,this.hitDetectionImageData_=null),this.container},c.prototype.getFeatures=function(n){return new Promise(function(u){if(!this.hitDetectionImageData_&&!this.animatingOrInteracting_){var r=[this.context.canvas.width,this.context.canvas.height];xo(this.pixelTransform,r);var s=this.renderedCenter_,P=this.renderedResolution_,z=this.renderedRotation_,F=this.renderedProjection_,N=this.wrappedRenderedExtent_,V=this.getLayer(),me=[],be=r[0]*$l,Se=r[1]*$l;me.push(this.getRenderTransform(s,P,z,$l,be,Se,0).slice());var Ve=V.getSource(),Ke=F.getExtent();if(Ve.getWrapX()&&F.canWrapX()&&!sc(Ke,N)){for(var Ie=N[0],Ge=bs(Ke),et=0,rt=void 0;Ie<Ke[0];)--et,rt=Ge*et,me.push(this.getRenderTransform(s,P,z,$l,be,Se,rt).slice()),Ie+=Ge;for(et=0,Ie=N[2];Ie>Ke[2];)++et,rt=Ge*et,me.push(this.getRenderTransform(s,P,z,$l,be,Se,rt).slice()),Ie-=Ge}this.hitDetectionImageData_=c0(r,me,this.renderedFeatures_,V.getStyleFunction(),N,P,z)}u(h0(n,this.renderedFeatures_,this.hitDetectionImageData_))}.bind(this))},c.prototype.forEachFeatureAtCoordinate=function(n,u,r,s,P){var z=this;if(!!this.replayGroup_){var F=u.viewState.resolution,N=u.viewState.rotation,V=this.getLayer(),me={},be=function(Ke,Ie,Ge){var et=Ai(Ke),rt=me[et];if(rt){if(rt!==!0&&Ge<rt.distanceSq){if(Ge===0)return me[et]=!0,P.splice(P.lastIndexOf(rt),1),s(Ke,V,Ie);rt.geometry=Ie,rt.distanceSq=Ge}}else{if(Ge===0)return me[et]=!0,s(Ke,V,Ie);P.push(me[et]={feature:Ke,layer:V,geometry:Ie,distanceSq:Ge,callback:s})}},Se,Ve=[this.replayGroup_];return this.declutterExecutorGroup&&Ve.push(this.declutterExecutorGroup),Ve.some(function(Ke){return Se=Ke.forEachFeatureAtCoordinate(n,F,N,r,be,Ke===z.declutterExecutorGroup&&u.declutterTree?u.declutterTree.all().map(function(Ie){return Ie.value}):null)}),Se}},c.prototype.handleFontsChanged=function(){var n=this.getLayer();n.getVisible()&&this.replayGroup_&&n.changed()},c.prototype.handleStyleImageChange_=function(n){this.renderIfReadyAndVisible()},c.prototype.prepareFrame=function(n){var u=this.getLayer(),r=u.getSource();if(!r)return!1;var s=n.viewHints[yd.ANIMATING],P=n.viewHints[yd.INTERACTING],z=u.getUpdateWhileAnimating(),F=u.getUpdateWhileInteracting();if(!this.dirty_&&!z&&s||!F&&P)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;var N=n.extent,V=n.viewState,me=V.projection,be=V.resolution,Se=n.pixelRatio,Ve=u.getRevision(),Ke=u.getRenderBuffer(),Ie=u.getRenderOrder();Ie===void 0&&(Ie=f0);var Ge=V.center.slice(),et=yl(N,Ke*be),rt=et.slice(),_t=[et.slice()],yt=me.getExtent();if(r.getWrapX()&&me.canWrapX()&&!sc(yt,n.extent)){var ct=bs(yt),Tt=Math.max(bs(et)/2,ct);et[0]=yt[0]-Tt,et[2]=yt[2]+Tt,Jv(Ge,me);var St=Kv(_t[0],me);St[0]<yt[0]&&St[2]<yt[2]?_t.push([St[0]+ct,St[1],St[2]+ct,St[3]]):St[0]>yt[0]&&St[2]>yt[2]&&_t.push([St[0]-ct,St[1],St[2]-ct,St[3]])}if(!this.dirty_&&this.renderedResolution_==be&&this.renderedRevision_==Ve&&this.renderedRenderOrder_==Ie&&sc(this.wrappedRenderedExtent_,et))return _s(this.renderedExtent_,rt)||(this.hitDetectionImageData_=null,this.renderedExtent_=rt),this.renderedCenter_=Ge,this.replayGroupChanged=!1,!0;this.replayGroup_=null,this.dirty_=!1;var Lt=new s_(ig(be,Se),et,be,Se),ur;this.getLayer().getDeclutter()&&(ur=new s_(ig(be,Se),et,be,Se));var Vt=uh(),Qt;if(Vt){for(var or=0,Mt=_t.length;or<Mt;++or){var Br=_t[or],Tr=Qp(Br,me);r.loadFeatures(Tr,rx(be,me),Vt)}Qt=Um(Vt,me)}else for(var or=0,Mt=_t.length;or<Mt;++or)r.loadFeatures(_t[or],be,me);var br=d0(be,Se),Mr=function(Yr){var vi,di=Yr.getStyleFunction()||u.getStyleFunction();if(di&&(vi=di(Yr,be)),vi){var en=this.renderFeature(Yr,br,vi,Lt,Qt,ur);this.dirty_=this.dirty_||en}}.bind(this),Ir=Qp(et,me),xr=r.getFeaturesInExtent(Ir);Ie&&xr.sort(Ie);for(var or=0,Mt=xr.length;or<Mt;++or)Mr(xr[or]);this.renderedFeatures_=xr;var ai=Lt.finish(),jt=new c_(et,be,Se,r.getOverlaps(),ai,u.getRenderBuffer());return ur&&(this.declutterExecutorGroup=new c_(et,be,Se,r.getOverlaps(),ur.finish(),u.getRenderBuffer())),this.renderedResolution_=be,this.renderedRevision_=Ve,this.renderedRenderOrder_=Ie,this.renderedExtent_=rt,this.wrappedRenderedExtent_=et,this.renderedCenter_=Ge,this.renderedProjection_=me,this.replayGroup_=jt,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0},c.prototype.renderFeature=function(n,u,r,s,P,z){if(!r)return!1;var F=!1;if(Array.isArray(r))for(var N=0,V=r.length;N<V;++N)F=d_(s,n,r[N],u,this.boundHandleStyleImageChange_,P,z)||F;else F=d_(s,n,r,u,this.boundHandleStyleImageChange_,P,z);return F},c}(t0),g0=b2;var w2=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),E2=function(_){w2(c,_);function c(n){return _.call(this,n)||this}return c.prototype.createRenderer=function(){return new g0(this)},c}($x),tp=E2;var y0=Gp(n_(),1);var T2=function(){function _(c){this.rbush_=new y0.default(c),this.items_={}}return _.prototype.insert=function(c,n){var u={minX:c[0],minY:c[1],maxX:c[2],maxY:c[3],value:n};this.rbush_.insert(u),this.items_[Ai(n)]=u},_.prototype.load=function(c,n){for(var u=new Array(n.length),r=0,s=n.length;r<s;r++){var P=c[r],z=n[r],F={minX:P[0],minY:P[1],maxX:P[2],maxY:P[3],value:z};u[r]=F,this.items_[Ai(z)]=F}this.rbush_.load(u)},_.prototype.remove=function(c){var n=Ai(c),u=this.items_[n];return delete this.items_[n],this.rbush_.remove(u)!==null},_.prototype.update=function(c,n){var u=this.items_[Ai(n)],r=[u.minX,u.minY,u.maxX,u.maxY];Bm(r,c)||(this.remove(n),this.insert(c,n))},_.prototype.getAll=function(){var c=this.rbush_.all();return c.map(function(n){return n.value})},_.prototype.getInExtent=function(c){var n={minX:c[0],minY:c[1],maxX:c[2],maxY:c[3]},u=this.rbush_.search(n);return u.map(function(r){return r.value})},_.prototype.forEach=function(c){return this.forEach_(this.getAll(),c)},_.prototype.forEachInExtent=function(c,n){return this.forEach_(this.getInExtent(c),n)},_.prototype.forEach_=function(c,n){for(var u,r=0,s=c.length;r<s;r++)if(u=n(c[r]),u)return u;return u},_.prototype.isEmpty=function(){return Vl(this.items_)},_.prototype.clear=function(){this.rbush_.clear(),this.items_={}},_.prototype.getExtent=function(c){var n=this.rbush_.toJSON();return sh(n.minX,n.minY,n.maxX,n.maxY,c)},_.prototype.concat=function(c){this.rbush_.load(c.rbush_.all());for(var n in c.items_)this.items_[n]=c.items_[n]},_}(),vd=T2;var S2=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),I2=function(_){S2(c,_);function c(n){var u=_.call(this)||this;u.projection=ga(n.projection),u.attributions_=_0(n.attributions),u.attributionsCollapsible_=n.attributionsCollapsible!==void 0?n.attributionsCollapsible:!0,u.loading=!1,u.state_=n.state!==void 0?n.state:Su.READY,u.wrapX_=n.wrapX!==void 0?n.wrapX:!1,u.interpolate_=!!n.interpolate,u.viewResolver=null,u.viewRejector=null;var r=u;return u.viewPromise_=new Promise(function(s,P){r.viewResolver=s,r.viewRejector=P}),u}return c.prototype.getAttributions=function(){return this.attributions_},c.prototype.getAttributionsCollapsible=function(){return this.attributionsCollapsible_},c.prototype.getProjection=function(){return this.projection},c.prototype.getResolutions=function(){return jr()},c.prototype.getView=function(){return this.viewPromise_},c.prototype.getState=function(){return this.state_},c.prototype.getWrapX=function(){return this.wrapX_},c.prototype.getInterpolate=function(){return this.interpolate_},c.prototype.refresh=function(){this.changed()},c.prototype.setAttributions=function(n){this.attributions_=_0(n),this.changed()},c.prototype.setState=function(n){this.state_=n,this.changed()},c}(Po);function _0(_){return _?Array.isArray(_)?function(c){return _}:typeof _=="function"?_:function(c){return[_]}:null}var cf=I2;var Qa={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};function v0(_,c){return[[-1/0,-1/0,1/0,1/0]]}var _h={ARRAY_BUFFER:"arraybuffer",JSON:"json",TEXT:"text",XML:"xml"};var C2=!1;function A2(_,c,n,u,r,s,P){var z=new XMLHttpRequest;z.open("GET",typeof _=="function"?_(n,u,r):_,!0),c.getType()==_h.ARRAY_BUFFER&&(z.responseType="arraybuffer"),z.withCredentials=C2,z.onload=function(F){if(!z.status||z.status>=200&&z.status<300){var N=c.getType(),V=void 0;N==_h.JSON||N==_h.TEXT?V=z.responseText:N==_h.XML?(V=z.responseXML,V||(V=new DOMParser().parseFromString(z.responseText,"application/xml"))):N==_h.ARRAY_BUFFER&&(V=z.response),V?s(c.readFeatures(V,{extent:n,featureProjection:r}),c.readProjection(V)):P()}else P()},z.onerror=P,z.send()}function m_(_,c){return function(n,u,r,s,P){var z=this;A2(_,c,n,u,r,function(F,N){z.addFeatures(F),s!==void 0&&s(F)},P||qh)}}var x0=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),vh=function(_){x0(c,_);function c(n,u,r){var s=_.call(this,n)||this;return s.feature=u,s.features=r,s}return c}(La);var P2=function(_){x0(c,_);function c(n){var u=this,r=n||{};u=_.call(this,{attributions:r.attributions,interpolate:!0,projection:void 0,state:Su.READY,wrapX:r.wrapX!==void 0?r.wrapX:!0})||this,u.on,u.once,u.un,u.loader_=qh,u.format_=r.format,u.overlaps_=r.overlaps===void 0?!0:r.overlaps,u.url_=r.url,r.loader!==void 0?u.loader_=r.loader:u.url_!==void 0&&(wn(u.format_,7),u.loader_=m_(u.url_,u.format_)),u.strategy_=r.strategy!==void 0?r.strategy:v0;var s=r.useSpatialIndex!==void 0?r.useSpatialIndex:!0;u.featuresRtree_=s?new vd:null,u.loadedExtentsRtree_=new vd,u.loadingExtentsCount_=0,u.nullGeometryFeatures_={},u.idIndex_={},u.uidIndex_={},u.featureChangeKeys_={},u.featuresCollection_=null;var P,z;return Array.isArray(r.features)?z=r.features:r.features&&(P=r.features,z=P.getArray()),!s&&P===void 0&&(P=new ch(z)),z!==void 0&&u.addFeaturesInternal(z),P!==void 0&&u.bindFeaturesCollection_(P),u}return c.prototype.addFeature=function(n){this.addFeatureInternal(n),this.changed()},c.prototype.addFeatureInternal=function(n){var u=Ai(n);if(!this.addToIndex_(u,n)){this.featuresCollection_&&this.featuresCollection_.remove(n);return}this.setupChangeEvents_(u,n);var r=n.getGeometry();if(r){var s=r.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(s,n)}else this.nullGeometryFeatures_[u]=n;this.dispatchEvent(new vh(Qa.ADDFEATURE,n))},c.prototype.setupChangeEvents_=function(n,u){this.featureChangeKeys_[n]=[lo(u,Ji.CHANGE,this.handleFeatureChange_,this),lo(u,jp.PROPERTYCHANGE,this.handleFeatureChange_,this)]},c.prototype.addToIndex_=function(n,u){var r=!0,s=u.getId();return s!==void 0&&(s.toString()in this.idIndex_?r=!1:this.idIndex_[s.toString()]=u),r&&(wn(!(n in this.uidIndex_),30),this.uidIndex_[n]=u),r},c.prototype.addFeatures=function(n){this.addFeaturesInternal(n),this.changed()},c.prototype.addFeaturesInternal=function(n){for(var u=[],r=[],s=[],P=0,z=n.length;P<z;P++){var F=n[P],N=Ai(F);this.addToIndex_(N,F)&&r.push(F)}for(var P=0,V=r.length;P<V;P++){var F=r[P],N=Ai(F);this.setupChangeEvents_(N,F);var me=F.getGeometry();if(me){var be=me.getExtent();u.push(be),s.push(F)}else this.nullGeometryFeatures_[N]=F}if(this.featuresRtree_&&this.featuresRtree_.load(u,s),this.hasListener(Qa.ADDFEATURE))for(var P=0,Se=r.length;P<Se;P++)this.dispatchEvent(new vh(Qa.ADDFEATURE,r[P]))},c.prototype.bindFeaturesCollection_=function(n){var u=!1;this.addEventListener(Qa.ADDFEATURE,function(r){u||(u=!0,n.push(r.feature),u=!1)}),this.addEventListener(Qa.REMOVEFEATURE,function(r){u||(u=!0,n.remove(r.feature),u=!1)}),n.addEventListener(ws.ADD,function(r){u||(u=!0,this.addFeature(r.element),u=!1)}.bind(this)),n.addEventListener(ws.REMOVE,function(r){u||(u=!0,this.removeFeature(r.element),u=!1)}.bind(this)),this.featuresCollection_=n},c.prototype.clear=function(n){if(n){for(var u in this.featureChangeKeys_){var r=this.featureChangeKeys_[u];r.forEach(Ao)}this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){var s=function(F){this.removeFeatureInternal(F)}.bind(this);this.featuresRtree_.forEach(s);for(var P in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[P])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};var z=new vh(Qa.CLEAR);this.dispatchEvent(z),this.changed()},c.prototype.forEachFeature=function(n){if(this.featuresRtree_)return this.featuresRtree_.forEach(n);this.featuresCollection_&&this.featuresCollection_.forEach(n)},c.prototype.forEachFeatureAtCoordinateDirect=function(n,u){var r=[n[0],n[1],n[0],n[1]];return this.forEachFeatureInExtent(r,function(s){var P=s.getGeometry();if(P.intersectsCoordinate(n))return u(s)})},c.prototype.forEachFeatureInExtent=function(n,u){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(n,u);this.featuresCollection_&&this.featuresCollection_.forEach(u)},c.prototype.forEachFeatureIntersectingExtent=function(n,u){return this.forEachFeatureInExtent(n,function(r){var s=r.getGeometry();if(s.intersectsExtent(n)){var P=u(r);if(P)return P}})},c.prototype.getFeaturesCollection=function(){return this.featuresCollection_},c.prototype.getFeatures=function(){var n;return this.featuresCollection_?n=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(n=this.featuresRtree_.getAll(),Vl(this.nullGeometryFeatures_)||Ha(n,Im(this.nullGeometryFeatures_))),n},c.prototype.getFeaturesAtCoordinate=function(n){var u=[];return this.forEachFeatureAtCoordinateDirect(n,function(r){u.push(r)}),u},c.prototype.getFeaturesInExtent=function(n){return this.featuresRtree_?this.featuresRtree_.getInExtent(n):this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]},c.prototype.getClosestFeatureToCoordinate=function(n,u){var r=n[0],s=n[1],P=null,z=[NaN,NaN],F=1/0,N=[-1/0,-1/0,1/0,1/0],V=u||Sm;return this.featuresRtree_.forEachInExtent(N,function(me){if(V(me)){var be=me.getGeometry(),Se=F;if(F=be.closestPointXY(r,s,z,F),F<Se){P=me;var Ve=Math.sqrt(F);N[0]=r-Ve,N[1]=s-Ve,N[2]=r+Ve,N[3]=s+Ve}}}),P},c.prototype.getExtent=function(n){return this.featuresRtree_.getExtent(n)},c.prototype.getFeatureById=function(n){var u=this.idIndex_[n.toString()];return u!==void 0?u:null},c.prototype.getFeatureByUid=function(n){var u=this.uidIndex_[n];return u!==void 0?u:null},c.prototype.getFormat=function(){return this.format_},c.prototype.getOverlaps=function(){return this.overlaps_},c.prototype.getUrl=function(){return this.url_},c.prototype.handleFeatureChange_=function(n){var u=n.target,r=Ai(u),s=u.getGeometry();if(!s)r in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(u),this.nullGeometryFeatures_[r]=u);else{var P=s.getExtent();r in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[r],this.featuresRtree_&&this.featuresRtree_.insert(P,u)):this.featuresRtree_&&this.featuresRtree_.update(P,u)}var z=u.getId();if(z!==void 0){var F=z.toString();this.idIndex_[F]!==u&&(this.removeFromIdIndex_(u),this.idIndex_[F]=u)}else this.removeFromIdIndex_(u),this.uidIndex_[r]=u;this.changed(),this.dispatchEvent(new vh(Qa.CHANGEFEATURE,u))},c.prototype.hasFeature=function(n){var u=n.getId();return u!==void 0?u in this.idIndex_:Ai(n)in this.uidIndex_},c.prototype.isEmpty=function(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&Vl(this.nullGeometryFeatures_):this.featuresCollection_?this.featuresCollection_.getLength()===0:!0},c.prototype.loadFeatures=function(n,u,r){for(var s=this.loadedExtentsRtree_,P=this.strategy_(n,u,r),z=function(me,be){var Se=P[me],Ve=s.forEachInExtent(Se,function(Ke){return sc(Ke.extent,Se)});Ve||(++F.loadingExtentsCount_,F.dispatchEvent(new vh(Qa.FEATURESLOADSTART)),F.loader_.call(F,Se,u,r,function(Ke){--this.loadingExtentsCount_,this.dispatchEvent(new vh(Qa.FEATURESLOADEND,void 0,Ke))}.bind(F),function(){--this.loadingExtentsCount_,this.dispatchEvent(new vh(Qa.FEATURESLOADERROR))}.bind(F)),s.insert(Se,{extent:Se.slice()}))},F=this,N=0,V=P.length;N<V;++N)z(N,V);this.loading=this.loader_.length<4?!1:this.loadingExtentsCount_>0},c.prototype.refresh=function(){this.clear(!0),this.loadedExtentsRtree_.clear(),_.prototype.refresh.call(this)},c.prototype.removeLoadedExtent=function(n){var u=this.loadedExtentsRtree_,r;u.forEachInExtent(n,function(s){if(Bm(s.extent,n))return r=s,!0}),r&&u.remove(r)},c.prototype.removeFeature=function(n){if(!!n){var u=Ai(n);u in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[u]:this.featuresRtree_&&this.featuresRtree_.remove(n);var r=this.removeFeatureInternal(n);r&&this.changed()}},c.prototype.removeFeatureInternal=function(n){var u=Ai(n),r=this.featureChangeKeys_[u];if(!!r){r.forEach(Ao),delete this.featureChangeKeys_[u];var s=n.getId();return s!==void 0&&delete this.idIndex_[s.toString()],delete this.uidIndex_[u],this.dispatchEvent(new vh(Qa.REMOVEFEATURE,n)),n}},c.prototype.removeFromIdIndex_=function(n){var u=!1;for(var r in this.idIndex_)if(this.idIndex_[r]===n){delete this.idIndex_[r],u=!0;break}return u},c.prototype.setLoader=function(n){this.loader_=n},c.prototype.setUrl=function(n){wn(this.format_,7),this.url_=n,this.setLoader(m_(n,this.format_))},c}(cf),rp=P2;var b0=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),hf=function(_){b0(c,_);function c(n,u){var r=_.call(this,n)||this;return r.layer=u,r}return c}(La);var g_={LAYERS:"layers"},M2=function(_){b0(c,_);function c(n){var u=this,r=n||{},s=Ra({},r);delete s.layers;var P=r.layers;return u=_.call(this,s)||this,u.on,u.once,u.un,u.layersListenerKeys_=[],u.listenerKeys_={},u.addChangeListener(g_.LAYERS,u.handleLayersChanged_),P?Array.isArray(P)?P=new ch(P.slice(),{unique:!0}):wn(typeof P.getArray=="function",43):P=new ch(void 0,{unique:!0}),u.setLayers(P),u}return c.prototype.handleLayerChange_=function(){this.changed()},c.prototype.handleLayersChanged_=function(){this.layersListenerKeys_.forEach(Ao),this.layersListenerKeys_.length=0;var n=this.getLayers();this.layersListenerKeys_.push(lo(n,ws.ADD,this.handleLayersAdd_,this),lo(n,ws.REMOVE,this.handleLayersRemove_,this));for(var u in this.listenerKeys_)this.listenerKeys_[u].forEach(Ao);ih(this.listenerKeys_);for(var r=n.getArray(),s=0,P=r.length;s<P;s++){var z=r[s];this.registerLayerListeners_(z),this.dispatchEvent(new hf("addlayer",z))}this.changed()},c.prototype.registerLayerListeners_=function(n){var u=[lo(n,jp.PROPERTYCHANGE,this.handleLayerChange_,this),lo(n,Ji.CHANGE,this.handleLayerChange_,this)];n instanceof c&&u.push(lo(n,"addlayer",this.handleLayerGroupAdd_,this),lo(n,"removelayer",this.handleLayerGroupRemove_,this)),this.listenerKeys_[Ai(n)]=u},c.prototype.handleLayerGroupAdd_=function(n){this.dispatchEvent(new hf("addlayer",n.layer))},c.prototype.handleLayerGroupRemove_=function(n){this.dispatchEvent(new hf("removelayer",n.layer))},c.prototype.handleLayersAdd_=function(n){var u=n.element;this.registerLayerListeners_(u),this.dispatchEvent(new hf("addlayer",u)),this.changed()},c.prototype.handleLayersRemove_=function(n){var u=n.element,r=Ai(u);this.listenerKeys_[r].forEach(Ao),delete this.listenerKeys_[r],this.dispatchEvent(new hf("removelayer",u)),this.changed()},c.prototype.getLayers=function(){return this.get(g_.LAYERS)},c.prototype.setLayers=function(n){var u=this.getLayers();if(u)for(var r=u.getArray(),s=0,P=r.length;s<P;++s)this.dispatchEvent(new hf("removelayer",r[s]));this.set(g_.LAYERS,n)},c.prototype.getLayersArray=function(n){var u=n!==void 0?n:[];return this.getLayers().forEach(function(r){r.getLayersArray(u)}),u},c.prototype.getLayerStatesArray=function(n){var u=n!==void 0?n:[],r=u.length;this.getLayers().forEach(function(V){V.getLayerStatesArray(u)});var s=this.getLayerState(),P=s.zIndex;!n&&s.zIndex===void 0&&(P=0);for(var z=r,F=u.length;z<F;z++){var N=u[z];N.opacity*=s.opacity,N.visible=N.visible&&s.visible,N.maxResolution=Math.min(N.maxResolution,s.maxResolution),N.minResolution=Math.max(N.minResolution,s.minResolution),N.minZoom=Math.max(N.minZoom,s.minZoom),N.maxZoom=Math.min(N.maxZoom,s.maxZoom),s.extent!==void 0&&(N.extent!==void 0?N.extent=Xv(N.extent,s.extent):N.extent=s.extent),N.zIndex===void 0&&(N.zIndex=P)}return u},c.prototype.getSourceState=function(){return Su.READY},c}(Gm),y_=M2;var ia={SINGLECLICK:"singleclick",CLICK:Ji.CLICK,DBLCLICK:Ji.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var __={ACTIVE:"active"};var k2=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),L2=function(_){k2(c,_);function c(n){var u=_.call(this)||this;return u.on,u.once,u.un,n&&n.handleEvent&&(u.handleEvent=n.handleEvent),u.map_=null,u.setActive(!0),u}return c.prototype.getActive=function(){return this.get(__.ACTIVE)},c.prototype.getMap=function(){return this.map_},c.prototype.handleEvent=function(n){return!0},c.prototype.setActive=function(n){this.set(__.ACTIVE,n)},c.prototype.setMap=function(n){this.map_=n},c}(Po);var w0=L2;var R2=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),z2=function(_){R2(c,_);function c(n){var u=this,r=n||{};return u=_.call(this,r)||this,r.handleDownEvent&&(u.handleDownEvent=r.handleDownEvent),r.handleDragEvent&&(u.handleDragEvent=r.handleDragEvent),r.handleMoveEvent&&(u.handleMoveEvent=r.handleMoveEvent),r.handleUpEvent&&(u.handleUpEvent=r.handleUpEvent),r.stopDown&&(u.stopDown=r.stopDown),u.handlingDownUpSequence=!1,u.trackedPointers_={},u.targetPointers=[],u}return c.prototype.getPointerCount=function(){return this.targetPointers.length},c.prototype.handleDownEvent=function(n){return!1},c.prototype.handleDragEvent=function(n){},c.prototype.handleEvent=function(n){if(!n.originalEvent)return!0;var u=!1;if(this.updateTrackedPointers_(n),this.handlingDownUpSequence){if(n.type==ia.POINTERDRAG)this.handleDragEvent(n),n.originalEvent.preventDefault();else if(n.type==ia.POINTERUP){var r=this.handleUpEvent(n);this.handlingDownUpSequence=r&&this.targetPointers.length>0}}else if(n.type==ia.POINTERDOWN){var s=this.handleDownEvent(n);this.handlingDownUpSequence=s,u=this.stopDown(s)}else n.type==ia.POINTERMOVE&&this.handleMoveEvent(n);return!u},c.prototype.handleMoveEvent=function(n){},c.prototype.handleUpEvent=function(n){return!1},c.prototype.stopDown=function(n){return n},c.prototype.updateTrackedPointers_=function(n){if(D2(n)){var u=n.originalEvent,r=u.pointerId.toString();n.type==ia.POINTERUP?delete this.trackedPointers_[r]:n.type==ia.POINTERDOWN?this.trackedPointers_[r]=u:r in this.trackedPointers_&&(this.trackedPointers_[r]=u),this.targetPointers=Im(this.trackedPointers_)}},c}(w0);function D2(_){var c=_.type;return c===ia.POINTERDOWN||c===ia.POINTERDRAG||c===ia.POINTERUP}var E0=z2;var T0=function(_){var c=_.originalEvent;return c.altKey&&!(c.metaKey||c.ctrlKey)&&!c.shiftKey};var S0=Sm,I0=function(_){return _.type==ia.CLICK};var C0=function(_){return _.type==ia.SINGLECLICK};var A0=function(_){var c=_.originalEvent;return wn(c!==void 0,56),c.isPrimary&&c.button===0};var O2=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),F2=function(_){O2(c,_);function c(n,u,r){var s=_.call(this)||this;if(s.ends_=[],s.maxDelta_=-1,s.maxDeltaRevision_=-1,Array.isArray(n[0]))s.setCoordinates(n,u);else if(u!==void 0&&r)s.setFlatCoordinates(u,n),s.ends_=r;else{for(var P=s.getLayout(),z=n,F=[],N=[],V=0,me=z.length;V<me;++V){var be=z[V];V===0&&(P=be.getLayout()),Ha(F,be.getFlatCoordinates()),N.push(F.length)}s.setFlatCoordinates(P,F),s.ends_=N}return s}return c.prototype.appendLineString=function(n){this.flatCoordinates?Ha(this.flatCoordinates,n.getFlatCoordinates().slice()):this.flatCoordinates=n.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()},c.prototype.clone=function(){var n=new c(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return n.applyProperties(this),n},c.prototype.closestPointXY=function(n,u,r,s){return s<xs(this.getExtent(),n,u)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(nd(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),ad(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,n,u,r,s))},c.prototype.getCoordinateAtM=function(n,u,r){if(this.layout!=An.XYM&&this.layout!=An.XYZM||this.flatCoordinates.length===0)return null;var s=u!==void 0?u:!1,P=r!==void 0?r:!1;return Lx(this.flatCoordinates,0,this.ends_,this.stride,n,s,P)},c.prototype.getCoordinates=function(){return ph(this.flatCoordinates,0,this.ends_,this.stride)},c.prototype.getEnds=function(){return this.ends_},c.prototype.getLineString=function(n){return n<0||this.ends_.length<=n?null:new uc(this.flatCoordinates.slice(n===0?0:this.ends_[n-1],this.ends_[n]),this.layout)},c.prototype.getLineStrings=function(){for(var n=this.flatCoordinates,u=this.ends_,r=this.layout,s=[],P=0,z=0,F=u.length;z<F;++z){var N=u[z],V=new uc(n.slice(P,N),r);s.push(V),P=N}return s},c.prototype.getFlatMidpoints=function(){for(var n=[],u=this.flatCoordinates,r=0,s=this.ends_,P=this.stride,z=0,F=s.length;z<F;++z){var N=s[z],V=Km(u,r,N,P,.5);Ha(n,V),r=N}return n},c.prototype.getSimplifiedGeometryInternal=function(n){var u=[],r=[];return u.length=xx(this.flatCoordinates,0,this.ends_,this.stride,n,u,0,r),new c(u,An.XY,r)},c.prototype.getType=function(){return Pt.MULTI_LINE_STRING},c.prototype.intersectsExtent=function(n){return Ix(this.flatCoordinates,0,this.ends_,this.stride,n)},c.prototype.setCoordinates=function(n,u){this.setLayout(u,n,2),this.flatCoordinates||(this.flatCoordinates=[]);var r=sd(this.flatCoordinates,0,n,this.stride,this.ends_);this.flatCoordinates.length=r.length===0?0:r[r.length-1],this.changed()},c}(Es),P0=F2;var B2=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),U2=function(_){B2(c,_);function c(n,u){var r=_.call(this)||this;return u&&!Array.isArray(n[0])?r.setFlatCoordinates(u,n):r.setCoordinates(n,u),r}return c.prototype.appendPoint=function(n){this.flatCoordinates?Ha(this.flatCoordinates,n.getFlatCoordinates()):this.flatCoordinates=n.getFlatCoordinates().slice(),this.changed()},c.prototype.clone=function(){var n=new c(this.flatCoordinates.slice(),this.layout);return n.applyProperties(this),n},c.prototype.closestPointXY=function(n,u,r,s){if(s<xs(this.getExtent(),n,u))return s;for(var P=this.flatCoordinates,z=this.stride,F=0,N=P.length;F<N;F+=z){var V=ql(n,u,P[F],P[F+1]);if(V<s){s=V;for(var me=0;me<z;++me)r[me]=P[F+me];r.length=z}}return s},c.prototype.getCoordinates=function(){return vl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)},c.prototype.getPoint=function(n){var u=this.flatCoordinates?this.flatCoordinates.length/this.stride:0;return n<0||u<=n?null:new ya(this.flatCoordinates.slice(n*this.stride,(n+1)*this.stride),this.layout)},c.prototype.getPoints=function(){for(var n=this.flatCoordinates,u=this.layout,r=this.stride,s=[],P=0,z=n.length;P<z;P+=r){var F=new ya(n.slice(P,P+r),u);s.push(F)}return s},c.prototype.getType=function(){return Pt.MULTI_POINT},c.prototype.intersectsExtent=function(n){for(var u=this.flatCoordinates,r=this.stride,s=0,P=u.length;s<P;s+=r){var z=u[s],F=u[s+1];if(Jf(n,z,F))return!0}return!1},c.prototype.setCoordinates=function(n,u){this.setLayout(u,n,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Yh(this.flatCoordinates,0,n,this.stride),this.changed()},c}(Es),ng=U2;function M0(_,c,n,u){for(var r=[],s=Ya(),P=0,z=n.length;P<z;++P){var F=n[P];s=Fm(_,c,F[0],u),r.push((s[0]+s[2])/2,(s[1]+s[3])/2),c=F[F.length-1]}return r}var N2=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),V2=function(_){N2(c,_);function c(n,u,r){var s=_.call(this)||this;if(s.endss_=[],s.flatInteriorPointsRevision_=-1,s.flatInteriorPoints_=null,s.maxDelta_=-1,s.maxDeltaRevision_=-1,s.orientedRevision_=-1,s.orientedFlatCoordinates_=null,!r&&!Array.isArray(n[0])){for(var P=s.getLayout(),z=n,F=[],N=[],V=0,me=z.length;V<me;++V){var be=z[V];V===0&&(P=be.getLayout());for(var Se=F.length,Ve=be.getEnds(),Ke=0,Ie=Ve.length;Ke<Ie;++Ke)Ve[Ke]+=Se;Ha(F,be.getFlatCoordinates()),N.push(Ve)}u=P,n=F,r=N}return u!==void 0&&r?(s.setFlatCoordinates(u,n),s.endss_=r):s.setCoordinates(n,u),s}return c.prototype.appendPolygon=function(n){var u;if(!this.flatCoordinates)this.flatCoordinates=n.getFlatCoordinates().slice(),u=n.getEnds().slice(),this.endss_.push();else{var r=this.flatCoordinates.length;Ha(this.flatCoordinates,n.getFlatCoordinates()),u=n.getEnds().slice();for(var s=0,P=u.length;s<P;++s)u[s]+=r}this.endss_.push(u),this.changed()},c.prototype.clone=function(){for(var n=this.endss_.length,u=new Array(n),r=0;r<n;++r)u[r]=this.endss_[r].slice();var s=new c(this.flatCoordinates.slice(),this.layout,u);return s.applyProperties(this),s},c.prototype.closestPointXY=function(n,u,r,s){return s<xs(this.getExtent(),n,u)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(gx(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),yx(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,n,u,r,s))},c.prototype.containsXY=function(n,u){return Tx(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,n,u)},c.prototype.getArea=function(){return wx(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)},c.prototype.getCoordinates=function(n){var u;return n!==void 0?(u=this.getOrientedFlatCoordinates().slice(),Wy(u,0,this.endss_,this.stride,n)):u=this.flatCoordinates,ud(u,0,this.endss_,this.stride)},c.prototype.getEndss=function(){return this.endss_},c.prototype.getFlatInteriorPoints=function(){if(this.flatInteriorPointsRevision_!=this.getRevision()){var n=M0(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=Sx(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,n),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_},c.prototype.getInteriorPoints=function(){return new ng(this.getFlatInteriorPoints().slice(),An.XYM)},c.prototype.getOrientedFlatCoordinates=function(){if(this.orientedRevision_!=this.getRevision()){var n=this.flatCoordinates;Mx(n,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=n:(this.orientedFlatCoordinates_=n.slice(),this.orientedFlatCoordinates_.length=Wy(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_},c.prototype.getSimplifiedGeometryInternal=function(n){var u=[],r=[];return u.length=bx(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(n),u,0,r),new c(u,An.XY,r)},c.prototype.getPolygon=function(n){if(n<0||this.endss_.length<=n)return null;var u;if(n===0)u=0;else{var r=this.endss_[n-1];u=r[r.length-1]}var s=this.endss_[n].slice(),P=s[s.length-1];if(u!==0)for(var z=0,F=s.length;z<F;++z)s[z]-=u;return new pd(this.flatCoordinates.slice(u,P),this.layout,s)},c.prototype.getPolygons=function(){for(var n=this.layout,u=this.flatCoordinates,r=this.endss_,s=[],P=0,z=0,F=r.length;z<F;++z){var N=r[z].slice(),V=N[N.length-1];if(P!==0)for(var me=0,be=N.length;me<be;++me)N[me]-=P;var Se=new pd(u.slice(P,V),n,N);s.push(Se),P=V}return s},c.prototype.getType=function(){return Pt.MULTI_POLYGON},c.prototype.intersectsExtent=function(n){return Cx(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,n)},c.prototype.setCoordinates=function(n,u){this.setLayout(u,n,3),this.flatCoordinates||(this.flatCoordinates=[]);var r=vx(this.flatCoordinates,0,n,this.stride,this.endss_);if(r.length===0)this.flatCoordinates.length=0;else{var s=r[r.length-1];this.flatCoordinates.length=s.length===0?0:s[s.length-1]}this.changed()},c}(Es),k0=V2;var O0=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),L0=0,xd=1,R0=[0,0,0,0],pf=[],v_={MODIFYSTART:"modifystart",MODIFYEND:"modifyend"},x_=function(_){O0(c,_);function c(n,u,r){var s=_.call(this,n)||this;return s.features=u,s.mapBrowserEvent=r,s}return c}(La);var G2=function(_){O0(c,_);function c(n){var u=_.call(this,n)||this;u.on,u.once,u.un,u.boundHandleFeatureChange_=u.handleFeatureChange_.bind(u),u.condition_=n.condition?n.condition:A0,u.defaultDeleteCondition_=function(s){return T0(s)&&C0(s)},u.deleteCondition_=n.deleteCondition?n.deleteCondition:u.defaultDeleteCondition_,u.insertVertexCondition_=n.insertVertexCondition?n.insertVertexCondition:S0,u.vertexFeature_=null,u.vertexSegments_=null,u.lastPixel_=[0,0],u.ignoreNextSingleClick_=!1,u.featuresBeingModified_=null,u.rBush_=new vd,u.pixelTolerance_=n.pixelTolerance!==void 0?n.pixelTolerance:10,u.snappedToVertex_=!1,u.changingFeature_=!1,u.dragSegments_=[],u.overlay_=new tp({source:new rp({useSpatialIndex:!1,wrapX:!!n.wrapX}),style:n.style?n.style:q2(),updateWhileAnimating:!0,updateWhileInteracting:!0}),u.SEGMENT_WRITERS_={Point:u.writePointGeometry_.bind(u),LineString:u.writeLineStringGeometry_.bind(u),LinearRing:u.writeLineStringGeometry_.bind(u),Polygon:u.writePolygonGeometry_.bind(u),MultiPoint:u.writeMultiPointGeometry_.bind(u),MultiLineString:u.writeMultiLineStringGeometry_.bind(u),MultiPolygon:u.writeMultiPolygonGeometry_.bind(u),Circle:u.writeCircleGeometry_.bind(u),GeometryCollection:u.writeGeometryCollectionGeometry_.bind(u)},u.source_=null,u.hitDetection_=null;var r;if(n.features?r=n.features:n.source&&(u.source_=n.source,r=new ch(u.source_.getFeatures()),u.source_.addEventListener(Qa.ADDFEATURE,u.handleSourceAdd_.bind(u)),u.source_.addEventListener(Qa.REMOVEFEATURE,u.handleSourceRemove_.bind(u))),!r)throw new Error("The modify interaction requires features, a source or a layer");return n.hitDetection&&(u.hitDetection_=n.hitDetection),u.features_=r,u.features_.forEach(u.addFeature_.bind(u)),u.features_.addEventListener(ws.ADD,u.handleFeatureAdd_.bind(u)),u.features_.addEventListener(ws.REMOVE,u.handleFeatureRemove_.bind(u)),u.lastPointerEvent_=null,u.delta_=[0,0],u.snapToPointer_=n.snapToPointer===void 0?!u.hitDetection_:n.snapToPointer,u}return c.prototype.addFeature_=function(n){var u=n.getGeometry();if(u){var r=this.SEGMENT_WRITERS_[u.getType()];r&&r(n,u)}var s=this.getMap();s&&s.isRendered()&&this.getActive()&&this.handlePointerAtPixel_(this.lastPixel_,s),n.addEventListener(Ji.CHANGE,this.boundHandleFeatureChange_)},c.prototype.willModifyFeatures_=function(n,u){if(!this.featuresBeingModified_){this.featuresBeingModified_=new ch;for(var r=this.featuresBeingModified_.getArray(),s=0,P=u.length;s<P;++s)for(var z=u[s],F=0,N=z.length;F<N;++F){var V=z[F].feature;V&&r.indexOf(V)===-1&&this.featuresBeingModified_.push(V)}this.featuresBeingModified_.getLength()===0?this.featuresBeingModified_=null:this.dispatchEvent(new x_(v_.MODIFYSTART,this.featuresBeingModified_,n))}},c.prototype.removeFeature_=function(n){this.removeFeatureSegmentData_(n),this.vertexFeature_&&this.features_.getLength()===0&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),n.removeEventListener(Ji.CHANGE,this.boundHandleFeatureChange_)},c.prototype.removeFeatureSegmentData_=function(n){var u=this.rBush_,r=[];u.forEach(function(F){n===F.feature&&r.push(F)});for(var s=r.length-1;s>=0;--s){for(var P=r[s],z=this.dragSegments_.length-1;z>=0;--z)this.dragSegments_[z][0]===P&&this.dragSegments_.splice(z,1);u.remove(P)}},c.prototype.setActive=function(n){this.vertexFeature_&&!n&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),_.prototype.setActive.call(this,n)},c.prototype.setMap=function(n){this.overlay_.setMap(n),_.prototype.setMap.call(this,n)},c.prototype.getOverlay=function(){return this.overlay_},c.prototype.handleSourceAdd_=function(n){n.feature&&this.features_.push(n.feature)},c.prototype.handleSourceRemove_=function(n){n.feature&&this.features_.remove(n.feature)},c.prototype.handleFeatureAdd_=function(n){this.addFeature_(n.element)},c.prototype.handleFeatureChange_=function(n){if(!this.changingFeature_){var u=n.target;this.removeFeature_(u),this.addFeature_(u)}},c.prototype.handleFeatureRemove_=function(n){var u=n.element;this.removeFeature_(u)},c.prototype.writePointGeometry_=function(n,u){var r=u.getCoordinates(),s={feature:n,geometry:u,segment:[r,r]};this.rBush_.insert(u.getExtent(),s)},c.prototype.writeMultiPointGeometry_=function(n,u){for(var r=u.getCoordinates(),s=0,P=r.length;s<P;++s){var z=r[s],F={feature:n,geometry:u,depth:[s],index:s,segment:[z,z]};this.rBush_.insert(u.getExtent(),F)}},c.prototype.writeLineStringGeometry_=function(n,u){for(var r=u.getCoordinates(),s=0,P=r.length-1;s<P;++s){var z=r.slice(s,s+2),F={feature:n,geometry:u,index:s,segment:z};this.rBush_.insert(wu(z),F)}},c.prototype.writeMultiLineStringGeometry_=function(n,u){for(var r=u.getCoordinates(),s=0,P=r.length;s<P;++s)for(var z=r[s],F=0,N=z.length-1;F<N;++F){var V=z.slice(F,F+2),me={feature:n,geometry:u,depth:[s],index:F,segment:V};this.rBush_.insert(wu(V),me)}},c.prototype.writePolygonGeometry_=function(n,u){for(var r=u.getCoordinates(),s=0,P=r.length;s<P;++s)for(var z=r[s],F=0,N=z.length-1;F<N;++F){var V=z.slice(F,F+2),me={feature:n,geometry:u,depth:[s],index:F,segment:V};this.rBush_.insert(wu(V),me)}},c.prototype.writeMultiPolygonGeometry_=function(n,u){for(var r=u.getCoordinates(),s=0,P=r.length;s<P;++s)for(var z=r[s],F=0,N=z.length;F<N;++F)for(var V=z[F],me=0,be=V.length-1;me<be;++me){var Se=V.slice(me,me+2),Ve={feature:n,geometry:u,depth:[F,s],index:me,segment:Se};this.rBush_.insert(wu(Se),Ve)}},c.prototype.writeCircleGeometry_=function(n,u){var r=u.getCenter(),s={feature:n,geometry:u,index:L0,segment:[r,r]},P={feature:n,geometry:u,index:xd,segment:[r,r]},z=[s,P];s.featureSegments=z,P.featureSegments=z,this.rBush_.insert(Yp(r),s);var F=u,N=uh();if(N&&this.getMap()){var V=this.getMap().getView().getProjection();F=F.clone().transform(N,V),F=$y(F).transform(V,N)}this.rBush_.insert(F.getExtent(),P)},c.prototype.writeGeometryCollectionGeometry_=function(n,u){for(var r=u.getGeometriesArray(),s=0;s<r.length;++s){var P=r[s],z=this.SEGMENT_WRITERS_[P.getType()];z(n,P)}},c.prototype.createOrUpdateVertexFeature_=function(n,u,r){var s=this.vertexFeature_;if(!s)s=new lc(new ya(n)),this.vertexFeature_=s,this.overlay_.getSource().addFeature(s);else{var P=s.getGeometry();P.setCoordinates(n)}return s.set("features",u),s.set("geometries",r),s},c.prototype.handleEvent=function(n){if(!n.originalEvent)return!0;this.lastPointerEvent_=n;var u;return!n.map.getView().getInteracting()&&n.type==ia.POINTERMOVE&&!this.handlingDownUpSequence&&this.handlePointerMove_(n),this.vertexFeature_&&this.deleteCondition_(n)&&(n.type!=ia.SINGLECLICK||!this.ignoreNextSingleClick_?u=this.removePoint():u=!0),n.type==ia.SINGLECLICK&&(this.ignoreNextSingleClick_=!1),_.prototype.handleEvent.call(this,n)&&!u},c.prototype.handleDragEvent=function(n){this.ignoreNextSingleClick_=!1,this.willModifyFeatures_(n,this.dragSegments_);for(var u=[n.coordinate[0]+this.delta_[0],n.coordinate[1]+this.delta_[1]],r=[],s=[],P=0,z=this.dragSegments_.length;P<z;++P){var F=this.dragSegments_[P],N=F[0],V=N.feature;r.indexOf(V)===-1&&r.push(V);var me=N.geometry;s.indexOf(me)===-1&&s.push(me);for(var be=N.depth,Se=void 0,Ve=N.segment,Ke=F[1];u.length<me.getStride();)u.push(Ve[Ke][u.length]);switch(me.getType()){case Pt.POINT:Se=u,Ve[0]=u,Ve[1]=u;break;case Pt.MULTI_POINT:Se=me.getCoordinates(),Se[N.index]=u,Ve[0]=u,Ve[1]=u;break;case Pt.LINE_STRING:Se=me.getCoordinates(),Se[N.index+Ke]=u,Ve[Ke]=u;break;case Pt.MULTI_LINE_STRING:Se=me.getCoordinates(),Se[be[0]][N.index+Ke]=u,Ve[Ke]=u;break;case Pt.POLYGON:Se=me.getCoordinates(),Se[be[0]][N.index+Ke]=u,Ve[Ke]=u;break;case Pt.MULTI_POLYGON:Se=me.getCoordinates(),Se[be[1]][be[0]][N.index+Ke]=u,Ve[Ke]=u;break;case Pt.CIRCLE:if(Ve[0]=u,Ve[1]=u,N.index===L0)this.changingFeature_=!0,me.setCenter(u),this.changingFeature_=!1;else{this.changingFeature_=!0;var Ie=n.map.getView().getProjection(),Ge=wy(Xl(me.getCenter(),Ie),Xl(u,Ie)),et=uh();if(et){var rt=me.clone().transform(et,Ie);rt.setRadius(Ge),Ge=rt.transform(Ie,et).getRadius()}me.setRadius(Ge),this.changingFeature_=!1}break;default:}Se&&this.setGeometryCoordinates_(me,Se)}this.createOrUpdateVertexFeature_(u,r,s)},c.prototype.handleDownEvent=function(n){if(!this.condition_(n))return!1;var u=n.coordinate;this.handlePointerAtPixel_(n.pixel,n.map,u),this.dragSegments_.length=0,this.featuresBeingModified_=null;var r=this.vertexFeature_;if(r){var s=n.map.getView().getProjection(),P=[],z=r.getGeometry().getCoordinates(),F=wu([z]),N=this.rBush_.getInExtent(F),V={};N.sort(j2);for(var me=0,be=N.length;me<be;++me){var Se=N[me],Ve=Se.segment,Ke=Ai(Se.geometry),Ie=Se.depth;if(Ie&&(Ke+="-"+Ie.join("-")),V[Ke]||(V[Ke]=new Array(2)),Se.geometry.getType()===Pt.CIRCLE&&Se.index===xd){var Ge=D0(u,Se,s);Tu(Ge,z)&&!V[Ke][0]&&(this.dragSegments_.push([Se,0]),V[Ke][0]=Se);continue}if(Tu(Ve[0],z)&&!V[Ke][0]){this.dragSegments_.push([Se,0]),V[Ke][0]=Se;continue}if(Tu(Ve[1],z)&&!V[Ke][1]){if((Se.geometry.getType()===Pt.LINE_STRING||Se.geometry.getType()===Pt.MULTI_LINE_STRING)&&V[Ke][0]&&V[Ke][0].index===0)continue;this.dragSegments_.push([Se,1]),V[Ke][1]=Se;continue}Ai(Ve)in this.vertexSegments_&&!V[Ke][0]&&!V[Ke][1]&&this.insertVertexCondition_(n)&&P.push(Se)}P.length&&this.willModifyFeatures_(n,[P]);for(var et=P.length-1;et>=0;--et)this.insertVertex_(P[et],z)}return!!this.vertexFeature_},c.prototype.handleUpEvent=function(n){for(var u=this.dragSegments_.length-1;u>=0;--u){var r=this.dragSegments_[u][0],s=r.geometry;if(s.getType()===Pt.CIRCLE){var P=s.getCenter(),z=r.featureSegments[0],F=r.featureSegments[1];z.segment[0]=P,z.segment[1]=P,F.segment[0]=P,F.segment[1]=P,this.rBush_.update(Yp(P),z);var N=s,V=uh();if(V){var me=n.map.getView().getProjection();N=N.clone().transform(V,me),N=$y(N).transform(me,V)}this.rBush_.update(N.getExtent(),F)}else this.rBush_.update(wu(r.segment),r)}return this.featuresBeingModified_&&(this.dispatchEvent(new x_(v_.MODIFYEND,this.featuresBeingModified_,n)),this.featuresBeingModified_=null),!1},c.prototype.handlePointerMove_=function(n){this.lastPixel_=n.pixel,this.handlePointerAtPixel_(n.pixel,n.map,n.coordinate)},c.prototype.handlePointerAtPixel_=function(n,u,r){var s=this,P=r||u.getCoordinateFromPixel(n),z=u.getView().getProjection(),F=function(Mt,Br){return z0(P,Mt,z)-z0(P,Br,z)},N,V;if(this.hitDetection_){var me=typeof this.hitDetection_=="object"?function(Mt){return Mt===s.hitDetection_}:void 0;u.forEachFeatureAtPixel(n,function(Mt,Br,Tr){if(Tr=Tr||Mt.getGeometry(),Tr.getType()===Pt.POINT&&gv(s.features_.getArray(),Mt)){V=Tr;var br=Tr.getFlatCoordinates().slice(0,2);N=[{feature:Mt,geometry:Tr,segment:[br,br]}]}return!0},{layerFilter:me})}if(!N){var be=td(Yp(P,R0),z),Se=u.getView().getResolution()*this.pixelTolerance_,Ve=Qp(yl(be,Se,R0),z);N=this.rBush_.getInExtent(Ve)}if(N&&N.length>0){var Ke=N.sort(F)[0],Ie=Ke.segment,Ge=D0(P,Ke,z),et=u.getPixelFromCoordinate(Ge),rt=wy(n,et);if(V||rt<=this.pixelTolerance_){var _t={};if(_t[Ai(Ie)]=!0,this.snapToPointer_||(this.delta_[0]=Ge[0]-P[0],this.delta_[1]=Ge[1]-P[1]),Ke.geometry.getType()===Pt.CIRCLE&&Ke.index===xd)this.snappedToVertex_=!0,this.createOrUpdateVertexFeature_(Ge,[Ke.feature],[Ke.geometry]);else{var yt=u.getPixelFromCoordinate(Ie[0]),ct=u.getPixelFromCoordinate(Ie[1]),Tt=Jp(et,yt),St=Jp(et,ct);rt=Math.sqrt(Math.min(Tt,St)),this.snappedToVertex_=rt<=this.pixelTolerance_,this.snappedToVertex_&&(Ge=Tt>St?Ie[1]:Ie[0]),this.createOrUpdateVertexFeature_(Ge,[Ke.feature],[Ke.geometry]);var Lt={};Lt[Ai(Ke.geometry)]=!0;for(var ur=1,Vt=N.length;ur<Vt;++ur){var Qt=N[ur].segment;if(Tu(Ie[0],Qt[0])&&Tu(Ie[1],Qt[1])||Tu(Ie[0],Qt[1])&&Tu(Ie[1],Qt[0])){var or=Ai(N[ur].geometry);or in Lt||(Lt[or]=!0,_t[Ai(Qt)]=!0)}else break}}this.vertexSegments_=_t;return}}this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null)},c.prototype.insertVertex_=function(n,u){for(var r=n.segment,s=n.feature,P=n.geometry,z=n.depth,F=n.index,N;u.length<P.getStride();)u.push(0);switch(P.getType()){case Pt.MULTI_LINE_STRING:N=P.getCoordinates(),N[z[0]].splice(F+1,0,u);break;case Pt.POLYGON:N=P.getCoordinates(),N[z[0]].splice(F+1,0,u);break;case Pt.MULTI_POLYGON:N=P.getCoordinates(),N[z[1]][z[0]].splice(F+1,0,u);break;case Pt.LINE_STRING:N=P.getCoordinates(),N.splice(F+1,0,u);break;default:return}this.setGeometryCoordinates_(P,N);var V=this.rBush_;V.remove(n),this.updateSegmentIndices_(P,F,z,1);var me={segment:[r[0],u],feature:s,geometry:P,depth:z,index:F};V.insert(wu(me.segment),me),this.dragSegments_.push([me,1]);var be={segment:[u,r[1]],feature:s,geometry:P,depth:z,index:F+1};V.insert(wu(be.segment),be),this.dragSegments_.push([be,0]),this.ignoreNextSingleClick_=!0},c.prototype.removePoint=function(){if(this.lastPointerEvent_&&this.lastPointerEvent_.type!=ia.POINTERDRAG){var n=this.lastPointerEvent_;this.willModifyFeatures_(n,this.dragSegments_);var u=this.removeVertex_();return this.featuresBeingModified_&&this.dispatchEvent(new x_(v_.MODIFYEND,this.featuresBeingModified_,n)),this.featuresBeingModified_=null,u}return!1},c.prototype.removeVertex_=function(){var n=this.dragSegments_,u={},r=!1,s,P,z,F,N,V,me,be,Se,Ve,Ke;for(N=n.length-1;N>=0;--N)z=n[N],Ve=z[0],Ke=Ai(Ve.feature),Ve.depth&&(Ke+="-"+Ve.depth.join("-")),Ke in u||(u[Ke]={}),z[1]===0?(u[Ke].right=Ve,u[Ke].index=Ve.index):z[1]==1&&(u[Ke].left=Ve,u[Ke].index=Ve.index+1);for(Ke in u){switch(Se=u[Ke].right,me=u[Ke].left,V=u[Ke].index,be=V-1,me!==void 0?Ve=me:Ve=Se,be<0&&(be=0),F=Ve.geometry,P=F.getCoordinates(),s=P,r=!1,F.getType()){case Pt.MULTI_LINE_STRING:P[Ve.depth[0]].length>2&&(P[Ve.depth[0]].splice(V,1),r=!0);break;case Pt.LINE_STRING:P.length>2&&(P.splice(V,1),r=!0);break;case Pt.MULTI_POLYGON:s=s[Ve.depth[1]];case Pt.POLYGON:s=s[Ve.depth[0]],s.length>4&&(V==s.length-1&&(V=0),s.splice(V,1),r=!0,V===0&&(s.pop(),s.push(s[0]),be=s.length-1));break;default:}if(r){this.setGeometryCoordinates_(F,P);var Ie=[];if(me!==void 0&&(this.rBush_.remove(me),Ie.push(me.segment[0])),Se!==void 0&&(this.rBush_.remove(Se),Ie.push(Se.segment[1])),me!==void 0&&Se!==void 0){var Ge={depth:Ve.depth,feature:Ve.feature,geometry:Ve.geometry,index:be,segment:Ie};this.rBush_.insert(wu(Ge.segment),Ge)}this.updateSegmentIndices_(F,V,Ve.depth,-1),this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),n.length=0}}return r},c.prototype.setGeometryCoordinates_=function(n,u){this.changingFeature_=!0,n.setCoordinates(u),this.changingFeature_=!1},c.prototype.updateSegmentIndices_=function(n,u,r,s){this.rBush_.forEachInExtent(n.getExtent(),function(P){P.geometry===n&&(r===void 0||P.depth===void 0||_s(P.depth,r))&&P.index>u&&(P.index+=s)})},c}(E0);function j2(_,c){return _.index-c.index}function z0(_,c,n){var u=c.geometry;if(u.getType()===Pt.CIRCLE){var r=u;if(c.index===xd){var s=uh();s&&(r=r.clone().transform(s,n));var P=Jp(r.getCenter(),Xl(_,n)),z=Math.sqrt(P)-r.getRadius();return z*z}}var F=Xl(_,n);return pf[0]=Xl(c.segment[0],n),pf[1]=Xl(c.segment[1],n),Yv(F,pf)}function D0(_,c,n){var u=c.geometry;if(u.getType()===Pt.CIRCLE&&c.index===xd){var r=u,s=uh();return s&&(r=r.clone().transform(s,n)),Sy(r.getClosestPoint(Xl(_,n)),n)}var P=Xl(_,n);return pf[0]=Xl(c.segment[0],n),pf[1]=Xl(c.segment[1],n),Sy(by(P,pf),n)}function q2(){var _=qx();return function(c,n){return _[Pt.POINT]}}var b_=G2;var Z2=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),X2=function(_){Z2(c,_);function c(n){var u=_.call(this)||this;return u.geometries_=n||null,u.changeEventsKeys_=[],u.listenGeometriesChange_(),u}return c.prototype.unlistenGeometriesChange_=function(){this.changeEventsKeys_.forEach(Ao),this.changeEventsKeys_.length=0},c.prototype.listenGeometriesChange_=function(){if(!!this.geometries_)for(var n=0,u=this.geometries_.length;n<u;++n)this.changeEventsKeys_.push(lo(this.geometries_[n],Ji.CHANGE,this.changed,this))},c.prototype.clone=function(){var n=new c(null);return n.setGeometries(this.geometries_),n.applyProperties(this),n},c.prototype.closestPointXY=function(n,u,r,s){if(s<xs(this.getExtent(),n,u))return s;for(var P=this.geometries_,z=0,F=P.length;z<F;++z)s=P[z].closestPointXY(n,u,r,s);return s},c.prototype.containsXY=function(n,u){for(var r=this.geometries_,s=0,P=r.length;s<P;++s)if(r[s].containsXY(n,u))return!0;return!1},c.prototype.computeExtent=function(n){Kp(n);for(var u=this.geometries_,r=0,s=u.length;r<s;++r)qv(n,u[r].getExtent());return n},c.prototype.getGeometries=function(){return F0(this.geometries_)},c.prototype.getGeometriesArray=function(){return this.geometries_},c.prototype.getGeometriesArrayRecursive=function(){for(var n=[],u=this.geometries_,r=0,s=u.length;r<s;++r)u[r].getType()===this.getType()?n=n.concat(u[r].getGeometriesArrayRecursive()):n.push(u[r]);return n},c.prototype.getSimplifiedGeometry=function(n){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),n<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&n<this.simplifiedGeometryMaxMinSquaredTolerance)return this;for(var u=[],r=this.geometries_,s=!1,P=0,z=r.length;P<z;++P){var F=r[P],N=F.getSimplifiedGeometry(n);u.push(N),N!==F&&(s=!0)}if(s){var V=new c(null);return V.setGeometriesArray(u),V}else return this.simplifiedGeometryMaxMinSquaredTolerance=n,this},c.prototype.getType=function(){return Pt.GEOMETRY_COLLECTION},c.prototype.intersectsExtent=function(n){for(var u=this.geometries_,r=0,s=u.length;r<s;++r)if(u[r].intersectsExtent(n))return!0;return!1},c.prototype.isEmpty=function(){return this.geometries_.length===0},c.prototype.rotate=function(n,u){for(var r=this.geometries_,s=0,P=r.length;s<P;++s)r[s].rotate(n,u);this.changed()},c.prototype.scale=function(n,u,r){var s=r;s||(s=$h(this.getExtent()));for(var P=this.geometries_,z=0,F=P.length;z<F;++z)P[z].scale(n,u,s);this.changed()},c.prototype.setGeometries=function(n){this.setGeometriesArray(F0(n))},c.prototype.setGeometriesArray=function(n){this.unlistenGeometriesChange_(),this.geometries_=n,this.listenGeometriesChange_(),this.changed()},c.prototype.applyTransform=function(n){for(var u=this.geometries_,r=0,s=u.length;r<s;++r)u[r].applyTransform(n);this.changed()},c.prototype.translate=function(n,u){for(var r=this.geometries_,s=0,P=r.length;s<P;++s)r[s].translate(n,u);this.changed()},c.prototype.disposeInternal=function(){this.unlistenGeometriesChange_(),_.prototype.disposeInternal.call(this)},c}(Xm);function F0(_){for(var c=[],n=0,u=_.length;n<u;++n)c.push(_[n].clone());return c}var B0=X2;var W2=function(){function _(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.supportedMediaTypes=null}return _.prototype.getReadOptions=function(c,n){var u;if(n){var r=n.dataProjection?ga(n.dataProjection):this.readProjection(c);n.extent&&r&&r.getUnits()===ac.TILE_PIXELS&&(r=ga(r),r.setWorldExtent(n.extent)),u={dataProjection:r,featureProjection:n.featureProjection}}return this.adaptOptions(u)},_.prototype.adaptOptions=function(c){return Ra({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection},c)},_.prototype.getType=function(){return jr()},_.prototype.readFeature=function(c,n){return jr()},_.prototype.readFeatures=function(c,n){return jr()},_.prototype.readGeometry=function(c,n){return jr()},_.prototype.readProjection=function(c){return jr()},_.prototype.writeFeature=function(c,n){return jr()},_.prototype.writeFeatures=function(c,n){return jr()},_.prototype.writeGeometry=function(c,n){return jr()},_}(),U0=W2;function w_(_,c,n){var u=n?ga(n.featureProjection):null,r=n?ga(n.dataProjection):null,s;if(u&&r&&!tx(u,r)?s=(c?_.clone():_).transform(c?u:r,c?r:u):s=_,c&&n&&n.decimals!==void 0){var P=Math.pow(10,n.decimals),z=function(F){for(var N=0,V=F.length;N<V;++N)F[N]=Math.round(F[N]*P)/P;return F};s===_&&(s=_.clone()),s.applyTransform(z)}return s}var $2=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),H2=function(_){$2(c,_);function c(){return _.call(this)||this}return c.prototype.getType=function(){return _h.JSON},c.prototype.readFeature=function(n,u){return this.readFeatureFromObject(og(n),this.getReadOptions(n,u))},c.prototype.readFeatures=function(n,u){return this.readFeaturesFromObject(og(n),this.getReadOptions(n,u))},c.prototype.readFeatureFromObject=function(n,u){return jr()},c.prototype.readFeaturesFromObject=function(n,u){return jr()},c.prototype.readGeometry=function(n,u){return this.readGeometryFromObject(og(n),this.getReadOptions(n,u))},c.prototype.readGeometryFromObject=function(n,u){return jr()},c.prototype.readProjection=function(n){return this.readProjectionFromObject(og(n))},c.prototype.readProjectionFromObject=function(n){return jr()},c.prototype.writeFeature=function(n,u){return JSON.stringify(this.writeFeatureObject(n,u))},c.prototype.writeFeatureObject=function(n,u){return jr()},c.prototype.writeFeatures=function(n,u){return JSON.stringify(this.writeFeaturesObject(n,u))},c.prototype.writeFeaturesObject=function(n,u){return jr()},c.prototype.writeGeometry=function(n,u){return JSON.stringify(this.writeGeometryObject(n,u))},c.prototype.writeGeometryObject=function(n,u){return jr()},c}(U0);function og(_){if(typeof _=="string"){var c=JSON.parse(_);return c||null}else return _!==null?_:null}var N0=H2;var K2=function(){var _=function(c,n){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,r){u.__proto__=r}||function(u,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(u[s]=r[s])},_(c,n)};return function(c,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");_(c,n);function u(){this.constructor=c}c.prototype=n===null?Object.create(n):(u.prototype=n.prototype,new u)}}(),Y2=function(_){K2(c,_);function c(n){var u=this,r=n||{};return u=_.call(this)||this,u.dataProjection=ga(r.dataProjection?r.dataProjection:"EPSG:4326"),r.featureProjection&&(u.defaultFeatureProjection=ga(r.featureProjection)),u.geometryName_=r.geometryName,u.extractGeometryName_=r.extractGeometryName,u.supportedMediaTypes=["application/geo+json","application/vnd.geo+json"],u}return c.prototype.readFeatureFromObject=function(n,u){var r=null;n.type==="Feature"?r=n:r={type:"Feature",geometry:n,properties:null};var s=E_(r.geometry,u),P=new lc;return this.geometryName_?P.setGeometryName(this.geometryName_):this.extractGeometryName_&&"geometry_name"in r!==void 0&&P.setGeometryName(r.geometry_name),P.setGeometry(s),"id"in r&&P.setId(r.id),r.properties&&P.setProperties(r.properties,!0),P},c.prototype.readFeaturesFromObject=function(n,u){var r=n,s=null;if(r.type==="FeatureCollection"){var P=n;s=[];for(var z=P.features,F=0,N=z.length;F<N;++F)s.push(this.readFeatureFromObject(z[F],u))}else s=[this.readFeatureFromObject(n,u)];return s},c.prototype.readGeometryFromObject=function(n,u){return E_(n,u)},c.prototype.readProjectionFromObject=function(n){var u=n.crs,r;return u?u.type=="name"?r=ga(u.properties.name):u.type==="EPSG"?r=ga("EPSG:"+u.properties.code):wn(!1,36):r=this.dataProjection,r},c.prototype.writeFeatureObject=function(n,u){u=this.adaptOptions(u);var r={type:"Feature",geometry:null,properties:null},s=n.getId();if(s!==void 0&&(r.id=s),!n.hasProperties())return r;var P=n.getProperties(),z=n.getGeometry();return z&&(r.geometry=T_(z,u),delete P[n.getGeometryName()]),Vl(P)||(r.properties=P),r},c.prototype.writeFeaturesObject=function(n,u){u=this.adaptOptions(u);for(var r=[],s=0,P=n.length;s<P;++s)r.push(this.writeFeatureObject(n[s],u));return{type:"FeatureCollection",features:r}},c.prototype.writeGeometryObject=function(n,u){return T_(n,this.adaptOptions(u))},c}(N0);function E_(_,c){if(!_)return null;var n;switch(_.type){case Pt.POINT:{n=Q2(_);break}case Pt.LINE_STRING:{n=eE(_);break}case Pt.POLYGON:{n=nE(_);break}case Pt.MULTI_POINT:{n=rE(_);break}case Pt.MULTI_LINE_STRING:{n=tE(_);break}case Pt.MULTI_POLYGON:{n=iE(_);break}case Pt.GEOMETRY_COLLECTION:{n=J2(_);break}default:throw new Error("Unsupported GeoJSON type: "+_.type)}return w_(n,!1,c)}function J2(_,c){var n=_.geometries.map(function(u){return E_(u,c)});return new B0(n)}function Q2(_){return new ya(_.coordinates)}function eE(_){return new uc(_.coordinates)}function tE(_){return new P0(_.coordinates)}function rE(_){return new ng(_.coordinates)}function iE(_){return new k0(_.coordinates)}function nE(_){return new pd(_.coordinates)}function T_(_,c){_=w_(_,!0,c);var n=_.getType(),u;switch(n){case Pt.POINT:{u=cE(_,c);break}case Pt.LINE_STRING:{u=aE(_,c);break}case Pt.POLYGON:{u=hE(_,c);break}case Pt.MULTI_POINT:{u=lE(_,c);break}case Pt.MULTI_LINE_STRING:{u=sE(_,c);break}case Pt.MULTI_POLYGON:{u=uE(_,c);break}case Pt.GEOMETRY_COLLECTION:{u=oE(_,c);break}case Pt.CIRCLE:{u={type:"GeometryCollection",geometries:[]};break}default:throw new Error("Unsupported geometry type: "+n)}return u}function oE(_,c){var n=_.getGeometriesArray().map(function(u){var r=Ra({},c);return delete r.featureProjection,T_(u,r)});return{type:"GeometryCollection",geometries:n}}function aE(_,c){return{type:"LineString",coordinates:_.getCoordinates()}}function sE(_,c){return{type:"MultiLineString",coordinates:_.getCoordinates()}}function lE(_,c){return{type:"MultiPoint",coordinates:_.getCoordinates()}}function uE(_,c){var n;return c&&(n=c.rightHanded),{type:"MultiPolygon",coordinates:_.getCoordinates(n)}}function cE(_,c){return{type:"Point",coordinates:_.getCoordinates()}}function hE(_,c){var n;return c&&(n=c.rightHanded),{type:"Polygon",coordinates:_.getCoordinates(n)}}var bl=Y2;var ag,pE=new Uint8Array(16);function S_(){if(!ag&&(ag=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!ag))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ag(pE)}var V0=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function fE(_){return typeof _=="string"&&V0.test(_)}var G0=fE;var va=[];for(sg=0;sg<256;++sg)va.push((sg+256).toString(16).substr(1));var sg;function dE(_){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=(va[_[c+0]]+va[_[c+1]]+va[_[c+2]]+va[_[c+3]]+"-"+va[_[c+4]]+va[_[c+5]]+"-"+va[_[c+6]]+va[_[c+7]]+"-"+va[_[c+8]]+va[_[c+9]]+"-"+va[_[c+10]]+va[_[c+11]]+va[_[c+12]]+va[_[c+13]]+va[_[c+14]]+va[_[c+15]]).toLowerCase();if(!G0(n))throw TypeError("Stringified UUID is invalid");return n}var j0=dE;function mE(_,c,n){_=_||{};var u=_.random||(_.rng||S_)();if(u[6]=u[6]&15|64,u[8]=u[8]&63|128,c){n=n||0;for(var r=0;r<16;++r)c[n+r]=u[r];return c}return j0(u)}var I_=mE;var ip=class extends Po{constructor(n={}){super();this.defineProperties(n),n.properties&&this.setProperties(n.properties),this.visible=n.visible===void 0?!0:!!n.visible,this.group=n.group,this.copyrights=n.copyrights,this.children=n.children,this.on("change:visible:group",u=>{this.group===u.target.group&&this!==u.target&&this.visible?this.visible=!1:this.children&&this.children.forEach(r=>r.dispatchEvent(u))})}defineProperties(n={}){let{name:u,key:r,properties:s,hitTolerance:P}={...n},z=I_();Object.defineProperties(this,{name:{value:u},key:{value:r||u||z},group:{get:()=>this.get("group"),set:F=>{this.set("group",F)}},copyrights:{get:()=>this.get("copyrights"),set:F=>{let N=F&&!Array.isArray(F)?[F]:F;this.set("copyrights",N||[])}},options:{value:n},map:{writable:!0},visible:{get:()=>this.get("visible"),set:F=>{if(F!==this.visible)if(this.set("visible",F),this.visible){if(this.parent&&(this.parent.visible=!0),this.children&&!this.children.some(N=>N.visible)&&this.children.forEach(N=>{N.visible=!0}),this.parent&&this.group){let N=this.parent;for(;N.parent;)N=N.parent;let V=new La("change:visible:group");V.target=this,N.dispatchEvent(V)}}else this.visible||(this.children&&this.children.forEach(N=>{N.visible=!1}),this.parent&&this.parent.visible&&this.parent.children&&!this.parent.children.find(N=>N.visible)&&(this.parent.visible=!1))}},disabled:{get:()=>this.get("disabled"),set:F=>{this.set("disabled",F)}},parent:{value:null,writable:!0},children:{get:()=>this.get("children")||[],set:F=>{(this.children||[]).forEach(N=>{N.parent=void 0}),Array.isArray(F)&&F.forEach(N=>{N.parent=this}),this.set("children",F||[])}},hitTolerance:{value:P||5,writable:!0},properties:{value:{...s||{}}}})}attachToMap(n){this.detachFromMap(),this.map=n,this.children&&this.children.forEach(u=>{u.attachToMap(n)})}detachFromMap(){this.map=void 0}getFeatureInfoAtCoordinate(n,u){return console.error("getFeatureInfoAtCoordinate must be implemented by inheriting layers",this.key),Promise.resolve({layer:this,features:[],coordinate:n})}flat(){return $f(this)}};function gE(_){return class extends _{constructor(n={}){super(n);let{userInteractions:u=!0,userClickInteractions:r=!0,userHoverInteractions:s=!0,defaultUserInteractions:P=!0}=n;this.userInteractions=u,this.userClickInteractions=r,this.userHoverInteractions=s,this.defaultUserInteractions=P,this.userClickCallbacks=[],this.userHoverCallbacks=[],this.userClickEventsKeys=[],this.userHoverEventsKeys=[],this.onUserClickCallback=this.onUserClickCallback.bind(this),this.onUserMoveCallback=this.onUserMoveCallback.bind(this);let{onClick:z,onHover:F}=n;this.userInteractions&&this.userClickInteractions&&z&&this.onClick(z),this.userInteractions&&this.userHoverInteractions&&F&&this.onHover(F)}attachToMap(n){super.attachToMap(n),this.userInteractions&&this.defaultUserInteractions&&this.userClickInteractions&&this.onFeatureClick&&this.onClick(this.onFeatureClick),this.userInteractions&&this.defaultUserInteractions&&this.userHoverInteractions&&this.onFeatureHover&&this.onHover(this.onFeatureHover),this.listenEvents()}detachFromMap(){this.unlistenEvents(),super.detachFromMap()}listenEvents(){this.unlistenEvents(),this.userClickCallbacks.forEach(n=>{this.userClickEventsKeys.push(this.on("user:click",({target:{features:u,layer:r,coordinate:s,event:P}})=>{n(u,r,s,P)}))}),this.userHoverCallbacks.forEach(n=>{this.userHoverEventsKeys.push(this.on("user:hover",({target:{features:u,layer:r,coordinate:s,event:P}})=>{n(u,r,s,P)}))})}unlistenEvents(){Ka(this.userClickEventsKeys),Ka(this.userHoverEventsKeys),this.userClickEventsKeys=[],this.userHoverEventsKeys=[]}onClick(n){this.userClickCallbacks.push(n),this.activateUserInteractions(),this.map&&this.listenEvents()}onHover(n){this.userHoverCallbacks.push(n),this.activateUserInteractions(),this.map&&this.listenEvents()}unClick(n){let u=this.userClickCallbacks.indexOf(n);u===-1&&(this.userClickCallbacks=this.userClickCallbacks.slice(u,1),this.map&&this.listenEvents())}unHover(n){let u=this.userHoverCallbacks.indexOf(n);u===-1&&(this.userHoverCallbacks=this.userHoverCallbacks.slice(u,1),this.map&&this.listenEvents())}onUserClickCallback(n){let u=n.coordinate||uo(n.lngLat.toArray()),r={features:[],layer:this,coordinate:u,event:n};return this.getFeatureInfoAtCoordinate(u).then(s=>(this.dispatchEvent({type:"user:click",target:s}),s)).catch(()=>r)}onUserMoveCallback(n){let u=n.coordinate||uo(n.lngLat.toArray()),r={features:[],layer:this,coordinate:u,event:n};return this.getFeatureInfoAtCoordinate(u).then(s=>(this.dispatchEvent({type:"user:hover",target:s}),s)).catch(()=>r)}activateUserInteractions(){}deactivateUserInteractions(){}}}var lg=gE;var bd=class extends lg(ip){constructor(n){super(n);this.olLayer&&this.olLayer.setVisible(this.visible)}defineProperties(n){super.defineProperties(n),Object.defineProperties(this,{olLayer:{value:n.olLayer,writable:!0},olListenersKeys:{value:[]}})}attachToMap(n){if(super.attachToMap(n),!!this.map&&(this.olLayer&&!this.map?.getLayers()?.getArray()?.includes(this.olLayer)&&this.map.addLayer(this.olLayer),this.olListenersKeys.push(this.on("change:visible",()=>{this.olLayer&&this.olLayer.setVisible(this.visible)})),this.olListenersKeys.push(this.map.getLayers().on("remove",u=>{u.element===this.olLayer&&this.detachFromMap()})),this.toggleVisibleListeners(),this.olListenersKeys.push(this.on("change:visible",this.toggleVisibleListeners)),this.copyrights&&this.olLayer)){let u=this.copyrights||[];this.olLayer.getLayers?this.olLayer.getLayers().getArray().forEach(r=>{r.getSource&&r.getSource()?.setAttributions(u)}):this.olLayer.getSource&&this.olLayer.getSource()?.setAttributions(u)}}detachFromMap(){this.deactivateUserInteractions(),Ka(this.olListenersKeys),this.olLayer&&this.map?.getLayers()?.getArray()?.includes(this.olLayer)&&this.map.removeLayer(this.olLayer),super.detachFromMap()}activateUserInteractions(){this.deactivateUserInteractions(),this.map&&this.userInteractions&&this.userClickInteractions&&this.userClickCallbacks?.length&&(this.singleClickListenerKey=this.map.on("singleclick",this.onUserClickCallback),this.olListenersKeys.push(this.singleClickListenerKey)),this.map&&this.userInteractions&&this.userHoverInteractions&&this.userHoverCallbacks?.length&&(this.pointerMoveListenerKey=this.map.on("pointermove",this.onUserMoveCallback))}deactivateUserInteractions(){Ka([this.pointerMoveListenerKey,this.singleClickListenerKey])}toggleVisibleListeners(){this.visible?this.activateUserInteractions():this.deactivateUserInteractions()}clone(n){return new bd({...this.options,...n})}},Is=bd;var q0=new xl({radius:6,fill:new Hs({color:[255,0,0,1]}),stroke:new _a({color:[0,0,0,1],width:1})}),yE=new Wl({stroke:new _a({color:[0,0,0,1],width:5})}),_E=new Wl({image:q0,stroke:new _a({color:[255,0,0,1],width:3})}),vE=new Wl({image:q0,stroke:new _a({color:[255,0,0,1],width:3,lineDash:[1,10]})}),xE=(_,c)=>{let n=_.get("minResolution"),u=_.get("maxResolution"),r=c<=n&&c>u;return n&&u&&!r?null:_.get("mot")!=="foot"?[yE,_E]:[vE]},wd=class extends Is{constructor(c={}){super(c),this.olLayer=c.olLayer||new tp({source:new rp,style:c.style||xE})}clone(c){return new wd({...this.options,...c})}},ug=wd;var bE=/^([^@$!\n]*)(@?([\d.]+),([\d.]+))?(\$?([a-zA-Z0-9]{0,2}))$/,Z0=/^([\d.]+),([\d.]+)$/,X0=/^!([^$]*)(\$?([a-zA-Z0-9]{0,2}))$/,cg="stop-fetch",W0=_=>{let c=[];return _.forEach(n=>{c.push(...n.getGeometry().getCoordinates())}),c},Ed=class extends af{constructor(c={}){super(c),Object.defineProperties(this,{mot:{get:()=>this.get("mot"),set:n=>{n&&(this.set("mot",n),this.viaPoints&&this.drawRoute())}},loading:{get:()=>this.get("loading"),set:n=>{this.set("loading",n)}},modify:{get:()=>this.get("modify"),set:n=>{this.set("modify",n)}}}),this.loading=!1,this.graphs=c.graphs||[["osm",0,99]],this.mot=c.mot||"bus",this.modify=c.modify!==!1,this.routingApiParams=c.routingApiParams||{},this.useRawViaPoints=c.useRawViaPoints||!1,this.snapToClosestStation=c.snapToClosestStation||!1,this.cacheStationData={},this.abortControllers=[],this.apiKey=c.apiKey,this.stopsApiKey=c.stopsApiKey||this.apiKey,this.segments=[],this.stopsApiUrl=c.stopsApiUrl||"https://api.geops.io/stops/v1/",this.api=new Zf({...c}),this.routingLayer=c.routingLayer||new ug({name:"routing-layer",style:c.style}),this.onRouteError=c.onRouteError||(n=>{this.dispatchEvent({type:"change:route",target:this}),this.reset(),console.error(n)}),this.viaPoints=[],this.onMapClick=this.onMapClick.bind(this),this.onModifyEnd=this.onModifyEnd.bind(this),this.onModifyStart=this.onModifyStart.bind(this),this.apiChangeListener=()=>this.drawRoute(),this.createModifyInteraction()}static getGraphsResolutions(c,n){let u=n.getView();return c.map(([,r,s])=>[u.getResolutionForZoom(r),u.getResolutionForZoom(s||r+1)])}addViaPoint(c,n=-1,u=0){this.viaPoints.splice(n===-1?this.viaPoints.length:n,u,c),this.drawRoute(),this.dispatchEvent({type:"change:route",target:this})}removeViaPoint(c=this.viaPoints.length-1){this.viaPoints.length&&this.viaPoints[c]&&this.viaPoints.splice(c,1),this.drawRoute(),this.dispatchEvent({type:"change:route",target:this})}setViaPoints(c){this.viaPoints=[...c],this.drawRoute(),this.dispatchEvent({type:"change:route",target:this})}reset(){this.abortRequests(),this.viaPoints=[],this.routingLayer.olLayer.getSource().clear(),this.dispatchEvent({type:"change:route",target:this})}abortRequests(){this.graphs.forEach(([c])=>{this.abortControllers[c]&&this.abortControllers[c].abort(),this.abortControllers[c]=new AbortController}),this.abortControllers[cg]?.abort(),this.abortControllers[cg]=new AbortController,this.loading=!1}drawRoute(){if(this.abortRequests(),this.routingLayer.olLayer.getSource().clear(),!this.viaPoints.length)return null;if(this.viaPoints.length===1)return this.drawViaPoint(this.viaPoints[0],0,this.abortControllers[cg]);let c=this.viaPoints.map(n=>{if(Array.isArray(n)){let u=this.map.getView().getProjection(),[r,s]=lh(n,u);return this.snapToClosestStation?[`@${s}`,r]:[s,r]}return this.useRawViaPoints?n:`!${n}`});return this.loading=!0,this.routingLayer.olLayer.getSource().clear(),this.viaPoints.forEach((n,u)=>this.drawViaPoint(n,u,this.abortControllers[cg])),Promise.all(this.graphs.map(([n],u)=>{let{signal:r}=this.abortControllers[n];return this.api.route({graph:n,via:`${c.join("|")}`,mot:`${this.mot}`,"resolve-hops":!1,elevation:!1,"coord-radius":100,"coord-punish":1e3,...this.routingApiParams},{signal:r}).then(s=>{if(this.segments=this.format.readFeatures(s),this.mot==="foot"){let F=this.segments.reduce((N,V)=>{let me=V.get("trg");return N.find(be=>be[0]===me[0]&&be[1]===me[1])?N:[...N,me]},[]);this.segments=F.map(N=>{let V=this.segments.filter(be=>{let Se=be.get("trg");return Se[0]===N[0]&&Se[1]===N[1]}),me=W0(V);return new lc({geometry:new uc(me)})})}let P=W0(this.segments),z=new lc({geometry:new uc(P)});z.set("graph",n),z.set("mot",this.mot),z.set("minResolution",this.graphsResolutions[u][0]),z.set("maxResolution",this.graphsResolutions[u][1]),this.routingLayer.olLayer.getSource().addFeature(z),this.loading=!1}).catch(s=>{s.name!=="AbortError"&&(this.segments=[],this.dispatchEvent({type:"error",target:this}),this.onRouteError(s,this),this.loading=!1)})}))}drawViaPoint(c,n,u){let r=new lc;if(r.set("viaPointIdx",n),Array.isArray(c))return r.setGeometry(new ya(c)),this.routingLayer.olLayer.getSource().addFeature(r),Promise.resolve(r);if(!this.useRawViaPoints||X0.test(c)){let N,V;return this.useRawViaPoints?[,N,,V]=X0.exec(c):[N,V]=c.split("$"),fetch(`${this.stopsApiUrl}lookup/${N}?key=${this.stopsApiKey}`,{signal:u.signal}).then(me=>me.json()).then(me=>{let{coordinates:be}=me.features[0].geometry;return this.cacheStationData[c]=uo(be),r.set("viaPointTrack",V),r.setGeometry(new ya(uo(be))),this.routingLayer.olLayer.getSource().addFeature(r),r}).catch(me=>{me.name!=="AbortError"&&(this.dispatchEvent({type:"error",target:this}),this.onRouteError(me,this),this.loading=!1)})}if(this.useRawViaPoints&&Z0.test(c)){let[N,V]=Z0.exec(c),me=uo([parseFloat(V),parseFloat(N)],this.map.getView().getProjection());return r.setGeometry(new ya(me)),this.routingLayer.olLayer.getSource().addFeature(r),Promise.resolve(r)}let[,s,,P,z,,F]=bE.exec(c);if(z&&P){let N=uo([parseFloat(z),parseFloat(P)],this.map.getView().getProjection());return r.set("viaPointTrack",F),r.setGeometry(new ya(N)),this.routingLayer.olLayer.getSource().addFeature(r),Promise.resolve(r)}return s?fetch(`${this.stopsApiUrl}?key=${this.stopsApiKey}&q=${s}&limit=1`,{signal:u.signal}).then(N=>N.json()).then(N=>{let{coordinates:V}=N.features[0].geometry;return this.cacheStationData[c]=uo(V),r.set("viaPointTrack",F),r.setGeometry(new ya(uo(V))),this.routingLayer.olLayer.getSource().addFeature(r),r}).catch(N=>(this.dispatchEvent({type:"error",target:this}),this.onRouteError(N,this),this.loading=!1,null)):Promise.resolve(null)}onMapClick(c){let u=c.target.getFeaturesAtPixel(c.pixel).find(r=>r.getGeometry()?.getType()===Pt.POINT&&r.get("viaPointIdx")!==void 0);if(u){this.removeViaPoint(u.get("viaPointIdx"));return}this.addViaPoint(c.coordinate)}onModifyStart(c){let n=-1,u=c.features.getArray().find(s=>s.getGeometry()?.getType()===Pt.LINE_STRING);if(u){let s=yl(new ya(u.getGeometry().getClosestPoint(c.mapBrowserEvent.coordinate)).getExtent(),.001);n=this.segments.findIndex(P=>P.getGeometry().intersectsExtent(s))}let r=(c.features.getArray().filter(s=>s.getGeometry()?.getType()===Pt.POINT)||[])[0];this.initialRouteDrag={viaPoint:r,oldRoute:u&&u.clone(),segmentIndex:n}}onModifyEnd(c){let n=c.mapBrowserEvent.coordinate,{oldRoute:u,viaPoint:r,segmentIndex:s}=this.initialRouteDrag;return r?this.addViaPoint(n,r.get("viaPointIdx"),1):u?s===-1?Promise.reject(new Error("No segment found")):this.addViaPoint(n,s+1):this.addViaPoint(n,0,1)}createDefaultElement(){this.element=document.createElement("button"),this.element.id="ol-toggle-routing",this.element.innerHTML="Toggle Route Control",this.element.onclick=()=>this.active?this.deactivate():this.activate(),Object.assign(this.element.style,{position:"absolute",right:"10px",top:"10px"})}createModifyInteraction(){this.modifyInteraction=new b_({source:this.routingLayer.olLayer.getSource(),pixelTolerance:4,hitDetection:this.routingLayer.olLayer,deleteCondition:c=>{let u=c.target.getFeaturesAtPixel(c.pixel,{hitTolerance:5}).find(r=>r.getGeometry()?.getType()===Pt.POINT&&r.get("index"));return I0(c)&&u?(this.removeViaPoint(u.get("index")),!0):!1}}),this.modifyInteraction.on("modifystart",this.onModifyStart),this.modifyInteraction.on("modifyend",this.onModifyEnd),this.modifyInteraction.setActive(!1)}addListeners(){!this.modify||(this.removeListeners(),this.onMapClickKey=this.map.on("singleclick",this.onMapClick))}removeListeners(){Ka(this.onMapClickKey)}activate(){super.activate(),this.map?(this.format=new bl({featureProjection:this.map.getView().getProjection()}),this.graphsResolutions=Ed.getGraphsResolutions(this.graphs,this.map),this.map.removeInteraction(this.modifyInteraction),this.routingLayer.attachToMap(this.map),this.map.addInteraction(this.modifyInteraction),this.modifyInteraction.setActive(this.modify),this.addListeners()):(this.format=new bl({featureProjection:"EPSG:3857"}),this.graphsResolutions=this.graphs)}deactivate(){this.map&&(this.routingLayer.detachFromMap(this.map),this.map.removeInteraction(this.modifyInteraction),this.removeListeners(),this.reset())}render(){}},$0=Ed;var C_=class extends af{constructor(n){super(n);let{apiParams:u,apiKey:r,url:s,placeholder:P}=n||{};this.apiParams={limit:20,...u||{}},this.placeholder=P||"Search for a stop...";let z={apiKey:r};s&&(z.url=s),this.api=new Xf(z),this.abortController=new AbortController}deactivate(){}render(n){let u=n?.features||[];!this.suggestionsElt||(this.suggestionsElt.style.display=u.length?"block":"none",this.suggestionsElt.innerHTML="",u.forEach(r=>{let s=document.createElement("div");s.innerHTML=r?.properties?.name,s.onclick=()=>{this.onSuggestionClick(r)},Object.assign(s.style,{padding:"5px 12px"}),this.suggestionsElt?.appendChild(s)}))}createDefaultElement(){this.element=document.createElement("div"),this.element.id="mbt-search",Object.assign(this.element.style,{position:"absolute",top:0,left:"50px",margin:"10px",display:"flex",flexDirection:"column",width:"320px"}),this.inputElt=document.createElement("input"),this.inputElt.type="text",this.inputElt.placeholder=this.placeholder,this.inputElt.autocomplete="off",this.inputElt.onkeyup=n=>{this.abortController?.abort(),this.abortController=new AbortController,this.search(n.target.value,this.abortController)},Object.assign(this.inputElt.style,{padding:"10px 30px 10px 10px"}),this.element.appendChild(this.inputElt),this.suggestionsElt=document.createElement("div"),Object.assign(this.suggestionsElt.style,{backgroundColor:"white",overflowY:"auto",cursor:"pointer"}),this.element.appendChild(this.suggestionsElt),this.clearElt=document.createElement("div"),Object.assign(this.clearElt.style,{display:"none",position:"absolute",right:"0",padding:"0 10px",fontSize:"200%",cursor:"pointer"}),this.clearElt.innerHTML="\xD7",this.clearElt.onclick=()=>this.clear(),this.element.appendChild(this.clearElt)}search(n,u){return(n!==void 0||n!==null)&&(this.apiParams.q=n),this.clearElt&&(this.clearElt.style.display="block"),this.api.search(this.apiParams,u&&{signal:u.signal}).then(r=>{this.render(r)}).catch(()=>{this.render()})}onSuggestionClick(n){}clear(){!this.suggestionsElt||!this.inputElt||!this.clearElt||(this.inputElt.value="",this.suggestionsElt.innerHTML="",this.clearElt.style.display="none")}},H0=C_;var A_=class extends H0{onSuggestionClick(c){let n=uo(c.geometry.coordinates);this.map.getView().setCenter(n)}},K0=A_;var J0=Gp(Y0());var k_=class extends Is{constructor(n){super(n);this.olLayer=new Kh({source:new cf({}),render:this.getOlLayerRender()}),this.styleUrl=n.url,this.apiKey=n.apiKey,this.apiKeyName=n.apiKeyName||"key",this.updateAttribution=this.updateAttribution.bind(this)}attachToMap(n){super.attachToMap(n),this.map&&(this.format=new bl({featureProjection:this.map.getView().getProjection()}),this.loadMbMap())}detachFromMap(){this.mbMap&&(this.mbMap.off("idle",this.updateAttribution),this.mbMap.triggerRepaint=()=>{},this.mbMap.remove(),this.mbMap=void 0),this.loaded=!1,super.detachFromMap()}loadMbMap(){if(this.olListenersKeys.push(this.map?.on("change:target",()=>{this.loadMbMap()})),!this.map?.getTargetElement())return;if(!this.visible){this.olListenersKeys.push(this.once("change:visible",()=>{this.loadMbMap()}));return}let n=document.createElement("div");if(n.style.position="absolute",n.style.width="100%",n.style.height="100%",!this.styleUrl){console.error(`No styleUrl defined for mapbox layer: ${this.styleUrl}`);return}!this.apiKey&&!this.styleUrl?.includes(this.apiKeyName)&&console.error(`No apiKey defined for mapbox layer with style url to ${this.styleUrl}`);let u=this.getMapboxMapClass();this.mbMap=new u({style:Zh(this.styleUrl,{[this.apiKeyName]:this.apiKey}).toString(),container:n,interactive:!1,trackResize:!1,attributionControl:!1,...this.options.mapOptions||{}}),this.mbMap.once("load",()=>{this.loaded=!0,this.dispatchEvent({type:"load",target:this})}),this.mbMap.on("idle",this.updateAttribution)}updateAttribution(n){let u=oc(n.target)||[];this.copyrights?.toString()!==u.toString()&&(this.copyrights=u,this.olLayer?.getSource()?.setAttributions(u))}getFeatureInfoAtCoordinate(n,u){if(!u||!this.format||!this.mbMap||!this.mbMap.isStyleLoaded())return Promise.resolve({coordinate:n,features:[],layer:this});let r=n&&this.mbMap.project(lh(n)),s;if(this.hitTolerance){let{x:z,y:F}=r;s=[{x:z-this.hitTolerance,y:F-this.hitTolerance},{x:z+this.hitTolerance,y:F+this.hitTolerance}]}let P=this.mbMap.queryRenderedFeatures(s||r,u).map(z=>{let F=this.format.readFeature(z);return F&&F.set("mapboxFeature",z),F});return Promise.resolve({layer:this,features:P,coordinate:n})}getOlLayerRender(){console.error("This function must be implemented in subclasses");let n=document.createElement("div");return()=>n}getMapboxMapClass(){return console.error("This function must be implemented in subclasses"),null}},hg=k_;var np=class extends hg{attachToMap(n){super.attachToMap(n),this.map&&this.olListenersKeys.push(this.map.on("change:size",()=>{try{this.mbMap&&this.mbMap.resize()}catch(u){console.warn(u)}}))}loadMbMap(){let[n,u]=this.map?.getView().getCenter()||[];if((!n||!u)&&(n=0,u=0),this.renderState={center:[n,u],zoom:void 0,rotation:void 0,visible:void 0,opacity:void 0,size:[0,0]},super.loadMbMap(),!this.mbMap)return;this.mbMap.once("load",()=>{!this.mbMap||(this.mbMap.resize(),this.copyrights=oc(this.mbMap)||[],this.olLayer?.getSource()?.setAttributions(this.copyrights))});let r=this.mbMap.getCanvas();r&&(this.options.tabIndex?r.setAttribute("tabindex",`${this.options.tabIndex}`):r.removeAttribute("tabindex"))}getOlLayerRender(){return tf(this)}getMapboxMapClass(){return J0.Map}clone(n){return new np({...this.options,...n})}};var t1=Gp(e1());var op=class extends hg{getOlLayerRender(){return ef(this)}getMapboxMapClass(){return t1.Map}clone(c){return new op({...this.options,...c})}};var Td=class extends Is{constructor(n){super(n);if(this.mapboxLayer=n.mapboxLayer,this.disabled=!1,this.styleLayersFilter=n.styleLayersFilter,this.beforeId=n.beforeId,this.featureInfoFilter=n.featureInfoFilter||(u=>u),this.queryRenderedLayersFilter=n.queryRenderedLayersFilter,this.highlightedFeatures=[],this.selectedFeatures=[],this.styleLayers=(n.styleLayer?[n.styleLayer]:n.styleLayers)||[],this.addStyleLayers=this.addStyleLayers.bind(this),this.onLoad=this.onLoad.bind(this),n.filters&&(this.addDynamicFilters=()=>{this.setFilter(typeof n.filters=="function"?n.filters(this):n.filters)}),!this.styleLayersFilter&&this.styleLayers){let u=this.styleLayers.map(r=>r.id);this.styleLayersFilter=r=>u.includes(r.id)}}attachToMap(n){if(this.mapboxLayer&&!this.mapboxLayer.map&&this.mapboxLayer?.attachToMap(n),super.attachToMap(n),!this.map||!this.mapboxLayer)return;let{mbMap:u}=this.mapboxLayer;if(!u){this.olListenersKeys.push(this.map.on("change:target",()=>{this.attachToMap(n)}));return}this.mapboxLayer.loaded||u.isStyleLoaded()||u.loaded()?this.onLoad():u.once("load",this.onLoad),this.olListenersKeys.push(this.on("change:visible",r=>{this.applyLayoutVisibility(r)})),this.olListenersKeys.push(this.mapboxLayer.on("load",()=>{this.onLoad()}))}detachFromMap(){if(this.mapboxLayer?.mbMap){let{mbMap:n}=this.mapboxLayer;n.off("load",this.onLoad),this.removeStyleLayers()}super.detachFromMap()}addStyleLayers(){if(!this.mapboxLayer?.mbMap)return;let{mbMap:n}=this.mapboxLayer;this.styleLayers.forEach(u=>{let{id:r,source:s}=u;n.getSource(s)&&r&&!n.getLayer(r)&&n.addLayer(u,this.beforeId)}),this.applyLayoutVisibility()}removeStyleLayers(){if(!this.mapboxLayer?.mbMap)return;let{mbMap:n}=this.mapboxLayer;this.styleLayers.forEach(u=>{let{id:r}=u;r&&n.getLayer(r)&&n.removeLayer(r)})}onLoad(){if(this.addStyleLayers(),this.addDynamicFilters&&this.addDynamicFilters(),!this.mapboxLayer?.mbMap)return;let{mbMap:n}=this.mapboxLayer,u=n.getStyle();if(u&&this.styleLayersFilter){let r=u.layers.filter(this.styleLayersFilter);this.disabled=!r.length}}getFeatureInfoAtCoordinate(n){if(!this.mapboxLayer?.mbMap)return Promise.resolve({coordinate:n,features:[],layer:this});let{mbMap:u}=this.mapboxLayer;if(!u.isStyleLoaded())return Promise.resolve({coordinate:n,features:[],layer:this});let r=this.styleLayers||[];return this.styleLayersFilter&&(r=u.getStyle().layers.filter(this.styleLayersFilter)),this.queryRenderedLayersFilter&&(r=u.getStyle().layers.filter(this.queryRenderedLayersFilter)),this.mapboxLayer.getFeatureInfoAtCoordinate(n,{layers:r.map(s=>s&&s.id),validate:!1}).then(s=>{let P=s.features.filter(z=>this.featureInfoFilter(z,this.map?.getView().getResolution()));return this.highlight(P),{...s,features:P,layer:this}})}setFilter(n){if(!this.mapboxLayer?.mbMap)return;let{mbMap:u}=this.mapboxLayer;this.styleLayers.forEach(({id:r})=>{r&&n&&u.getLayer(r)&&u.setFilter(r,n)})}setHoverState(n,u){if(!this.mapboxLayer?.mbMap)return;let{mbMap:r}=this.mapboxLayer;!n||!r||n.forEach(s=>{let{source:P,sourceLayer:z}=s.get("mapboxFeature")||{};if(!P&&!z||!s.getId()){s.getId()||console.warn("No feature's id found. To use the feature state functionnality, tiles must be generated with --generate-ids. See https://github.com/mapbox/tippecanoe#adding-calculated-attributes.",s.getId(),s.getProperties());return}r.setFeatureState({id:s.getId(),source:P,sourceLayer:z},{hover:u})})}select(n=[]){this.setHoverState(this.selectedFeatures||[],!1),this.selectedFeatures=n,this.setHoverState(this.selectedFeatures||[],!0)}highlight(n=[]){let u=this.highlightedFeatures?.filter(r=>!(this.selectedFeatures||[]).map(s=>s.getId()).includes(r.getId()))||[];this.setHoverState(u,!1),this.highlightedFeatures=n,this.setHoverState(this.highlightedFeatures,!0)}applyLayoutVisibility(n){let{visible:u}=this,r=this.styleLayersFilter;if(!this.mapboxLayer?.mbMap)return;let{mbMap:s}=this.mapboxLayer,P=s.getStyle();if(!!P&&r){let z=u?"visible":"none";for(let F=0;F<P.layers.length;F+=1){let N=P.layers[F];r(N)&&s.getLayer(N.id)&&s.setLayoutProperty(N.id,"visibility",z)}}}clone(n){return new Td({...this.options,...n})}},r1=Td;var F_=Gp(a1()),B_=Gp(h1());function rT(_){return class extends _{constructor(u){super({hitTolerance:10,...u});this.debug=u.debug||!1,this.mode=u.mode||ra.TOPOGRAPHIC,this.api=u.api||new Wf(u),this.tenant=u.tenant||"",this.minZoomNonTrain=u.minZoomNonTrain||9,this.minZoomInterpolation=u.minZoomInterpolation||8,this.format=new bl,this.generalizationLevelByZoom=u.generalizationLevelByZoom||[5,5,5,5,5,5,5,5,10,30,30,100,100,100],this.getGeneralizationLevelByZoom=r=>u.getGeneralizationLevelByZoom&&u.getGeneralizationLevelByZoom(r,this.generalizationLevelByZoom)||this.generalizationLevelByZoom[r],this.renderTimeIntervalByZoom=u.renderTimeIntervalByZoom||[1e5,5e4,4e4,3e4,2e4,15e3,1e4,5e3,2e3,1e3,400,300,250,180,90,60,50,50,50,50,50],this.getRenderTimeIntervalByZoom=r=>u.getRenderTimeIntervalByZoom&&u.getRenderTimeIntervalByZoom(r,this.renderTimeIntervalByZoom)||this.renderTimeIntervalByZoom[r],this.isUpdateBboxOnMoveEnd=u.isUpdateBboxOnMoveEnd!==!1,this.throttleRenderTrajectories=(0,B_.default)(this.renderTrajectoriesInternal,50,{leading:!1,trailing:!0}),this.debounceRenderTrajectories=(0,F_.default)(this.renderTrajectoriesInternal,50,{leading:!0,trailing:!0,maxWait:5e3}),this.onFeatureHover=this.onFeatureHover.bind(this),this.onFeatureClick=this.onFeatureClick.bind(this),this.renderTrajectoriesInternal=this.renderTrajectoriesInternal.bind(this),this.onTrajectoryMessage=this.onTrajectoryMessage.bind(this),this.onDeleteTrajectoryMessage=this.onDeleteTrajectoryMessage.bind(this),this.onDocumentVisibilityChange=this.onDocumentVisibilityChange.bind(this)}defineProperties(u){let{style:r,speed:s,pixelRatio:P,hoverVehicleId:z,selectedVehicleId:F,filter:N,sort:V,time:me,live:be,canvas:Se,styleOptions:Ve}=u,Ke=s||1,Ie=me||new Date;super.defineProperties(u),Object.defineProperties(this,{isTrackerLayer:{value:!0},canvas:{value:Se||document.createElement("canvas")},style:{value:r||Hh},styleOptions:{value:{...rf,...Ve||{}}},speed:{get:()=>Ke,set:Ge=>{Ke=Ge,this.start()}},filter:{value:N,writable:!0},sort:{value:V,writable:!0},live:{value:be===!1?be:!0,writable:!0},time:{get:()=>Ie,set:Ge=>{Ie=Ge&&Ge.getTime?Ge:new Date(Ge),this.renderTrajectories()}},trajectories:{value:{},writable:!0},hoverVehicleId:{value:z,writable:!0},selectedVehicleId:{value:F,writable:!0},pixelRatio:{value:P||(typeof window<"u"?window.devicePixelRatio:1),writable:!0},useRequestAnimationFrame:{value:u.useRequestAnimationFrame||!1,writable:!0},useThrottle:{value:u.useThrottle!==!1,writable:!0},useDebounce:{value:u.useDebounce||!1,writable:!0}})}attachToMap(u){super.attachToMap(u),this.visible&&this.start(),this.visibilityRef=this.on("change:visible",r=>{r.target.visible?this.start():this.stop()}),document.addEventListener("visibilitychange",this.onDocumentVisibilityChange)}detachFromMap(){document.removeEventListener("visibilitychange",this.onDocumentVisibilityChange),this.stop(),Ka(this.visibilityRef),this.canvas&&(this.canvas.getContext("2d")?.clearRect(0,0,this.canvas.width,this.canvas.height),super.detachFromMap())}start(){this.stop(),this.renderTrajectories(),this.startUpdateTime(),this.api.open(),this.api.subscribeTrajectory(this.mode,this.onTrajectoryMessage,this.isUpdateBboxOnMoveEnd),this.api.subscribeDeletedVehicles(this.mode,this.onDeleteTrajectoryMessage,this.isUpdateBboxOnMoveEnd),this.isUpdateBboxOnMoveEnd&&this.setBbox()}startUpdateTime(){this.stopUpdateTime(),this.updateTimeDelay=this.getRefreshTimeInMs()||0,this.updateTimeInterval=window.setInterval(()=>{this.live?this.time=new Date:this.time&&this.updateTimeDelay&&this.speed&&(this.time=new Date(this.time.getTime()+this.updateTimeDelay*this.speed))},this.updateTimeDelay)}stop(){this.api.unsubscribeTrajectory(this.onTrajectoryMessage),this.api.unsubscribeDeletedVehicles(this.onDeleteTrajectoryMessage),this.api.close()}stopUpdateTime(){this.updateTimeInterval&&(clearInterval(this.updateTimeInterval),this.updateTimeInterval=void 0)}renderTrajectoriesInternal(u,r=!1){if(!this.map||!this.trajectories)return!1;let s=this.live?Date.now():this.time?.getTime(),P=Object.values(this.trajectories);return this.sort&&P.sort(this.sort),!this.canvas||!this.style||(this.renderState=Hf(this.canvas,P,this.style,{...u,pixelRatio:this.pixelRatio||1,time:s},{noInterpolate:(u.zoom||0)<this.minZoomInterpolation?!0:r,hoverVehicleId:this.hoverVehicleId,selectedVehicleId:this.selectedVehicleId,...this.styleOptions})),!0}renderTrajectories(u,r){this.requestId&&(cancelAnimationFrame(this.requestId),this.requestId=void 0),u&&(!r&&this.useRequestAnimationFrame?this.requestId=requestAnimationFrame(()=>{this.renderTrajectoriesInternal(u,r)}):!r&&this.useDebounce?this.debounceRenderTrajectories(u,r):!r&&this.useThrottle?this.throttleRenderTrajectories(u,r):this.renderTrajectoriesInternal(u,r))}setBbox(u,r){if(this.trajectories&&u&&r){let P=Object.keys(this.trajectories);for(let z=P.length-1;z>=0;z-=1)this.purgeTrajectory(this.trajectories[P[z]],u,r)}if(!u)return;let s=[...u];this.isUpdateBboxOnMoveEnd&&r&&(s.push(r),this.tenant&&s.push(`tenant=${this.tenant}`),this.generalizationLevel=this.getGeneralizationLevelByZoom(r),this.generalizationLevel&&s.push(`gen=${this.generalizationLevel}`)),this.api.bbox=s}setMode(u){this.mode!==u&&(this.mode=u,this.api.subscribeTrajectory(this.mode,this.onTrajectoryMessage,this.isUpdateBboxOnMoveEnd),this.api.subscribeDeletedVehicles(this.mode,this.onDeleteTrajectoryMessage,this.isUpdateBboxOnMoveEnd))}getRefreshTimeInMs(u=0){let r=u!==void 0?Math.round(u):-1,s=this.getRenderTimeIntervalByZoom(r)||25,P=Math.max(25,s/(this.speed||1)),z=Math.min(P,500);if(this.useThrottle?this.throttleRenderTrajectories=(0,B_.default)(this.renderTrajectoriesInternal,z,{leading:!0,trailing:!0}):this.useDebounce&&(this.debounceRenderTrajectories=(0,F_.default)(this.renderTrajectoriesInternal,z,{leading:!0,trailing:!0,maxWait:5e3})),this.api?.buffer){let[,F]=this.api.buffer;this.api.buffer=[z,F]}return P}getVehicle(u){return this.trajectories&&Object.values(this.trajectories).filter(u)||[]}getFeatureInfoAtCoordinate(u,r){let{resolution:s,nb:P}=r,z=yl([...u,...u],this.hitTolerance*s),F=Object.values(this.trajectories||{});this.sort&&(F=F.sort(this.sort));let N=[];for(let V=0;V<F.length&&(F[V].properties.coordinate&&Hp(z,F[V].properties.coordinate)&&N.push(F[V]),N.length!==P);V+=1);return Promise.resolve({layer:this,features:N.map(V=>this.format.readFeature(V)),coordinate:u})}getTrajectoryInfos(u){let r=[this.api.getStopSequence(u),this.api.getFullTrajectory(u,this.mode,this.generalizationLevel)];return Promise.all(r).then(([s,P])=>({stopSequence:s,fullTrajectory:P}))}purgeTrajectory(u,r,s){let{type:P,bounds:z}=u.properties;return!ko(r,z)||P!=="rail"&&s<(this.minZoomNonTrain||9)?(this.removeTrajectory(u),!0):!1}addTrajectory(u){this.filter&&!this.filter(u)||(this.trajectories||(this.trajectories={}),this.trajectories[u.properties.train_id]=u,this.renderTrajectories())}removeTrajectory(u){let r;typeof u!="string"?r=u?.properties?.train_id:r=u,this.trajectories&&delete this.trajectories[r]}onZoomEnd(){this.startUpdateTime()}onDocumentVisibilityChange(){!this.visible||(document.hidden?this.stop():this.start())}onTrajectoryMessage(u){if(!u.content)return;let r=u.content,{geometry:s,properties:{train_id:P,time_since_update:z,raw_coordinates:F}}=r;z<0||this.purgeTrajectory(r)||(this.debug&&this.mode===ra.TOPOGRAPHIC&&F?r.properties.olGeometry={type:"Point",coordinates:uo(F,this.map.getView().getProjection())}:r.properties.olGeometry=this.format.readGeometry(s),r.properties.timeOffset=Date.now()-u.timestamp,this.addTrajectory(r))}onDeleteTrajectoryMessage(u){!u.content||this.removeTrajectory(u.content)}onFeatureHover(u,r,s){let[P]=u,z=null;P&&(z=P.get("train_id")),this.hoverVehicleId!==z&&(this.hoverVehicleId=z,this.renderTrajectories(!0))}onFeatureClick(u,r,s){let[P]=u,z=null;P&&(z=P.get("train_id")),this.selectedVehicleId!==z&&(this.selectedVehicleId=z,this.selectedVehicle=P,this.renderTrajectories(!0))}}}var fg=rT;var iT=new Wl({zIndex:2,image:new xl({radius:5,fill:new Hs({color:"#000000"})}),stroke:new _a({color:"#000000",width:6})}),nT=(_,c,n)=>{let u="#ffffff",r=_.get("type"),s=_.get("stroke");return s&&s[0]!=="#"&&(s=`#${s}`),u=s||n?.getBgColor(r),u=/#ffffff/i.test(u)?"#ff0000":u,[iT,new Wl({zIndex:3,image:new xl({radius:4,fill:new Hs({color:u})}),stroke:new _a({color:u,width:4})})]},dg=nT;var oT=new Wl({zIndex:2,image:new xl({radius:5,fill:new Hs({color:"#000000"})}),stroke:new _a({color:"#000000",width:6})}),aT=new Wl({zIndex:3,image:new xl({radius:4,fill:new Hs({color:"#a0a0a0"})}),stroke:new _a({color:"#a0a0a0",width:4})}),sT=()=>[oT,aT],p1=sT;var lT=new bl,Sd=class extends fg(Is){constructor(c){super({...c}),this.olLayer=c.olLayer||new y_({layers:[new tp({source:new rp({features:[]}),style:(n,u)=>(c.fullTrajectoryStyle||dg)(n,u,this.styleOptions)}),new Kh({source:new cf({}),render:n=>{if(this.container||(this.container=document.createElement("div"),this.container.style.position="absolute",this.container.style.width="100%",this.container.style.height="100%",this.transformContainer=document.createElement("div"),this.transformContainer.style.position="absolute",this.transformContainer.style.width="100%",this.transformContainer.style.height="100%",this.container.appendChild(this.transformContainer),this.canvas&&(this.canvas.style.position="absolute",this.canvas.style.top="0",this.canvas.style.left="0",this.canvas.style.transformOrigin="top left",this.transformContainer.appendChild(this.canvas))),this.renderedViewState){let{center:u,resolution:r,rotation:s}=n.viewState,{center:P,resolution:z,rotation:F}=this.renderedViewState;if(z/r>=3)this.canvas?.getContext("2d")?.clearRect(0,0,this.canvas?.width,this.canvas?.height);else{let N=this.map.getPixelFromCoordinate(P),V=this.map.getPixelFromCoordinate(u);this.transformContainer.style.transform=kv(N[0]-V[0],N[1]-V[1],z/r,z/r,s-F,0,0)}}return this.container}})]}),this.vectorLayer=this.olLayer.getLayers().item(0),this.renderState={center:[0,0],zoom:void 0,rotation:0}}attachToMap(c){super.attachToMap(c),this.map&&this.olListenersKeys.push(...this.map.on(["moveend","change:target"],n=>{let u=(n.map||n.target).getView();if(u.getAnimating()||u.getInteracting())return;let r=u.getZoom();this.currentZoom!==r&&this.onZoomEnd(),this.currentZoom=r,this.onMoveEnd(n)}))}detachFromMap(){super.detachFromMap(),this.container=null}hasFeatureInfoAtCoordinate(c){if(this.map&&this.canvas){let n=this.canvas.getContext("2d"),u=this.map.getPixelFromCoordinate(c);return!!n?.getImageData(u[0]*(this.pixelRatio||1),u[1]*(this.pixelRatio||1),1,1).data[3]}return!1}renderTrajectories(c){if(!this.map)return;let n=this.map.getView();super.renderTrajectories({size:this.map.getSize(),center:this.map.getView().getCenter(),extent:n.calculateExtent(),resolution:n.getResolution(),rotation:n.getRotation(),zoom:n.getZoom(),pixelRatio:this.pixelRatio},c)}renderTrajectoriesInternal(c,n){if(!this.map)return!1;let u=!1;return u=this.map.getView().getAnimating()||this.map.getView().getInteracting()?!1:super.renderTrajectoriesInternal(c,n),u&&(this.renderedViewState={...c},this.transformContainer&&(this.transformContainer.style.transform="")),u}getRefreshTimeInMs(){return super.getRefreshTimeInMs(this.map.getView().getZoom())}getFeatureInfoAtCoordinate(c,n={}){let u=this.map.getView().getResolution();return super.getFeatureInfoAtCoordinate(c,{resolution:u,...n})}onMoveEnd(c){this.visible&&this.isUpdateBboxOnMoveEnd&&this.setBbox(),this.visible&&this.isUpdateBboxOnMoveEnd&&this.userClickInteractions&&this.selectedVehicleId&&this.highlightTrajectory(this.selectedVehicleId)}onZoomEnd(){super.onZoomEnd()}onFeatureHover(c,n,u){super.onFeatureHover(c,n,u),this.map.getTargetElement().style.cursor=c.length?"pointer":"auto"}onFeatureClick(c,n,u){super.onFeatureClick(c,n,u),!c.length&&this.vectorLayer&&this.vectorLayer.getSource().clear(),this.selectedVehicleId&&this.highlightTrajectory(this.selectedVehicleId)}purgeTrajectory(c,n,u){return super.purgeTrajectory(c,n||this.map.getView().calculateExtent(),u||this.map.getView().getZoom())}setBbox(c,n){let u=c,r=n;!u&&this.isUpdateBboxOnMoveEnd&&(u=c||this.map.getView().calculateExtent(),r=Math.floor(this.map.getView().getZoom())),super.setBbox(u,r)}highlightTrajectory(c){this.api.getFullTrajectory(c,this.mode,this.generalizationLevel).then(n=>{if(this.vectorLayer.getSource().clear(),!n||!n.features||!n.features.length)return;let r=lT.readFeatures(n);this.vectorLayer.getSource().addFeatures(r)})}clone(c){return new Sd({...this.options,...c})}},f1=Sd;var Id=class extends Is{getFeatureInfoAtCoordinate(c){let n=[];if(this.map){let u=this.map.getPixelFromCoordinate(c);n=this.map.getFeaturesAtPixel(u,{layerFilter:r=>r===this.olLayer,hitTolerance:this.hitTolerance})}return Promise.resolve({features:n,layer:this,coordinate:c})}clone(c){return new Id({...this.options,...c})}},d1=Id;var Cd=class extends Is{constructor(n){super(n);this.abortController=new AbortController,this.format=new bl}getFeatureInfoUrl(n){if(!this.map)return;let u=this.map.getView().getProjection(),r=this.map.getView().getResolution();if(r&&u&&this.olLayer?.getSource()?.getFeatureInfoUrl)return this.olLayer?.getSource()?.getFeatureInfoUrl(n,r,u,{info_format:"application/json",query_layers:this.olLayer?.getSource()?.getParams().layers})}getFeatureInfoAtCoordinate(n){this.abortController?.abort(),this.abortController=new AbortController;let{signal:u}=this.abortController,r=this.getFeatureInfoUrl(n);return r?fetch(r,{signal:u}).then(s=>s.json()).then(s=>s.features).then(s=>({layer:this,coordinate:n,features:s.map(P=>this.format.readFeature(P))})).catch(()=>Promise.resolve({features:[],coordinate:n,layer:this})):(console.error("No url for the WMS layer."),Promise.resolve({features:[],coordinate:n,layer:this}))}clone(n){return new Cd({...this.options,...n})}},m1=Cd;var vg={};iy(vg,{CopyrightControl:()=>g1,Layer:()=>gg,RealtimeAPI:()=>Wf,RealtimeLayer:()=>M1,RealtimeModes:()=>ra,RoutingAPI:()=>Zf,StopsAPI:()=>Xf,createTrackerFilters:()=>uy,getCircleCanvas:()=>Ry,getDelayBgCanvas:()=>ky,getDelayTextCanvas:()=>Ly,getHoursAndMinutes:()=>Iv,getLayersAsFlatArray:()=>$f,getMapboxMapCopyrights:()=>oc,getMapboxRender:()=>tf,getMaplibreRender:()=>ef,getMercatorResolution:()=>_g,getSourceCoordinates:()=>Md,getTextCanvas:()=>zy,getUTCDateString:()=>Tv,getUTCTimeString:()=>Sv,getUrlWithParams:()=>Zh,pad:()=>km,realtimeDefaultStyle:()=>Hh,realtimeDelayStyle:()=>Dy,realtimeSimpleStyle:()=>Oy,removeDuplicate:()=>Xh,renderTrajectories:()=>Hf,sortByDelay:()=>cy,trackerConfig:()=>rf});var U_=class extends jm{constructor(c){super(c),this.render=this.render.bind(this)}activate(){super.activate(),this.map&&(this.map.on("sourcedata",this.render),this.map.on("styledata",this.render),this.map.on("idle",this.render))}deactivate(){this.map&&(this.map.off("sourcedata",this.render),this.map.off("styledata",this.render),this.map.off("idle",this.render)),super.deactivate()}getCopyrights(){return oc(this.map)}},g1=U_;var Ad=class extends lg(ip){attachToMap(n){super.attachToMap(n),!!this.map&&this.userInteractions&&(this.toggleVisibleListeners(),this.onChangeVisibleKey=this.on("change:visible",this.toggleVisibleListeners))}detachFromMap(){this.map&&(this.deactivateUserInteractions(),Ka(this.onChangeVisibleKey)),super.detachFromMap()}activateUserInteractions(){this.deactivateUserInteractions(),this.map&&this.userInteractions&&this.userClickInteractions&&this.userClickCallbacks?.length&&this.map.on("click",this.onUserClickCallback),this.map&&this.userInteractions&&this.userHoverInteractions&&this.userHoverCallbacks?.length&&this.map.on("mousemove",this.onUserMoveCallback)}deactivateUserInteractions(){this.map&&(this.map.off("mousemove",this.onUserMoveCallback),this.map.off("click",this.onUserClickCallback))}toggleVisibleListeners(){this.visible?this.activateUserInteractions():this.deactivateUserInteractions()}getMercatorExtent(){let n=this.map.getBounds().toArray();return ed([...n[0],...n[1]],"EPSG:4326","EPSG:3857")}getOlZoom(){return this.map.getZoom()+1}clone(n){return new Ad({...this.options,...n})}},gg=Ad;var Go=63710088e-1,y1={centimeters:Go*100,centimetres:Go*100,degrees:Go/111325,feet:Go*3.28084,inches:Go*39.37,kilometers:Go/1e3,kilometres:Go/1e3,meters:Go,metres:Go,miles:Go/1609.344,millimeters:Go*1e3,millimetres:Go*1e3,nauticalmiles:Go/1852,radians:1,yards:Go*1.0936},y5={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/Go,yards:1.0936133};function _1(_,c,n){n===void 0&&(n={});var u={type:"Feature"};return(n.id===0||n.id)&&(u.id=n.id),n.bbox&&(u.bbox=n.bbox),u.properties=c||{},u.geometry=_,u}function xh(_,c,n){if(n===void 0&&(n={}),!_)throw new Error("coordinates is required");if(!Array.isArray(_))throw new Error("coordinates must be an Array");if(_.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!N_(_[0])||!N_(_[1]))throw new Error("coordinates must contain numbers");var u={type:"Point",coordinates:_};return _1(u,c,n)}function uT(_,c){c===void 0&&(c="kilometers");var n=y1[c];if(!n)throw new Error(c+" units is invalid");return _*n}function cT(_,c){c===void 0&&(c="kilometers");var n=y1[c];if(!n)throw new Error(c+" units is invalid");return _/n}function v1(_){var c=_%(2*Math.PI);return c*180/Math.PI}function ap(_){var c=_%360;return c*Math.PI/180}function yg(_,c,n){if(c===void 0&&(c="kilometers"),n===void 0&&(n="kilometers"),!(_>=0))throw new Error("length must be a positive number");return uT(cT(_,c),n)}function N_(_){return!isNaN(_)&&_!==null&&!Array.isArray(_)}function V_(_){return!!_&&_.constructor===Object}function Pd(_,c,n){if(_!==null)for(var u,r,s,P,z,F,N,V=0,me=0,be,Se=_.type,Ve=Se==="FeatureCollection",Ke=Se==="Feature",Ie=Ve?_.features.length:1,Ge=0;Ge<Ie;Ge++){N=Ve?_.features[Ge].geometry:Ke?_.geometry:_,be=N?N.type==="GeometryCollection":!1,z=be?N.geometries.length:1;for(var et=0;et<z;et++){var rt=0,_t=0;if(P=be?N.geometries[et]:N,P!==null){F=P.coordinates;var yt=P.type;switch(V=n&&(yt==="Polygon"||yt==="MultiPolygon")?1:0,yt){case null:break;case"Point":if(c(F,me,Ge,rt,_t)===!1)return!1;me++,rt++;break;case"LineString":case"MultiPoint":for(u=0;u<F.length;u++){if(c(F[u],me,Ge,rt,_t)===!1)return!1;me++,yt==="MultiPoint"&&rt++}yt==="LineString"&&rt++;break;case"Polygon":case"MultiLineString":for(u=0;u<F.length;u++){for(r=0;r<F[u].length-V;r++){if(c(F[u][r],me,Ge,rt,_t)===!1)return!1;me++}yt==="MultiLineString"&&rt++,yt==="Polygon"&&_t++}yt==="Polygon"&&rt++;break;case"MultiPolygon":for(u=0;u<F.length;u++){for(_t=0,r=0;r<F[u].length;r++){for(s=0;s<F[u][r].length-V;s++){if(c(F[u][r][s],me,Ge,rt,_t)===!1)return!1;me++}_t++}rt++}break;case"GeometryCollection":for(u=0;u<P.geometries.length;u++)if(Pd(P.geometries[u],c,n)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function hT(_,c){c===void 0&&(c={});var n=0,u=0,r=0;return Pd(_,function(s){n+=s[0],u+=s[1],r++},!0),xh([n/r,u/r],c.properties)}var x1=hT;function Mu(_){if(!_)throw new Error("coord is required");if(!Array.isArray(_)){if(_.type==="Feature"&&_.geometry!==null&&_.geometry.type==="Point")return _.geometry.coordinates;if(_.type==="Point")return _.coordinates}if(Array.isArray(_)&&_.length>=2&&!Array.isArray(_[0])&&!Array.isArray(_[1]))return _;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function b1(_){if(Array.isArray(_))return _;if(_.type==="Feature"){if(_.geometry!==null)return _.geometry.coordinates}else if(_.coordinates)return _.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function pT(_,c,n){n===void 0&&(n={});var u;n.final?u=w1(Mu(c),Mu(_)):u=w1(Mu(_),Mu(c));var r=u>180?-(360-u):u;return r}function w1(_,c){var n=ap(_[1]),u=ap(c[1]),r=ap(c[0]-_[0]);r>Math.PI&&(r-=2*Math.PI),r<-Math.PI&&(r+=2*Math.PI);var s=Math.log(Math.tan(u/2+Math.PI/4)/Math.tan(n/2+Math.PI/4)),P=Math.atan2(r,s);return(v1(P)+360)%360}var E1=pT;function fT(_,c,n){n===void 0&&(n={});var u=Mu(_),r=Mu(c);r[0]+=r[0]-u[0]>180?-360:u[0]-r[0]>180?360:0;var s=dT(u,r),P=yg(s,"meters",n.units);return P}function dT(_,c,n){n=n===void 0?Go:Number(n);var u=n,r=_[1]*Math.PI/180,s=c[1]*Math.PI/180,P=s-r,z=Math.abs(c[0]-_[0])*Math.PI/180;z>Math.PI&&(z-=2*Math.PI);var F=Math.log(Math.tan(s/2+Math.PI/4)/Math.tan(r/2+Math.PI/4)),N=Math.abs(F)>1e-11?P/F:Math.cos(r),V=Math.sqrt(P*P+N*N*z*z),me=V*u;return me}var T1=fT;function mT(_,c,n,u){u===void 0&&(u={});var r=c<0,s=yg(Math.abs(c),u.units,"meters");r&&(s=-Math.abs(s));var P=Mu(_),z=gT(P,s,n);return z[0]+=z[0]-P[0]>180?-360:P[0]-z[0]>180?360:0,xh(z,u.properties)}function gT(_,c,n,u){u=u===void 0?Go:Number(u);var r=c/u,s=_[0]*Math.PI/180,P=ap(_[1]),z=ap(n),F=r*Math.cos(z),N=P+F;Math.abs(N)>Math.PI/2&&(N=N>0?Math.PI-N:-Math.PI-N);var V=Math.log(Math.tan(N/2+Math.PI/4)/Math.tan(P/2+Math.PI/4)),me=Math.abs(V)>1e-11?F/V:Math.cos(P),be=r*Math.sin(z)/me,Se=s+be;return[(Se*180/Math.PI+540)%360-180,N*180/Math.PI]}var S1=mT;function yT(_){if(!_)throw new Error("geojson is required");switch(_.type){case"Feature":return I1(_);case"FeatureCollection":return _T(_);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return G_(_);default:throw new Error("unknown GeoJSON type")}}function I1(_){var c={type:"Feature"};return Object.keys(_).forEach(function(n){switch(n){case"type":case"properties":case"geometry":return;default:c[n]=_[n]}}),c.properties=C1(_.properties),c.geometry=G_(_.geometry),c}function C1(_){var c={};return _&&Object.keys(_).forEach(function(n){var u=_[n];typeof u=="object"?u===null?c[n]=null:Array.isArray(u)?c[n]=u.map(function(r){return r}):c[n]=C1(u):c[n]=u}),c}function _T(_){var c={type:"FeatureCollection"};return Object.keys(_).forEach(function(n){switch(n){case"type":case"features":return;default:c[n]=_[n]}}),c.features=_.features.map(function(n){return I1(n)}),c}function G_(_){var c={type:_.type};return _.bbox&&(c.bbox=_.bbox),_.type==="GeometryCollection"?(c.geometries=_.geometries.map(function(n){return G_(n)}),c):(c.coordinates=A1(_.coordinates),c)}function A1(_){var c=_;return typeof c[0]!="object"?c.slice():c.map(function(n){return A1(n)})}var P1=yT;function vT(_,c,n){if(n=n||{},!V_(n))throw new Error("options is invalid");var u=n.pivot,r=n.mutate;if(!_)throw new Error("geojson is required");if(c==null||isNaN(c))throw new Error("angle is required");return c===0||(u||(u=x1(_)),(r===!1||r===void 0)&&(_=P1(_)),Pd(_,function(s){var P=E1(u,s),z=P+c,F=T1(u,s),N=b1(S1(u,F,z));s[0]=N[0],s[1]=N[1]})),_}var j_=vT;var xT=(_,c=1)=>{let{width:n,height:u}=_.getCanvas(),r=_.unproject({x:0,y:0}),s=_.unproject({x:0,y:u/c}),P=_.unproject({x:n/c,y:u/c}),z=_.unproject({x:n/c,y:0});return[[r.lng,r.lat],[z.lng,z.lat],[P.lng,P.lat],[s.lng,s.lat]]},Md=xT;var bT=_=>{let c=_.getBounds().toArray(),n=uo(c[0]),u=uo(c[1]),r=[...n,...u],{width:s,height:P}=_.getCanvas(),z=bs(r)/s,F=Eu(r)/P;return Math.max(z,F)},_g=bT;var q_=class extends fg(gg){constructor(c={}){super({...c}),this.onLoad=this.onLoad.bind(this),this.onMove=this.onMove.bind(this),this.onMoveEnd=this.onMoveEnd.bind(this),this.onZoomEnd=this.onZoomEnd.bind(this),this.onVisibilityChange=this.onVisibilityChange.bind(this)}attachToMap(c,n){!c||(super.attachToMap(c),this.source={type:"canvas",canvas:this.canvas,coordinates:Md(c,this.pixelRatio),animate:!0,attribution:this.copyrights&&this.copyrights.join(", ")},this.beforeId=n,this.layer={id:this.key,type:"raster",source:this.key,layout:{visibility:this.visible?"visible":"none"},paint:{"raster-opacity":1,"raster-fade-duration":0,"raster-resampling":"nearest"}},c.isStyleLoaded()&&this.onLoad(),this.map.on("load",this.onLoad),this.listeners=[this.on("change:visible",this.onVisibilityChange)])}detachFromMap(){this.map&&(this.map.off("load",this.onLoad),this.listeners.forEach(c=>{Ka(c)}),this.map.style&&this.map.getLayer(this.key)&&this.map.removeLayer(this.key),this.map.style&&this.map.getSource(this.key)&&this.map.removeSource(this.key)),super.detachFromMap()}start(){super.start(),this.map.on("move",this.onMove),this.map.on("moveend",this.onMoveEnd),this.map.on("zoomend",this.onZoomEnd)}stop(){super.stop(),this.map&&(this.map.off("move",this.onMove),this.map.off("moveend",this.onMoveEnd),this.map.off("zoomend",this.onZoomEnd))}onLoad(){this.map.getSource(this.key)||this.map.addSource(this.key,this.source),this.map.getLayer(this.key)||this.map.addLayer(this.layer,this.beforeId)}onUserMoveCallback(c){super.onUserMoveCallback({coordinate:uo(c.lngLat.toArray()),...c})}renderTrajectories(c=!1){if(!this.map)return;this.pixelRatio||(this.pixelRatio=1);let{width:n,height:u}=this.map.getCanvas(),r=this.map.getCenter(),s=this.map.unproject({x:0,y:u/this.pixelRatio}),P=this.map.unproject({x:n/this.pixelRatio,y:0}),z=j_(xh([s.lng,s.lat]),-this.map.getBearing(),{pivot:[r.lng,r.lat]}).geometry.coordinates,F=j_(xh([P.lng,P.lat]),-this.map.getBearing(),{pivot:[r.lng,r.lat]}).geometry.coordinates,N=[...uo(z),...uo(F)],V=bs(N)/(n/this.pixelRatio),me=Eu(N)/(u/this.pixelRatio),be=Math.max(V,me),Se={size:[n/this.pixelRatio,u/this.pixelRatio],center:uo([r.lng,r.lat]),extent:N,resolution:be,zoom:this.map.getZoom(),rotation:-(this.map.getBearing()*Math.PI)/180,pixelRatio:this.pixelRatio};super.renderTrajectories(Se,c)}getRefreshTimeInMs(){return super.getRefreshTimeInMs(this.map.getZoom())}getFeatureInfoAtCoordinate(c,n={}){let u=_g(this.map);return super.getFeatureInfoAtCoordinate(c,{resolution:u,...n})}onVisibilityChange(){this.visible&&!this.map.getLayer(this.key)?this.map.addLayer(this.layer,this.beforeId):this.map.getLayer(this.key)&&this.map.removeLayer(this.key)}purgeTrajectory(c,n,u){return super.purgeTrajectory(c,n||this.getMercatorExtent(),u||Math.floor(this.map.getZoom()+1))}setBbox(c,n){let u=c,r=n;!u&&this.isUpdateBboxOnMoveEnd&&(u=c||this.getMercatorExtent(),r=Math.floor(this.getOlZoom())),super.setBbox(u,r)}onMove(){this.renderTrajectories()}renderTrajectoriesInternal(c,n=!1){let u=super.renderTrajectoriesInternal(c,n);if(u&&this.map.style){let r=Md(this.map,this.pixelRatio),s=this.map.getSource(this.key);s&&s.setCoordinates(r)}return u}onMoveEnd(){this.renderTrajectories(),this.visible&&this.isUpdateBboxOnMoveEnd&&this.setBbox()}onFeatureHover(c,n,u){super.onFeatureHover(c,n,u),this.map.getCanvasContainer().style.cursor=c.length?"pointer":"auto"}},M1=q_;var Z_={ol:mg,mapbox:vg};typeof window<"u"&&(window.mbt=Z_);var _3=Z_;})();
1083
1083
  //# sourceMappingURL=mbt.min.js.map