@partbot/stockist-map 0.1.6 → 0.1.8

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.
@@ -839,5 +839,5 @@ uniform ${I} ${R} u_${L};
839
839
  `),re=Q.concat(Pr.prelude.vertexSource,T.vertexSource,n.vertexSource).join(`
840
840
  `);Di(I)||(X=(function(Te){return Te.replace(/\bin\s/g,"varying ").replace("out highp vec4 fragColor;","").replace(/fragColor/g,"gl_FragColor").replace(/texture\(/g,"texture2D(")})(X),re=(function(Te){return Te.replace(/\bin\s/g,"attribute ").replace(/\bout\s/g,"varying ").replace(/texture\(/g,"texture2D(")})(re));const J=I.createShader(I.FRAGMENT_SHADER);if(I.isContextLost())return void(this.failedToCreate=!0);if(I.shaderSource(J,X),I.compileShader(J),!I.getShaderParameter(J,I.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${I.getShaderInfoLog(J)}`);I.attachShader(this.program,J);const pe=I.createShader(I.VERTEX_SHADER);if(I.isContextLost())return void(this.failedToCreate=!0);if(I.shaderSource(pe,re),I.compileShader(pe),!I.getShaderParameter(pe,I.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${I.getShaderInfoLog(pe)}`);I.attachShader(this.program,pe),this.attributes={};const xe={};this.numAttributes=O.length;for(let Te=0;Te<this.numAttributes;Te++)O[Te]&&(I.bindAttribLocation(this.program,Te,O[Te]),this.attributes[O[Te]]=Te);if(I.linkProgram(this.program),!I.getProgramParameter(this.program,I.LINK_STATUS))throw new Error(`Program failed to link: ${I.getProgramInfoLog(this.program)}`);I.deleteShader(pe),I.deleteShader(J);for(const Te of ie)if(Te&&!xe[Te]){const Re=I.getUniformLocation(this.program,Te);Re&&(xe[Te]=Re)}this.fixedUniforms=h(t,xe),this.terrainUniforms=((Te,Re)=>({u_depth:new d.b_(Te,Re.u_depth),u_terrain:new d.b_(Te,Re.u_terrain),u_terrain_dim:new d.bp(Te,Re.u_terrain_dim),u_terrain_matrix:new d.c0(Te,Re.u_terrain_matrix),u_terrain_unpack:new d.c1(Te,Re.u_terrain_unpack),u_terrain_exaggeration:new d.bp(Te,Re.u_terrain_exaggeration)}))(t,xe),this.projectionUniforms=((Te,Re)=>({u_projection_matrix:new d.c0(Te,Re.u_projection_matrix),u_projection_tile_mercator_coords:new d.c1(Te,Re.u_projection_tile_mercator_coords),u_projection_clipping_plane:new d.c1(Te,Re.u_projection_clipping_plane),u_projection_transition:new d.bp(Te,Re.u_projection_transition),u_projection_fallback_matrix:new d.c0(Te,Re.u_projection_fallback_matrix)}))(t,xe),this.binderUniforms=l?l.getUniforms(t,xe):[]}draw(t,n,l,h,g,b,T,P,M,I,R,L,O,$,Z,Y,H,K,ie){var Q;const X=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(l),t.setStencilMode(h),t.setColorMode(g),t.setCullFace(b),P){t.activeTexture.set(X.TEXTURE2),X.bindTexture(X.TEXTURE_2D,P.depthTexture),t.activeTexture.set(X.TEXTURE3),X.bindTexture(X.TEXTURE_2D,P.texture);for(const J in this.terrainUniforms)this.terrainUniforms[J].set(P[J])}if(M)for(const J in M)this.projectionUniforms[Id[J]].set(M[J]);if(T)for(const J in this.fixedUniforms)this.fixedUniforms[J].set(T[J]);Y&&Y.setUniforms(t,this.binderUniforms,$,{zoom:Z});let re=0;switch(n){case X.LINES:re=2;break;case X.TRIANGLES:re=3;break;case X.LINE_STRIP:re=1}for(const J of O.get())J.vaos||(J.vaos={}),(Q=J.vaos)[I]||(Q[I]=new Md),J.vaos[I].bind(t,this,R,Y?Y.getPaintVertexBuffers():[],L,J.vertexOffset,H,K,ie),X.drawElements(n,J.primitiveLength*re,X.UNSIGNED_SHORT,J.primitiveOffset*re*2)}}function zc(f,t,n){const l=1/d.aK(n,1,t.transform.tileZoom),h=Math.pow(2,n.tileID.overscaledZ),g=n.tileSize*Math.pow(2,t.transform.tileZoom)/h,b=g*(n.tileID.canonical.x+n.tileID.wrap*h),T=g*n.tileID.canonical.y;return{u_image:0,u_texsize:n.imageAtlasTexture.size,u_scale:[l,f.fromScale,f.toScale],u_fade:f.t,u_pixel_coord_upper:[b>>16,T>>16],u_pixel_coord_lower:[65535&b,65535&T]}}const Ac=(f,t,n,l)=>{const h=f.style.light,g=h.properties.get("position"),b=[g.x,g.y,g.z],T=d.c4();h.properties.get("anchor")==="viewport"&&d.c5(T,f.transform.bearingInRadians),d.c6(b,b,T);const P=f.transform.transformLightDirection(b),M=h.properties.get("color");return{u_lightpos:b,u_lightpos_globe:P,u_lightintensity:h.properties.get("intensity"),u_lightcolor:[M.r,M.g,M.b],u_vertical_gradient:+t,u_opacity:n,u_fill_translate:l}},Dc=(f,t,n,l,h,g,b)=>d.e(Ac(f,t,n,l),zc(g,f,b),{u_height_factor:-Math.pow(2,h.overscaledZ)/b.tileSize/8}),Ul=(f,t,n,l)=>d.e(zc(t,f,n),{u_fill_translate:l}),Rc=(f,t)=>({u_world:f,u_fill_translate:t}),Lc=(f,t,n,l,h)=>d.e(Ul(f,t,n,h),{u_world:l}),cs=(f,t,n,l,h)=>{const g=f.transform;let b,T,P=0;if(n.paint.get("circle-pitch-alignment")==="map"){const M=d.aK(t,1,g.zoom);b=!0,T=[M,M],P=M/(d.a6*Math.pow(2,t.tileID.overscaledZ))*2*Math.PI*h}else b=!1,T=g.pixelsToGLUnits;return{u_camera_to_center_distance:g.cameraToCenterDistance,u_scale_with_map:+(n.paint.get("circle-pitch-scale")==="map"),u_pitch_with_map:+b,u_device_pixel_ratio:f.pixelRatio,u_extrude_scale:T,u_globe_extrude_scale:P,u_translate:l}},Ch=f=>({u_pixel_extrude_scale:[1/f.width,1/f.height]}),hs=f=>({u_viewport_size:[f.width,f.height]}),Fc=(f,t=1)=>({u_color:f,u_overlay:0,u_overlay_scale:t}),Nu=(f,t,n,l)=>{const h=d.aK(f,1,t)/(d.a6*Math.pow(2,f.tileID.overscaledZ))*2*Math.PI*l;return{u_extrude_scale:d.aK(f,1,t),u_intensity:n,u_globe_extrude_scale:h}},ds=(f,t,n,l)=>{const h=d.O();d.c7(h,0,f.width,f.height,0,0,1);const g=f.context.gl;return{u_matrix:h,u_world:[g.drawingBufferWidth,g.drawingBufferHeight],u_image:n,u_color_ramp:l,u_opacity:t.paint.get("heatmap-opacity")}},ql=(f,t,n)=>{const l=n.paint.get("hillshade-accent-color");let h;switch(n.paint.get("hillshade-method")){case"basic":h=4;break;case"combined":h=1;break;case"igor":h=2;break;case"multidirectional":h=3;break;default:h=0}const g=n.getIlluminationProperties();for(let b=0;b<g.directionRadians.length;b++)n.paint.get("hillshade-illumination-anchor")==="viewport"&&(g.directionRadians[b]+=f.transform.bearingInRadians);return{u_image:0,u_latrange:kd(0,t.tileID),u_exaggeration:n.paint.get("hillshade-exaggeration"),u_altitudes:g.altitudeRadians,u_azimuths:g.directionRadians,u_accent:l,u_method:h,u_highlights:g.highlightColor,u_shadows:g.shadowColor}},Sa=(f,t)=>{const n=t.stride,l=d.O();return d.c7(l,0,d.a6,-d.a6,0,0,1),d.Q(l,l,[0,-d.a6,0]),{u_matrix:l,u_image:1,u_dimension:[n,n],u_zoom:f.overscaledZ,u_unpack:t.getUnpackVector()}};function kd(f,t){const n=Math.pow(2,t.canonical.z),l=t.canonical.y;return[new d.a7(0,l/n).toLngLat().lat,new d.a7(0,(l+1)/n).toLngLat().lat]}const ju=(f,t,n=0)=>({u_image:0,u_unpack:t.getUnpackVector(),u_dimension:[t.stride,t.stride],u_elevation_stops:1,u_color_stops:4,u_color_ramp_size:n,u_opacity:f.paint.get("color-relief-opacity")}),$l=(f,t,n,l)=>{const h=f.transform;return{u_translation:Kn(f,t,n),u_ratio:l/d.aK(t,1,h.zoom),u_device_pixel_ratio:f.pixelRatio,u_units_to_pixels:[1/h.pixelsToGLUnits[0],1/h.pixelsToGLUnits[1]]}},Bc=(f,t,n,l,h)=>d.e($l(f,t,n,l),{u_image:0,u_image_height:h}),Vu=(f,t,n,l,h)=>{const g=f.transform,b=ps(t,g);return{u_translation:Kn(f,t,n),u_texsize:t.imageAtlasTexture.size,u_ratio:l/d.aK(t,1,g.zoom),u_device_pixel_ratio:f.pixelRatio,u_image:0,u_scale:[b,h.fromScale,h.toScale],u_fade:h.t,u_units_to_pixels:[1/g.pixelsToGLUnits[0],1/g.pixelsToGLUnits[1]]}},Gl=(f,t,n,l,h)=>{const g=ps(t,f.transform);return d.e($l(f,t,n,l),{u_tileratio:g,u_crossfade_from:h.fromScale,u_crossfade_to:h.toScale,u_image:0,u_mix:h.t,u_lineatlas_width:f.lineAtlas.width,u_lineatlas_height:f.lineAtlas.height})},Oc=(f,t,n,l,h,g)=>{const b=ps(t,f.transform);return d.e($l(f,t,n,l),{u_image:0,u_image_height:g,u_tileratio:b,u_crossfade_from:h.fromScale,u_crossfade_to:h.toScale,u_image_dash:1,u_mix:h.t,u_lineatlas_width:f.lineAtlas.width,u_lineatlas_height:f.lineAtlas.height})};function ps(f,t){return 1/d.aK(f,1,t.tileZoom)}function Kn(f,t,n){return d.aL(f.transform,t,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}const Nc=(f,t,n,l,h)=>{return{u_tl_parent:f,u_scale_parent:t,u_buffer_scale:1,u_fade_t:n.mix,u_opacity:n.opacity*l.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:l.paint.get("raster-brightness-min"),u_brightness_high:l.paint.get("raster-brightness-max"),u_saturation_factor:(b=l.paint.get("raster-saturation"),b>0?1-1/(1.001-b):-b),u_contrast_factor:(g=l.paint.get("raster-contrast"),g>0?1/(1-g):1+g),u_spin_weights:jc(l.paint.get("raster-hue-rotate")),u_coords_top:[h[0].x,h[0].y,h[1].x,h[1].y],u_coords_bottom:[h[3].x,h[3].y,h[2].x,h[2].y]};var g,b};function jc(f){f*=Math.PI/180;const t=Math.sin(f),n=Math.cos(f);return[(2*n+1)/3,(-Math.sqrt(3)*t-n+1)/3,(Math.sqrt(3)*t-n+1)/3]}const Uu=(f,t,n,l,h,g,b,T,P,M,I,R,L)=>{const O=b.transform;return{u_is_size_zoom_constant:+(f==="constant"||f==="source"),u_is_size_feature_constant:+(f==="constant"||f==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:O.cameraToCenterDistance,u_pitch:O.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:O.width/O.height,u_fade_change:b.options.fadeDuration?b.symbolFadeChange:1,u_label_plane_matrix:T,u_coord_matrix:P,u_is_text:+I,u_pitch_with_map:+l,u_is_along_line:h,u_is_variable_anchor:g,u_texsize:R,u_texture:0,u_translation:M,u_pitched_scale:L}},Vc=(f,t,n,l,h,g,b,T,P,M,I,R,L,O)=>{const $=b.transform;return d.e(Uu(f,t,n,l,h,g,b,T,P,M,I,R,O),{u_gamma_scale:l?Math.cos($.pitch*Math.PI/180)*$.cameraToCenterDistance:1,u_device_pixel_ratio:b.pixelRatio,u_is_halo:L?1:0,u_is_plain:1})},Uc=(f,t,n,l,h,g,b,T,P,M,I,R,L)=>d.e(Vc(f,t,n,l,h,g,b,T,P,M,!0,I,!0,L),{u_texsize_icon:R,u_texture_icon:1}),Si=(f,t)=>({u_opacity:f,u_color:t}),fs=(f,t,n,l,h)=>d.e((function(g,b,T,P){const M=T.imageManager.getPattern(g.from.toString()),I=T.imageManager.getPattern(g.to.toString()),{width:R,height:L}=T.imageManager.getPixelSize(),O=Math.pow(2,P.tileID.overscaledZ),$=P.tileSize*Math.pow(2,T.transform.tileZoom)/O,Z=$*(P.tileID.canonical.x+P.tileID.wrap*O),Y=$*P.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:M.tl,u_pattern_br_a:M.br,u_pattern_tl_b:I.tl,u_pattern_br_b:I.br,u_texsize:[R,L],u_mix:b.t,u_pattern_size_a:M.displaySize,u_pattern_size_b:I.displaySize,u_scale_a:b.fromScale,u_scale_b:b.toScale,u_tile_units_to_pixels:1/d.aK(P,1,T.transform.tileZoom),u_pixel_coord_upper:[Z>>16,Y>>16],u_pixel_coord_lower:[65535&Z,65535&Y]}})(n,h,t,l),{u_opacity:f}),qc=(f,t)=>{},Mh={fillExtrusion:(f,t)=>({u_lightpos:new d.c2(f,t.u_lightpos),u_lightpos_globe:new d.c2(f,t.u_lightpos_globe),u_lightintensity:new d.bp(f,t.u_lightintensity),u_lightcolor:new d.c2(f,t.u_lightcolor),u_vertical_gradient:new d.bp(f,t.u_vertical_gradient),u_opacity:new d.bp(f,t.u_opacity),u_fill_translate:new d.c3(f,t.u_fill_translate)}),fillExtrusionPattern:(f,t)=>({u_lightpos:new d.c2(f,t.u_lightpos),u_lightpos_globe:new d.c2(f,t.u_lightpos_globe),u_lightintensity:new d.bp(f,t.u_lightintensity),u_lightcolor:new d.c2(f,t.u_lightcolor),u_vertical_gradient:new d.bp(f,t.u_vertical_gradient),u_height_factor:new d.bp(f,t.u_height_factor),u_opacity:new d.bp(f,t.u_opacity),u_fill_translate:new d.c3(f,t.u_fill_translate),u_image:new d.b_(f,t.u_image),u_texsize:new d.c3(f,t.u_texsize),u_pixel_coord_upper:new d.c3(f,t.u_pixel_coord_upper),u_pixel_coord_lower:new d.c3(f,t.u_pixel_coord_lower),u_scale:new d.c2(f,t.u_scale),u_fade:new d.bp(f,t.u_fade)}),fill:(f,t)=>({u_fill_translate:new d.c3(f,t.u_fill_translate)}),fillPattern:(f,t)=>({u_image:new d.b_(f,t.u_image),u_texsize:new d.c3(f,t.u_texsize),u_pixel_coord_upper:new d.c3(f,t.u_pixel_coord_upper),u_pixel_coord_lower:new d.c3(f,t.u_pixel_coord_lower),u_scale:new d.c2(f,t.u_scale),u_fade:new d.bp(f,t.u_fade),u_fill_translate:new d.c3(f,t.u_fill_translate)}),fillOutline:(f,t)=>({u_world:new d.c3(f,t.u_world),u_fill_translate:new d.c3(f,t.u_fill_translate)}),fillOutlinePattern:(f,t)=>({u_world:new d.c3(f,t.u_world),u_image:new d.b_(f,t.u_image),u_texsize:new d.c3(f,t.u_texsize),u_pixel_coord_upper:new d.c3(f,t.u_pixel_coord_upper),u_pixel_coord_lower:new d.c3(f,t.u_pixel_coord_lower),u_scale:new d.c2(f,t.u_scale),u_fade:new d.bp(f,t.u_fade),u_fill_translate:new d.c3(f,t.u_fill_translate)}),circle:(f,t)=>({u_camera_to_center_distance:new d.bp(f,t.u_camera_to_center_distance),u_scale_with_map:new d.b_(f,t.u_scale_with_map),u_pitch_with_map:new d.b_(f,t.u_pitch_with_map),u_extrude_scale:new d.c3(f,t.u_extrude_scale),u_device_pixel_ratio:new d.bp(f,t.u_device_pixel_ratio),u_globe_extrude_scale:new d.bp(f,t.u_globe_extrude_scale),u_translate:new d.c3(f,t.u_translate)}),collisionBox:(f,t)=>({u_pixel_extrude_scale:new d.c3(f,t.u_pixel_extrude_scale)}),collisionCircle:(f,t)=>({u_viewport_size:new d.c3(f,t.u_viewport_size)}),debug:(f,t)=>({u_color:new d.b$(f,t.u_color),u_overlay:new d.b_(f,t.u_overlay),u_overlay_scale:new d.bp(f,t.u_overlay_scale)}),depth:qc,clippingMask:qc,heatmap:(f,t)=>({u_extrude_scale:new d.bp(f,t.u_extrude_scale),u_intensity:new d.bp(f,t.u_intensity),u_globe_extrude_scale:new d.bp(f,t.u_globe_extrude_scale)}),heatmapTexture:(f,t)=>({u_matrix:new d.c0(f,t.u_matrix),u_world:new d.c3(f,t.u_world),u_image:new d.b_(f,t.u_image),u_color_ramp:new d.b_(f,t.u_color_ramp),u_opacity:new d.bp(f,t.u_opacity)}),hillshade:(f,t)=>({u_image:new d.b_(f,t.u_image),u_latrange:new d.c3(f,t.u_latrange),u_exaggeration:new d.bp(f,t.u_exaggeration),u_altitudes:new d.c9(f,t.u_altitudes),u_azimuths:new d.c9(f,t.u_azimuths),u_accent:new d.b$(f,t.u_accent),u_method:new d.b_(f,t.u_method),u_shadows:new d.c8(f,t.u_shadows),u_highlights:new d.c8(f,t.u_highlights)}),hillshadePrepare:(f,t)=>({u_matrix:new d.c0(f,t.u_matrix),u_image:new d.b_(f,t.u_image),u_dimension:new d.c3(f,t.u_dimension),u_zoom:new d.bp(f,t.u_zoom),u_unpack:new d.c1(f,t.u_unpack)}),colorRelief:(f,t)=>({u_image:new d.b_(f,t.u_image),u_unpack:new d.c1(f,t.u_unpack),u_dimension:new d.c3(f,t.u_dimension),u_elevation_stops:new d.b_(f,t.u_elevation_stops),u_color_stops:new d.b_(f,t.u_color_stops),u_color_ramp_size:new d.b_(f,t.u_color_ramp_size),u_opacity:new d.bp(f,t.u_opacity)}),line:(f,t)=>({u_translation:new d.c3(f,t.u_translation),u_ratio:new d.bp(f,t.u_ratio),u_device_pixel_ratio:new d.bp(f,t.u_device_pixel_ratio),u_units_to_pixels:new d.c3(f,t.u_units_to_pixels)}),lineGradient:(f,t)=>({u_translation:new d.c3(f,t.u_translation),u_ratio:new d.bp(f,t.u_ratio),u_device_pixel_ratio:new d.bp(f,t.u_device_pixel_ratio),u_units_to_pixels:new d.c3(f,t.u_units_to_pixels),u_image:new d.b_(f,t.u_image),u_image_height:new d.bp(f,t.u_image_height)}),linePattern:(f,t)=>({u_translation:new d.c3(f,t.u_translation),u_texsize:new d.c3(f,t.u_texsize),u_ratio:new d.bp(f,t.u_ratio),u_device_pixel_ratio:new d.bp(f,t.u_device_pixel_ratio),u_image:new d.b_(f,t.u_image),u_units_to_pixels:new d.c3(f,t.u_units_to_pixels),u_scale:new d.c2(f,t.u_scale),u_fade:new d.bp(f,t.u_fade)}),lineSDF:(f,t)=>({u_translation:new d.c3(f,t.u_translation),u_ratio:new d.bp(f,t.u_ratio),u_device_pixel_ratio:new d.bp(f,t.u_device_pixel_ratio),u_units_to_pixels:new d.c3(f,t.u_units_to_pixels),u_image:new d.b_(f,t.u_image),u_mix:new d.bp(f,t.u_mix),u_tileratio:new d.bp(f,t.u_tileratio),u_crossfade_from:new d.bp(f,t.u_crossfade_from),u_crossfade_to:new d.bp(f,t.u_crossfade_to),u_lineatlas_width:new d.bp(f,t.u_lineatlas_width),u_lineatlas_height:new d.bp(f,t.u_lineatlas_height)}),lineGradientSDF:(f,t)=>({u_translation:new d.c3(f,t.u_translation),u_ratio:new d.bp(f,t.u_ratio),u_device_pixel_ratio:new d.bp(f,t.u_device_pixel_ratio),u_units_to_pixels:new d.c3(f,t.u_units_to_pixels),u_image:new d.b_(f,t.u_image),u_image_height:new d.bp(f,t.u_image_height),u_tileratio:new d.bp(f,t.u_tileratio),u_crossfade_from:new d.bp(f,t.u_crossfade_from),u_crossfade_to:new d.bp(f,t.u_crossfade_to),u_image_dash:new d.b_(f,t.u_image_dash),u_mix:new d.bp(f,t.u_mix),u_lineatlas_width:new d.bp(f,t.u_lineatlas_width),u_lineatlas_height:new d.bp(f,t.u_lineatlas_height)}),raster:(f,t)=>({u_tl_parent:new d.c3(f,t.u_tl_parent),u_scale_parent:new d.bp(f,t.u_scale_parent),u_buffer_scale:new d.bp(f,t.u_buffer_scale),u_fade_t:new d.bp(f,t.u_fade_t),u_opacity:new d.bp(f,t.u_opacity),u_image0:new d.b_(f,t.u_image0),u_image1:new d.b_(f,t.u_image1),u_brightness_low:new d.bp(f,t.u_brightness_low),u_brightness_high:new d.bp(f,t.u_brightness_high),u_saturation_factor:new d.bp(f,t.u_saturation_factor),u_contrast_factor:new d.bp(f,t.u_contrast_factor),u_spin_weights:new d.c2(f,t.u_spin_weights),u_coords_top:new d.c1(f,t.u_coords_top),u_coords_bottom:new d.c1(f,t.u_coords_bottom)}),symbolIcon:(f,t)=>({u_is_size_zoom_constant:new d.b_(f,t.u_is_size_zoom_constant),u_is_size_feature_constant:new d.b_(f,t.u_is_size_feature_constant),u_size_t:new d.bp(f,t.u_size_t),u_size:new d.bp(f,t.u_size),u_camera_to_center_distance:new d.bp(f,t.u_camera_to_center_distance),u_pitch:new d.bp(f,t.u_pitch),u_rotate_symbol:new d.b_(f,t.u_rotate_symbol),u_aspect_ratio:new d.bp(f,t.u_aspect_ratio),u_fade_change:new d.bp(f,t.u_fade_change),u_label_plane_matrix:new d.c0(f,t.u_label_plane_matrix),u_coord_matrix:new d.c0(f,t.u_coord_matrix),u_is_text:new d.b_(f,t.u_is_text),u_pitch_with_map:new d.b_(f,t.u_pitch_with_map),u_is_along_line:new d.b_(f,t.u_is_along_line),u_is_variable_anchor:new d.b_(f,t.u_is_variable_anchor),u_texsize:new d.c3(f,t.u_texsize),u_texture:new d.b_(f,t.u_texture),u_translation:new d.c3(f,t.u_translation),u_pitched_scale:new d.bp(f,t.u_pitched_scale)}),symbolSDF:(f,t)=>({u_is_size_zoom_constant:new d.b_(f,t.u_is_size_zoom_constant),u_is_size_feature_constant:new d.b_(f,t.u_is_size_feature_constant),u_size_t:new d.bp(f,t.u_size_t),u_size:new d.bp(f,t.u_size),u_camera_to_center_distance:new d.bp(f,t.u_camera_to_center_distance),u_pitch:new d.bp(f,t.u_pitch),u_rotate_symbol:new d.b_(f,t.u_rotate_symbol),u_aspect_ratio:new d.bp(f,t.u_aspect_ratio),u_fade_change:new d.bp(f,t.u_fade_change),u_label_plane_matrix:new d.c0(f,t.u_label_plane_matrix),u_coord_matrix:new d.c0(f,t.u_coord_matrix),u_is_text:new d.b_(f,t.u_is_text),u_pitch_with_map:new d.b_(f,t.u_pitch_with_map),u_is_along_line:new d.b_(f,t.u_is_along_line),u_is_variable_anchor:new d.b_(f,t.u_is_variable_anchor),u_texsize:new d.c3(f,t.u_texsize),u_texture:new d.b_(f,t.u_texture),u_gamma_scale:new d.bp(f,t.u_gamma_scale),u_device_pixel_ratio:new d.bp(f,t.u_device_pixel_ratio),u_is_halo:new d.b_(f,t.u_is_halo),u_is_plain:new d.b_(f,t.u_is_plain),u_translation:new d.c3(f,t.u_translation),u_pitched_scale:new d.bp(f,t.u_pitched_scale)}),symbolTextAndIcon:(f,t)=>({u_is_size_zoom_constant:new d.b_(f,t.u_is_size_zoom_constant),u_is_size_feature_constant:new d.b_(f,t.u_is_size_feature_constant),u_size_t:new d.bp(f,t.u_size_t),u_size:new d.bp(f,t.u_size),u_camera_to_center_distance:new d.bp(f,t.u_camera_to_center_distance),u_pitch:new d.bp(f,t.u_pitch),u_rotate_symbol:new d.b_(f,t.u_rotate_symbol),u_aspect_ratio:new d.bp(f,t.u_aspect_ratio),u_fade_change:new d.bp(f,t.u_fade_change),u_label_plane_matrix:new d.c0(f,t.u_label_plane_matrix),u_coord_matrix:new d.c0(f,t.u_coord_matrix),u_is_text:new d.b_(f,t.u_is_text),u_pitch_with_map:new d.b_(f,t.u_pitch_with_map),u_is_along_line:new d.b_(f,t.u_is_along_line),u_is_variable_anchor:new d.b_(f,t.u_is_variable_anchor),u_texsize:new d.c3(f,t.u_texsize),u_texsize_icon:new d.c3(f,t.u_texsize_icon),u_texture:new d.b_(f,t.u_texture),u_texture_icon:new d.b_(f,t.u_texture_icon),u_gamma_scale:new d.bp(f,t.u_gamma_scale),u_device_pixel_ratio:new d.bp(f,t.u_device_pixel_ratio),u_is_halo:new d.b_(f,t.u_is_halo),u_translation:new d.c3(f,t.u_translation),u_pitched_scale:new d.bp(f,t.u_pitched_scale)}),background:(f,t)=>({u_opacity:new d.bp(f,t.u_opacity),u_color:new d.b$(f,t.u_color)}),backgroundPattern:(f,t)=>({u_opacity:new d.bp(f,t.u_opacity),u_image:new d.b_(f,t.u_image),u_pattern_tl_a:new d.c3(f,t.u_pattern_tl_a),u_pattern_br_a:new d.c3(f,t.u_pattern_br_a),u_pattern_tl_b:new d.c3(f,t.u_pattern_tl_b),u_pattern_br_b:new d.c3(f,t.u_pattern_br_b),u_texsize:new d.c3(f,t.u_texsize),u_mix:new d.bp(f,t.u_mix),u_pattern_size_a:new d.c3(f,t.u_pattern_size_a),u_pattern_size_b:new d.c3(f,t.u_pattern_size_b),u_scale_a:new d.bp(f,t.u_scale_a),u_scale_b:new d.bp(f,t.u_scale_b),u_pixel_coord_upper:new d.c3(f,t.u_pixel_coord_upper),u_pixel_coord_lower:new d.c3(f,t.u_pixel_coord_lower),u_tile_units_to_pixels:new d.bp(f,t.u_tile_units_to_pixels)}),terrain:(f,t)=>({u_texture:new d.b_(f,t.u_texture),u_ele_delta:new d.bp(f,t.u_ele_delta),u_fog_matrix:new d.c0(f,t.u_fog_matrix),u_fog_color:new d.b$(f,t.u_fog_color),u_fog_ground_blend:new d.bp(f,t.u_fog_ground_blend),u_fog_ground_blend_opacity:new d.bp(f,t.u_fog_ground_blend_opacity),u_horizon_color:new d.b$(f,t.u_horizon_color),u_horizon_fog_blend:new d.bp(f,t.u_horizon_fog_blend),u_is_globe_mode:new d.bp(f,t.u_is_globe_mode)}),terrainDepth:(f,t)=>({u_ele_delta:new d.bp(f,t.u_ele_delta)}),terrainCoords:(f,t)=>({u_texture:new d.b_(f,t.u_texture),u_terrain_coords_id:new d.bp(f,t.u_terrain_coords_id),u_ele_delta:new d.bp(f,t.u_ele_delta)}),projectionErrorMeasurement:(f,t)=>({u_input:new d.bp(f,t.u_input),u_output_expected:new d.bp(f,t.u_output_expected)}),atmosphere:(f,t)=>({u_sun_pos:new d.c2(f,t.u_sun_pos),u_atmosphere_blend:new d.bp(f,t.u_atmosphere_blend),u_globe_position:new d.c2(f,t.u_globe_position),u_globe_radius:new d.bp(f,t.u_globe_radius),u_inv_proj_matrix:new d.c0(f,t.u_inv_proj_matrix)}),sky:(f,t)=>({u_sky_color:new d.b$(f,t.u_sky_color),u_horizon_color:new d.b$(f,t.u_horizon_color),u_horizon:new d.c3(f,t.u_horizon),u_horizon_normal:new d.c3(f,t.u_horizon_normal),u_sky_horizon_blend:new d.bp(f,t.u_sky_horizon_blend),u_sky_blend:new d.bp(f,t.u_sky_blend)})};class Ih{constructor(t,n,l){this.context=t;const h=t.gl;this.buffer=h.createBuffer(),this.dynamicDraw=!!l,this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),h.bufferData(h.ELEMENT_ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?h.DYNAMIC_DRAW:h.STATIC_DRAW),this.dynamicDraw||n.freeBufferAfterUpload()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){const n=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),n.bufferSubData(n.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const kh={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class qu{constructor(t,n,l,h){this.length=n.length,this.attributes=l,this.itemSize=n.bytesPerElement,this.dynamicDraw=h,this.context=t;const g=t.gl;this.buffer=g.createBuffer(),t.bindVertexBuffer.set(this.buffer),g.bufferData(g.ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?g.DYNAMIC_DRAW:g.STATIC_DRAW),this.dynamicDraw||n.freeBufferAfterUpload()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){if(t.length!==this.length)throw new Error(`Length of new data is ${t.length}, which doesn't match current length of ${this.length}`);const n=this.context.gl;this.bind(),n.bufferSubData(n.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,n){for(const l of this.attributes){const h=n.attributes[l.name];h!==void 0&&t.enableVertexAttribArray(h)}}setVertexAttribPointers(t,n,l){for(const h of this.attributes){const g=n.attributes[h.name];g!==void 0&&t.vertexAttribPointer(g,h.components,t[kh[h.type]],!1,this.itemSize,h.offset+this.itemSize*(l||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class tr{constructor(t){this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(t){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class zh extends tr{getDefault(){return d.bo.transparent}set(t){const n=this.current;(t.r!==n.r||t.g!==n.g||t.b!==n.b||t.a!==n.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class Ko extends tr{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class Xs extends tr{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class Ea extends tr{getDefault(){return[!0,!0,!0,!0]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||t[3]!==n[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class Zl extends tr{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class Pa extends tr{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class Ca extends tr{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){const n=this.current;(t.func!==n.func||t.ref!==n.ref||t.mask!==n.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}}class Qn extends tr{getDefault(){const t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}}class an extends tr{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.STENCIL_TEST):n.disable(n.STENCIL_TEST),this.current=t,this.dirty=!1}}class $c extends tr{getDefault(){return[0,1]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}}class Wl extends tr{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.DEPTH_TEST):n.disable(n.DEPTH_TEST),this.current=t,this.dirty=!1}}class $u extends tr{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class Ma extends tr{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.BLEND):n.disable(n.BLEND),this.current=t,this.dirty=!1}}class Hl extends tr{getDefault(){const t=this.gl;return[t.ONE,t.ZERO]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||this.dirty)&&(this.gl.blendFunc(t[0],t[1]),this.current=t,this.dirty=!1)}}class Xl extends tr{getDefault(){return d.bo.transparent}set(t){const n=this.current;(t.r!==n.r||t.g!==n.g||t.b!==n.b||t.a!==n.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class Ys extends tr{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}}class Yl extends tr{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.CULL_FACE):n.disable(n.CULL_FACE),this.current=t,this.dirty=!1}}class Qo extends tr{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class Ia extends tr{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}class ka extends tr{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}}class Ah extends tr{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class Gc extends tr{getDefault(){const t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||t[3]!==n[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class Dt extends tr{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindFramebuffer(n.FRAMEBUFFER,t),this.current=t,this.dirty=!1}}class Gu extends tr{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindRenderbuffer(n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class Dh extends tr{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindTexture(n.TEXTURE_2D,t),this.current=t,this.dirty=!1}}class Zc extends tr{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindBuffer(n.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class cr extends tr{getDefault(){return null}set(t){const n=this.gl;n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Wc extends tr{getDefault(){return null}set(t){var n;if(t===this.current&&!this.dirty)return;const l=this.gl;Di(l)?l.bindVertexArray(t):(n=l.getExtension("OES_vertex_array_object"))===null||n===void 0||n.bindVertexArrayOES(t),this.current=t,this.dirty=!1}}class Zu extends tr{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}}class Ks extends tr{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}}class Rh extends tr{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}}class ms extends tr{constructor(t,n){super(t),this.context=t,this.parent=n}getDefault(){return null}}class za extends ms{setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class Aa extends ms{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class Jo extends ms{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}const Kl="Framebuffer is not complete";class Lh{constructor(t,n,l,h,g){this.context=t,this.width=n,this.height=l;const b=t.gl,T=this.framebuffer=b.createFramebuffer();if(this.colorAttachment=new za(t,T),h)this.depthAttachment=g?new Jo(t,T):new Aa(t,T);else if(g)throw new Error("Stencil cannot be set without depth");if(b.checkFramebufferStatus(b.FRAMEBUFFER)!==b.FRAMEBUFFER_COMPLETE)throw new Error(Kl)}destroy(){const t=this.context.gl,n=this.colorAttachment.get();if(n&&t.deleteTexture(n),this.depthAttachment){const l=this.depthAttachment.get();l&&t.deleteRenderbuffer(l)}t.deleteFramebuffer(this.framebuffer)}}class Wu{constructor(t){var n,l;if(this.gl=t,this.clearColor=new zh(this),this.clearDepth=new Ko(this),this.clearStencil=new Xs(this),this.colorMask=new Ea(this),this.depthMask=new Zl(this),this.stencilMask=new Pa(this),this.stencilFunc=new Ca(this),this.stencilOp=new Qn(this),this.stencilTest=new an(this),this.depthRange=new $c(this),this.depthTest=new Wl(this),this.depthFunc=new $u(this),this.blend=new Ma(this),this.blendFunc=new Hl(this),this.blendColor=new Xl(this),this.blendEquation=new Ys(this),this.cullFace=new Yl(this),this.cullFaceSide=new Qo(this),this.frontFace=new Ia(this),this.program=new ka(this),this.activeTexture=new Ah(this),this.viewport=new Gc(this),this.bindFramebuffer=new Dt(this),this.bindRenderbuffer=new Gu(this),this.bindTexture=new Dh(this),this.bindVertexBuffer=new Zc(this),this.bindElementBuffer=new cr(this),this.bindVertexArray=new Wc(this),this.pixelStoreUnpack=new Zu(this),this.pixelStoreUnpackPremultiplyAlpha=new Ks(this),this.pixelStoreUnpackFlipY=new Rh(this),this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE),Di(t)){this.HALF_FLOAT=t.HALF_FLOAT;const h=t.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(n=t.RGBA16F)!==null&&n!==void 0?n:h==null?void 0:h.RGBA16F_EXT,this.RGB16F=(l=t.RGB16F)!==null&&l!==void 0?l:h==null?void 0:h.RGB16F_EXT,t.getExtension("EXT_color_buffer_float")}else{t.getExtension("EXT_color_buffer_half_float"),t.getExtension("OES_texture_half_float_linear");const h=t.getExtension("OES_texture_half_float");this.HALF_FLOAT=h==null?void 0:h.HALF_FLOAT_OES}}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(t,n){return new Ih(this,t,n)}createVertexBuffer(t,n,l){return new qu(this,t,n,l)}createRenderbuffer(t,n,l){const h=this.gl,g=h.createRenderbuffer();return this.bindRenderbuffer.set(g),h.renderbufferStorage(h.RENDERBUFFER,t,n,l),this.bindRenderbuffer.set(null),g}createFramebuffer(t,n,l,h){return new Lh(this,t,n,l,h)}clear({color:t,depth:n,stencil:l}){const h=this.gl;let g=0;t&&(g|=h.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),n!==void 0&&(g|=h.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(n),this.depthMask.set(!0)),l!==void 0&&(g|=h.STENCIL_BUFFER_BIT,this.clearStencil.set(l),this.stencilMask.set(255)),h.clear(g)}setCullFace(t){t.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(t.mode),this.frontFace.set(t.frontFace))}setDepthMode(t){t.func!==this.gl.ALWAYS||t.mask?(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range)):this.depthTest.set(!1)}setStencilMode(t){t.test.func!==this.gl.ALWAYS||t.mask?(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask})):this.stencilTest.set(!1)}setColorMode(t){d.bQ(t.blendFunction,ar.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor)),this.colorMask.set(t.mask)}createVertexArray(){var t;return Di(this.gl)?this.gl.createVertexArray():(t=this.gl.getExtension("OES_vertex_array_object"))===null||t===void 0?void 0:t.createVertexArrayOES()}deleteVertexArray(t){var n;Di(this.gl)?this.gl.deleteVertexArray(t):(n=this.gl.getExtension("OES_vertex_array_object"))===null||n===void 0||n.deleteVertexArrayOES(t)}unbindVAO(){this.bindVertexArray.set(null)}}let Da;function ea(f,t,n,l,h){var g,b;const T=f.context,P=f.transform,M=T.gl,I=f.useProgram("collisionBox"),R=[];let L=0,O=0;for(const ie of l){const Q=t.getTile(ie).getBucket(n);if(!Q)continue;const X=h?Q.textCollisionBox:Q.iconCollisionBox,re=Q.collisionCircleArray;re.length>0&&(R.push({circleArray:re,circleOffset:O,coord:ie}),L+=re.length/4,O=L),X&&I.draw(T,M.LINES,It.disabled,kt.disabled,f.colorModeForRenderPass(),Vt.disabled,Ch(f.transform),(g=f.style.map.terrain)===null||g===void 0?void 0:g.getTerrainData(ie),P.getProjectionData({overscaledTileID:ie,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),n.id,X.layoutVertexBuffer,X.indexBuffer,X.segments,null,f.transform.zoom,null,null,X.collisionVertexBuffer)}if(!h||!R.length)return;const $=f.useProgram("collisionCircle"),Z=new d.ca;Z.resize(4*L),Z._trim();let Y=0;for(const ie of R)for(let Q=0;Q<ie.circleArray.length/4;Q++){const X=4*Q,re=ie.circleArray[X+0],J=ie.circleArray[X+1],pe=ie.circleArray[X+2],xe=ie.circleArray[X+3];Z.emplace(Y++,re,J,pe,xe,0),Z.emplace(Y++,re,J,pe,xe,1),Z.emplace(Y++,re,J,pe,xe,2),Z.emplace(Y++,re,J,pe,xe,3)}(!Da||Da.length<2*L)&&(Da=(function(ie){const Q=2*ie,X=new d.cc;X.resize(Q),X._trim();for(let re=0;re<Q;re++){const J=6*re;X.uint16[J+0]=4*re+0,X.uint16[J+1]=4*re+1,X.uint16[J+2]=4*re+2,X.uint16[J+3]=4*re+2,X.uint16[J+4]=4*re+3,X.uint16[J+5]=4*re+0}return X})(L));const H=T.createIndexBuffer(Da,!0),K=T.createVertexBuffer(Z,d.cb.members,!0);for(const ie of R){const Q=hs(f.transform);$.draw(T,M.TRIANGLES,It.disabled,kt.disabled,f.colorModeForRenderPass(),Vt.disabled,Q,(b=f.style.map.terrain)===null||b===void 0?void 0:b.getTerrainData(ie.coord),null,n.id,K,H,d.aV.simpleSegment(0,2*ie.circleOffset,ie.circleArray.length,ie.circleArray.length/2),null,f.transform.zoom,null,null,null)}K.destroy(),H.destroy()}const ta=d.ap(new Float32Array(16));function Ql(f,t,n,l,h,g){const{horizontalAlign:b,verticalAlign:T}=d.aP(f);return new d.P((-(b-.5)*t/h+l[0])*g,(-(T-.5)*n/h+l[1])*g)}function Hc(f,t,n,l,h,g){const b=t.tileAnchorPoint.add(new d.P(t.translation[0],t.translation[1]));if(t.pitchWithMap){let T=l.mult(g);n||(T=T.rotate(-h));const P=b.add(T);return At(P.x,P.y,t.pitchedLabelPlaneMatrix,t.getElevation).point}if(n){const T=nr(t.tileAnchorPoint.x+1,t.tileAnchorPoint.y,t).point.sub(f),P=Math.atan(T.y/T.x)+(T.x<0?Math.PI:0);return f.add(l.rotate(P))}return f.add(l)}function gs(f,t,n,l,h,g,b,T,P,M,I,R){const L=f.text.placedSymbolArray,O=f.text.dynamicLayoutVertexArray,$=f.icon.dynamicLayoutVertexArray,Z={};O.clear();for(let Y=0;Y<L.length;Y++){const H=L.get(Y),K=H.hidden||!H.crossTileID||f.allowVerticalPlacement&&!H.placedOrientation?null:l[H.crossTileID];if(K){const ie=new d.P(H.anchorX,H.anchorY),Q={getElevation:R,width:h.width,height:h.height,pitchedLabelPlaneMatrix:g,pitchWithMap:n,transform:h,tileAnchorPoint:ie,translation:M,unwrappedTileID:I},X=n?Zi(ie.x,ie.y,Q):nr(ie.x,ie.y,Q),re=kl(h.cameraToCenterDistance,X.signedDistanceFromCamera);let J=d.ay(f.textSizeData,T,H)*re/d.aJ;n&&(J*=f.tilePixelRatio/b);const{width:pe,height:xe,anchor:Te,textOffset:Re,textBoxScale:Ae}=K,rt=Ql(Te,pe,xe,Re,Ae,J),Ge=h.getPitchedTextCorrection(ie.x+M[0],ie.y+M[1],I),ke=Hc(X.point,Q,t,rt,-h.bearingInRadians,Ge),Xe=f.allowVerticalPlacement&&H.placedOrientation===d.ax.vertical?Math.PI/2:0;for(let ot=0;ot<H.numGlyphs;ot++)d.aD(O,ke,Xe);P&&H.associatedIconIndex>=0&&(Z[H.associatedIconIndex]={shiftedAnchor:ke,angle:Xe})}else Qa(H.numGlyphs,O)}if(P){$.clear();const Y=f.icon.placedSymbolArray;for(let H=0;H<Y.length;H++){const K=Y.get(H);if(K.hidden)Qa(K.numGlyphs,$);else{const ie=Z[H];if(ie)for(let Q=0;Q<K.numGlyphs;Q++)d.aD($,ie.shiftedAnchor,ie.angle);else Qa(K.numGlyphs,$)}}f.icon.dynamicLayoutVertexBuffer.updateData($)}f.text.dynamicLayoutVertexBuffer.updateData(O)}function Xc(f,t,n){return n.iconsInText&&t?"symbolTextAndIcon":f?"symbolSDF":"symbolIcon"}function Yc(f,t,n,l,h,g,b,T,P,M,I,R,L){var O,$;const Z=f.context,Y=Z.gl,H=f.transform,K=T==="map",ie=P==="map",Q=T!=="viewport"&&n.layout.get("symbol-placement")!=="point",X=K&&!ie&&!Q,re=!n.layout.get("symbol-sort-key").isConstant();let J=!1;const pe=f.getDepthModeForSublayer(0,It.ReadOnly),xe=n._unevaluatedLayout.hasValue("text-variable-anchor")||n._unevaluatedLayout.hasValue("text-variable-anchor-offset"),Te=[],Re=H.getCircleRadiusCorrection();for(const Ge of l){const ke=t.getTile(Ge),Xe=ke.getBucket(n);if(!Xe)continue;const ot=h?Xe.text:Xe.icon;if(!(ot!=null&&ot.segments.get().length)||!ot.hasVisibleVertices)continue;const Jt=ot.programConfigurations.get(n.id),Ir=h||Xe.sdfIcons,dr=h?Xe.textSizeData:Xe.iconSizeData,Xr=ie||H.pitch!==0,ni=f.useProgram(Xc(Ir,h,Xe),Jt),Tr=d.aw(dr,H.zoom),kr=(O=f.style.map.terrain)===null||O===void 0?void 0:O.getTerrainData(Ge);let fi,mi,li,Pi,Ro=[0,0],En=null;if(h)mi=ke.glyphAtlasTexture,li=Y.LINEAR,fi=ke.glyphAtlasTexture.size,Xe.iconsInText&&(Ro=ke.imageAtlasTexture.size,En=ke.imageAtlasTexture,Pi=Xr||f.options.rotating||f.options.zooming||dr.kind==="composite"||dr.kind==="camera"?Y.LINEAR:Y.NEAREST);else{const zr=n.layout.get("icon-size").constantOr(0)!==1||Xe.iconsNeedLinear;mi=ke.imageAtlasTexture,li=Ir||f.options.rotating||f.options.zooming||zr||Xr?Y.LINEAR:Y.NEAREST,fi=ke.imageAtlasTexture.size}const Lo=d.aK(ke,1,f.transform.zoom),gi=nn(K,f.transform,Lo),ha=Il(ie,K,f.transform,Lo),da=d.aL(H,ke,g,b),lu=H.getProjectionData({overscaledTileID:Ge,applyGlobeMatrix:!L,applyTerrainMatrix:!0}),ao=xe&&Xe.hasTextData(),so=n.layout.get("icon-text-fit")!=="none"&&ao&&Xe.hasIconData();if(Q){const zr=d.O();Mt(zr,gi);const qa=f.style.map.terrain?(Fo,cu)=>f.style.map.terrain.getElevation(Ge,Fo,cu):null,uu=n.layout.get("text-rotation-alignment")==="map";Dr(Xe,f,h,gi,zr,ie,M,uu,Ge.toUnwrapped(),H.width,H.height,da,qa)}const hn=h&&xe||so,jn=Q||hn?ta:ie?gi:f.transform.clipSpaceToPixelsMatrix,Xt=Ir&&n.paint.get(h?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let Ut;Ut=Ir?Xe.iconsInText?Uc(dr.kind,Tr,X,ie,Q,hn,f,jn,ha,da,fi,Ro,Re):Vc(dr.kind,Tr,X,ie,Q,hn,f,jn,ha,da,h,fi,Xt,Re):Uu(dr.kind,Tr,X,ie,Q,hn,f,jn,ha,da,h,fi,Re);const Yr={program:ni,buffers:ot,uniformValues:Ut,projectionData:lu,atlasTexture:mi,atlasTextureIcon:En,atlasInterpolation:li,atlasInterpolationIcon:Pi,isSDF:Ir,hasHalo:Xt};if(re&&Xe.canOverlap){J=!0;const zr=ot.segments.get();for(const qa of zr)Te.push({segments:new d.aV([qa]),sortKey:qa.sortKey,state:Yr,terrainData:kr})}else Te.push({segments:ot.segments,sortKey:0,state:Yr,terrainData:kr})}J&&Te.sort(((Ge,ke)=>Ge.sortKey-ke.sortKey));const Ae=($=n.paint.get(h?"text-halo-width":"icon-halo-width").constantOr(null))!==null&&$!==void 0?$:1/0,rt=n.layout.get("text-letter-spacing").constantOr(0)*d.aJ<0||Ae>1;for(const Ge of Te){const ke=Ge.state;Z.activeTexture.set(Y.TEXTURE0),ke.atlasTexture.bind(ke.atlasInterpolation,Y.CLAMP_TO_EDGE),ke.atlasTextureIcon&&(Z.activeTexture.set(Y.TEXTURE1),ke.atlasTextureIcon&&ke.atlasTextureIcon.bind(ke.atlasInterpolationIcon,Y.CLAMP_TO_EDGE));const Xe=ke.isSDF&&ke.hasHalo;if(Xe){const ot=ke.uniformValues;ot.u_is_halo=1,rt&&(ot.u_is_plain=0,Qs(ke.buffers,Ge.segments,n,f,ke.program,pe,I,R,ot,ke.projectionData,Ge.terrainData),ot.u_is_halo=0,ot.u_is_plain=1)}Qs(ke.buffers,Ge.segments,n,f,ke.program,pe,I,R,ke.uniformValues,ke.projectionData,Ge.terrainData),Xe&&!rt&&(ke.uniformValues.u_is_halo=0)}}function Qs(f,t,n,l,h,g,b,T,P,M,I){const R=l.context;h.draw(R,R.gl.TRIANGLES,g,b,T,Vt.backCCW,P,I,M,n.id,f.layoutVertexBuffer,f.indexBuffer,t,n.paint,l.transform.zoom,f.programConfigurations.get(n.id),f.dynamicLayoutVertexBuffer,f.opacityVertexBuffer)}function Kc(f,t,n,l,h){const g=f.context,b=g.gl,T=kt.disabled,P=new ar([b.ONE,b.ONE],d.bo.transparent,[!0,!0,!0,!0]),M=t.getBucket(n);if(!M)return;const I=l.key;let R=n.heatmapFbos.get(I);R||(R=Jl(g,t.tileSize,t.tileSize),n.heatmapFbos.set(I,R)),g.bindFramebuffer.set(R.framebuffer),g.viewport.set([0,0,t.tileSize,t.tileSize]),g.clear({color:d.bo.transparent});const L=M.programConfigurations.get(n.id),O=f.useProgram("heatmap",L,!h),$=f.transform.getProjectionData({overscaledTileID:t.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),Z=f.style.map.terrain.getTerrainData(l);O.draw(g,b.TRIANGLES,It.disabled,T,P,Vt.disabled,Nu(t,f.transform.zoom,n.paint.get("heatmap-intensity"),1),Z,$,n.id,M.layoutVertexBuffer,M.indexBuffer,M.segments,n.paint,f.transform.zoom,L)}function Fh(f,t,n,l,h){const g=f.context,b=g.gl,T=f.transform;g.setColorMode(f.colorModeForRenderPass());const P=Bn(g,t),M=n.key,I=t.heatmapFbos.get(M);if(!I)return;g.activeTexture.set(b.TEXTURE0),b.bindTexture(b.TEXTURE_2D,I.colorAttachment.get()),g.activeTexture.set(b.TEXTURE1),P.bind(b.LINEAR,b.CLAMP_TO_EDGE);const R=T.getProjectionData({overscaledTileID:n,applyTerrainMatrix:h,applyGlobeMatrix:!l});f.useProgram("heatmapTexture").draw(g,b.TRIANGLES,It.disabled,kt.disabled,f.colorModeForRenderPass(),Vt.disabled,ds(f,t,0,1),null,R,t.id,f.rasterBoundsBuffer,f.quadTriangleIndexBuffer,f.rasterBoundsSegments,t.paint,T.zoom),I.destroy(),t.heatmapFbos.delete(M)}function Jl(f,t,n){var l,h;const g=f.gl,b=g.createTexture();g.bindTexture(g.TEXTURE_2D,b),g.texParameteri(g.TEXTURE_2D,g.TEXTURE_WRAP_S,g.CLAMP_TO_EDGE),g.texParameteri(g.TEXTURE_2D,g.TEXTURE_WRAP_T,g.CLAMP_TO_EDGE),g.texParameteri(g.TEXTURE_2D,g.TEXTURE_MIN_FILTER,g.LINEAR),g.texParameteri(g.TEXTURE_2D,g.TEXTURE_MAG_FILTER,g.LINEAR);const T=(l=f.HALF_FLOAT)!==null&&l!==void 0?l:g.UNSIGNED_BYTE,P=(h=f.RGBA16F)!==null&&h!==void 0?h:g.RGBA;g.texImage2D(g.TEXTURE_2D,0,P,t,n,0,g.RGBA,T,null);const M=f.createFramebuffer(t,n,!1,!1);return M.colorAttachment.set(b),M}function Bn(f,t){return t.colorRampTexture||(t.colorRampTexture=new d.T(f,t.colorRamp,f.gl.RGBA)),t.colorRampTexture}function eu(f,t,n,l,h,g,b,T){let P=256;if(h.stepInterpolant){const M=t.getSource().maxzoom,I=b.canonical.z===M?Math.ceil(1<<f.transform.maxZoom-b.canonical.z):1;P=d.al(d.ce(g.maxLineLength/d.a6*1024*I),256,n.maxTextureSize)}return T.gradient=d.cf({expression:h.gradientExpression(),evaluationKey:"lineProgress",resolution:P,image:T.gradient||void 0,clips:g.lineClipsArray}),T.texture?T.texture.update(T.gradient):T.texture=new d.T(n,T.gradient,l.RGBA),T.version=h.gradientVersion,T.texture}function Js(f,t,n,l,h){f.activeTexture.set(t.TEXTURE0),n.imageAtlasTexture.bind(t.LINEAR,t.CLAMP_TO_EDGE),l.updatePaintBuffers(h)}function Jn(f,t,n,l,h,g){(h||f.lineAtlas.dirty)&&(t.activeTexture.set(n.TEXTURE0),f.lineAtlas.bind(t)),l.updatePaintBuffers(g)}function br(f,t,n,l,h,g,b){const T=g.gradients[h.id];let P=T.texture;h.gradientVersion!==T.version&&(P=eu(f,t,n,l,h,g,b,T)),n.activeTexture.set(l.TEXTURE0),P.bind(h.stepInterpolant?l.NEAREST:l.LINEAR,l.CLAMP_TO_EDGE)}function Hi(f,t,n,l,h,g,b,T,P){const M=g.gradients[h.id];let I=M.texture;h.gradientVersion!==M.version&&(I=eu(f,t,n,l,h,g,b,M)),n.activeTexture.set(l.TEXTURE0),I.bind(h.stepInterpolant?l.NEAREST:l.LINEAR,l.CLAMP_TO_EDGE),n.activeTexture.set(l.TEXTURE1),f.lineAtlas.bind(n),T.updatePaintBuffers(P)}function Ri(f,t,n,l,h){if(!n||!(l!=null&&l.imageAtlas))return;const g=l.imageAtlas.patternPositions;let b=g[n.to.toString()],T=g[n.from.toString()];if(!b&&T&&(b=T),!T&&b&&(T=b),!b||!T){const P=h.getPaintProperty(t);b=g[P],T=g[P]}b&&T&&f.setConstantPatternPositions(b,T)}function Hu(f,t,n,l,h,g,b,T){var P;const M=f.context.gl,I="fill-pattern",R=n.paint.get(I),L=R==null?void 0:R.constantOr(1),O=n.getCrossfadeParameters();let $,Z,Y,H,K;const ie=f.transform,Q=n.paint.get("fill-translate"),X=n.paint.get("fill-translate-anchor");b?(Z=L&&!n.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",$=M.LINES):(Z=L?"fillPattern":"fill",$=M.TRIANGLES);const re=R.constantOr(null);for(const J of l){const pe=t.getTile(J);if(L&&!pe.patternsLoaded())continue;const xe=pe.getBucket(n);if(!xe)continue;const Te=xe.programConfigurations.get(n.id),Re=f.useProgram(Z,Te),Ae=(P=f.style.map.terrain)===null||P===void 0?void 0:P.getTerrainData(J);L&&(f.context.activeTexture.set(M.TEXTURE0),pe.imageAtlasTexture.bind(M.LINEAR,M.CLAMP_TO_EDGE),Te.updatePaintBuffers(O)),Ri(Te,I,re,pe,n);const rt=ie.getProjectionData({overscaledTileID:J,applyGlobeMatrix:!T,applyTerrainMatrix:!0}),Ge=d.aL(ie,pe,Q,X);if(b){H=xe.indexBuffer2,K=xe.segments2;const Xe=[M.drawingBufferWidth,M.drawingBufferHeight];Y=Z==="fillOutlinePattern"&&L?Lc(f,O,pe,Xe,Ge):Rc(Xe,Ge)}else H=xe.indexBuffer,K=xe.segments,Y=L?Ul(f,O,pe,Ge):{u_fill_translate:Ge};const ke=f.stencilModeForClipping(J);Re.draw(f.context,$,h,ke,g,Vt.backCCW,Y,Ae,rt,n.id,xe.layoutVertexBuffer,H,K,n.paint,f.transform.zoom,Te)}}function el(f,t,n,l,h,g,b,T){var P;const M=f.context,I=M.gl,R="fill-extrusion-pattern",L=n.paint.get(R),O=L.constantOr(1),$=n.getCrossfadeParameters(),Z=n.paint.get("fill-extrusion-opacity"),Y=L.constantOr(null),H=f.transform;for(const K of l){const ie=t.getTile(K),Q=ie.getBucket(n);if(!Q)continue;const X=(P=f.style.map.terrain)===null||P===void 0?void 0:P.getTerrainData(K),re=Q.programConfigurations.get(n.id),J=f.useProgram(O?"fillExtrusionPattern":"fillExtrusion",re);O&&(f.context.activeTexture.set(I.TEXTURE0),ie.imageAtlasTexture.bind(I.LINEAR,I.CLAMP_TO_EDGE),re.updatePaintBuffers($));const pe=H.getProjectionData({overscaledTileID:K,applyGlobeMatrix:!T,applyTerrainMatrix:!0});Ri(re,R,Y,ie,n);const xe=d.aL(H,ie,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),Te=n.paint.get("fill-extrusion-vertical-gradient"),Re=O?Dc(f,Te,Z,xe,K,$,ie):Ac(f,Te,Z,xe);J.draw(M,M.gl.TRIANGLES,h,g,b,Vt.backCCW,Re,X,pe,n.id,Q.layoutVertexBuffer,Q.indexBuffer,Q.segments,n.paint,f.transform.zoom,re,f.style.map.terrain&&Q.centroidVertexBuffer)}}function Co(f,t,n,l,h,g,b,T,P){var M;const I=f.style.projection,R=f.context,L=f.transform,O=R.gl,$=[`#define NUM_ILLUMINATION_SOURCES ${n.paint.get("hillshade-highlight-color").values.length}`],Z=f.useProgram("hillshade",null,!1,$),Y=!f.options.moving;for(const H of l){const K=t.getTile(H),ie=K.fbo;if(!ie)continue;const Q=I.getMeshFromTileID(R,H.canonical,T,!0,"raster"),X=(M=f.style.map.terrain)===null||M===void 0?void 0:M.getTerrainData(H);R.activeTexture.set(O.TEXTURE0),O.bindTexture(O.TEXTURE_2D,ie.colorAttachment.get());const re=L.getProjectionData({overscaledTileID:H,aligned:Y,applyGlobeMatrix:!P,applyTerrainMatrix:!0});Z.draw(R,O.TRIANGLES,g,h[H.overscaledZ],b,Vt.backCCW,ql(f,K,n),X,re,n.id,Q.vertexBuffer,Q.indexBuffer,Q.segments)}}let On=0;function Mo(f,t,n,l,h,g,b,T,P){var M;const I=f.style.projection,R=f.context,L=f.transform,O=R.gl,$=f.useProgram("colorRelief"),Z=!f.options.moving,Y=n.paint.get("resampling")==="nearest"?O.NEAREST:O.LINEAR;let H=!0,K=0;for(const ie of l){const Q=t.getTile(ie),X=Q.dem;if(H){On||(On=O.getParameter(O.MAX_TEXTURE_SIZE));const Re=On,{elevationTexture:Ae,colorTexture:rt}=n.getColorRampTextures(R,Re,X.getUnpackVector());R.activeTexture.set(O.TEXTURE1),Ae.bind(O.NEAREST,O.CLAMP_TO_EDGE),R.activeTexture.set(O.TEXTURE4),rt.bind(O.LINEAR,O.CLAMP_TO_EDGE),H=!1,K=Ae.size[0]}if(!(X!=null&&X.data))continue;const re=X.stride,J=X.getPixels();if(R.activeTexture.set(O.TEXTURE0),R.pixelStoreUnpackPremultiplyAlpha.set(!1),Q.demTexture||(Q.demTexture=f.getTileTexture(re)),Q.demTexture){const Re=Q.demTexture;Re.update(J,{premultiply:!1}),Re.bind(Y,O.CLAMP_TO_EDGE)}else Q.demTexture=new d.T(R,J,O.RGBA,{premultiply:!1}),Q.demTexture.bind(Y,O.CLAMP_TO_EDGE);const pe=I.getMeshFromTileID(R,ie.canonical,T,!0,"raster"),xe=(M=f.style.map.terrain)===null||M===void 0?void 0:M.getTerrainData(ie),Te=L.getProjectionData({overscaledTileID:ie,aligned:Z,applyGlobeMatrix:!P,applyTerrainMatrix:!0});$.draw(R,O.TRIANGLES,g,h[ie.overscaledZ],b,Vt.backCCW,ju(n,Q.dem,K),xe,Te,n.id,pe.vertexBuffer,pe.indexBuffer,pe.segments)}}const Io=[new d.P(0,0),new d.P(d.a6,0),new d.P(d.a6,d.a6),new d.P(0,d.a6)];function Ra(f,t,n,l,h,g,b,T,P=!1,M=!1){var I;const R=l[l.length-1].overscaledZ,L=f.context,O=L.gl,$=f.useProgram("raster"),Z=f.transform,Y=f.style.projection,H=f.colorModeForRenderPass(),K=!f.options.moving,ie=n.paint.get("raster-opacity"),Q=n.paint.get("resampling")==="nearest"||n.paint.get("raster-resampling")==="nearest"?O.NEAREST:O.LINEAR,X=n.paint.get("raster-fade-duration"),re=!!f.style.map.terrain;for(const J of l){const pe=f.getDepthModeForSublayer(J.overscaledZ-R,ie===1?It.ReadWrite:It.ReadOnly,O.LESS),xe=t.getTile(J);L.activeTexture.set(O.TEXTURE0),xe.texture.bind(Q,O.CLAMP_TO_EDGE,O.LINEAR_MIPMAP_NEAREST),L.activeTexture.set(O.TEXTURE1);const{parentTile:Te,parentScaleBy:Re,parentTopLeft:Ae,fadeValues:rt}=_s(xe,t,X,re);xe.fadeOpacity=rt.tileOpacity,Te?(Te.fadeOpacity=rt.parentTileOpacity,Te.texture.bind(Q,O.CLAMP_TO_EDGE,O.LINEAR_MIPMAP_NEAREST)):xe.texture.bind(Q,O.CLAMP_TO_EDGE,O.LINEAR_MIPMAP_NEAREST),xe.texture.useMipmap&&L.extTextureFilterAnisotropic&&f.transform.pitch>f.options.anisotropicFilterPitch&&O.texParameterf(O.TEXTURE_2D,L.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,L.extTextureFilterAnisotropicMax);const Ge=(I=f.style.map.terrain)===null||I===void 0?void 0:I.getTerrainData(J),ke=Z.getProjectionData({overscaledTileID:J,aligned:K,applyGlobeMatrix:!M,applyTerrainMatrix:!0}),Xe=Nc(Ae,Re,rt.fadeMix,n,T),ot=Y.getMeshFromTileID(L,J.canonical,g,b,"raster");$.draw(L,O.TRIANGLES,pe,h?h[J.overscaledZ]:kt.disabled,H,P?Vt.frontCCW:Vt.backCCW,Xe,Ge,ke,n.id,ot.vertexBuffer,ot.indexBuffer,ot.segments)}}function _s(f,t,n,l){const h={parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:{tileOpacity:1,parentTileOpacity:1,fadeMix:{opacity:1,mix:0}}};if(n===0||l)return h;if(f.fadingParentID){const g=t.getLoadedTile(f.fadingParentID);if(!g)return h;const b=Math.pow(2,g.tileID.overscaledZ-f.tileID.overscaledZ),T=[f.tileID.canonical.x*b%1,f.tileID.canonical.y*b%1],P=(function(M,I,R){const L=st(),O=(L-I.timeAdded)/R,$=M.fadingDirection===Dn.Incoming,Z=d.al((L-M.timeAdded)/R,0,1),Y=d.al(1-O,0,1),H=$?Z:Y;return{tileOpacity:H,parentTileOpacity:$?Y:Z,fadeMix:{opacity:1,mix:1-H}}})(f,g,n);return{parentTile:g,parentScaleBy:b,parentTopLeft:T,fadeValues:P}}if(f.selfFading){const g=(function(b,T){const P=(st()-b.timeAdded)/T,M=d.al(P,0,1);return{tileOpacity:M,fadeMix:{opacity:M,mix:0}}})(f,n);return{parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:g}}return h}const ra=new d.bo(1,0,0,1),wr=new d.bo(0,1,0,1),yr=new d.bo(0,0,1,1),ia=new d.bo(1,0,1,1),jr=new d.bo(0,1,1,1);function Li(f,t,n,l){ko(f,0,t+n/2,f.transform.width,n,l)}function na(f,t,n,l){ko(f,t-n/2,0,n,f.transform.height,l)}function ko(f,t,n,l,h,g){const b=f.context,T=b.gl;T.enable(T.SCISSOR_TEST),T.scissor(t*f.pixelRatio,n*f.pixelRatio,l*f.pixelRatio,h*f.pixelRatio),b.clear({color:g}),T.disable(T.SCISSOR_TEST)}function Xi(f,t,n){var l;const h=f.context,g=h.gl,b=f.useProgram("debug"),T=It.disabled,P=kt.disabled,M=f.colorModeForRenderPass(),I="$debug",R=(l=f.style.map.terrain)===null||l===void 0?void 0:l.getTerrainData(n);h.activeTexture.set(g.TEXTURE0);const L=t.getTileByID(n.key).latestRawTileData,O=Math.floor(((L==null?void 0:L.byteLength)||0)/1024),$=t.getTile(n).tileSize,Z=512/Math.min($,512)*(n.overscaledZ/f.transform.zoom)*.5;let Y=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(Y+=` => ${n.overscaledZ}`),(function(K,ie){K.initDebugOverlayCanvas();const Q=K.debugOverlayCanvas,X=K.context.gl,re=K.debugOverlayCanvas.getContext("2d");re.clearRect(0,0,Q.width,Q.height),re.shadowColor="white",re.shadowBlur=2,re.lineWidth=1.5,re.strokeStyle="white",re.textBaseline="top",re.font="bold 36px Open Sans, sans-serif",re.fillText(ie,5,5),re.strokeText(ie,5,5),K.debugOverlayTexture.update(Q),K.debugOverlayTexture.bind(X.LINEAR,X.CLAMP_TO_EDGE)})(f,`${Y} ${O}kB`);const H=f.transform.getProjectionData({overscaledTileID:n,applyGlobeMatrix:!0,applyTerrainMatrix:!0});b.draw(h,g.TRIANGLES,T,P,ar.alphaBlended,Vt.disabled,Fc(d.bo.transparent,Z),null,H,I,f.debugBuffer,f.quadTriangleIndexBuffer,f.debugSegments),b.draw(h,g.LINE_STRIP,T,P,M,Vt.disabled,Fc(d.bo.red),R,H,I,f.debugBuffer,f.tileBorderIndexBuffer,f.debugSegments)}function tl(f,t,n,l){const{isRenderingGlobe:h}=l,g=f.context,b=g.gl,T=f.transform,P=f.colorModeForRenderPass(),M=f.getDepthModeFor3D(),I=f.useProgram("terrain");g.bindFramebuffer.set(null),g.viewport.set([0,0,f.width,f.height]);for(const R of n){const L=t.getTerrainMesh(R.tileID),O=f.renderToTexture.getTexture(R),$=t.getTerrainData(R.tileID);g.activeTexture.set(b.TEXTURE0),b.bindTexture(b.TEXTURE_2D,O.texture);const Z=t.getMeshFrameDelta(T.zoom),Y=T.calculateFogMatrix(R.tileID.toUnwrapped()),H=Ou(Z,Y,f.style.sky,T.pitch,h),K=T.getProjectionData({overscaledTileID:R.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});I.draw(g,b.TRIANGLES,M,kt.disabled,P,Vt.backCCW,H,$,K,"terrain",L.vertexBuffer,L.indexBuffer,L.segments)}}function Xu(f,t){if(!t.mesh){const n=new d.aU;n.emplaceBack(-1,-1),n.emplaceBack(1,-1),n.emplaceBack(1,1),n.emplaceBack(-1,1);const l=new d.aW;l.emplaceBack(0,1,2),l.emplaceBack(0,2,3),t.mesh=new fr(f.createVertexBuffer(n,Xo.members),f.createIndexBuffer(l),d.aV.simpleSegment(0,0,n.length,l.length))}return t.mesh}const Qc={symbol:function(f,t,n,l,h,g){if(f.renderPass!=="translucent")return;const{isRenderingToTexture:b}=g,T=kt.disabled,P=f.colorModeForRenderPass();(n._unevaluatedLayout.hasValue("text-variable-anchor")||n._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&(function(M,I,R,L,O,$,Z,Y,H){var K;const ie=I.transform,Q=I.style.map.terrain,X=O==="map",re=$==="map";for(const J of M){const pe=L.getTile(J),xe=pe.getBucket(R);if(!(!((K=xe==null?void 0:xe.text)===null||K===void 0)&&K.segments.get().length))continue;const Te=d.aw(xe.textSizeData,ie.zoom),Re=d.aK(pe,1,I.transform.zoom),Ae=nn(X,I.transform,Re),rt=R.layout.get("icon-text-fit")!=="none"&&xe.hasIconData();if(Te){const Ge=Math.pow(2,ie.zoom-pe.tileID.overscaledZ),ke=Q?(Xe,ot)=>Q.getElevation(J,Xe,ot):null;gs(xe,X,re,H,ie,Ae,Ge,Te,rt,d.aL(ie,pe,Z,Y),J.toUnwrapped(),ke)}}})(l,f,n,t,n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),h),n.paint.get("icon-opacity").constantOr(1)!==0&&Yc(f,t,n,l,!1,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),n.layout.get("icon-rotation-alignment"),n.layout.get("icon-pitch-alignment"),n.layout.get("icon-keep-upright"),T,P,b),n.paint.get("text-opacity").constantOr(1)!==0&&Yc(f,t,n,l,!0,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),n.layout.get("text-keep-upright"),T,P,b),t.map.showCollisionBoxes&&(ea(f,t,n,l,!0),ea(f,t,n,l,!1))},circle:function(f,t,n,l,h){var g;if(f.renderPass!=="translucent")return;const{isRenderingToTexture:b}=h,T=n.paint.get("circle-opacity"),P=n.paint.get("circle-stroke-width"),M=n.paint.get("circle-stroke-opacity"),I=!n.layout.get("circle-sort-key").isConstant();if(T.constantOr(1)===0&&(P.constantOr(1)===0||M.constantOr(1)===0))return;const R=f.context,L=R.gl,O=f.transform,$=f.getDepthModeForSublayer(0,It.ReadOnly),Z=kt.disabled,Y=f.colorModeForRenderPass(),H=[],K=O.getCircleRadiusCorrection();for(const ie of l){const Q=t.getTile(ie),X=Q.getBucket(n);if(!X)continue;const re=n.paint.get("circle-translate"),J=n.paint.get("circle-translate-anchor"),pe=d.aL(O,Q,re,J),xe=X.programConfigurations.get(n.id),Te=f.useProgram("circle",xe),Re=X.layoutVertexBuffer,Ae=X.indexBuffer,rt=(g=f.style.map.terrain)===null||g===void 0?void 0:g.getTerrainData(ie),Ge={programConfiguration:xe,program:Te,layoutVertexBuffer:Re,indexBuffer:Ae,uniformValues:cs(f,Q,n,pe,K),terrainData:rt,projectionData:O.getProjectionData({overscaledTileID:ie,applyGlobeMatrix:!b,applyTerrainMatrix:!0})};if(I){const ke=X.segments.get();for(const Xe of ke)H.push({segments:new d.aV([Xe]),sortKey:Xe.sortKey,state:Ge})}else H.push({segments:X.segments,sortKey:0,state:Ge})}I&&H.sort(((ie,Q)=>ie.sortKey-Q.sortKey));for(const ie of H){const{programConfiguration:Q,program:X,layoutVertexBuffer:re,indexBuffer:J,uniformValues:pe,terrainData:xe,projectionData:Te}=ie.state;X.draw(R,L.TRIANGLES,$,Z,Y,Vt.backCCW,pe,xe,Te,n.id,re,J,ie.segments,n.paint,f.transform.zoom,Q)}},heatmap:function(f,t,n,l,h){if(n.paint.get("heatmap-opacity")===0)return;const g=f.context,{isRenderingToTexture:b,isRenderingGlobe:T}=h;if(f.style.map.terrain){for(const P of l){const M=t.getTile(P);t.hasRenderableParent(P)||(f.renderPass==="offscreen"?Kc(f,M,n,P,T):f.renderPass==="translucent"&&Fh(f,n,P,b,T))}g.viewport.set([0,0,f.width,f.height])}else f.renderPass==="offscreen"?(function(P,M,I,R){const L=P.context,O=L.gl,$=P.transform,Z=kt.disabled,Y=new ar([O.ONE,O.ONE],d.bo.transparent,[!0,!0,!0,!0]);(function(H,K,ie){const Q=H.gl;H.activeTexture.set(Q.TEXTURE1),H.viewport.set([0,0,K.width/4,K.height/4]);let X=ie.heatmapFbos.get(d.cd);X?(Q.bindTexture(Q.TEXTURE_2D,X.colorAttachment.get()),H.bindFramebuffer.set(X.framebuffer)):(X=Jl(H,K.width/4,K.height/4),ie.heatmapFbos.set(d.cd,X))})(L,P,I),L.clear({color:d.bo.transparent});for(const H of R){if(M.hasRenderableParent(H))continue;const K=M.getTile(H),ie=K.getBucket(I);if(!ie)continue;const Q=ie.programConfigurations.get(I.id),X=P.useProgram("heatmap",Q),re=$.getProjectionData({overscaledTileID:H,applyGlobeMatrix:!0,applyTerrainMatrix:!1}),J=$.getCircleRadiusCorrection();X.draw(L,O.TRIANGLES,It.disabled,Z,Y,Vt.backCCW,Nu(K,$.zoom,I.paint.get("heatmap-intensity"),J),null,re,I.id,ie.layoutVertexBuffer,ie.indexBuffer,ie.segments,I.paint,$.zoom,Q)}L.viewport.set([0,0,P.width,P.height])})(f,t,n,l):f.renderPass==="translucent"&&(function(P,M){const I=P.context,R=I.gl;I.setColorMode(P.colorModeForRenderPass());const L=M.heatmapFbos.get(d.cd);L&&(I.activeTexture.set(R.TEXTURE0),R.bindTexture(R.TEXTURE_2D,L.colorAttachment.get()),I.activeTexture.set(R.TEXTURE1),Bn(I,M).bind(R.LINEAR,R.CLAMP_TO_EDGE),P.useProgram("heatmapTexture").draw(I,R.TRIANGLES,It.disabled,kt.disabled,P.colorModeForRenderPass(),Vt.disabled,ds(P,M,0,1),null,null,M.id,P.viewportBuffer,P.quadTriangleIndexBuffer,P.viewportSegments,M.paint,P.transform.zoom))})(f,n)},line:function(f,t,n,l,h){var g;if(f.renderPass!=="translucent")return;const{isRenderingToTexture:b}=h,T=n.paint.get("line-opacity"),P=n.paint.get("line-width");if(T.constantOr(1)===0||P.constantOr(1)===0)return;const M=f.getDepthModeForSublayer(0,It.ReadOnly),I=f.colorModeForRenderPass(),R=n.paint.get("line-dasharray"),L=R.constantOr(1),O=n.paint.get("line-pattern"),$=O.constantOr(1),Z=n.paint.get("line-gradient"),Y=n.getCrossfadeParameters();let H;H=$?"linePattern":L&&Z?"lineGradientSDF":L?"lineSDF":Z?"lineGradient":"line";const K=f.context,ie=K.gl,Q=f.transform;let X=!0;for(const re of l){const J=t.getTile(re);if($&&!J.patternsLoaded())continue;const pe=J.getBucket(n);if(!pe)continue;const xe=pe.programConfigurations.get(n.id),Te=f.context.program.get(),Re=f.useProgram(H,xe),Ae=X||Re.program!==Te,rt=(g=f.style.map.terrain)===null||g===void 0?void 0:g.getTerrainData(re),Ge=O.constantOr(null),ke=R==null?void 0:R.constantOr(null);if(Ge&&J.imageAtlas){const dr=J.imageAtlas,Xr=dr.patternPositions[Ge.to.toString()],ni=dr.patternPositions[Ge.from.toString()];Xr&&ni&&xe.setConstantPatternPositions(Xr,ni)}else if(ke){const dr=n.layout.get("line-cap").constantOr(null)==="round",Xr=f.lineAtlas.getDash(ke.to,dr),ni=f.lineAtlas.getDash(ke.from,dr);xe.setConstantDashPositions(Xr,ni)}const Xe=Q.getProjectionData({overscaledTileID:re,applyGlobeMatrix:!b,applyTerrainMatrix:!0}),ot=Q.getPixelScale();let Jt;$?(Jt=Vu(f,J,n,ot,Y),Js(K,ie,J,xe,Y)):L&&Z?(Jt=Oc(f,J,n,ot,Y,pe.lineClipsArray.length),Hi(f,t,K,ie,n,pe,re,xe,Y)):L?(Jt=Gl(f,J,n,ot,Y),Jn(f,K,ie,xe,Ae,Y)):Z?(Jt=Bc(f,J,n,ot,pe.lineClipsArray.length),br(f,t,K,ie,n,pe,re)):Jt=$l(f,J,n,ot);const Ir=f.stencilModeForClipping(re);Re.draw(K,ie.TRIANGLES,M,Ir,I,Vt.disabled,Jt,rt,Xe,n.id,pe.layoutVertexBuffer,pe.indexBuffer,pe.segments,n.paint,f.transform.zoom,xe,pe.layoutVertexBuffer2),X=!1}},fill:function(f,t,n,l,h){const g=n.paint.get("fill-color"),b=n.paint.get("fill-opacity");if(b.constantOr(1)===0)return;const{isRenderingToTexture:T}=h,P=f.colorModeForRenderPass(),M=n.paint.get("fill-pattern"),I=f.opaquePassEnabledForLayer()&&!M.constantOr(1)&&g.constantOr(d.bo.transparent).a===1&&b.constantOr(0)===1?"opaque":"translucent";if(f.renderPass===I){const R=f.getDepthModeForSublayer(1,f.renderPass==="opaque"?It.ReadWrite:It.ReadOnly);Hu(f,t,n,l,R,P,!1,T)}if(f.renderPass==="translucent"&&n.paint.get("fill-antialias")){const R=f.getDepthModeForSublayer(n.getPaintProperty("fill-outline-color")?2:0,It.ReadOnly);Hu(f,t,n,l,R,P,!0,T)}},fillExtrusion:function(f,t,n,l,h){const g=n.paint.get("fill-extrusion-opacity");if(g===0)return;const{isRenderingToTexture:b}=h;if(f.renderPass==="translucent"){const T=new It(f.context.gl.LEQUAL,It.ReadWrite,f.depthRangeFor3D);if(g!==1||n.paint.get("fill-extrusion-pattern").constantOr(1))el(f,t,n,l,T,kt.disabled,ar.disabled,b),el(f,t,n,l,T,f.stencilModeFor3D(),f.colorModeForRenderPass(),b);else{const P=f.colorModeForRenderPass();el(f,t,n,l,T,kt.disabled,P,b)}}},hillshade:function(f,t,n,l,h){if(f.renderPass!=="offscreen"&&f.renderPass!=="translucent")return;const{isRenderingToTexture:g}=h,b=f.context,T=f.style.projection.useSubdivision,P=f.getDepthModeForSublayer(0,It.ReadOnly),M=f.colorModeForRenderPass();if(f.renderPass==="offscreen")(function(I,R,L,O,$,Z,Y){const H=I.context,K=H.gl,ie=O.paint.get("resampling")==="nearest"?K.NEAREST:K.LINEAR;for(const Q of L){const X=R.getTile(Q),re=X.dem;if(!(re!=null&&re.data)||!X.needsHillshadePrepare)continue;const J=re.dim,pe=re.stride,xe=re.getPixels();if(H.activeTexture.set(K.TEXTURE1),H.pixelStoreUnpackPremultiplyAlpha.set(!1),X.demTexture||(X.demTexture=I.getTileTexture(pe)),X.demTexture){const Re=X.demTexture;Re.update(xe,{premultiply:!1}),Re.bind(K.NEAREST,K.CLAMP_TO_EDGE)}else X.demTexture=new d.T(H,xe,K.RGBA,{premultiply:!1}),X.demTexture.bind(K.NEAREST,K.CLAMP_TO_EDGE);H.activeTexture.set(K.TEXTURE0);let Te=X.fbo;if(!Te){const Re=new d.T(H,{width:J,height:J,data:null},K.RGBA);Re.bind(ie,K.CLAMP_TO_EDGE),Te=X.fbo=H.createFramebuffer(J,J,!0,!1),Te.colorAttachment.set(Re.texture)}H.bindFramebuffer.set(Te.framebuffer),H.viewport.set([0,0,J,J]),I.useProgram("hillshadePrepare").draw(H,K.TRIANGLES,$,Z,Y,Vt.disabled,Sa(X.tileID,re),null,null,O.id,I.rasterBoundsBuffer,I.quadTriangleIndexBuffer,I.rasterBoundsSegments),X.needsHillshadePrepare=!1}})(f,t,l,n,P,kt.disabled,M),b.viewport.set([0,0,f.width,f.height]);else if(f.renderPass==="translucent")if(T){const[I,R,L]=f.stencilConfigForOverlapTwoPass(l);Co(f,t,n,L,I,P,M,!1,g),Co(f,t,n,L,R,P,M,!0,g)}else{const[I,R]=f.getStencilConfigForOverlapAndUpdateStencilID(l);Co(f,t,n,R,I,P,M,!1,g)}},colorRelief:function(f,t,n,l,h){if(f.renderPass!=="translucent"||!l.length)return;const{isRenderingToTexture:g}=h,b=f.style.projection.useSubdivision,T=f.getDepthModeForSublayer(0,It.ReadOnly),P=f.colorModeForRenderPass();if(b){const[M,I,R]=f.stencilConfigForOverlapTwoPass(l);Mo(f,t,n,R,M,T,P,!1,g),Mo(f,t,n,R,I,T,P,!0,g)}else{const[M,I]=f.getStencilConfigForOverlapAndUpdateStencilID(l);Mo(f,t,n,I,M,T,P,!1,g)}},raster:function(f,t,n,l,h){if(f.renderPass!=="translucent"||n.paint.get("raster-opacity")===0||!l.length)return;const{isRenderingToTexture:g}=h,b=t.getSource(),T=f.style.projection.useSubdivision;if(b instanceof $n)Ra(f,t,n,l,null,!1,!1,b.tileCoords,b.flippedWindingOrder,g);else if(T){const[P,M,I]=f.stencilConfigForOverlapTwoPass(l);Ra(f,t,n,I,P,!1,!0,Io,!1,g),Ra(f,t,n,I,M,!0,!0,Io,!1,g)}else{const[P,M]=f.getStencilConfigForOverlapAndUpdateStencilID(l);Ra(f,t,n,M,P,!1,!0,Io,!1,g)}},background:function(f,t,n,l,h){var g;const b=n.paint.get("background-color"),T=n.paint.get("background-opacity");if(T===0)return;const{isRenderingToTexture:P}=h,M=f.context,I=M.gl,R=f.style.projection,L=f.transform,O=L.tileSize,$=n.paint.get("background-pattern");if(f.isPatternMissing($))return;const Z=!$&&b.a===1&&T===1&&f.opaquePassEnabledForLayer()?"opaque":"translucent";if(f.renderPass!==Z)return;const Y=kt.disabled,H=f.getDepthModeForSublayer(0,Z==="opaque"?It.ReadWrite:It.ReadOnly),K=f.colorModeForRenderPass(),ie=f.useProgram($?"backgroundPattern":"background"),Q=l||Gn(L,{tileSize:O,terrain:f.style.map.terrain});$&&(M.activeTexture.set(I.TEXTURE0),f.imageManager.bind(f.context));const X=n.getCrossfadeParameters();for(const re of Q){const J=L.getProjectionData({overscaledTileID:re,applyGlobeMatrix:!P,applyTerrainMatrix:!0}),pe=$?fs(T,f,$,{tileID:re,tileSize:O},X):Si(T,b),xe=(g=f.style.map.terrain)===null||g===void 0?void 0:g.getTerrainData(re),Te=R.getMeshFromTileID(M,re.canonical,!1,!0,"raster");ie.draw(M,I.TRIANGLES,H,Y,K,Vt.backCCW,pe,xe,J,n.id,Te.vertexBuffer,Te.indexBuffer,Te.segments)}},sky:function(f,t){const n=f.context,l=n.gl,h=((I,R,L)=>{const O=Math.cos(R.rollInRadians),$=Math.sin(R.rollInRadians),Z=Rn(R),Y=R.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:I.properties.get("sky-color"),u_horizon_color:I.properties.get("horizon-color"),u_horizon:[(R.width/2-Z*$)*L,(R.height/2+Z*O)*L],u_horizon_normal:[-$,O],u_sky_horizon_blend:I.properties.get("sky-horizon-blend")*R.height/2*L,u_sky_blend:Y}})(t,f.style.map.transform,f.pixelRatio),g=new It(l.LEQUAL,It.ReadWrite,[0,1]),b=kt.disabled,T=f.colorModeForRenderPass(),P=f.useProgram("sky"),M=Xu(n,t);P.draw(n,l.TRIANGLES,g,b,T,Vt.disabled,h,null,void 0,"sky",M.vertexBuffer,M.indexBuffer,M.segments)},atmosphere:function(f,t,n){const l=f.context,h=l.gl,g=f.useProgram("atmosphere"),b=new It(h.LEQUAL,It.ReadOnly,[0,1]),T=f.transform,P=(function(Y,H){const K=Y.properties.get("position"),ie=[-K.x,-K.y,-K.z],Q=d.ap(new Float64Array(16));return Y.properties.get("anchor")==="map"&&(d.be(Q,Q,H.rollInRadians),d.bf(Q,Q,-H.pitchInRadians),d.be(Q,Q,H.bearingInRadians),d.bf(Q,Q,H.center.lat*Math.PI/180),d.bI(Q,Q,-H.center.lng*Math.PI/180)),d.cg(ie,ie,Q),ie})(n,f.transform),M=T.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),I=t.properties.get("atmosphere-blend")*M.projectionTransition;if(I===0)return;const R=bn(T.worldSize,T.center.lat),L=T.inverseProjectionMatrix,O=new Float64Array(4);O[3]=1,d.aE(O,O,T.modelViewProjectionMatrix),O[0]/=O[3],O[1]/=O[3],O[2]/=O[3],O[3]=1,d.aE(O,O,L),O[0]/=O[3],O[1]/=O[3],O[2]/=O[3],O[3]=1;const $=((Y,H,K,ie,Q)=>({u_sun_pos:Y,u_atmosphere_blend:H,u_globe_position:K,u_globe_radius:ie,u_inv_proj_matrix:Q}))(P,I,[O[0],O[1],O[2]],R,L),Z=Xu(l,t);g.draw(l,h.TRIANGLES,b,kt.disabled,ar.alphaBlended,Vt.disabled,$,null,null,"atmosphere",Z.vertexBuffer,Z.indexBuffer,Z.segments)},custom:function(f,t,n,l){const{isRenderingGlobe:h}=l,g=f.context,b=n.implementation,T=f.style.projection,P=f.transform,M=P.getProjectionDataForCustomLayer(h),I={farZ:P.farZ,nearZ:P.nearZ,fov:P.fov*Math.PI/180,modelViewProjectionMatrix:P.modelViewProjectionMatrix,projectionMatrix:P.projectionMatrix,shaderData:{variantName:T.shaderVariantName,vertexShaderPrelude:`const float PI = 3.141592653589793;
841
841
  uniform mat4 u_projection_matrix;
842
- ${T.shaderPreludeCode.vertexSource}`,define:T.shaderDefine},defaultProjectionData:M},R=b.renderingMode?b.renderingMode:"2d";if(f.renderPass==="offscreen"){const L=b.prerender;L&&(f.setCustomLayerDefaults(),g.setColorMode(f.colorModeForRenderPass()),L.call(b,g.gl,I),g.setDirty(),f.setBaseState())}else if(f.renderPass==="translucent"){f.setCustomLayerDefaults(),g.setColorMode(f.colorModeForRenderPass()),g.setStencilMode(kt.disabled);const L=R==="3d"?f.getDepthModeFor3D():f.getDepthModeForSublayer(0,It.ReadOnly);g.setDepthMode(L),b.render(g.gl,I),g.setDirty(),f.setBaseState(),g.bindFramebuffer.set(null)}},debug:function(f,t,n){for(const l of n)Xi(f,t,l)},debugPadding:function(f){const t=f.transform.padding;Li(f,f.transform.height-(t.top||0),3,ra),Li(f,t.bottom||0,3,wr),na(f,t.left||0,3,yr),na(f,f.transform.width-(t.right||0),3,ia);const n=f.transform.centerPoint;(function(l,h,g,b){ko(l,h-1,g-10,2,20,b),ko(l,h-10,g-1,20,2,b)})(f,n.x,f.transform.height-n.y,jr)},terrainDepth:function(f,t){const n=f.context,l=n.gl,h=f.transform,g=ar.unblended,b=new It(l.LEQUAL,It.ReadWrite,[0,1]),T=t.tileManager.getRenderableTiles(),P=f.useProgram("terrainDepth");n.bindFramebuffer.set(t.getFramebuffer("depth").framebuffer),n.viewport.set([0,0,f.width/devicePixelRatio,f.height/devicePixelRatio]),n.clear({color:d.bo.transparent,depth:1});for(const M of T){const I=t.getTerrainMesh(M.tileID),R=t.getTerrainData(M.tileID),L=h.getProjectionData({overscaledTileID:M.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),O={u_ele_delta:t.getMeshFrameDelta(h.zoom)};P.draw(n,l.TRIANGLES,b,kt.disabled,g,Vt.backCCW,O,R,L,"terrain",I.vertexBuffer,I.indexBuffer,I.segments)}n.bindFramebuffer.set(null),n.viewport.set([0,0,f.width,f.height])},terrainCoords:function(f,t){const n=f.context,l=n.gl,h=f.transform,g=ar.unblended,b=new It(l.LEQUAL,It.ReadWrite,[0,1]),T=t.getCoordsTexture(),P=t.tileManager.getRenderableTiles(),M=f.useProgram("terrainCoords");n.bindFramebuffer.set(t.getFramebuffer("coords").framebuffer),n.viewport.set([0,0,f.width/devicePixelRatio,f.height/devicePixelRatio]),n.clear({color:d.bo.transparent,depth:1}),t.coordsIndex=[];for(const I of P){const R=t.getTerrainMesh(I.tileID),L=t.getTerrainData(I.tileID);n.activeTexture.set(l.TEXTURE0),l.bindTexture(l.TEXTURE_2D,T.texture);const O={u_terrain_coords_id:(255-t.coordsIndex.length)/255,u_texture:0,u_ele_delta:t.getMeshFrameDelta(h.zoom)},$=h.getProjectionData({overscaledTileID:I.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});M.draw(n,l.TRIANGLES,b,kt.disabled,g,Vt.backCCW,O,L,$,"terrain",R.vertexBuffer,R.indexBuffer,R.segments),t.coordsIndex.push(I.tileID.key)}n.bindFramebuffer.set(null),n.viewport.set([0,0,f.width,f.height])}};class La{constructor(t,n){this.drawFunctions=Qc,this.context=new Wu(t),this.transform=n,this._tileTextures={},this.terrainFacilitator={depthDirty:!0,coordsDirty:!1,matrix:d.ap(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=bi.maxOverzooming+bi.maxUnderzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Wr}resize(t,n,l){if(this.width=Math.floor(t*l),this.height=Math.floor(n*l),this.pixelRatio=l,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const h of this.style._order)this.style._layers[h].resize()}setup(){const t=this.context,n=new d.aU;n.emplaceBack(0,0),n.emplaceBack(d.a6,0),n.emplaceBack(0,d.a6),n.emplaceBack(d.a6,d.a6),this.tileExtentBuffer=t.createVertexBuffer(n,Xo.members),this.tileExtentSegments=d.aV.simpleSegment(0,0,4,2);const l=new d.aU;l.emplaceBack(0,0),l.emplaceBack(d.a6,0),l.emplaceBack(0,d.a6),l.emplaceBack(d.a6,d.a6),this.debugBuffer=t.createVertexBuffer(l,Xo.members),this.debugSegments=d.aV.simpleSegment(0,0,4,5);const h=new d.ch;h.emplaceBack(0,0,0,0),h.emplaceBack(d.a6,0,d.a6,0),h.emplaceBack(0,d.a6,0,d.a6),h.emplaceBack(d.a6,d.a6,d.a6,d.a6),this.rasterBoundsBuffer=t.createVertexBuffer(h,jl.members),this.rasterBoundsSegments=d.aV.simpleSegment(0,0,4,2);const g=new d.aU;g.emplaceBack(0,0),g.emplaceBack(d.a6,0),g.emplaceBack(0,d.a6),g.emplaceBack(d.a6,d.a6),this.rasterBoundsBufferPosOnly=t.createVertexBuffer(g,Xo.members),this.rasterBoundsSegmentsPosOnly=d.aV.simpleSegment(0,0,4,5);const b=new d.aU;b.emplaceBack(0,0),b.emplaceBack(1,0),b.emplaceBack(0,1),b.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(b,Xo.members),this.viewportSegments=d.aV.simpleSegment(0,0,4,2);const T=new d.ci;T.emplaceBack(0),T.emplaceBack(1),T.emplaceBack(3),T.emplaceBack(2),T.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(T);const P=new d.aW;P.emplaceBack(1,0,2),P.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(P);const M=this.context.gl;this.stencilClearMode=new kt({func:M.ALWAYS,mask:0},0,255,M.ZERO,M.ZERO,M.ZERO),this.tileExtentMesh=new fr(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){const t=this.context,n=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const l=d.O();d.c7(l,0,this.width,this.height,0,0,1),d.S(l,l,[n.drawingBufferWidth,n.drawingBufferHeight,0]);const h={mainMatrix:l,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:l};this.useProgram("clippingMask",null,!0).draw(t,n.TRIANGLES,It.disabled,this.stencilClearMode,ar.disabled,Vt.disabled,null,null,h,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,n,l){if(this.currentStencilSource===t.source||!t.isTileClipped()||!(n!=null&&n.length))return;this.currentStencilSource=t.source,this.nextStencilID+n.length>256&&this.clearStencil();const h=this.context;h.setColorMode(ar.disabled),h.setDepthMode(It.disabled);const g={};for(const b of n)g[b.key]=this.nextStencilID++;this._renderTileMasks(g,n,l,!0),this._renderTileMasks(g,n,l,!1),this._tileClippingMaskIDs=g}_renderTileMasks(t,n,l,h){var g;const b=this.context,T=b.gl,P=this.style.projection,M=this.transform,I=this.useProgram("clippingMask");for(const R of n){const L=t[R.key],O=(g=this.style.map.terrain)===null||g===void 0?void 0:g.getTerrainData(R),$=P.getMeshFromTileID(this.context,R.canonical,h,!0,"stencil"),Z=M.getProjectionData({overscaledTileID:R,applyGlobeMatrix:!l,applyTerrainMatrix:!0});I.draw(b,T.TRIANGLES,It.disabled,new kt({func:T.ALWAYS,mask:0},L,255,T.KEEP,T.KEEP,T.REPLACE),ar.disabled,l?Vt.disabled:Vt.backCCW,null,O,Z,"$clipping",$.vertexBuffer,$.indexBuffer,$.segments)}}_renderTilesDepthBuffer(){var t;const n=this.context,l=n.gl,h=this.style.projection,g=this.transform,b=this.useProgram("depth"),T=this.getDepthModeFor3D(),P=Gn(g,{tileSize:g.tileSize});for(const M of P){const I=(t=this.style.map.terrain)===null||t===void 0?void 0:t.getTerrainData(M),R=h.getMeshFromTileID(this.context,M.canonical,!0,!0,"raster"),L=g.getProjectionData({overscaledTileID:M,applyGlobeMatrix:!0,applyTerrainMatrix:!0});b.draw(n,l.TRIANGLES,T,kt.disabled,ar.disabled,Vt.backCCW,null,I,L,"$clipping",R.vertexBuffer,R.indexBuffer,R.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,n=this.context.gl;return new kt({func:n.NOTEQUAL,mask:255},t,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(t){const n=this.context.gl;return new kt({func:n.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,n.KEEP,n.KEEP,n.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(t){const n=this.context.gl,l=t.sort(((b,T)=>T.overscaledZ-b.overscaledZ)),h=l[l.length-1].overscaledZ,g=l[0].overscaledZ-h+1;if(g>1){this.currentStencilSource=void 0,this.nextStencilID+g>256&&this.clearStencil();const b={};for(let T=0;T<g;T++)b[T+h]=new kt({func:n.GEQUAL,mask:255},T+this.nextStencilID,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID+=g,[b,l]}return[{[h]:kt.disabled},l]}stencilConfigForOverlapTwoPass(t){const n=this.context.gl,l=t.sort(((b,T)=>T.overscaledZ-b.overscaledZ)),h=l[l.length-1].overscaledZ,g=l[0].overscaledZ-h+1;if(this.clearStencil(),g>1){const b={},T={};for(let P=0;P<g;P++)b[P+h]=new kt({func:n.GREATER,mask:255},g+1+P,255,n.KEEP,n.KEEP,n.REPLACE),T[P+h]=new kt({func:n.GREATER,mask:255},1+P,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID=2*g+1,[b,T,l]}return this.nextStencilID=3,[{[h]:new kt({func:n.GREATER,mask:255},2,255,n.KEEP,n.KEEP,n.REPLACE)},{[h]:new kt({func:n.GREATER,mask:255},1,255,n.KEEP,n.KEEP,n.REPLACE)},l]}colorModeForRenderPass(){const t=this.context.gl;return this._showOverdrawInspector?new ar([t.CONSTANT_COLOR,t.ONE],new d.bo(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?ar.unblended:ar.alphaBlended}getDepthModeForSublayer(t,n,l){if(!this.opaquePassEnabledForLayer())return It.disabled;const h=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new It(l||this.context.gl.LEQUAL,n,[h,h])}getDepthModeFor3D(){return new It(this.context.gl.LEQUAL,It.ReadWrite,this.depthRangeFor3D)}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(t,n){var l,h,g;this.style=t,this.options=n,this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(st()),this.imageManager.beginFrame();const b=this.style._order,T=this.style.tileManagers,P={},M={},I={},R={isRenderingToTexture:!1,isRenderingGlobe:((l=t.projection)===null||l===void 0?void 0:l.transitionState)>0};for(const O in T){const $=T[O];$.used&&$.prepare(this.context),P[O]=$.getVisibleCoordinates(!1),M[O]=P[O].slice().reverse(),I[O]=$.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let O=0;O<b.length;O++)if(this.style._layers[b[O]].is3D()){this.opaquePassCutoff=O;break}this.maybeDrawDepth(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const O of b){const $=this.style._layers[O];if(!$.hasOffscreenPass()||$.isHidden(this.transform.zoom))continue;const Z=M[$.source];($.type==="custom"||Z.length)&&this.renderLayer(this,T[$.source],$,Z,R)}if((h=this.style.projection)===null||h===void 0||h.updateGPUdependent({context:this.context,useProgram:O=>this.useProgram(O)}),this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:n.showOverdrawInspector?d.bo.black:d.bo.transparent,depth:1}),this.clearStencil(),this.style.sky&&this.drawFunctions.sky(this,this.style.sky),this._showOverdrawInspector=n.showOverdrawInspector,this.depthRangeFor3D=[0,1-(t._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=b.length-1;this.currentLayer>=0;this.currentLayer--){const O=this.style._layers[b[this.currentLayer]],$=T[O.source],Z=P[O.source];this._renderTileClippingMasks(O,Z,!1),this.renderLayer(this,$,O,Z,R)}this.renderPass="translucent";let L=!1;for(this.currentLayer=0;this.currentLayer<b.length;this.currentLayer++){const O=this.style._layers[b[this.currentLayer]],$=T[O.source];if(!((g=this.renderToTexture)===null||g===void 0)&&g.renderLayer(O,R))continue;this.opaquePassEnabledForLayer()||L||(L=!0,R.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());const Z=(O.type==="symbol"?I:M)[O.source];this._renderTileClippingMasks(O,P[O.source],!!this.renderToTexture),this.renderLayer(this,$,O,Z,R)}if(R.isRenderingGlobe&&this.drawFunctions.atmosphere(this,this.style.sky,this.style.light),this.options.showTileBoundaries){const O=(function($,Z){let Y=null;const H=Object.values($._layers).flatMap((X=>X.source&&!X.isHidden(Z)?[$.tileManagers[X.source]]:[])),K=H.filter((X=>X.getSource().type==="vector")),ie=H.filter((X=>X.getSource().type!=="vector")),Q=X=>{(!Y||Y.getSource().maxzoom<X.getSource().maxzoom)&&(Y=X)};for(const X of K)Q(X);if(!Y)for(const X of ie)Q(X);return Y})(this.style,this.transform.zoom);O&&this.drawFunctions.debug(this,O,O.getVisibleCoordinates())}this.options.showPadding&&this.drawFunctions.debugPadding(this),this.context.setDefault()}maybeDrawDepth(t){var n,l;if(!(!((l=(n=this.style)===null||n===void 0?void 0:n.map)===null||l===void 0)&&l.terrain))return;const h=this.terrainFacilitator.matrix,g=this.transform.modelViewProjectionMatrix;let b=this.terrainFacilitator.depthDirty;b||(b=t?!d.cj(h,g):!d.ck(h,g)),b||(b=this.style.map.terrain.tileManager.anyTilesAfterTime(this.terrainFacilitator.renderTime)),b&&(d.cl(h,g),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.depthDirty=!1,this.terrainFacilitator.coordsDirty=!0,this.drawFunctions.terrainDepth(this,this.style.map.terrain))}maybeDrawCoords(){var t,n;!((n=(t=this.style)===null||t===void 0?void 0:t.map)===null||n===void 0)&&n.terrain&&this.terrainFacilitator.coordsDirty&&(this.terrainFacilitator.coordsDirty=!1,this.drawFunctions.terrainCoords(this,this.style.map.terrain))}renderLayer(t,n,l,h,g){if(l.isHidden(this.transform.zoom)||l.type!=="background"&&l.type!=="custom"&&!(h||[]).length)return;this.id=l.id;const b=this.drawFunctions;d.aQ(l)?b.symbol(t,n,l,h,this.style.placement.variableOffsets,g):d.cm(l)?b.circle(t,n,l,h,g):d.cn(l)?b.heatmap(t,n,l,h,g):d.co(l)?b.line(t,n,l,h,g):d.cp(l)?b.fill(t,n,l,h,g):d.cq(l)?b.fillExtrusion(t,n,l,h,g):d.cr(l)?b.hillshade(t,n,l,h,g):d.cs(l)?b.colorRelief(t,n,l,h,g):d.bU(l)?b.raster(t,n,l,h,g):d.ct(l)?b.background(t,n,l,h,g):d.cu(l)&&b.custom(t,n,l,g)}saveTileTexture(t){const n=this._tileTextures[t.size[0]];n?n.length<La.MAX_TEXTURE_POOL_SIZE_PER_BUCKET?n.push(t):t.destroy():this._tileTextures[t.size[0]]=[t]}getTileTexture(t){const n=this._tileTextures[t];return n&&n.length>0?n.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;const n=this.imageManager.getPattern(t.from.toString()),l=this.imageManager.getPattern(t.to.toString());return!n||!l}useProgram(t,n,l=!1,h=[]){var g;this.cache||(this.cache={});const b=!!this.style.map.terrain,T=this.style.projection,P=l?Pr.projectionMercator:T.shaderPreludeCode,M=l?hi:T.shaderDefine,I=t+(n?n.cacheKey:"")+`/${l?on:T.shaderVariantName}`+(this._showOverdrawInspector?"/overdraw":"")+(b?"/terrain":"")+(h?`/${h.join("/")}`:"");return(g=this.cache)[I]||(g[I]=new Vl(this.context,Pr[t],n,Mh[t],this._showOverdrawInspector,b,P,M,h)),this.cache[I]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new d.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){var t,n;if(this._tileTextures){for(const l in this._tileTextures){const h=this._tileTextures[l];if(h)for(const g of h)g.destroy()}this._tileTextures={}}if(this.tileExtentBuffer&&this.tileExtentBuffer.destroy(),this.debugBuffer&&this.debugBuffer.destroy(),this.rasterBoundsBuffer&&this.rasterBoundsBuffer.destroy(),this.rasterBoundsBufferPosOnly&&this.rasterBoundsBufferPosOnly.destroy(),this.viewportBuffer&&this.viewportBuffer.destroy(),this.tileBorderIndexBuffer&&this.tileBorderIndexBuffer.destroy(),this.quadTriangleIndexBuffer&&this.quadTriangleIndexBuffer.destroy(),this.tileExtentMesh&&((t=this.tileExtentMesh.vertexBuffer)===null||t===void 0||t.destroy()),this.tileExtentMesh&&((n=this.tileExtentMesh.indexBuffer)===null||n===void 0||n.destroy()),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this.cache){for(const l in this.cache){const h=this.cache[l];h!=null&&h.program&&this.context.gl.deleteProgram(h.program)}this.cache={}}this.context&&this.context.setDefault()}overLimit(){const{drawingBufferWidth:t,drawingBufferHeight:n}=this.context.gl;return this.width!==t||this.height!==n}}function Yu(f,t){let n,l=!1,h=null;const g=()=>{h=null,l&&(f(...n),h=setTimeout(g,t),l=!1)};return(...b)=>(l=!0,n=b,h||g(),h)}La.MAX_TEXTURE_POOL_SIZE_PER_BUCKET=50;class Tn{constructor(t){this._getCurrentHash=()=>{const n=window.location.hash.replace("#","");if(this._hashName){let l;const h=n.split("&").map((g=>g.split("=")));for(const g of h)g[0]===this._hashName&&(l=g);return(l&&l[1]||"").split("/")}return n.split("/")},this._onHashChange=()=>{const n=this._getCurrentHash();if(!this._isValidHash(n))return!1;const l=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(n[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+n[2],+n[1]],zoom:+n[0],bearing:l,pitch:+(n[4]||0)}),!0},this._updateHashUnthrottled=()=>{const n=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,n)},this._removeHash=()=>{const n=this._getCurrentHash();if(n.length===0)return;const l=n.join("/");let h=l;h.split("&").length>0&&(h=h.split("&")[0]),this._hashName&&(h=`${this._hashName}=${l}`);let g=window.location.hash.replace(h,"");g.startsWith("#&")?g=g.slice(0,1)+g.slice(2):g==="#"&&(g="");let b=window.location.href.replace(/(#.+)?$/,g);b=b.replace("&&","&"),window.history.replaceState(window.history.state,null,b)},this._updateHash=Yu(this._updateHashUnthrottled,300),this._hashName=t&&encodeURIComponent(t)}addTo(t){return this._map=t,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(t){const n=this._map.getCenter(),l=Math.round(100*this._map.getZoom())/100,h=Math.ceil((l*Math.LN2+Math.log(512/360/.5))/Math.LN10),g=Math.pow(10,h),b=Math.round(n.lng*g)/g,T=Math.round(n.lat*g)/g,P=this._map.getBearing(),M=this._map.getPitch();let I="";if(I+=t?`/${b}/${T}/${l}`:`${l}/${T}/${b}`,(P||M)&&(I+="/"+Math.round(10*P)/10),M&&(I+=`/${Math.round(M)}`),this._hashName){const R=this._hashName;let L=!1;const O=window.location.hash.slice(1).split("&").map(($=>{const Z=$.split("=")[0];return Z===R?(L=!0,`${Z}=${I}`):$})).filter(($=>$));return L||O.push(`${R}=${I}`),`#${O.join("&")}`}return`#${I}`}_isValidHash(t){if(t.length<3||t.some(isNaN))return!1;try{new d.W(+t[2],+t[1])}catch{return!1}const n=+t[0],l=+(t[3]||0),h=+(t[4]||0);return n>=this._map.getMinZoom()&&n<=this._map.getMaxZoom()&&l>=-180&&l<=180&&h>=this._map.getMinPitch()&&h<=this._map.getMaxPitch()}}const oa={linearity:.3,easing:d.cv(0,0,.3,1)},sn=d.e({deceleration:2500,maxSpeed:1400},oa),Nn=d.e({deceleration:20,maxSpeed:1400},oa),Bh=d.e({deceleration:1e3,maxSpeed:360},oa),pi=d.e({deceleration:1e3,maxSpeed:90},oa),rl=d.e({deceleration:1e3,maxSpeed:360},oa);class il{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:st(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,n=st();for(;t.length>0&&n-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const n={zoom:0,bearing:0,pitch:0,roll:0,pan:new d.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:g}of this._inertiaBuffer)n.zoom+=g.zoomDelta||0,n.bearing+=g.bearingDelta||0,n.pitch+=g.pitchDelta||0,n.roll+=g.rollDelta||0,g.panDelta&&n.pan._add(g.panDelta),g.around&&(n.around=g.around),g.pinchAround&&(n.pinchAround=g.pinchAround);const l=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,h={};if(n.pan.mag()){const g=Sn(n.pan.mag(),l,d.e({},sn,t||{})),b=n.pan.mult(g.amount/n.pan.mag()),T=this._map.cameraHelper.handlePanInertia(b,this._map.transform);h.center=T.easingCenter,h.offset=T.easingOffset,Fa(h,g)}if(n.zoom){const g=Sn(n.zoom,l,Nn);h.zoom=d.cw(this._map.transform.zoom+g.amount,this._map.getZoomSnap(),g.amount),Fa(h,g)}if(n.bearing){const g=Sn(n.bearing,l,Bh);h.bearing=this._map.transform.bearing+d.al(g.amount,-179,179),Fa(h,g)}if(n.pitch){const g=Sn(n.pitch,l,pi);h.pitch=this._map.transform.pitch+g.amount,Fa(h,g)}if(n.roll){const g=Sn(n.roll,l,rl);h.roll=this._map.transform.roll+d.al(g.amount,-179,179),Fa(h,g)}if(h.zoom||h.bearing){const g=n.pinchAround===void 0?n.around:n.pinchAround;h.around=g?this._map.unproject(g):this._map.getCenter()}return this.clear(),d.e(h,{noMoveStart:!0})}}function Fa(f,t){(!f.duration||f.duration<t.duration)&&(f.duration=t.duration,f.easing=t.easing)}function Sn(f,t,n){const{maxSpeed:l,linearity:h,deceleration:g}=n,b=d.al(f*h/(t/1e3),-l,l),T=Math.abs(b)/(g*h);return{easing:n.easing,duration:1e3*T,amount:b*(T/2)}}class Rr extends d.n{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,l,h={}){l=l instanceof MouseEvent?l:new MouseEvent(t,l);const g=ze.mousePos(n.getCanvas(),l),b=n.unproject(g);super(t,d.e({point:g,lngLat:b,originalEvent:l},h)),this._defaultPrevented=!1,this.target=n}}class Fi extends d.n{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,l){const h=t==="touchend"?l.changedTouches:l.touches,g=ze.touchPos(n.getCanvasContainer(),h),b=g.map((P=>n.unproject(P))),T=g.reduce(((P,M,I,R)=>P.add(M.div(R.length))),new d.P(0,0));super(t,{points:g,point:T,lngLats:b,lngLat:n.unproject(T),originalEvent:l}),this._defaultPrevented=!1}}class Ba extends d.n{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,l){super(t,{originalEvent:l}),this._defaultPrevented=!1}}class aa{constructor(t,n){this._map=t,this._clickTolerance=n.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new Ba(t.type,this._map,t))}mousedown(t,n){return this._mousedownPos=n,this._firePreventable(new Rr(t.type,this._map,t))}mouseup(t){this._map.fire(new Rr(t.type,this._map,t))}click(t,n){this._mousedownPos&&this._mousedownPos.dist(n)>=this._clickTolerance||this._map.fire(new Rr(t.type,this._map,t))}dblclick(t){return this._firePreventable(new Rr(t.type,this._map,t))}mouseover(t){this._map.fire(new Rr(t.type,this._map,t))}mouseout(t){this._map.fire(new Rr(t.type,this._map,t))}touchstart(t){return this._firePreventable(new Fi(t.type,this._map,t))}touchmove(t){this._map.fire(new Fi(t.type,this._map,t))}touchend(t){this._map.fire(new Fi(t.type,this._map,t))}touchcancel(t){this._map.fire(new Fi(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class zo{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new Rr(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Rr("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new Rr(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Yi{constructor(t){this._map=t}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(t){return this.transform.screenPointToLocation(d.P.convert(t),this._map.terrain)}}class eo{constructor(t,n){this._map=t,this._tr=new Yi(t),this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=n.clickTolerance||1,n.boxZoom&&typeof n.boxZoom=="object"&&(this._boxZoomEnd=n.boxZoom.boxZoomEnd)}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,n){this.isEnabled()&&t.shiftKey&&t.button===0&&(ze.disableDrag(),this._startPos=this._lastPos=n,this._active=!0)}mousemoveWindow(t,n){if(!this._active)return;const l=n;if(this._lastPos.equals(l)||!this._box&&l.dist(this._startPos)<this._clickTolerance)return;const h=this._startPos;this._lastPos=l,this._box||(this._box=ze.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",t));const g=Math.min(h.x,l.x),b=Math.max(h.x,l.x),T=Math.min(h.y,l.y),P=Math.max(h.y,l.y);this._box.style.transform=`translate(${g}px,${T}px)`,this._box.style.width=b-g+"px",this._box.style.height=P-T+"px"}mouseupWindow(t,n){if(!this._active||t.button!==0)return;const l=this._startPos,h=n;if(this.reset(),ze.suppressClick(),l.x!==h.x||l.y!==h.y)return this._map.fire(new d.n("boxzoomend",{originalEvent:t})),this._boxZoomEnd?void this._boxZoomEnd(this._map,l,h,t):{cameraAnimation:g=>g.fitScreenCoordinates(l,h,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",t)}keydown(t){this._active&&t.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(this._box.remove(),this._box=null),ze.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,n){return this._map.fire(new d.n(t,{originalEvent:n}))}}function Qe(f,t){if(f.length!==t.length)throw new Error(`The number of touches and points are not equal - touches ${f.length}, points ${t.length}`);const n={};for(let l=0;l<f.length;l++)n[f[l].identifier]=t[l];return n}class Ku{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(t,n,l){(this.centroid||l.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=t.timeStamp),l.length===this.numTouches&&(this.centroid=(function(h){const g=new d.P(0,0);for(const b of h)g._add(b);return g.div(h.length)})(n),this.touches=Qe(l,n)))}touchmove(t,n,l){if(this.aborted||!this.centroid)return;const h=Qe(l,n);for(const g in this.touches){const b=h[g];(!b||b.dist(this.touches[g])>30)&&(this.aborted=!0)}}touchend(t,n,l){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),l.length===0){const h=!this.aborted&&this.centroid;if(this.reset(),h)return h}}}class Ei{constructor(t){this.singleTap=new Ku(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,n,l){this.singleTap.touchstart(t,n,l)}touchmove(t,n,l){this.singleTap.touchmove(t,n,l)}touchend(t,n,l){const h=this.singleTap.touchend(t,n,l);if(h){const g=t.timeStamp-this.lastTime<500,b=!this.lastTap||this.lastTap.dist(h)<30;if(g&&b||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=h,this.count===this.numTaps)return this.reset(),h}}}class ln{constructor(t){this._tr=new Yi(t),this._zoomIn=new Ei({numTouches:1,numTaps:2}),this._zoomOut=new Ei({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,n,l){this._zoomIn.touchstart(t,n,l),this._zoomOut.touchstart(t,n,l)}touchmove(t,n,l){this._zoomIn.touchmove(t,n,l),this._zoomOut.touchmove(t,n,l)}touchend(t,n,l){const h=this._zoomIn.touchend(t,n,l),g=this._zoomOut.touchend(t,n,l),b=this._tr;return h?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:T=>T.easeTo({duration:300,zoom:d.cw(b.zoom+1,T.getZoomSnap()),around:b.unproject(h)},{originalEvent:t})}):g?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:T=>T.easeTo({duration:300,zoom:d.cw(b.zoom-1,T.getZoomSnap()),around:b.unproject(g)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class rr{constructor(t){this._enabled=!!t.enable,this._moveStateManager=t.moveStateManager,this._clickTolerance=t.clickTolerance||1,this._moveFunction=t.move,this._activateOnStart=!!t.activateOnStart,t.assignEvents(this),this.reset()}reset(t){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(t)}_move(...t){const n=this._moveFunction(...t);if(n.bearingDelta||n.pitchDelta||n.rollDelta||n.around||n.panDelta)return this._active=!0,n}dragStart(t,n){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(t)&&(this._moveStateManager.startMove(t),this._lastPoint=Array.isArray(n)?n[0]:n,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(t,n){if(!this.isEnabled())return;const l=this._lastPoint;if(!l)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t))return void this.reset(t);const h=Array.isArray(n)?n[0]:n;return!this._moved&&h.dist(l)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=h,this._move(l,h))}dragEnd(t){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(t)&&(this._moved&&ze.suppressClick(),this.reset(t))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}const Ki=0,Qu=2,Oh={[Ki]:1,[Qu]:2};class sa{constructor(t){this._correctEvent=t.checkCorrectEvent}startMove(t){this._eventButton=t.button}endMove(t){delete this._eventButton}isValidStartEvent(t){return this._correctEvent(t)}isValidMoveEvent(t){return!(function(n,l){const h=Oh[l];return n.buttons===void 0||(n.buttons&h)!==h})(t,this._eventButton)}isValidEndEvent(t){return t.button===this._eventButton}}class Ju{constructor(){this._firstTouch=void 0}_isOneFingerTouch(t){return t.targetTouches.length===1}_isSameTouchEvent(t){return t.targetTouches[0].identifier===this._firstTouch}startMove(t){this._firstTouch=t.targetTouches[0].identifier}endMove(t){delete this._firstTouch}isValidStartEvent(t){return this._isOneFingerTouch(t)}isValidMoveEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}isValidEndEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}}class ec{constructor(t=new sa({checkCorrectEvent:()=>!0}),n=new Ju){this.mouseMoveStateManager=t,this.oneFingerTouchMoveStateManager=n}_executeRelevantHandler(t,n,l){return t instanceof MouseEvent?n(t):typeof TouchEvent<"u"&&t instanceof TouchEvent?l(t):void 0}startMove(t){this._executeRelevantHandler(t,(n=>{this.mouseMoveStateManager.startMove(n)}),(n=>{this.oneFingerTouchMoveStateManager.startMove(n)}))}endMove(t){this._executeRelevantHandler(t,(n=>{this.mouseMoveStateManager.endMove(n)}),(n=>{this.oneFingerTouchMoveStateManager.endMove(n)}))}isValidStartEvent(t){return this._executeRelevantHandler(t,(n=>this.mouseMoveStateManager.isValidStartEvent(n)),(n=>this.oneFingerTouchMoveStateManager.isValidStartEvent(n)))}isValidMoveEvent(t){return this._executeRelevantHandler(t,(n=>this.mouseMoveStateManager.isValidMoveEvent(n)),(n=>this.oneFingerTouchMoveStateManager.isValidMoveEvent(n)))}isValidEndEvent(t){return this._executeRelevantHandler(t,(n=>this.mouseMoveStateManager.isValidEndEvent(n)),(n=>this.oneFingerTouchMoveStateManager.isValidEndEvent(n)))}}const ys=f=>{f.mousedown=f.dragStart,f.mousemoveWindow=f.dragMove,f.mouseup=f.dragEnd,f.contextmenu=t=>{t.preventDefault()}};class Jc{constructor(t,n){this._clickTolerance=t.clickTolerance||1,this._map=n,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new d.P(0,0)}_shouldBePrevented(t){return t<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(t,n,l){return this._calculateTransform(t,n,l)}touchmove(t,n,l){if(this._active){if(!this._shouldBePrevented(l.length))return t.preventDefault(),this._calculateTransform(t,n,l);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",t)}}touchend(t,n,l){this._calculateTransform(t,n,l),this._active&&this._shouldBePrevented(l.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,n,l){l.length>0&&(this._active=!0);const h=Qe(l,n),g=new d.P(0,0),b=new d.P(0,0);let T=0;for(const M in h){const I=h[M],R=this._touches[M];R&&(g._add(I),b._add(I.sub(R)),T++,h[M]=I)}if(this._touches=h,this._shouldBePrevented(T)||!b.mag())return;const P=b.div(T);return this._sum._add(P),this._sum.mag()<this._clickTolerance?void 0:{around:g.div(T),panDelta:P}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Oa{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(t,n,l){this._firstTwoTouches||l.length<2||(this._firstTwoTouches=[l[0].identifier,l[1].identifier],this._start([n[0],n[1]]))}touchmove(t,n,l){if(!this._firstTwoTouches)return;t.preventDefault();const[h,g]=this._firstTwoTouches,b=nl(l,n,h),T=nl(l,n,g);if(!b||!T)return;const P=this._aroundCenter?null:b.add(T).div(2);return this._move([b,T],P,t)}touchend(t,n,l){if(!this._firstTwoTouches)return;const[h,g]=this._firstTwoTouches,b=nl(l,n,h),T=nl(l,n,g);b&&T||(this._active&&ze.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(t){this._enabled=!0,this._aroundCenter=!!t&&t.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function nl(f,t,n){for(let l=0;l<f.length;l++)if(f[l].identifier===n)return t[l]}function eh(f,t){return Math.log(f/t)/Math.LN2}class ol extends Oa{constructor(){super(),this._zoomRate=1,this._zoomThreshold=.1}setZoomRate(t){this._zoomRate=t??1}setZoomThreshold(t){this._zoomThreshold=t??.1}reset(){super.reset(),delete this._distance,delete this._startDistance}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,n){const l=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(eh(this._distance,this._startDistance))<this._zoomThreshold))return this._active=!0,{zoomDelta:eh(this._distance,l)*this._zoomRate,pinchAround:n}}}function al(f,t){return 180*f.angleWith(t)/Math.PI}class th extends Oa{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(t){this._startVector=this._vector=t[0].sub(t[1]),this._minDiameter=t[0].dist(t[1])}_move(t,n,l){const h=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:al(this._vector,h),pinchAround:n}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const n=25/(Math.PI*this._minDiameter)*360,l=al(t,this._startVector);return Math.abs(l)<n}}function tc(f){return Math.abs(f.y)>Math.abs(f.x)}class un extends Oa{constructor(t){super(),this._currentTouchCount=0,this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,n,l){super.touchstart(t,n,l),this._currentTouchCount=l.length}_start(t){this._lastPoints=t,tc(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,n,l){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const h=t[0].sub(this._lastPoints[0]),g=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(h,g,l.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(h.y+g.y)/2*-.5}):void 0}gestureBeginsVertically(t,n,l){if(this._valid!==void 0)return this._valid;const h=t.mag()>=2,g=n.mag()>=2;if(!h&&!g)return;if(!h||!g)return this._firstMove===void 0&&(this._firstMove=l),l-this._firstMove<100&&void 0;const b=t.y>0==n.y>0;return tc(t)&&tc(n)&&b}}const hr={panStep:100,bearingStep:15,pitchStep:10};class tu{constructor(t){this._tr=new Yi(t);const n=hr;this._panStep=n.panStep,this._bearingStep=n.bearingStep,this._pitchStep=n.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let n=0,l=0,h=0,g=0,b=0;switch(t.keyCode){case 61:case 107:case 171:case 187:n=1;break;case 189:case 109:case 173:n=-1;break;case 37:t.shiftKey?l=-1:(t.preventDefault(),g=-1);break;case 39:t.shiftKey?l=1:(t.preventDefault(),g=1);break;case 38:t.shiftKey?h=1:(t.preventDefault(),b=-1);break;case 40:t.shiftKey?h=-1:(t.preventDefault(),b=1);break;default:return}return this._rotationDisabled&&(l=0,h=0),{cameraAnimation:T=>{const P=this._tr;T.easeTo({duration:300,easeId:"keyboardHandler",easing:vs,zoom:n?d.cw(P.zoom+n*(t.shiftKey?2:1),T.getZoomSnap()):P.zoom,bearing:P.bearing+l*this._bearingStep,pitch:P.pitch+h*this._pitchStep,offset:[-g*this._panStep,-b*this._panStep],center:P.center},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function vs(f){return f*(2-f)}const Ao=4.000244140625,ru=1/450;class iu{constructor(t,n){this._onTimeout=l=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(l)},this._map=t,this._tr=new Yi(t),this._triggerRenderFrame=n,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=ru}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!t&&t.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(t){return!!this._map.cooperativeGestures.isEnabled()&&!(t.ctrlKey||this._map.cooperativeGestures.isBypassed(t))}wheel(t){if(!this.isEnabled())return;if(this._shouldBePrevented(t))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",t);let n=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const l=st(),h=l-(this._lastWheelEventTime||0);this._lastWheelEventTime=l,n!==0&&n%Ao==0?this._type="wheel":n!==0&&Math.abs(n)<4?this._type="trackpad":h>400?(this._type=null,this._lastValue=n,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(h*n)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,n+=this._lastValue)),t.shiftKey&&n&&(n/=4),this._type&&(this._lastWheelEvent=t,this._delta-=n,this._active||this._start(t)),t.preventDefault()}_start(t){if(!this._delta)return;this._needsRerender=!1,this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const n=ze.mousePos(this._map.getCanvas(),t),l=this._tr;this._aroundPoint=this._aroundCenter?l.transform.locationToScreenPoint(d.W.convert(l.center)):n,this._needsRerender||(this._needsRerender=!0,this._triggerRenderFrame())}renderFrame(){if(!this._needsRerender||(this._needsRerender=!1,!this.isActive()))return;const t=this._tr.transform;if(typeof this._lastExpectedZoom=="number"){const T=t.zoom-this._lastExpectedZoom;typeof this._startZoom=="number"&&(this._startZoom+=T),typeof this._targetZoom=="number"&&(this._targetZoom+=T)}if(this._delta!==0){const T=this._type==="wheel"&&Math.abs(this._delta)>Ao?this._wheelZoomRate:this._defaultZoomRate;let P=2/(1+Math.exp(-Math.abs(this._delta*T)));this._delta<0&&P!==0&&(P=1/P);const M=typeof this._targetZoom!="number"?t.scale:d.ao(this._targetZoom),I=t.applyConstrain(t.getCameraLngLat(),d.ar(M*P)).zoom,R=this._map.getZoomSnap();if(this._type==="wheel"&&R>0){const L=d.cw(t.zoom,R);this._targetZoom=d.cw(I,R,I-L)}else this._targetZoom=I;this._type==="wheel"&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const n=typeof this._targetZoom!="number"?t.zoom:this._targetZoom,l=this._startZoom,h=this._easing;let g,b=!1;if(this._type==="wheel"&&l&&h){const T=st()-this._lastWheelEventTime,P=Math.min((T+5)/200,1),M=h(P);g=d.H.number(l,n,M),P<1?this._needsRerender=!0:b=!0}else g=n,b=!0;return this._active=!0,b&&(this._active=!1,this._finishTimeout=setTimeout((()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout}),200)),this._lastExpectedZoom=g,{noInertia:!0,needsRenderFrame:!b,zoomDelta:g-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let n=d.cy;if(this._prevEase){const l=this._prevEase,h=(st()-l.start)/l.duration,g=l.easing(h+.01)-l.easing(h),b=.27/Math.sqrt(g*g+1e-4)*.01,T=Math.sqrt(.0729-b*b);n=d.cv(b,T,.25,1)}return this._prevEase={start:st(),duration:t,easing:n},n}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class nu{constructor(t,n){this._clickZoom=t,this._tapZoom=n}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class rc{constructor(t){this._tr=new Yi(t),this.reset()}reset(){this._active=!1}dblclick(t,n){return t.preventDefault(),{cameraAnimation:l=>{l.easeTo({duration:300,zoom:d.cw(this._tr.zoom+(t.shiftKey?-1:1),l.getZoomSnap()),around:this._tr.unproject(n)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class sl{constructor(){this._tap=new Ei({numTouches:1,numTaps:1}),this._zoomRate=1,this.reset()}setZoomRate(t){this._zoomRate=t??1}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(t,n,l){if(!this._swipePoint)if(this._tapTime){const h=n[0],g=t.timeStamp-this._tapTime<500,b=this._tapPoint.dist(h)<30;g&&b?l.length>0&&(this._swipePoint=h,this._swipeTouch=l[0].identifier):this.reset()}else this._tap.touchstart(t,n,l)}touchmove(t,n,l){if(this._tapTime){if(this._swipePoint){if(l[0].identifier!==this._swipeTouch)return;const h=n[0],g=h.y-this._swipePoint.y;return this._swipePoint=h,t.preventDefault(),this._active=!0,{zoomDelta:g/128*this._zoomRate}}}else this._tap.touchmove(t,n,l)}touchend(t,n,l){if(this._tapTime)this._swipePoint&&l.length===0&&this.reset();else{const h=this._tap.touchend(t,n,l);h&&(this._tapTime=t.timeStamp,this._tapPoint=h)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Gr{constructor(t,n,l){this._el=t,this._mousePan=n,this._touchPan=l}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class to{constructor(t,n,l,h){this._pitchWithRotate=t.pitchWithRotate,this._rollEnabled=t.rollEnabled,this._mouseRotate=n,this._mousePitch=l,this._mouseRoll=h}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable(),this._rollEnabled&&this._mouseRoll.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable(),this._mouseRoll.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())&&(!this._rollEnabled||this._mouseRoll.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()||this._mouseRoll.isActive()}}class tt{constructor(t,n,l,h){this._el=t,this._touchZoom=n,this._touchRotate=l,this._tapDragZoom=h,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}setZoomRate(t){this._touchZoom.setZoomRate(t),this._tapDragZoom.setZoomRate(t)}setZoomThreshold(t){this._touchZoom.setZoomThreshold(t)}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class lt{constructor(t,n){this._bypassKey=navigator.userAgent.includes("Mac")?"metaKey":"ctrlKey",this._map=t,this._options=n,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const t=this._map.getCanvasContainer();t.classList.add("maplibregl-cooperative-gestures"),this._container=ze.create("div","maplibregl-cooperative-gesture-screen",t);let n=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(n=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const l=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),h=document.createElement("div");h.className="maplibregl-desktop-message",h.textContent=n,this._container.appendChild(h);const g=document.createElement("div");g.className="maplibregl-mobile-message",g.textContent=l,this._container.appendChild(g),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(this._container.remove(),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(t){return t[this._bypassKey]}notifyGestureBlocked(t,n){this._enabled&&(this._map.fire(new d.n("cooperativegestureprevented",{gestureType:t,originalEvent:n})),this._container.classList.add("maplibregl-show"),setTimeout((()=>{this._container.classList.remove("maplibregl-show")}),100))}}const Bi=f=>f.zoom||f.drag||f.roll||f.pitch||f.rotate;class la extends d.n{}function Na(f){var t;return((t=f.panDelta)===null||t===void 0?void 0:t.mag())||f.zoomDelta||f.bearingDelta||f.pitchDelta||f.rollDelta}class Oi{get _ownerDocument(){var t;return((t=this._el)===null||t===void 0?void 0:t.ownerDocument)||document}get _ownerWindow(){var t,n;return((n=(t=this._el)===null||t===void 0?void 0:t.ownerDocument)===null||n===void 0?void 0:n.defaultView)||window}constructor(t,n){this.handleWindowEvent=h=>{this.handleEvent(h,`${h.type}Window`)},this.handleEvent=(h,g)=>{if(h.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const b=h.type==="renderFrame"?void 0:h,T={needsRenderFrame:!1},P={},M={};for(const{handlerName:L,handler:O,allowed:$}of this._handlers){if(!O.isEnabled())continue;let Z;if(this._blockedByActive(M,$,L))O.reset();else if(O[g||h.type]){if(d.cz(h,g||h.type)){const Y=ze.mousePos(this._map.getCanvas(),h);Z=O[g||h.type](h,Y)}else if(d.cA(h,g||h.type)){const Y=this._getMapTouches(h.touches),H=ze.touchPos(this._map.getCanvas(),Y);Z=O[g||h.type](h,H,Y)}else d.cB(g||h.type)||(Z=O[g||h.type](h));this.mergeHandlerResult(T,P,Z,L,b),Z!=null&&Z.needsRenderFrame&&this._triggerRenderFrame()}(Z||O.isActive())&&(M[L]=O)}const I={};for(const L in this._previousActiveHandlers)M[L]||(I[L]=b);this._previousActiveHandlers=M,(Object.keys(I).length||Na(T))&&(this._changes.push([T,P,I]),this._triggerRenderFrame()),(Object.keys(M).length||Na(T))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:R}=T;R&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],R(this._map))},this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new il(t),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(n);const l=this._el;this._listeners=[[l,"touchstart",{passive:!0}],[l,"touchmove",{passive:!1}],[l,"touchend",void 0],[l,"touchcancel",void 0],[l,"mousedown",void 0],[l,"mousemove",void 0],[l,"mouseup",void 0],[this._ownerDocument,"mousemove",{capture:!0}],[this._ownerDocument,"mouseup",void 0],[l,"mouseover",void 0],[l,"mouseout",void 0],[l,"dblclick",void 0],[l,"click",void 0],[l,"keydown",{capture:!1}],[l,"keyup",void 0],[l,"wheel",{passive:!1}],[l,"contextmenu",void 0],[this._ownerWindow,"blur",void 0]];for(const[h,g,b]of this._listeners)h.addEventListener(g,h===this._ownerDocument?this.handleWindowEvent:this.handleEvent,b)}destroy(){for(const[t,n,l]of this._listeners)t.removeEventListener(n,t===this._ownerDocument?this.handleWindowEvent:this.handleEvent,l)}_addDefaultHandlers(t){const n=this._map,l=n.getCanvasContainer();this._add("mapEvent",new aa(n,t));const h=n.boxZoom=new eo(n,t);this._add("boxZoom",h),t.interactive&&t.boxZoom&&h.enable();const g=n.cooperativeGestures=new lt(n,t.cooperativeGestures);this._add("cooperativeGestures",g),t.cooperativeGestures&&g.enable();const b=new ln(n),T=new rc(n);n.doubleClickZoom=new nu(T,b),this._add("tapZoom",b),this._add("clickZoom",T),t.interactive&&t.doubleClickZoom&&n.doubleClickZoom.enable();const P=new sl;this._add("tapDragZoom",P);const M=n.touchPitch=new un(n);this._add("touchPitch",M),t.interactive&&t.touchPitch&&n.touchPitch.enable(t.touchPitch);const I=()=>n.project(n.getCenter()),R=(function({enable:Q,clickTolerance:X,aroundCenter:re=!0,minPixelCenterThreshold:J=100,rotateDegreesPerPixelMoved:pe=.8},xe){const Te=new sa({checkCorrectEvent:Re=>Re.button===0&&Re.ctrlKey||Re.button===2&&!Re.ctrlKey});return new rr({clickTolerance:X,move:(Re,Ae)=>{const rt=xe();if(re&&Math.abs(rt.y-Re.y)>J)return{bearingDelta:d.cx(new d.P(Re.x,Ae.y),Ae,rt)};let Ge=(Ae.x-Re.x)*pe;return re&&Ae.y<rt.y&&(Ge=-Ge),{bearingDelta:Ge}},moveStateManager:Te,enable:Q,assignEvents:ys})})(t,I),L=(function({enable:Q,clickTolerance:X,pitchDegreesPerPixelMoved:re=-.5}){const J=new sa({checkCorrectEvent:pe=>pe.button===0&&pe.ctrlKey||pe.button===2});return new rr({clickTolerance:X,move:(pe,xe)=>({pitchDelta:(xe.y-pe.y)*re}),moveStateManager:J,enable:Q,assignEvents:ys})})(t),O=(function({enable:Q,clickTolerance:X,rollDegreesPerPixelMoved:re=.3},J){const pe=new sa({checkCorrectEvent:xe=>xe.button===2&&xe.ctrlKey});return new rr({clickTolerance:X,move:(xe,Te)=>{const Re=J();let Ae=(Te.x-xe.x)*re;return Te.y<Re.y&&(Ae=-Ae),{rollDelta:Ae}},moveStateManager:pe,enable:Q,assignEvents:ys})})(t,I);n.dragRotate=new to(t,R,L,O),this._add("mouseRotate",R,["mousePitch"]),this._add("mousePitch",L,["mouseRotate","mouseRoll"]),this._add("mouseRoll",O,["mousePitch"]),t.interactive&&t.dragRotate&&n.dragRotate.enable();const $=(function({enable:Q,clickTolerance:X}){const re=new sa({checkCorrectEvent:J=>J.button===0&&!J.ctrlKey});return new rr({clickTolerance:X,move:(J,pe)=>({around:pe,panDelta:pe.sub(J)}),activateOnStart:!0,moveStateManager:re,enable:Q,assignEvents:ys})})(t),Z=new Jc(t,n);n.dragPan=new Gr(l,$,Z),this._add("mousePan",$),this._add("touchPan",Z,["touchZoom","touchRotate"]),t.interactive&&t.dragPan&&n.dragPan.enable(t.dragPan);const Y=new th,H=new ol;n.touchZoomRotate=new tt(l,H,Y,P),this._add("touchRotate",Y,["touchPan","touchZoom"]),this._add("touchZoom",H,["touchPan","touchRotate"]),t.interactive&&t.touchZoomRotate&&n.touchZoomRotate.enable(t.touchZoomRotate),this._add("blockableMapEvent",new zo(n));const K=n.scrollZoom=new iu(n,(()=>this._triggerRenderFrame()));this._add("scrollZoom",K,["mousePan"]),t.interactive&&t.scrollZoom&&n.scrollZoom.enable(t.scrollZoom);const ie=n.keyboard=new tu(n);this._add("keyboard",ie),t.interactive&&t.keyboard&&n.keyboard.enable()}_add(t,n,l){this._handlers.push({handlerName:t,handler:n,allowed:l}),this._handlersById[t]=n}stop(t){if(!this._updatingCamera){for(const{handler:n}of this._handlers)n.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}isActive(){for(const{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Bi(this._eventsInProgress)||this.isZooming()}_blockedByActive(t,n,l){for(const h in t)if(h!==l&&!(n!=null&&n.includes(h)))return!0;return!1}_getMapTouches(t){const n=[];for(const l of t)this._el.contains(l.target)&&n.push(l);return n}mergeHandlerResult(t,n,l,h,g){if(!l)return;d.e(t,l);const b={handlerName:h,originalEvent:l.originalEvent||g};l.zoomDelta!==void 0&&(n.zoom=b),l.panDelta!==void 0&&(n.drag=b),l.rollDelta!==void 0&&(n.roll=b),l.pitchDelta!==void 0&&(n.pitch=b),l.bearingDelta!==void 0&&(n.rotate=b)}_applyChanges(){const t={},n={},l={};for(const[h,g,b]of this._changes)h.panDelta&&(t.panDelta=(t.panDelta||new d.P(0,0))._add(h.panDelta)),h.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+h.zoomDelta),h.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+h.bearingDelta),h.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+h.pitchDelta),h.rollDelta&&(t.rollDelta=(t.rollDelta||0)+h.rollDelta),h.around!==void 0&&(t.around=h.around),h.pinchAround!==void 0&&(t.pinchAround=h.pinchAround),h.noInertia&&(t.noInertia=h.noInertia),d.e(n,g),d.e(l,b);this._updateMapTransform(t,n,l),this._changes=[]}_updateMapTransform(t,n,l){const h=this._map,g=h._getTransformForUpdate(),b=h.terrain;if(!(Na(t)||b&&this._terrainMovement))return void this._fireEvents(n,l,!0);h._stop(!0);let{panDelta:T,zoomDelta:P,bearingDelta:M,pitchDelta:I,rollDelta:R,around:L,pinchAround:O}=t;O!==void 0&&(L=O),L||(L=h.transform.centerPoint),b&&!g.isPointOnMapSurface(L)&&(L=g.centerPoint);const $={panDelta:T,zoomDelta:P,rollDelta:R,pitchDelta:I,bearingDelta:M,around:L};this._map.cameraHelper.useGlobeControls&&!g.isPointOnMapSurface(L)&&(L=g.centerPoint);const Z=L.distSqr(g.centerPoint)<.01?g.center:g.screenPointToLocation(T?L.sub(T):L);this._handleMapControls({terrain:b,tr:g,deltasForHelper:$,preZoomAroundLoc:Z,combinedEventsInProgress:n,panDelta:T}),h._applyUpdatedTransform(g),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(n,l,!0)}_handleMapControls({terrain:t,tr:n,deltasForHelper:l,preZoomAroundLoc:h,combinedEventsInProgress:g,panDelta:b}){const T=this._map.cameraHelper;if(T.handleMapControlsRollPitchBearingZoom(l,n),t)return T.useGlobeControls?(this._terrainMovement||!g.drag&&!g.zoom||(this._terrainMovement=!0,this._map._elevationFreeze=!0),void T.handleMapControlsPan(l,n,h)):this._terrainMovement||!g.drag&&!g.zoom?void(g.drag&&this._terrainMovement&&b?n.setCenter(n.screenPointToLocation(n.centerPoint.sub(b))):T.handleMapControlsPan(l,n,h)):(this._terrainMovement=!0,this._map._elevationFreeze=!0,void T.handleMapControlsPan(l,n,h));T.handleMapControlsPan(l,n,h)}_fireEvents(t,n,l){const h=Bi(this._eventsInProgress),g=Bi(t),b={};for(const R in t){const{originalEvent:L}=t[R];this._eventsInProgress[R]||(b[`${R}start`]=L),this._eventsInProgress[R]=t[R]}!h&&g&&this._fireEvent("movestart",g.originalEvent);for(const R in b)this._fireEvent(R,b[R]);g&&this._fireEvent("move",g.originalEvent);for(const R in t){const{originalEvent:L}=t[R];this._fireEvent(R,L)}const T={};let P;for(const R in this._eventsInProgress){const{handlerName:L,originalEvent:O}=this._eventsInProgress[R];this._handlersById[L].isActive()||(delete this._eventsInProgress[R],P=n[L]||O,T[`${R}end`]=P)}for(const R in T)this._fireEvent(R,T[R]);const M=Bi(this._eventsInProgress),I=(h||g)&&!M;if(I&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const R=this._map._getTransformForUpdate();this._map.getCenterClampedToGround()&&R.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(R)}if(l&&I){this._updatingCamera=!0;const R=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),L=O=>O!==0&&-this._bearingSnap<O&&O<this._bearingSnap;!R||!R.essential&&Wt.prefersReducedMotion?(this._map.fire(new d.n("moveend",{originalEvent:P})),L(this._map.getBearing())&&this._map.resetNorth()):(L(R.bearing||this._map.getBearing())&&(R.bearing=0),R.freezeElevation=!0,this._map.easeTo(R,{originalEvent:P})),this._updatingCamera=!1}}_fireEvent(t,n){this._map.fire(new d.n(t,n?{originalEvent:n}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add((t=>{delete this._frameId,this.handleEvent(new la("renderFrame",{timeStamp:t})),this._applyChanges()}))}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class Do extends d.E{constructor(t,n,l){super(),this._renderFrameCallback=()=>{const h=Math.min((st()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(h)),h<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=l.bearingSnap,this._zoomSnap=l.zoomSnap,this.cameraHelper=n,this.on("moveend",(()=>{delete this._requestedCameraState}))}migrateProjection(t,n){t.apply(this.transform,!0),this.transform=t,this.cameraHelper=n}getCenter(){return new d.W(this.transform.center.lng,this.transform.center.lat)}setCenter(t,n){return this.jumpTo({center:t},n)}getCenterElevation(){return this.transform.elevation}setCenterElevation(t,n){return this.jumpTo({elevation:t},n),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(t){this._centerClampedToGround=t}panBy(t,n,l){return t=d.P.convert(t).mult(-1),this.panTo(this.transform.center,d.e({offset:t},n),l)}panTo(t,n,l){return this.easeTo(d.e({center:t},n),l)}getZoom(){return this.transform.zoom}setZoom(t,n){return this.jumpTo({zoom:t},n),this}zoomTo(t,n,l){return this.easeTo(d.e({zoom:t},n),l)}zoomIn(t,n){return this.zoomTo(d.cw(this.getZoom()+1,this._zoomSnap),t,n),this}zoomOut(t,n){return this.zoomTo(d.cw(this.getZoom()-1,this._zoomSnap),t,n),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(t,n){return t!=this.transform.fov&&(this.transform.setFov(t),this.fire(new d.n("movestart",n)).fire(new d.n("move",n)).fire(new d.n("moveend",n))),this}getBearing(){return this.transform.bearing}setZoomSnap(t){return this._zoomSnap=t,this}getZoomSnap(){return this._zoomSnap}setBearing(t,n){return this.jumpTo({bearing:t},n),this}getPadding(){return this.transform.padding}setPadding(t,n){return this.jumpTo({padding:t},n),this}rotateTo(t,n,l){return this.easeTo(d.e({bearing:t},n),l)}resetNorth(t,n){return this.rotateTo(0,d.e({duration:1e3},t),n),this}resetNorthPitch(t,n){return this.easeTo(d.e({bearing:0,pitch:0,roll:0,duration:1e3},t),n),this}snapToNorth(t,n){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,n):this}getPitch(){return this.transform.pitch}setPitch(t,n){return this.jumpTo({pitch:t},n),this}getRoll(){return this.transform.roll}setRoll(t,n){return this.jumpTo({roll:t},n),this}cameraForBounds(t,n){t=Ie.convert(t).adjustAntiMeridian();const l=(n==null?void 0:n.bearing)||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),l,n)}_cameraForBoxAndBearing(t,n,l,h){const g={top:0,bottom:0,right:0,left:0};if(typeof(h=d.e({padding:g,offset:[0,0],maxZoom:this.transform.maxZoom},h)).padding=="number"){const I=h.padding;h.padding={top:I,bottom:I,right:I,left:I}}const b=d.e(g,h.padding);h.padding=b;const T=this.transform,P=new Ie(t,n),M=this.cameraHelper.cameraForBoxAndBearing(h,b,P,l,T);return M&&this._zoomSnap&&(M.zoom=d.cw(M.zoom,this._zoomSnap,-1)),M}fitBounds(t,n,l){return this._fitInternal(this.cameraForBounds(t,n),n,l)}fitScreenCoordinates(t,n,l,h,g){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(d.P.convert(t)),this.transform.screenPointToLocation(d.P.convert(n)),l,h),h,g)}_fitInternal(t,n,l){return t?(delete(n=d.e(t,n)).padding,n.linear?this.easeTo(n,l):this.flyTo(n,l)):this}jumpTo(t,n){this.stop(),"zoom"in t&&this._zoomSnap&&(t.zoom=d.cw(t.zoom,this._zoomSnap));const l=this._getTransformForUpdate();let h=!1,g=!1,b=!1;const T=l.zoom;this.terrain&&l.setElevation(this.terrain.getElevationForLngLatZoom(t.center?d.W.convert(t.center):l.center,t.zoom||l.tileZoom)),this.cameraHelper.handleJumpToCenterZoom(l,t);const P=l.zoom!==T;return"elevation"in t&&l.elevation!==+t.elevation&&l.setElevation(+t.elevation),"bearing"in t&&l.bearing!==+t.bearing&&(h=!0,l.setBearing(+t.bearing)),"pitch"in t&&l.pitch!==+t.pitch&&(g=!0,l.setPitch(+t.pitch)),"roll"in t&&l.roll!==+t.roll&&(b=!0,l.setRoll(+t.roll)),t.padding==null||l.isPaddingEqual(t.padding)||l.setPadding(t.padding),this._applyUpdatedTransform(l),this.fire(new d.n("movestart",n)).fire(new d.n("move",n)),P&&this.fire(new d.n("zoomstart",n)).fire(new d.n("zoom",n)).fire(new d.n("zoomend",n)),h&&this.fire(new d.n("rotatestart",n)).fire(new d.n("rotate",n)).fire(new d.n("rotateend",n)),g&&this.fire(new d.n("pitchstart",n)).fire(new d.n("pitch",n)).fire(new d.n("pitchend",n)),b&&this.fire(new d.n("rollstart",n)).fire(new d.n("roll",n)).fire(new d.n("rollend",n)),this.fire(new d.n("moveend",n))}calculateCameraOptionsFromTo(t,n,l,h=0){const g=d.a7.fromLngLat(t,n),b=d.a7.fromLngLat(l,h),T=b.x-g.x,P=b.y-g.y,M=b.z-g.z,I=Math.hypot(T,P,M);if(I===0)throw new Error("Can't calculate camera options with same From and To");const R=Math.hypot(T,P),L=d.ar(this.transform.cameraToCenterDistance/I/this.transform.tileSize),O=180*Math.atan2(T,-P)/Math.PI;let $=180*Math.acos(R/I)/Math.PI;return $=M<0?90-$:90+$,{center:b.toLngLat(),elevation:h,zoom:L,pitch:$,bearing:O}}calculateCameraOptionsFromCameraLngLatAltRotation(t,n,l,h,g){const b=this.transform.calculateCenterFromCameraLngLatAlt(t,n,l,h);return{center:b.center,elevation:b.elevation,zoom:b.zoom,bearing:l,pitch:h,roll:g}}easeTo(t,n){this._stop(!1,t.easeId),"zoom"in(t=d.e({offset:[0,0],duration:500,easing:d.cy},t))&&this._zoomSnap&&(t.zoom=d.cw(t.zoom,this._zoomSnap)),(t.animate===!1||!t.essential&&Wt.prefersReducedMotion)&&(t.duration=0);const l=this._getTransformForUpdate(),h=this.getBearing(),g=l.pitch,b=l.roll,T="bearing"in t?this._normalizeBearing(t.bearing,h):h,P="pitch"in t?+t.pitch:g,M="roll"in t?this._normalizeBearing(t.roll,b):b,I="padding"in t?t.padding:l.padding,R=d.P.convert(t.offset);let L,O;t.around&&(L=d.W.convert(t.around),O=l.locationToScreenPoint(L));const $={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},Z=this.cameraHelper.handleEaseTo(l,{bearing:T,pitch:P,roll:M,padding:I,around:L,aroundPoint:O,offsetAsPoint:R,offset:t.offset,zoom:t.zoom,center:t.center});return this._rotating||(this._rotating=h!==T),this._pitching||(this._pitching=P!==g),this._rolling||(this._rolling=M!==b),this._padding=!l.isPaddingEqual(I),this._zooming||(this._zooming=Z.isZooming),this._easeId=t.easeId,this._prepareEase(n,t.noMoveStart,$),this.terrain&&this._prepareElevation(Z.elevationCenter),this._ease((Y=>{Z.easeFunc(Y),this.terrain&&!t.freezeElevation&&this._updateElevation(Y),this._applyUpdatedTransform(l),this._fireMoveEvents(n)}),(Y=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(n,Y)}),t),this}_prepareEase(t,n,l={}){this._moving=!0,n||l.moving||this.fire(new d.n("movestart",t)),this._zooming&&!l.zooming&&this.fire(new d.n("zoomstart",t)),this._rotating&&!l.rotating&&this.fire(new d.n("rotatestart",t)),this._pitching&&!l.pitching&&this.fire(new d.n("pitchstart",t)),this._rolling&&!l.rolling&&this.fire(new d.n("rollstart",t))}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(t,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(t){this._elevationStart!==void 0&&this._elevationCenter!==void 0||this._prepareElevation(this.transform.center),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));const n=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(t<1&&n!==this._elevationTarget){const l=this._elevationTarget-this._elevationStart;this._elevationStart+=t*(l-(n-(l*t+this._elevationStart))/(1-t)),this._elevationTarget=n}this.transform.setElevation(d.H.number(this._elevationStart,this._elevationTarget,t))}_finalizeElevation(){this._elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(t){if(!this.terrain&&t.elevation>=0&&t.pitch<=90)return{};const n=t.getCameraLngLat(),l=t.getCameraAltitude(),h=this.terrain?this.terrain.getElevationForLngLatZoom(n,t.zoom):0;if(l<h){const g=this.calculateCameraOptionsFromTo(n,h,t.center,t.elevation);return{pitch:g.pitch,zoom:g.zoom}}return{}}_applyUpdatedTransform(t){const n=[];if(n.push((h=>this._elevateCameraIfInsideTerrain(h))),this.transformCameraUpdate&&n.push((h=>this.transformCameraUpdate(h))),!n.length)return;const l=t.clone();for(const h of n){const g=l.clone(),{center:b,zoom:T,roll:P,pitch:M,bearing:I,elevation:R}=h(g);b&&g.setCenter(b),R!==void 0&&g.setElevation(R),T!==void 0&&g.setZoom(T),P!==void 0&&g.setRoll(P),M!==void 0&&g.setPitch(M),I!==void 0&&g.setBearing(I),l.apply(g,!1)}this.transform.apply(l,!1)}_fireMoveEvents(t){this.fire(new d.n("move",t)),this._zooming&&this.fire(new d.n("zoom",t)),this._rotating&&this.fire(new d.n("rotate",t)),this._pitching&&this.fire(new d.n("pitch",t)),this._rolling&&this.fire(new d.n("roll",t))}_afterEase(t,n){if(this._easeId&&n&&this._easeId===n)return;delete this._easeId;const l=this._zooming,h=this._rotating,g=this._pitching,b=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,l&&this.fire(new d.n("zoomend",t)),h&&this.fire(new d.n("rotateend",t)),g&&this.fire(new d.n("pitchend",t)),b&&this.fire(new d.n("rollend",t)),this.fire(new d.n("moveend",t))}flyTo(t,n){if(!t.essential&&Wt.prefersReducedMotion){const Ae=d.V(t,["center","zoom","bearing","pitch","roll","elevation","padding"]);return this.jumpTo(Ae,n)}this.stop(),"zoom"in(t=d.e({offset:[0,0],speed:1.2,curve:1.42,easing:d.cy},t))&&this._zoomSnap&&(t.zoom=d.cw(t.zoom,this._zoomSnap));const l=this._getTransformForUpdate(),h=l.bearing,g=l.pitch,b=l.roll,T=l.padding,P="bearing"in t?this._normalizeBearing(t.bearing,h):h,M="pitch"in t?+t.pitch:g,I="roll"in t?this._normalizeBearing(t.roll,b):b,R="padding"in t?t.padding:l.padding,L=d.P.convert(t.offset);let O=l.centerPoint.add(L);const $=l.screenPointToLocation(O),Z=this.cameraHelper.handleFlyTo(l,{bearing:P,pitch:M,roll:I,padding:R,locationAtOffset:$,offsetAsPoint:L,center:t.center,minZoom:t.minZoom,zoom:t.zoom});let Y=t.curve;const H=Math.max(l.width,l.height),K=H/Z.scaleOfZoom,ie=Z.pixelPathLength;typeof Z.scaleOfMinZoom=="number"&&(Y=Math.sqrt(H/Z.scaleOfMinZoom/ie*2));const Q=Y*Y;function X(Ae){const rt=(K*K-H*H+(Ae?-1:1)*Q*Q*ie*ie)/(2*(Ae?K:H)*Q*ie);return Math.log(Math.sqrt(rt*rt+1)-rt)}function re(Ae){return(Math.exp(Ae)-Math.exp(-Ae))/2}function J(Ae){return(Math.exp(Ae)+Math.exp(-Ae))/2}const pe=X(!1);let xe=function(Ae){return J(pe)/J(pe+Y*Ae)},Te=function(Ae){return H*((J(pe)*(re(rt=pe+Y*Ae)/J(rt))-re(pe))/Q)/ie;var rt},Re=(X(!0)-pe)/Y;if(Math.abs(ie)<2e-6||!isFinite(Re)){if(Math.abs(H-K)<1e-6)return this.easeTo(t,n);const Ae=K<H?-1:1;Re=Math.abs(Math.log(K/H))/Y,Te=()=>0,xe=rt=>Math.exp(Ae*Y*rt)}return t.duration="duration"in t?+t.duration:1e3*Re/("screenSpeed"in t?+t.screenSpeed/Y:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=h!==P,this._pitching=M!==g,this._rolling=I!==b,this._padding=!l.isPaddingEqual(R),this._prepareEase(n,!1),this.terrain&&this._prepareElevation(Z.targetCenter),this._ease((Ae=>{const rt=Ae*Re,Ge=1/xe(rt),ke=Te(rt);this._rotating&&l.setBearing(d.H.number(h,P,Ae)),this._pitching&&l.setPitch(d.H.number(g,M,Ae)),this._rolling&&l.setRoll(d.H.number(b,I,Ae)),this._padding&&(l.interpolatePadding(T,R,Ae),O=l.centerPoint.add(L)),Z.easeFunc(Ae,Ge,ke,O),this.terrain&&!t.freezeElevation&&this._updateElevation(Ae),this._applyUpdatedTransform(l),this._fireMoveEvents(n)}),(()=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(n)}),t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,n){var l;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const h=this._onEaseEnd;delete this._onEaseEnd,h.call(this,n)}return t||(l=this.handlers)===null||l===void 0||l.stop(!1),this}_ease(t,n,l){l.animate===!1||l.duration===0?(t(1),n()):(this._easeStart=st(),this._easeOptions=l,this._onEaseFrame=t,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(t,n){t=d.X(t,-180,180);const l=Math.abs(t-n);return Math.abs(t-360-n)<l&&(t-=360),Math.abs(t+360-n)<l&&(t+=360),t}queryTerrainElevation(t){return this.terrain?this.terrain.getElevationForLngLat(d.W.convert(t),this.transform):null}}const ro={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class Qi{constructor(t=ro){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=n=>{!n||n.sourceDataType!=="metadata"&&n.sourceDataType!=="visibility"&&n.dataType!=="style"&&n.type!=="terrain"||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=t}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options.compact,this._container=ze.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=ze.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=ze.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(t,n){const l=this._map._getUIString(`AttributionControl.${n}`);t.title=l,t.setAttribute("aria-label",l)}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map((h=>typeof h!="string"?"":h))):typeof this.options.customAttribution=="string"&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const h=this._map.style.stylesheet;this.styleOwner=h.owner,this.styleId=h.id}const n=this._map.style.tileManagers;for(const h in n){const g=n[h];if(g.used||g.usedForTerrain){const b=g.getSource();b.attribution&&!t.includes(b.attribution)&&t.push(b.attribution)}}t=t.filter((h=>String(h).trim())),t.sort(((h,g)=>h.length-g.length)),t=t.filter(((h,g)=>{for(let b=g+1;b<t.length;b++)if(t[b].includes(h))return!1;return!0}));const l=t.join(" | ");l!==this._attribHTML&&(this._attribHTML=l,t.length?(this._innerContainer.innerHTML=ze.sanitize(l),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class ic{constructor(t={}){this._updateCompact=()=>{const n=this._container.children;if(n.length){const l=n[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&l.classList.add("maplibregl-compact"):l.classList.remove("maplibregl-compact")}},this.options=t}getDefaultPosition(){return"bottom-left"}onAdd(t){var n;this._map=t,this._compact=(n=this.options)===null||n===void 0?void 0:n.compact,this._container=ze.create("div","maplibregl-ctrl");const l=ze.create("a","maplibregl-ctrl-logo");return l.target="_blank",l.rel="noopener nofollow",l.href="https://maplibre.org/",l.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),l.setAttribute("rel","noopener nofollow"),this._container.appendChild(l),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class nc{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const n=++this._id;return this._queue.push({callback:t,id:n,cancelled:!1}),n}remove(t){const n=this._currentlyRunning,l=n?this._queue.concat(n):this._queue;for(const h of l)if(h.id===t)return void(h.cancelled=!0)}run(t=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const n=this._currentlyRunning=this._queue;this._queue=[];for(const l of n)if(!l.cancelled&&(l.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var Nh=d.aS([{name:"a_pos3d",type:"Int16",components:3}]);class ou extends d.E{constructor(t){super(),this._lastTilesetChange=st(),this.tileManager=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=t._source.tileSize*2**this.deltaZoom,t.usedForTerrain=!0,t.tileSize=this.tileSize}destruct(){this.tileManager.usedForTerrain=!1,this.tileManager.tileSize=null}getSource(){return this.tileManager._source}update(t,n){this.tileManager.update(t,n),this._renderableTilesKeys=[];const l={};for(const h of Gn(t,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:n,calculateTileZoom:this.tileManager._source.calculateTileZoom}))l[h.key]=!0,this._renderableTilesKeys.push(h.key),this._tiles[h.key]||(h.terrainRttPosMatrix32f=new Float64Array(16),d.c7(h.terrainRttPosMatrix32f,0,d.a6,d.a6,0,0,1),this._tiles[h.key]=new va(h,this.tileSize),this._lastTilesetChange=st());for(const h in this._tiles)l[h]||delete this._tiles[h]}freeRtt(t){for(const n in this._tiles){const l=this._tiles[n];(!t||l.tileID.equals(t)||l.tileID.isChildOf(t)||t.isChildOf(l.tileID))&&(l.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map((t=>this.getTileByID(t)))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t,n){return n?this._getTerrainCoordsForTileRanges(t,n):this._getTerrainCoordsForRegularTile(t)}_getTerrainCoordsForRegularTile(t){const n={};for(const l of this._renderableTilesKeys){const h=this._tiles[l].tileID,g=t.clone(),b=d.bj();if(h.canonical.equals(t.canonical))d.c7(b,0,d.a6,d.a6,0,0,1);else if(h.canonical.isChildOf(t.canonical)){const T=h.canonical.z-t.canonical.z,P=h.canonical.x-(h.canonical.x>>T<<T),M=h.canonical.y-(h.canonical.y>>T<<T),I=d.a6>>T;d.c7(b,0,I,I,0,0,1),d.Q(b,b,[-P*I,-M*I,0])}else{if(!t.canonical.isChildOf(h.canonical))continue;{const T=t.canonical.z-h.canonical.z,P=t.canonical.x-(t.canonical.x>>T<<T),M=t.canonical.y-(t.canonical.y>>T<<T),I=d.a6>>T;d.c7(b,0,d.a6,d.a6,0,0,1),d.Q(b,b,[P*I,M*I,0]),d.S(b,b,[1/2**T,1/2**T,0])}}g.terrainRttPosMatrix32f=new Float32Array(b),n[l]=g}return n}_getTerrainCoordsForTileRanges(t,n){const l={};for(const h of this._renderableTilesKeys){const g=this._tiles[h].tileID;if(!this._isWithinTileRanges(g,n))continue;const b=t.clone(),T=d.bj();if(g.canonical.z===t.canonical.z){const P=t.canonical.x-g.canonical.x+t.wrap*(1<<t.canonical.z),M=t.canonical.y-g.canonical.y;d.c7(T,0,d.a6,d.a6,0,0,1),d.Q(T,T,[P*d.a6,M*d.a6,0])}else if(g.canonical.z>t.canonical.z){const P=g.canonical.z-t.canonical.z,M=g.canonical.x-(g.canonical.x>>P<<P)+t.wrap*(1<<g.canonical.z),I=g.canonical.y-(g.canonical.y>>P<<P),R=t.canonical.x-(g.canonical.x>>P),L=t.canonical.y-(g.canonical.y>>P),O=d.a6>>P;d.c7(T,0,O,O,0,0,1),d.Q(T,T,[-M*O+R*d.a6,-I*O+L*d.a6,0])}else{const P=t.canonical.z-g.canonical.z,M=t.canonical.x-(t.canonical.x>>P<<P)+t.wrap*(1<<t.canonical.z),I=t.canonical.y-(t.canonical.y>>P<<P),R=(t.canonical.x>>P)-g.canonical.x,L=(t.canonical.y>>P)-g.canonical.y,O=d.a6<<P;d.c7(T,0,O,O,0,0,1),d.Q(T,T,[M*d.a6+R*O,I*d.a6+L*O,0])}b.terrainRttPosMatrix32f=new Float32Array(T),l[h]=b}return l}getSourceTile(t,n){var l,h;const g=this.tileManager._source;let b=t.overscaledZ-this.deltaZoom;if(b>g.maxzoom&&(b=g.maxzoom),b<g.minzoom)return;(l=this._sourceTileCache)[h=t.key]||(l[h]=t.scaledTo(b).key);let T=this.findTileInCaches(this._sourceTileCache[t.key]);if(!(T!=null&&T.dem)&&n)for(;b>=g.minzoom&&!(T!=null&&T.dem);)T=this.findTileInCaches(t.scaledTo(b--).key);return T}findTileInCaches(t){let n=this.tileManager.getTileByID(t);return n||(n=this.tileManager._outOfViewCache.getByKey(t),n)}anyTilesAfterTime(t=Date.now()){return this._lastTilesetChange>=t}_isWithinTileRanges(t,n){const l=n[t.canonical.z];return!!l&&(t.wrap>l.minWrap||t.wrap<l.maxWrap||t.canonical.x>=l.minTileXWrapped&&t.canonical.x<=l.maxTileXWrapped&&t.canonical.y>=l.minTileY&&t.canonical.y<=l.maxTileY)}}class cn{constructor(t,n,l){this._meshCache={},this.painter=t,this.tileManager=new ou(n),this.options=l,this.exaggeration=typeof l.exaggeration=="number"?l.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}destroy(){this._fbo&&(this._fbo.destroy(),this._fbo=null),this._fboCoordsTexture&&(this._fboCoordsTexture.destroy(),this._fboCoordsTexture=null),this._fboDepthTexture&&(this._fboDepthTexture.destroy(),this._fboDepthTexture=null),this._emptyDemTexture&&(this._emptyDemTexture.destroy(),this._emptyDemTexture=null),this._emptyDepthTexture&&(this._emptyDepthTexture.destroy(),this._emptyDepthTexture=null),this._coordsTexture&&(this._coordsTexture.destroy(),this._coordsTexture=null);for(const t in this._meshCache)this._meshCache[t].destroy();this._meshCache={},this.tileManager.destruct()}getDEMElevation(t,n,l,h=d.a6){var g;const b=t.normalizeCoordinates(n,l,h);if(!b)return 0;const T=this.getTerrainData(b.tileID),P=(g=T.tile)===null||g===void 0?void 0:g.dem;if(!P)return 0;const M=d.cC([],[b.x/h*d.a6,b.y/h*d.a6],T.u_terrain_matrix),I=[M[0]*P.dim,M[1]*P.dim],R=Math.floor(I[0]),L=Math.floor(I[1]),O=I[0]-R,$=I[1]-L;return P.get(R,L)*(1-O)*(1-$)+P.get(R+1,L)*O*(1-$)+P.get(R,L+1)*(1-O)*$+P.get(R+1,L+1)*O*$}getElevationForLngLatZoom(t,n){if(!d.cD(n,t.wrap()))return 0;const{tileID:l,mercatorX:h,mercatorY:g}=this._getOverscaledTileIDFromLngLatZoom(t,n);return this.getElevation(l,h%d.a6,g%d.a6,d.a6)}getElevationForLngLat(t,n){const l=Gn(n,{maxzoom:this.tileManager.maxzoom,minzoom:this.tileManager.minzoom,tileSize:512,terrain:this});let h=0;for(const g of l)g.canonical.z>h&&(h=Math.min(g.canonical.z,this.tileManager.maxzoom));return this.getElevationForLngLatZoom(t,h)}getElevation(t,n,l,h=d.a6){return this.getDEMElevation(t,n,l,h)*this.exaggeration}getTerrainData(t){var n,l;if(!this._emptyDemTexture){const b=this.painter.context,T=new d.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new d.T(b,T,b.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new d.T(b,new d.R({width:1,height:1}),b.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(b.gl.NEAREST,b.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=d.ap([])}const h=this.tileManager.getSourceTile(t,!0);if(h!=null&&h.dem&&(!h.demTexture||h.needsTerrainPrepare)){const b=this.painter.context;h.demTexture=this.painter.getTileTexture(h.dem.stride),h.demTexture?h.demTexture.update(h.dem.getPixels(),{premultiply:!1}):h.demTexture=new d.T(b,h.dem.getPixels(),b.gl.RGBA,{premultiply:!1}),h.demTexture.bind(b.gl.NEAREST,b.gl.CLAMP_TO_EDGE),h.needsTerrainPrepare=!1}const g=h&&h.toString()+h.tileID.key+t.key;if(g&&!this._demMatrixCache[g]){const b=this.tileManager.getSource().maxzoom;let T=t.canonical.z-h.tileID.canonical.z;t.overscaledZ>t.canonical.z&&(t.canonical.z>=b?T=t.canonical.z-b:d.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const P=t.canonical.x-(t.canonical.x>>T<<T),M=t.canonical.y-(t.canonical.y>>T<<T),I=d.cE(new Float64Array(16),[1/(d.a6<<T),1/(d.a6<<T),0]);d.Q(I,I,[P*d.a6,M*d.a6,0]),this._demMatrixCache[g]={matrix:I,coord:t}}return{u_depth:2,u_terrain:3,u_terrain_dim:((n=h==null?void 0:h.dem)===null||n===void 0?void 0:n.dim)||1,u_terrain_matrix:g?this._demMatrixCache[g].matrix:this._emptyDemMatrix,u_terrain_unpack:((l=h==null?void 0:h.dem)===null||l===void 0?void 0:l.getUnpackVector())||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:((h==null?void 0:h.demTexture)||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:h}}getFramebuffer(t){const n=this.painter,l=n.width/devicePixelRatio,h=n.height/devicePixelRatio;return!this._fbo||this._fbo.width===l&&this._fbo.height===h||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new d.T(n.context,{width:l,height:h,data:null},n.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(n.context.gl.NEAREST,n.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new d.T(n.context,{width:l,height:h,data:null},n.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(n.context.gl.NEAREST,n.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=n.context.createFramebuffer(l,h,!0,!1),this._fbo.depthAttachment.set(n.context.createRenderbuffer(n.context.gl.DEPTH_COMPONENT16,l,h))),this._fbo.colorAttachment.set(t==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const t=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const n=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let g=0,b=0;g<this._coordsTextureSize;g++)for(let T=0;T<this._coordsTextureSize;T++,b+=4)n[b+0]=255&T,n[b+1]=255&g,n[b+2]=T>>8<<4|g>>8,n[b+3]=0;const l=new d.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(n.buffer)),h=new d.T(t,l,t.gl.RGBA,{premultiply:!1});return h.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=h,h}pointCoordinate(t){this.painter.maybeDrawDepth(!0),this.painter.maybeDrawCoords();const n=new Uint8Array(4),l=this.painter.context,h=l.gl,g=Math.round(t.x*this.painter.pixelRatio/devicePixelRatio),b=Math.round(t.y*this.painter.pixelRatio/devicePixelRatio),T=Math.round(this.painter.height/devicePixelRatio);l.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),h.readPixels(g,T-b-1,1,1,h.RGBA,h.UNSIGNED_BYTE,n),l.bindFramebuffer.set(null);const P=n[0]+(n[2]>>4<<8),M=n[1]+((15&n[2])<<8),I=this.coordsIndex[255-n[3]],R=I&&this.tileManager.getTileByID(I);if(!R)return null;const L=this._coordsTextureSize,O=(1<<R.tileID.canonical.z)*L;return new d.a7((R.tileID.canonical.x*L+P)/O+R.tileID.wrap,(R.tileID.canonical.y*L+M)/O,this.getElevation(R.tileID,P,M,L))}depthAtPoint(t){const n=new Uint8Array(4),l=this.painter.context,h=l.gl;return l.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),h.readPixels(t.x,this.painter.height/devicePixelRatio-t.y-1,1,1,h.RGBA,h.UNSIGNED_BYTE,n),l.bindFramebuffer.set(null),(n[0]/16777216+n[1]/65536+n[2]/256+n[3])/256}getTerrainMesh(t){var n;const l=((n=this.painter.style.projection)===null||n===void 0?void 0:n.transitionState)>0,h=l&&t.canonical.y===0,g=l&&t.canonical.y===(1<<t.canonical.z)-1,b=`m_${h?"n":""}_${g?"s":""}`;if(this._meshCache[b])return this._meshCache[b];const T=this.painter.context,P=new d.cF,M=new d.aW,I=this.meshSize,R=d.a6/I,L=I*I;for(let J=0;J<=I;J++)for(let pe=0;pe<=I;pe++)P.emplaceBack(pe*R,J*R,0);for(let J=0;J<L;J+=I+1)for(let pe=0;pe<I;pe++)M.emplaceBack(pe+J,I+pe+J+1,I+pe+J+2),M.emplaceBack(pe+J,I+pe+J+2,pe+J+1);const O=P.length,$=O+(I+1),Z=(I+1)*I,Y=h?d.bq:0,H=h?0:1,K=g?d.br:d.a6,ie=g?0:1;for(let J=0;J<=I;J++)P.emplaceBack(J*R,Y,H);for(let J=0;J<=I;J++)P.emplaceBack(J*R,K,ie);for(let J=0;J<I;J++)M.emplaceBack(Z+J,$+J,$+J+1),M.emplaceBack(Z+J,$+J+1,Z+J+1),M.emplaceBack(0+J,O+J+1,O+J),M.emplaceBack(0+J,0+J+1,O+J+1);const Q=P.length,X=Q+2*(I+1);for(const J of[0,1])for(let pe=0;pe<=I;pe++)for(const xe of[0,1])P.emplaceBack(J*d.a6,pe*R,xe);for(let J=0;J<2*I;J+=2)M.emplaceBack(Q+J,Q+J+1,Q+J+3),M.emplaceBack(Q+J,Q+J+3,Q+J+2),M.emplaceBack(X+J,X+J+3,X+J+1),M.emplaceBack(X+J,X+J+2,X+J+3);const re=new fr(T.createVertexBuffer(P,Nh.members),T.createIndexBuffer(M),d.aV.simpleSegment(0,0,P.length,M.length));return this._meshCache[b]=re,re}getMeshFrameDelta(t){return 2*Math.PI*d.bD/Math.pow(2,Math.max(t,0))/5}getMinTileElevationForLngLatZoom(t,n){var l;if(!d.cD(n,t.wrap()))return 0;const{tileID:h}=this._getOverscaledTileIDFromLngLatZoom(t,n);return(l=this.getMinMaxElevation(h).minElevation)!==null&&l!==void 0?l:0}getMinMaxElevation(t){const n=this.getTerrainData(t).tile,l={minElevation:null,maxElevation:null};return n!=null&&n.dem&&(l.minElevation=n.dem.min*this.exaggeration,l.maxElevation=n.dem.max*this.exaggeration),l}_getOverscaledTileIDFromLngLatZoom(t,n){const l=d.a7.fromLngLat(t.wrap()),h=(1<<n)*d.a6,g=l.x*h,b=l.y*h,T=Math.floor(g/d.a6),P=Math.floor(b/d.a6);return{tileID:new d.a3(n,0,n,T,P),mercatorX:g,mercatorY:b}}}class mr{constructor(t,n,l){this._context=t,this._size=n,this._tileSize=l,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const t of this._objects)t.texture.destroy(),t.fbo.destroy()}_createObject(t){const n=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),l=new d.T(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return l.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),this._context.extTextureFilterAnisotropic&&this._context.gl.texParameterf(this._context.gl.TEXTURE_2D,this._context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this._context.extTextureFilterAnisotropicMax),n.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),n.colorAttachment.set(l.texture),{id:t,fbo:n,texture:l,stamp:-1,inUse:!1}}getObjectForId(t){return this._objects[t]}useObject(t){t.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter((n=>t.id!==n)),this._recentlyUsed.push(t.id)}stampObject(t){t.stamp=++this._stamp}getOrCreateFreeObject(){for(const n of this._recentlyUsed)if(!this._objects[n].inUse)return this._objects[n];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const t=this._createObject(this._objects.length);return this._objects.push(t),t}freeObject(t){t.inUse=!1}freeAllObjects(){for(const t of this._objects)this.freeObject(t)}isFull(){return!(this._objects.length<this._size)&&this._objects.some((t=>!t.inUse))===!1}}const sr={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0,"color-relief":!0};class ja{constructor(t,n){this.painter=t,this.terrain=n,this.pool=new mr(t.context,30,n.tileManager.tileSize*n.qualityFactor)}destruct(){this.pool.destruct()}getTexture(t){return this.pool.getObjectForId(t.rtt[this._stacks.length-1].id).texture}prepareForRender(t,n){var l,h,g;this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.tileManager.getRenderableTiles(),this._renderableLayerIds=t._order.filter((b=>!t._layers[b].isHidden(n))),this._coordsAscending={};for(const b in t.tileManagers){this._coordsAscending[b]={};const T=t.tileManagers[b].getVisibleCoordinates(),P=t.tileManagers[b].getSource(),M=P instanceof $n?P.terrainTileRanges:null;for(const I of T){const R=this.terrain.tileManager.getTerrainCoords(I,M);for(const L in R)(g=this._coordsAscending[b])[L]||(g[L]=[]),this._coordsAscending[b][L].push(R[L])}}this._rttFingerprints={};for(const b of t._order){const T=t._layers[b],P=T.source;if(sr[T.type]&&!this._rttFingerprints[P]){this._rttFingerprints[P]={};const M=(h=(l=t.tileManagers[P])===null||l===void 0?void 0:l.getState().revision)!==null&&h!==void 0?h:0;for(const I in this._coordsAscending[P])this._rttFingerprints[P][I]=`${this._coordsAscending[P][I].map((R=>R.key)).sort().join()}#${M}`}}for(const b of this._renderableTiles)for(const T in this._rttFingerprints){const P=this._rttFingerprints[T][b.tileID.key];P&&P!==b.rttFingerprint[T]&&(b.rtt=[])}}renderLayer(t,n){if(t.isHidden(this.painter.transform.zoom))return!1;const l=Object.assign(Object.assign({},n),{isRenderingToTexture:!0}),h=t.type,g=this.painter,b=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(sr[h]&&(this._prevType&&sr[this._prevType]||this._stacks.push([]),this._prevType=h,this._stacks[this._stacks.length-1].push(t.id),!b))return!0;if(sr[this._prevType]||sr[h]&&b){this._prevType=h;const T=this._stacks.length-1,P=this._stacks[T]||[];for(const M of this._renderableTiles){if(this.pool.isFull()&&(tl(this.painter,this.terrain,this._rttTiles,l),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(M),M.rtt[T]){const R=this.pool.getObjectForId(M.rtt[T].id);if(R.stamp===M.rtt[T].stamp){this.pool.useObject(R);continue}}const I=this.pool.getOrCreateFreeObject();this.pool.useObject(I),this.pool.stampObject(I),M.rtt[T]={id:I.id,stamp:I.stamp},g.context.bindFramebuffer.set(I.fbo.framebuffer),g.context.clear({color:d.bo.transparent,stencil:0}),g.currentStencilSource=void 0;for(const R of P){const L=g.style._layers[R],O=L.source?this._coordsAscending[L.source][M.tileID.key]:[M.tileID];g.context.viewport.set([0,0,I.fbo.width,I.fbo.height]),g._renderTileClippingMasks(L,O,!0),g.renderLayer(g,g.style.tileManagers[L.source],L,O,l),L.source&&(M.rttFingerprint[L.source]=this._rttFingerprints[L.source][M.tileID.key])}}return tl(this.painter,this.terrain,this._rttTiles,l),this._rttTiles=[],this.pool.freeAllObjects(),sr[h]}return!1}}const xs={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Drag to rotate map, click to reset north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","GlobeControl.Enable":"Enable globe","GlobeControl.Disable":"Disable globe","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use ⌘ + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},ua=Me,au={hash:!1,interactive:!0,bearingSnap:7,zoomSnap:0,attributionControl:ro,maplibreLogo:!1,refreshExpiredTiles:!0,canvasContextAttributes:{antialias:!1,preserveDrawingBuffer:!1,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,desynchronized:!1,contextType:void 0},scrollZoom:!0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],elevation:0,zoom:0,bearing:0,pitch:0,roll:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:d.c.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,transformConstrain:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,rollEnabled:!1,reduceMotion:void 0,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0,experimentalZoomLevelsToOverscale:void 0,anisotropicFilterPitch:20};let ll=class extends Do{get _ownerWindow(){var f,t;return((t=(f=this._container)===null||f===void 0?void 0:f.ownerDocument)===null||t===void 0?void 0:t.defaultView)||window}constructor(f){var t,n,l;const h=Object.assign(Object.assign(Object.assign({},au),f),{canvasContextAttributes:Object.assign(Object.assign({},au.canvasContextAttributes),f.canvasContextAttributes)});if(h.minZoom!=null&&h.maxZoom!=null&&h.minZoom>h.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(h.minPitch!=null&&h.maxPitch!=null&&h.minPitch>h.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(h.minPitch!=null&&h.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(h.maxPitch!=null&&h.maxPitch>180)throw new Error("maxPitch must be less than or equal to 180");const g=new Eo,b=new Yo;h.minZoom!==void 0&&g.setMinZoom(h.minZoom),h.maxZoom!==void 0&&g.setMaxZoom(h.maxZoom),h.minPitch!==void 0&&g.setMinPitch(h.minPitch),h.maxPitch!==void 0&&g.setMaxPitch(h.maxPitch),h.renderWorldCopies!==void 0&&g.setRenderWorldCopies(h.renderWorldCopies),h.transformConstrain!==null&&g.setConstrainOverride(h.transformConstrain),super(g,b,{bearingSnap:h.bearingSnap,zoomSnap:h.zoomSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new nc,this._controls=[],this._mapId=d.ad(),this._lostContextStyle={style:null,images:null},this._contextLost=P=>{if(P.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.painter.destroy(),this._lostContextStyle=this._getStyleAndImages(),this.style){for(const M of Object.values(this.style._layers))if(M.type==="custom"&&console.warn(`Custom layer with id '${M.id}' cannot be restored after WebGL context loss. You will need to re-add it manually after context restoration.`),M._listeners)for(const[I]of Object.entries(M._listeners))console.warn(`Custom layer with id '${M.id}' had event listeners for event '${I}' which cannot be restored after WebGL context loss. You will need to re-add them manually after context restoration.`);this.style.destroy(),this.style=null,this.fire(new d.n("webglcontextlost",{originalEvent:P}))}else this.fire(new d.n("webglcontextlost",{originalEvent:P}))},this._contextRestored=P=>{this._lostContextStyle.style&&this.setStyle(this._lostContextStyle.style,{diff:!1}),this._lostContextStyle.images&&this.style&&(this.style.imageManager.images=this._lostContextStyle.images),this._lostContextStyle={style:null,images:null},this._setupPainter(),this.resize(),this._update(),this._resizeInternal(),this.fire(new d.n("webglcontextrestored",{originalEvent:P}))},this._onMapScroll=P=>{if(P.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=h.interactive,this._maxTileCacheSize=h.maxTileCacheSize,this._maxTileCacheZoomLevels=h.maxTileCacheZoomLevels,this._canvasContextAttributes=Object.assign({},h.canvasContextAttributes),this._trackResize=h.trackResize===!0,this._bearingSnap=h.bearingSnap,this._zoomSnap=h.zoomSnap,this._centerClampedToGround=h.centerClampedToGround,this._refreshExpiredTiles=h.refreshExpiredTiles===!0,this._fadeDuration=h.fadeDuration,this._crossSourceCollisions=h.crossSourceCollisions===!0,this._collectResourceTiming=h.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},xs),h.locale),this._clickTolerance=h.clickTolerance,this._overridePixelRatio=h.pixelRatio,this._maxCanvasSize=h.maxCanvasSize,this._zoomLevelsToOverscale=h.experimentalZoomLevelsToOverscale,this.transformCameraUpdate=h.transformCameraUpdate,this.transformConstrain=h.transformConstrain,this.cancelPendingTileRequestsWhileZooming=h.cancelPendingTileRequestsWhileZooming===!0,this.setAnisotropicFilterPitch(h.anisotropicFilterPitch),h.reduceMotion!==void 0&&(Wt.prefersReducedMotion=h.reduceMotion),this._imageQueueHandle=Br.addThrottleControl((()=>this.isMoving())),this._requestManager=new Bt(h.transformRequest),this._container=this._resolveContainer(h.container),h.maxBounds&&this.setMaxBounds(h.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",(()=>this._update(!1))),this.on("moveend",(()=>this._update(!1))),this.on("zoom",(()=>this._update(!0))),this.on("terrain",(()=>{this.painter.terrainFacilitator.depthDirty=!0,this._update(!0)})),this.once("idle",(()=>this._idleTriggered=!0)),typeof window<"u"&&(this._ownerWindow.addEventListener("online",this._onWindowOnline,!1),this._setupResizeObserver()),this.handlers=new Oi(this,h),this._hash=h.hash?new Tn(typeof h.hash=="string"&&h.hash||void 0).addTo(this):void 0,!((t=this._hash)===null||t===void 0)&&t._onHashChange()||(this.jumpTo({center:h.center,elevation:h.elevation,zoom:h.zoom,bearing:h.bearing,pitch:h.pitch,roll:h.roll}),h.bounds&&(this.resize(),this.fitBounds(h.bounds,d.e({},h.fitBoundsOptions,{duration:0}))));const T=typeof h.style=="string"||((l=(n=h.style)===null||n===void 0?void 0:n.projection)===null||l===void 0?void 0:l.type)!=="globe";this.resize(null,T),this._localIdeographFontFamily=h.localIdeographFontFamily,this._validateStyle=h.validateStyle,h.style&&this.setStyle(h.style,{localIdeographFontFamily:h.localIdeographFontFamily}),h.attributionControl&&this.addControl(new Qi(typeof h.attributionControl=="boolean"?void 0:h.attributionControl)),h.maplibreLogo&&this.addControl(new ic,h.logoPosition),this.on("style.load",(()=>{if(T||this._resizeTransform(),this.transform.unmodified){const P=d.V(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(P)}})),this.on("data",(P=>{this._update(P.dataType==="style"),this.fire(new d.n(`${P.dataType}data`,P))})),this.on("dataloading",(P=>{this.fire(new d.n(`${P.dataType}dataloading`,P))})),this.on("dataabort",(P=>{this.fire(new d.n("sourcedataabort",P))}))}_getMapId(){return this._mapId}setGlobalStateProperty(f,t){return this.style.setGlobalStateProperty(f,t),this._update(!0)}getGlobalState(){return this.style.getGlobalState()}addControl(f,t){if(t===void 0&&(t=f.getDefaultPosition?f.getDefaultPosition():"top-right"),!(f!=null&&f.onAdd))return this.fire(new d.l(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const n=f.onAdd(this);this._controls.push(f);const l=this._controlPositions[t];return t.includes("bottom")?l.insertBefore(n,l.firstChild):l.appendChild(n),this}removeControl(f){if(!(f!=null&&f.onRemove))return this.fire(new d.l(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(f);return t>-1&&this._controls.splice(t,1),f.onRemove(this),this}hasControl(f){return this._controls.includes(f)}coveringTiles(f){return Gn(this.transform,f)}calculateCameraOptionsFromTo(f,t,n,l){return l==null&&this.terrain&&(l=this.terrain.getElevationForLngLat(n,this.transform)),super.calculateCameraOptionsFromTo(f,t,n,l)}resize(f,t=!0){if(this._lostContextStyle.style!==null)return this;this._resizeInternal(t);const n=!this._moving;return n&&(this.stop(),this.fire(new d.n("movestart",f)).fire(new d.n("move",f))),this.fire(new d.n("resize",f)),n&&this.fire(new d.n("moveend",f)),this}_resizeInternal(f=!0){const[t,n]=this._containerDimensions(),l=this._getClampedPixelRatio(t,n);if(this._resizeCanvas(t,n,l),this.painter.resize(t,n,l),this.painter.overLimit()){const h=this.painter.context.gl;this._maxCanvasSize=[h.drawingBufferWidth,h.drawingBufferHeight];const g=this._getClampedPixelRatio(t,n);this._resizeCanvas(t,n,g),this.painter.resize(t,n,g)}this._resizeTransform(f)}_resizeTransform(f=!0){var t;const[n,l]=this._containerDimensions();this.transform.resize(n,l,f),(t=this._requestedCameraState)===null||t===void 0||t.resize(n,l,f)}_getClampedPixelRatio(f,t){const{0:n,1:l}=this._maxCanvasSize,h=this.getPixelRatio(),g=f*h,b=t*h;return Math.min(g>n?n/g:1,b>l?l/b:1)*h}getPixelRatio(){var f;return(f=this._overridePixelRatio)!==null&&f!==void 0?f:devicePixelRatio}setPixelRatio(f){this._overridePixelRatio=f,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(f){return this.transform.setMaxBounds(Ie.convert(f)),this._update()}setMinZoom(f){if((f=f??-2)>=-2&&f<=this.transform.maxZoom){const t=this.transform.zoom,n=this._getTransformForUpdate();return n.setMinZoom(f),this._applyUpdatedTransform(n),this._update(),t!==this.transform.zoom&&this.fire(new d.n("zoomstart")).fire(new d.n("zoom")).fire(new d.n("zoomend")).fire(new d.n("movestart")).fire(new d.n("move")).fire(new d.n("moveend")),this}throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(f){if((f=f??22)>=this.transform.minZoom){const t=this.transform.zoom,n=this._getTransformForUpdate();return n.setMaxZoom(f),this._applyUpdatedTransform(n),this._update(),t!==this.transform.zoom&&this.fire(new d.n("zoomstart")).fire(new d.n("zoom")).fire(new d.n("zoomend")).fire(new d.n("movestart")).fire(new d.n("move")).fire(new d.n("moveend")),this}throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(f){if((f=f??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(f>=0&&f<=this.transform.maxPitch){const t=this.transform.pitch,n=this._getTransformForUpdate();return n.setMinPitch(f),this._applyUpdatedTransform(n),this._update(),t!==this.transform.pitch&&this.fire(new d.n("pitchstart")).fire(new d.n("pitch")).fire(new d.n("pitchend")).fire(new d.n("movestart")).fire(new d.n("move")).fire(new d.n("moveend")),this}throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(f){if((f=f??60)>180)throw new Error("maxPitch must be less than or equal to 180");if(f>=this.transform.minPitch){const t=this.transform.pitch,n=this._getTransformForUpdate();return n.setMaxPitch(f),this._applyUpdatedTransform(n),this._update(),t!==this.transform.pitch&&this.fire(new d.n("pitchstart")).fire(new d.n("pitch")).fire(new d.n("pitchend")).fire(new d.n("movestart")).fire(new d.n("move")).fire(new d.n("moveend")),this}throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getAnisotropicFilterPitch(){return this._anisotropicFilterPitch}setAnisotropicFilterPitch(f){if((f=f??20)>180)throw new Error("anisotropicFilterPitch must be less than or equal to 180");if(f<0)throw new Error("anisotropicFilterPitch must be greater than or equal to 0");return this._anisotropicFilterPitch=f,this._update()}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(f){return this.transform.setRenderWorldCopies(f),this._update()}setTransformConstrain(f){return this.transform.setConstrainOverride(f),this._update()}project(f){return this.transform.locationToScreenPoint(d.W.convert(f),this.style&&this.terrain)}unproject(f){return this.transform.screenPointToLocation(d.P.convert(f),this.terrain)}isMoving(){var f;return this._moving||((f=this.handlers)===null||f===void 0?void 0:f.isMoving())}isZooming(){var f;return this._zooming||((f=this.handlers)===null||f===void 0?void 0:f.isZooming())}isRotating(){var f;return this._rotating||((f=this.handlers)===null||f===void 0?void 0:f.isRotating())}_createDelegatedListener(f,t,n){if(f==="mouseenter"||f==="mouseover"){let l=!1;return{layers:t,listener:n,delegates:{mousemove:g=>{const b=t.filter((P=>this.getLayer(P))),T=b.length!==0?this.queryRenderedFeatures(g.point,{layers:b}):[];T.length?l||(l=!0,n.call(this,new Rr(f,this,g.originalEvent,{features:T}))):l=!1},mouseout:()=>{l=!1}}}}if(f==="mouseleave"||f==="mouseout"){let l=!1;return{layers:t,listener:n,delegates:{mousemove:b=>{const T=t.filter((P=>this.getLayer(P)));(T.length!==0?this.queryRenderedFeatures(b.point,{layers:T}):[]).length?l=!0:l&&(l=!1,n.call(this,new Rr(f,this,b.originalEvent)))},mouseout:b=>{l&&(l=!1,n.call(this,new Rr(f,this,b.originalEvent)))}}}}{const l=h=>{const g=t.filter((T=>this.getLayer(T))),b=g.length!==0?this.queryRenderedFeatures(h.point,{layers:g}):[];b.length&&(h.features=b,n.call(this,h),delete h.features)};return{layers:t,listener:n,delegates:{[f]:l}}}}_saveDelegatedListener(f,t){var n;this._delegatedListeners||(this._delegatedListeners={}),(n=this._delegatedListeners)[f]||(n[f]=[]),this._delegatedListeners[f].push(t)}_removeDelegatedListener(f,t,n){var l;if(!(!((l=this._delegatedListeners)===null||l===void 0)&&l[f]))return;const h=this._delegatedListeners[f];for(let g=0;g<h.length;g++){const b=h[g];if(b.listener===n&&b.layers.length===t.length&&b.layers.every((T=>t.includes(T)))){for(const T in b.delegates)this.off(T,b.delegates[T]);return void h.splice(g,1)}}}on(f,t,n){if(n===void 0)return super.on(f,t);const l=typeof t=="string"?[t]:t,h=this._createDelegatedListener(f,l,n);this._saveDelegatedListener(f,h);for(const g in h.delegates)this.on(g,h.delegates[g]);return{unsubscribe:()=>{this._removeDelegatedListener(f,l,n)}}}once(f,t,n){if(n===void 0)return super.once(f,t);const l=typeof t=="string"?[t]:t,h=this._createDelegatedListener(f,l,n);for(const g in h.delegates){const b=h.delegates[g];h.delegates[g]=(...T)=>{this._removeDelegatedListener(f,l,n),b(...T)}}this._saveDelegatedListener(f,h);for(const g in h.delegates)this.once(g,h.delegates[g]);return this}off(f,t,n){return n===void 0?super.off(f,t):(this._removeDelegatedListener(f,typeof t=="string"?[t]:t,n),this)}queryRenderedFeatures(f,t){if(!this.style)return[];let n;const l=f instanceof d.P||Array.isArray(f),h=l?f:[[0,0],[this.transform.width,this.transform.height]];if(t||(t=(l?{}:f)||{}),h instanceof d.P||typeof h[0]=="number")n=[d.P.convert(h)];else{const g=d.P.convert(h[0]),b=d.P.convert(h[1]);n=[g,new d.P(b.x,g.y),b,new d.P(g.x,b.y),g]}return this.style.queryRenderedFeatures(n,t,this.transform)}querySourceFeatures(f,t){return this.style.querySourceFeatures(f,t)}setStyle(f,t){return(t=d.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},t)).diff!==!1&&t.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&f?(this._diffStyle(f,t),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._updateStyle(f,t))}setTransformRequest(f){return this._requestManager.setTransformRequest(f),this}_getUIString(f){const t=this._locale[f];if(t==null)throw new Error(`Missing UI string '${f}'`);return t}_updateStyle(f,t){var n,l,h;if((n=this._diffStyleRequest)===null||n===void 0||n.abort(),this._diffStyleRequest=null,t.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",(()=>this._updateStyle(f,t)));const g=this.style&&t.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!f)),f?(this.style=new us(this,t||{}),this.style.setEventedParent(this,{style:this.style}),typeof f=="string"?this.style.loadURL(f,t,g):this.style.loadJSON(f,t,g),this):(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),(h=(l=this.style)===null||l===void 0?void 0:l.projection)===null||h===void 0||h.destroy(),delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new us(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(f,t){return d._(this,void 0,void 0,(function*(){var n;if((n=this._diffStyleRequest)===null||n===void 0||n.abort(),typeof f=="string"){const l=f;this._diffStyleRequest=new AbortController;const h=this._diffStyleRequest;try{const g=yield this._requestManager.transformRequest(l,"Style");if(h.signal.aborted)return void(this._diffStyleRequest=null);const b=yield d.k(g,h);this._diffStyleRequest=null,this._updateDiff(b.data,t)}catch(g){this._diffStyleRequest=null,d.$(g)||this.fire(new d.l(d.d(g)))}}else typeof f=="object"&&(this._diffStyleRequest=null,this._updateDiff(f,t))}))}_updateDiff(f,t){try{this.style.setState(f,t)&&this._update(!0)}catch(n){d.w(`Unable to perform style diff: ${d.d(n).message}. Rebuilding the style from scratch.`),this._updateStyle(f,t)}}getStyle(){if(this.style)return this.style.serialize()}_getStyleAndImages(){return this.style?{style:this.style.serialize(),images:this.style.imageManager.cloneImages()}:{style:null,images:{}}}isStyleLoaded(){if(this.style)return this.style.loaded();d.w("There is no style added to the map.")}addSource(f,t){return this._lazyInitEmptyStyle(),this.style.addSource(f,t),this._update(!0)}isSourceLoaded(f){var t;const n=(t=this.style)===null||t===void 0?void 0:t.tileManagers[f];if(n!==void 0)return n.loaded();this.fire(new d.l(new Error(`There is no tile manager with ID '${f}'`)))}setTerrain(f){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),f){const t=this.style.tileManagers[f.source];if(!t)throw new Error(`cannot load terrain, because there exists no source with ID: ${f.source}`);this.terrain===null&&t.reload();for(const n in this.style._layers){const l=this.style._layers[n];l.type==="hillshade"&&l.source===f.source&&d.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality."),l.type==="color-relief"&&l.source===f.source&&d.w("You are using the same source for a color-relief layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new cn(this.painter,t,f),this.painter.renderToTexture=new ja(this.painter,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._terrainDataCallback=n=>{var l;n.dataType==="style"?this.terrain.tileManager.freeRtt():n.dataType==="source"&&n.tile&&(n.sourceId!==f.source||this._elevationFreeze||(this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))),((l=n.source)===null||l===void 0?void 0:l.type)==="image"?this.terrain.tileManager.freeRtt():this.terrain.tileManager.freeRtt(n.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.destroy(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0);return this.fire(new d.n("terrain",{terrain:f})),this}getTerrain(){var f,t;return(t=(f=this.terrain)===null||f===void 0?void 0:f.options)!==null&&t!==void 0?t:null}areTilesLoaded(){var f;const t=(f=this.style)===null||f===void 0?void 0:f.tileManagers;for(const n of Object.values(t))if(!n.areTilesLoaded())return!1;return!0}removeSource(f){return this.style.removeSource(f),this._update(!0)}getSource(f){return this.style.getSource(f)}setSourceTileLodParams(f,t,n){if(n){const l=this.getSource(n);if(!l)throw new Error(`There is no source with ID "${n}", cannot set LOD parameters`);l.calculateTileZoom=ku(Math.max(1,f),Math.max(1,t))}else for(const l in this.style.tileManagers)this.style.tileManagers[l].getSource().calculateTileZoom=ku(Math.max(1,f),Math.max(1,t));return this._update(!0),this}refreshTiles(f,t){const n=this.style.tileManagers[f];if(!n)throw new Error(`There is no tile manager with ID "${f}", cannot refresh tile`);t===void 0?n.reload(!0):n.refreshTiles(t.map((l=>new d.aa(l.z,l.x,l.y))))}addImage(f,t,n={}){const{pixelRatio:l=1,sdf:h=!1,stretchX:g,stretchY:b,content:T,textFitWidth:P,textFitHeight:M}=n;if(this._lazyInitEmptyStyle(),!(t instanceof HTMLImageElement||d.b(t))){if(t.width===void 0||t.height===void 0)return this.fire(new d.l(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:I,height:R,data:L}=t,O=t;return this.style.addImage(f,{data:new d.R({width:I,height:R},new Uint8Array(L)),pixelRatio:l,stretchX:g,stretchY:b,content:T,textFitWidth:P,textFitHeight:M,sdf:h,version:0,userImage:O}),O.onAdd&&O.onAdd(this,f),this}}{const{width:I,height:R,data:L}=Wt.getImageData(t);this.style.addImage(f,{data:new d.R({width:I,height:R},L),pixelRatio:l,stretchX:g,stretchY:b,content:T,textFitWidth:P,textFitHeight:M,sdf:h,version:0})}}updateImage(f,t){const n=this.style.getImage(f);if(!n)return this.fire(new d.l(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const l=t instanceof HTMLImageElement||d.b(t)?Wt.getImageData(t):t,{width:h,height:g,data:b}=l;if(h===void 0||g===void 0)return this.fire(new d.l(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(h!==n.data.width||g!==n.data.height)return this.fire(new d.l(new Error("The width and height of the updated image must be that same as the previous version of the image")));const T=!(t instanceof HTMLImageElement||d.b(t));return n.data.replace(b,T),this.style.updateImage(f,n),this}getImage(f){return this.style.getImage(f)}hasImage(f){return f?!!this.style.getImage(f):(this.fire(new d.l(new Error("Missing required image id"))),!1)}removeImage(f){this.style.removeImage(f)}loadImage(f){return d._(this,void 0,void 0,(function*(){return Br.getImage(yield this._requestManager.transformRequest(f,"Image"),new AbortController)}))}listImages(){return this.style.listImages()}addLayer(f,t){return this._lazyInitEmptyStyle(),this.style.addLayer(f,t),this._update(!0)}moveLayer(f,t){return this.style.moveLayer(f,t),this._update(!0)}removeLayer(f){return this.style.removeLayer(f),this._update(!0)}getLayer(f){return this.style.getLayer(f)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(f,t,n){return this.style.setLayerZoomRange(f,t,n),this._update(!0)}setFilter(f,t,n={}){return this.style.setFilter(f,t,n),this._update(!0)}getFilter(f){return this.style.getFilter(f)}setPaintProperty(f,t,n,l={}){return this.style.setPaintProperty(f,t,n,l),this._update(!0)}getPaintProperty(f,t){return this.style.getPaintProperty(f,t)}setLayoutProperty(f,t,n,l={}){return this.style.setLayoutProperty(f,t,n,l),this._update(!0)}getLayoutProperty(f,t){return this.style.getLayoutProperty(f,t)}setGlyphs(f,t={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(f,t),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(f,t,n={}){return this._lazyInitEmptyStyle(),this.style.addSprite(f,t,n,(l=>{l||this._update(!0)})),this}removeSprite(f){return this._lazyInitEmptyStyle(),this.style.removeSprite(f),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(f,t={}){return this._lazyInitEmptyStyle(),this.style.setSprite(f,t,(n=>{n||this._update(!0)})),this}setLight(f,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(f,t),this._update(!0)}getLight(){return this.style.getLight()}setSky(f,t={}){return this._lazyInitEmptyStyle(),this.style.setSky(f,t),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(f,t){return this.style.setFeatureState(f,t),this._update()}removeFeatureState(f,t){return this.style.removeFeatureState(f,t),this._update()}getFeatureState(f){return this.style.getFeatureState(f)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let f=0,t=0;return this._container&&(f=this._container.clientWidth||400,t=this._container.clientHeight||300),[f,t]}_setupResizeObserver(){var f;let t=!1;const n=Yu((h=>{this._trackResize&&!this._removed&&(this.resize(h),this.redraw())}),50),l=(f=this._ownerWindow.ResizeObserver)!==null&&f!==void 0?f:ResizeObserver;this._resizeObserver=new l((h=>{t?n(h):t=!0})),this._resizeObserver.observe(this._container)}_resolveContainer(f){if(typeof f=="string"){const t=document.getElementById(f);if(!t)throw new Error(`Container '${f}' not found.`);return t}if(f instanceof HTMLElement||f&&typeof f=="object"&&f.nodeType===1)return f;throw new Error("Invalid type: 'container' must be a String or HTMLElement.")}_setupContainer(){const f=this._container;f.classList.add("maplibregl-map");const t=this._canvasContainer=ze.create("div","maplibregl-canvas-container",f);this._interactive&&t.classList.add("maplibregl-interactive"),this._canvas=ze.create("canvas","maplibregl-canvas",t),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");const n=this._containerDimensions(),l=this._getClampedPixelRatio(n[0],n[1]);this._resizeCanvas(n[0],n[1],l);const h=this._controlContainer=ze.create("div","maplibregl-control-container",f),g=this._controlPositions={};for(const b of["top-left","top-right","bottom-left","bottom-right"])g[b]=ze.create("div",`maplibregl-ctrl-${b} `,h);this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(f,t,n){this._canvas.width=Math.floor(n*f),this._canvas.height=Math.floor(n*t),this._canvas.style.width=`${f}px`,this._canvas.style.height=`${t}px`}_setupPainter(){const f=Object.assign(Object.assign({},this._canvasContextAttributes),{alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0});let t=null;this._canvas.addEventListener("webglcontextcreationerror",(l=>{t={requestedAttributes:f},l&&(t.statusMessage=l.statusMessage,t.type=l.type)}),{once:!0});let n=null;if(n=this._canvasContextAttributes.contextType?this._canvas.getContext(this._canvasContextAttributes.contextType,f):this._canvas.getContext("webgl2",f)||this._canvas.getContext("webgl",f),!n){const l="Failed to initialize WebGL";throw t?(t.message=l,new Error(JSON.stringify(t))):new Error(l)}this.painter=new La(n,this.transform)}migrateProjection(f,t){super.migrateProjection(f,t),this.painter.transform=f,this.fire(new d.n("projectiontransition",{newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(f){var t;return!((t=this.style)===null||t===void 0)&&t._loaded?(this._styleDirty||(this._styleDirty=f),this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(f){return this._update(),this._renderTaskQueue.add(f)}_cancelRenderFrame(f){this._renderTaskQueue.remove(f)}_render(f){var t,n,l,h,g,b;const T=this._idleTriggered?this._fadeDuration:0,P=((t=this.style.projection)===null||t===void 0?void 0:t.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(f),this._removed)return;let M=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const L=this.transform.zoom,O=st();this.style.zoomHistory.update(L,O);const $=new d.J(L,{now:O,fadeDuration:T,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),Z=$.crossFadingFactor();Z===1&&Z===this._crossFadingFactor||(M=!0,this._crossFadingFactor=Z),this.style.update($)}const I=((n=this.style.projection)===null||n===void 0?void 0:n.transitionState)>0!==P;(l=this.style.projection)===null||l===void 0||l.setErrorQueryLatitudeDegrees(this.transform.center.lat),this.transform.setTransitionState((h=this.style.projection)===null||h===void 0?void 0:h.transitionState,(g=this.style.projection)===null||g===void 0?void 0:g.latitudeErrorCorrectionRadians),this.style&&(this._sourcesDirty||I)&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.tileManager.update(this.transform,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),!this._elevationFreeze&&this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0)),this._placementDirty=(b=this.style)===null||b===void 0?void 0:b._updatePlacement(this.transform,this.showCollisionBoxes,T,this._crossSourceCollisions,I),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:T,showPadding:this.showPadding,anisotropicFilterPitch:this.getAnisotropicFilterPitch()}),this.fire(new d.n("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new d.n("load"))),this.style&&(this.style.hasTransitions()||M)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const R=this._sourcesDirty||this._styleDirty||this._placementDirty;return R||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new d.n("idle")),!this._loaded||this._fullyLoaded||R||(this._fullyLoaded=!0),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var f,t;this._hash&&this._hash.remove();for(const l of this._controls)l.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),(f=this._diffStyleRequest)===null||f===void 0||f.abort(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&this._ownerWindow.removeEventListener("online",this._onWindowOnline,!1),Br.removeThrottleControl(this._imageQueueHandle),(t=this._resizeObserver)===null||t===void 0||t.disconnect();const n=this.painter.context.gl.getExtension("WEBGL_lose_context");n!=null&&n.loseContext&&n.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),this._canvasContainer.remove(),this._controlContainer.remove(),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),this._removed=!0,this.fire(new d.n("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,Wt.frame(this._frameRequest,(f=>{this._frameRequest=null;try{this._render(f)}catch(t){if(!d.$(t)&&!(function(n){return n.message===Kl})(t))throw t}}),(()=>{}),this._ownerWindow))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(f){this._showTileBoundaries!==f&&(this._showTileBoundaries=f,this._update())}get showPadding(){return!!this._showPadding}set showPadding(f){this._showPadding!==f&&(this._showPadding=f,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(f){this._showCollisionBoxes!==f&&(this._showCollisionBoxes=f,f?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(f){this._showOverdrawInspector!==f&&(this._showOverdrawInspector=f,this._update())}get repaint(){return!!this._repaint}set repaint(f){this._repaint!==f&&(this._repaint=f,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(f){this._vertices=f,this._update()}get version(){return ua}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(f){return this._lazyInitEmptyStyle(),this.style.setProjection(f),this._update(!0)}};const Cr={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};class Va{constructor(t,n,l=!1){this.mousedown=g=>{this.startMove(g,ze.mousePos(this.element,g)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)},this.mousemove=g=>{this.move(g,ze.mousePos(this.element,g))},this.mouseup=g=>{this._rotatePitchHandler.dragEnd(g),this.offTemp()},this.touchstart=g=>{g.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=ze.touchPos(this.element,g.targetTouches)[0],this.startMove(g,this._startPos),window.addEventListener("touchmove",this.touchmove,{passive:!1}),window.addEventListener("touchend",this.touchend))},this.touchmove=g=>{g.targetTouches.length!==1?this.reset():(this._lastPos=ze.touchPos(this.element,g.targetTouches)[0],this.move(g,this._lastPos))},this.touchend=g=>{g.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()},this.reset=()=>{this._rotatePitchHandler.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10,this.element=n;const h=new ec;this._rotatePitchHandler=new rr({clickTolerance:3,move:(g,b)=>{const T=n.getBoundingClientRect(),P=new d.P((T.bottom-T.top)/2,(T.right-T.left)/2);return{bearingDelta:d.cx(new d.P(g.x,b.y),b,P),pitchDelta:l?-.5*(b.y-g.y):void 0}},moveStateManager:h,enable:!0,assignEvents:()=>{}}),this.map=t,n.addEventListener("mousedown",this.mousedown),n.addEventListener("touchstart",this.touchstart,{passive:!1}),n.addEventListener("touchcancel",this.reset)}startMove(t,n){this._rotatePitchHandler.dragStart(t,n),ze.disableDrag()}move(t,n){const l=this.map,{bearingDelta:h,pitchDelta:g}=this._rotatePitchHandler.dragMove(t,n)||{};h&&l.setBearing(l.getBearing()+h),g&&l.setPitch(l.getPitch()+g)}off(){const t=this.element;t.removeEventListener("mousedown",this.mousedown),t.removeEventListener("touchstart",this.touchstart),window.removeEventListener("touchmove",this.touchmove),window.removeEventListener("touchend",this.touchend),t.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){ze.enableDrag(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup),window.removeEventListener("touchmove",this.touchmove),window.removeEventListener("touchend",this.touchend)}}let io;function ul(f,t,n,l=!1){if(l||!n.getCoveringTilesDetailsProvider().allowWorldCopies())return f==null?void 0:f.wrap();const h=new d.W(f.lng,f.lat);if(f=new d.W(f.lng,f.lat),t){const g=new d.W(f.lng-360,f.lat),b=new d.W(f.lng+360,f.lat),T=n.locationToScreenPoint(f).distSqr(t);n.locationToScreenPoint(g).distSqr(t)<T?f=g:n.locationToScreenPoint(b).distSqr(t)<T&&(f=b)}for(;Math.abs(f.lng-n.center.lng)>180;){const g=n.locationToScreenPoint(f);if(g.x>=0&&g.y>=0&&g.x<=n.width&&g.y<=n.height)break;f.lng>n.center.lng?f.lng-=360:f.lng+=360}return f.lng!==h.lng&&n.isPointOnMapSurface(n.locationToScreenPoint(f))?f:h}const Ua={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 cl(f,t,n){const l=f.classList;for(const h in Ua)l.remove(`maplibregl-${n}-anchor-${h}`);l.add(`maplibregl-${n}-anchor-${t}`)}class no extends d.E{constructor(t){if(super(),this._onClick=n=>{this.fire(new d.n("click",{originalEvent:n}))},this._onKeyPress=n=>{n.code!=="Space"&&n.code!=="Enter"||this.togglePopup()},this._onMapClick=n=>{const l=n.originalEvent.target,h=this._element;this._popup&&(l===h||h.contains(l))&&this.togglePopup()},this._update=n=>{if(!this._map)return;const l=this._map.loaded()&&!this._map.isMoving();((n==null?void 0:n.type)==="terrain"||(n==null?void 0:n.type)==="render"&&!l)&&this._map.once("render",this._update),this._lngLat=ul(this._lngLat,this._flatPos,this._map.transform),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationToScreenPoint(this._lngLat)._add(this._offset));let h="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?h=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(h=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let g="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?g="rotateX(0deg)":this._pitchAlignment==="map"&&(g=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||n&&n.type!=="moveend"||(this._pos=this._pos.round()),this._element.style.transform=`${Ua[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${g} ${h}`,Wt.frameAsync(new AbortController,this._map._ownerWindow).then((()=>{this._updateOpacity((n==null?void 0:n.type)==="moveend")})).catch((()=>{}))},this._onMove=n=>{if(!this._isDragging){const l=this._clickTolerance||this._map._clickTolerance;this._isDragging=n.point.dist(this._pointerdownPos)>=l}this._isDragging&&(this._pos=n.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 d.n("dragstart"))),this.fire(new d.n("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new d.n("dragend")),this._state="inactive"},this._addDragHandler=n=>{this._element.contains(n.originalEvent.target)&&(n.preventDefault(),this._positionDelta=n.point.sub(this._pos).add(this._offset),this._pointerdownPos=n.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=(t==null?void 0:t.anchor)||"center",this._color=(t==null?void 0:t.color)||"#3FB1CE",this._scale=(t==null?void 0:t.scale)||1,this._draggable=(t==null?void 0:t.draggable)||!1,this._clickTolerance=(t==null?void 0:t.clickTolerance)||0,this._subpixelPositioning=(t==null?void 0:t.subpixelPositioning)||!1,this._isDragging=!1,this._state="inactive",this._rotation=(t==null?void 0:t.rotation)||0,this._rotationAlignment=(t==null?void 0:t.rotationAlignment)||"auto",this._pitchAlignment=t!=null&&t.pitchAlignment&&t.pitchAlignment!=="auto"?t.pitchAlignment:this._rotationAlignment,this.setOpacity(t==null?void 0:t.opacity,t==null?void 0:t.opacityWhenCovered),t==null?void 0:t.element)this._element=t.element,this._offset=d.P.convert((t==null?void 0:t.offset)||[0,0]);else{this._defaultMarker=!0,this._element=ze.create("div");const n=ze.createNS("http://www.w3.org/2000/svg","svg"),l=41,h=27;n.setAttributeNS(null,"display","block"),n.setAttributeNS(null,"height",`${l}px`),n.setAttributeNS(null,"width",`${h}px`),n.setAttributeNS(null,"viewBox",`0 0 ${h} ${l}`);const g=ze.createNS("http://www.w3.org/2000/svg","g");g.setAttributeNS(null,"stroke","none"),g.setAttributeNS(null,"stroke-width","1"),g.setAttributeNS(null,"fill","none"),g.setAttributeNS(null,"fill-rule","evenodd");const b=ze.createNS("http://www.w3.org/2000/svg","g");b.setAttributeNS(null,"fill-rule","nonzero");const T=ze.createNS("http://www.w3.org/2000/svg","g");T.setAttributeNS(null,"transform","translate(3.0, 29.0)"),T.setAttributeNS(null,"fill","#000000");const P=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const H of P){const K=ze.createNS("http://www.w3.org/2000/svg","ellipse");K.setAttributeNS(null,"opacity","0.04"),K.setAttributeNS(null,"cx","10.5"),K.setAttributeNS(null,"cy","5.80029008"),K.setAttributeNS(null,"rx",H.rx),K.setAttributeNS(null,"ry",H.ry),T.appendChild(K)}const M=ze.createNS("http://www.w3.org/2000/svg","g");M.setAttributeNS(null,"fill",this._color);const I=ze.createNS("http://www.w3.org/2000/svg","path");I.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),M.appendChild(I);const R=ze.createNS("http://www.w3.org/2000/svg","g");R.setAttributeNS(null,"opacity","0.25"),R.setAttributeNS(null,"fill","#000000");const L=ze.createNS("http://www.w3.org/2000/svg","path");L.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"),R.appendChild(L);const O=ze.createNS("http://www.w3.org/2000/svg","g");O.setAttributeNS(null,"transform","translate(6.0, 7.0)"),O.setAttributeNS(null,"fill","#FFFFFF");const $=ze.createNS("http://www.w3.org/2000/svg","g");$.setAttributeNS(null,"transform","translate(8.0, 8.0)");const Z=ze.createNS("http://www.w3.org/2000/svg","circle");Z.setAttributeNS(null,"fill","#000000"),Z.setAttributeNS(null,"opacity","0.25"),Z.setAttributeNS(null,"cx","5.5"),Z.setAttributeNS(null,"cy","5.5"),Z.setAttributeNS(null,"r","5.4999962");const Y=ze.createNS("http://www.w3.org/2000/svg","circle");Y.setAttributeNS(null,"fill","#FFFFFF"),Y.setAttributeNS(null,"cx","5.5"),Y.setAttributeNS(null,"cy","5.5"),Y.setAttributeNS(null,"r","5.4999962"),$.appendChild(Z),$.appendChild(Y),b.appendChild(T),b.appendChild(M),b.appendChild(R),b.appendChild(O),b.appendChild($),n.appendChild(b),n.setAttributeNS(null,"height",l*this._scale+"px"),n.setAttributeNS(null,"width",h*this._scale+"px"),this._element.appendChild(n),this._offset=d.P.convert((t==null?void 0:t.offset)||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",(n=>{n.preventDefault()})),this._element.addEventListener("mousedown",(n=>{n.preventDefault()})),cl(this._element,this._anchor,"marker"),t==null?void 0:t.className)for(const n of t.className.split(" "))this._element.classList.add(n);this._popup=null}addTo(t){return this.remove(),this._map=t,this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label",t._getUIString("Marker.Title")),this._element.hasAttribute("role")||this._element.setAttribute("role","button"),t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),t.on("terrain",this._update),t.on("projectiontransition",this._update),this._element.addEventListener("click",this._onClick),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",this._update),this._map.off("projectiontransition",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),this._element.removeEventListener("click",this._onClick),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=d.W.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){const h=Math.abs(13.5)/Math.SQRT2;t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[h,-1*(38.1-13.5+h)],"bottom-right":[-h,-1*(38.1-13.5+h)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=t,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(t){return this._subpixelPositioning=t,this}getPopup(){return this._popup}togglePopup(){const t=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:t?(t.isOpen()?t.remove():(t.setLngLat(this._lngLat),t.addTo(this._map)),this):this}_updateOpacity(t=!1){var n,l;const h=(n=this._map)===null||n===void 0?void 0:n.terrain,g=this._map.transform.isLocationOccluded(this._lngLat);if(!h||g){const O=g?this._opacityWhenCovered:this._opacity;return void(this._element.style.opacity!==O&&(this._element.style.opacity=O,this._element.classList.toggle("maplibregl-marker-covered",g)))}if(t)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout((()=>{this._opacityTimeout=null}),100)}const b=this._map,T=b.terrain.depthAtPoint(this._pos),P=b.terrain.getElevationForLngLat(this._lngLat,b.transform);if(b.transform.lngLatToCameraDepth(this._lngLat,P)-T<.006)return this._element.style.opacity=this._opacity,void this._element.classList.remove("maplibregl-marker-covered");const M=-this._offset.y/b.transform.pixelsPerMeter,I=Math.sin(b.getPitch()*Math.PI/180)*M,R=b.terrain.depthAtPoint(new d.P(this._pos.x,this._pos.y-this._offset.y)),L=b.transform.lngLatToCameraDepth(this._lngLat,P+I)-R>.006;!((l=this._popup)===null||l===void 0)&&l.isOpen()&&L&&this._popup.remove(),this._element.style.opacity=L?this._opacityWhenCovered:this._opacity,this._element.classList.toggle("maplibregl-marker-covered",L)}getOffset(){return this._offset}setOffset(t){return this._offset=d.P.convert(t),this._update(),this}addClassName(t){this._element.classList.add(t)}removeClassName(t){this._element.classList.remove(t)}toggleClassName(t){return this._element.classList.toggle(t)}setDraggable(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&t!=="auto"?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(t,n){return(this._opacity===void 0||t===void 0&&n===void 0)&&(this._opacity="1",this._opacityWhenCovered="0.2"),t!==void 0&&(this._opacity=String(t)),n!==void 0&&(this._opacityWhenCovered=String(n)),this._map&&this._updateOpacity(!0),this}}const Mr={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Lr=0,Fr=!1;const hl={maxWidth:100,unit:"metric"};function ca(f,t,n){const l=(n==null?void 0:n.maxWidth)||100,h=f._container.clientHeight/2,g=f._container.clientWidth/2,b=f.unproject([g-l/2,h]),T=f.unproject([g+l/2,h]),P=Math.round(f.project(T).x-f.project(b).x),M=Math.min(l,P,f._container.clientWidth),I=b.distanceTo(T);if((n==null?void 0:n.unit)==="imperial"){const R=3.2808*I;R>5280?oo(t,M,R/5280,f._getUIString("ScaleControl.Miles")):oo(t,M,R,f._getUIString("ScaleControl.Feet"))}else(n==null?void 0:n.unit)==="nautical"?oo(t,M,I/1852,f._getUIString("ScaleControl.NauticalMiles")):I>=1e3?oo(t,M,I/1e3,f._getUIString("ScaleControl.Kilometers")):oo(t,M,I,f._getUIString("ScaleControl.Meters"))}function oo(f,t,n,l){const h=(function(g){const b=Math.pow(10,`${Math.floor(g)}`.length-1);let T=g/b;return T=T>=10?10:T>=5?5:T>=3?3:T>=2?2:T>=1?1:(function(P){const M=Math.pow(10,Math.ceil(-Math.log(P)/Math.LN10));return Math.round(P*M)/M})(T),b*T})(n);f.style.width=t*(h/n)+"px",f.innerHTML=`${h}&nbsp;${l}`}const rh={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0,padding:void 0},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 dl(f){if(f){if(typeof f=="number"){const t=Math.round(Math.abs(f)/Math.SQRT2);return{center:new d.P(0,0),top:new d.P(0,f),"top-left":new d.P(t,t),"top-right":new d.P(-t,t),bottom:new d.P(0,-f),"bottom-left":new d.P(t,-t),"bottom-right":new d.P(-t,-t),left:new d.P(f,0),right:new d.P(-f,0)}}if(f instanceof d.P||Array.isArray(f)){const t=d.P.convert(f);return{center:t,top:t,"top-left":t,"top-right":t,bottom:t,"bottom-left":t,"bottom-right":t,left:t,right:t}}return{center:d.P.convert(f.center||[0,0]),top:d.P.convert(f.top||[0,0]),"top-left":d.P.convert(f["top-left"]||[0,0]),"top-right":d.P.convert(f["top-right"]||[0,0]),bottom:d.P.convert(f.bottom||[0,0]),"bottom-left":d.P.convert(f["bottom-left"]||[0,0]),"bottom-right":d.P.convert(f["bottom-right"]||[0,0]),left:d.P.convert(f.left||[0,0]),right:d.P.convert(f.right||[0,0])}}return dl(new d.P(0,0))}const su=Me;j.AJAXError=d.cG,j.EXTENT=d.a6,j.Event=d.n,j.Evented=d.E,j.LngLat=d.W,j.MercatorCoordinate=d.a7,j.Point=d.P,j.addProtocol=d.cH,j.config=d.c,j.removeProtocol=d.cI,j.AttributionControl=Qi,j.BoxZoomHandler=eo,j.CanvasSource=Sl,j.CooperativeGesturesHandler=lt,j.DoubleClickZoomHandler=nu,j.DragPanHandler=Gr,j.DragRotateHandler=to,j.EdgeInsets=wo,j.FullscreenControl=class extends d.E{constructor(f={}){var t;super(),this._onFullscreenChange=()=>{var n;let l=window.document.fullscreenElement||window.document.webkitFullscreenElement;for(;!((n=l==null?void 0:l.shadowRoot)===null||n===void 0)&&n.fullscreenElement;)l=l.shadowRoot.fullscreenElement;l===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,this._pseudo=(t=f.pseudo)!==null&&t!==void 0&&t,f!=null&&f.container&&(f.container instanceof HTMLElement?this._container=f.container:d.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(f){return this._map=f,this._container||(this._container=this._map.getContainer()),this._controlContainer=ze.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const f=this._fullscreenButton=ze.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);ze.create("span","maplibregl-ctrl-icon",f).setAttribute("aria-hidden","true"),f.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const f=this._getTitle();this._fullscreenButton.setAttribute("aria-label",f),this._fullscreenButton.title=f}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new d.n("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new d.n("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){this._pseudo?this._togglePseudoFullScreen():window.document.exitFullscreen?window.document.exitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._pseudo?this._togglePseudoFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},j.GeoJSONSource=_o,j.GeolocateControl=class extends d.E{constructor(f){super(),this._onSuccess=t=>{if(this._map){if(this._isOutOfMapMaxBounds(t))return this._setErrorState(),this.fire(new d.n("outofmaxbounds",t)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(t),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(t),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new d.n("geolocate",t)),this._finish()}},this._updateCamera=t=>{const n=new d.W(t.coords.longitude,t.coords.latitude),l=t.coords.accuracy,h=this._map.getBearing(),g=d.e({bearing:h},this.options.fitBoundsOptions),b=Ie.fromLngLat(n,l);this._map.fitBounds(b,g,{geolocateSource:!0})},this._updateMarker=t=>{if(t){const n=new d.W(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(n).addTo(this._map),this._userLocationDotMarker.setLngLat(n).addTo(this._map),this._accuracy=t.coords.accuracy,this._updateCircleRadiusIfNeeded()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onUpdate=()=>{this._updateCircleRadiusIfNeeded()},this._onError=t=>{if(this._map){if(t.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const n=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(t.code===3&&Fr)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new d.n("error",t)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._onMoveStart=t=>{if(!this._map)return;const n=(t==null?void 0:t[0])instanceof ResizeObserverEntry;t.geolocateSource||this._watchState!=="ACTIVE_LOCK"||n||this._map.isZooming()||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new d.n("trackuserlocationend")),this.fire(new d.n("userlocationlostfocus")))},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",(t=>{t.preventDefault()})),this._geolocateButton=ze.create("button","maplibregl-ctrl-geolocate",this._container),ze.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=t=>{if(this._map){if(t===!1){d.w("Geolocation support is not available so the GeolocateControl will be disabled.");const n=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n)}else{const n=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=ze.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new no({element:this._dotElement}),this._circleElement=ze.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new no({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onUpdate),this._map.on("move",this._onUpdate),this._map.on("rotate",this._onUpdate),this._map.on("pitch",this._onUpdate)),this._geolocateButton.addEventListener("click",(()=>this.trigger())),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",this._onMoveStart)}},this.options=d.e({},Mr,f)}onAdd(f){return this._map=f,this._container=ze.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),(function(){return d._(this,arguments,void 0,(function*(t=!1){if(io!==void 0&&!t)return io;if(window.navigator.permissions===void 0)return io=!!window.navigator.geolocation,io;try{io=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{io=!!window.navigator.geolocation}return io}))})().then((t=>this._finishSetupUI(t))),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(),this._container.remove(),this._map.off("movestart",this._onMoveStart),this._map.off("zoom",this._onUpdate),this._map.off("move",this._onUpdate),this._map.off("rotate",this._onUpdate),this._map.off("pitch",this._onUpdate),this._map=void 0,Lr=0,Fr=!1}_isOutOfMapMaxBounds(f){const t=this._map.getMaxBounds(),n=f.coords;return t&&(n.longitude<t.getWest()||n.longitude>t.getEast()||n.latitude<t.getSouth()||n.latitude>t.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":case"BACKGROUND_ERROR":case"OFF":case void 0:break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadiusIfNeeded(){const f=this._userLocationDotMarker.getLngLat();if(!(this.options.showUserLocation&&this.options.showAccuracyCircle&&this._accuracy&&f))return;const t=this._map.project(f),n=this._map.unproject([t.x+100,t.y]),l=f.distanceTo(n)/100,h=2*this._accuracy/l;this._circleElement.style.width=`${h.toFixed(2)}px`,this._circleElement.style.height=`${h.toFixed(2)}px`}trigger(){if(!this._setup)return d.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new d.n("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Lr--,Fr=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new d.n("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new d.n("trackuserlocationstart")),this.fire(new d.n("userlocationfocus"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let f;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Lr++,Lr>1?(f={maximumAge:6e5,timeout:0},Fr=!0):(f=this.options.positionOptions,Fr=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,f)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},j.GlobeControl=class{constructor(){this._toggleProjection=()=>{var f;const t=(f=this._map.getProjection())===null||f===void 0?void 0:f.type;this._map.setProjection(t!=="mercator"&&t?{type:"mercator"}:{type:"globe"}),this._updateGlobeIcon()},this._updateGlobeIcon=()=>{var f;this._globeButton.classList.remove("maplibregl-ctrl-globe"),this._globeButton.classList.remove("maplibregl-ctrl-globe-enabled"),((f=this._map.getProjection())===null||f===void 0?void 0:f.type)==="globe"?(this._globeButton.classList.add("maplibregl-ctrl-globe-enabled"),this._globeButton.title=this._map._getUIString("GlobeControl.Disable")):(this._globeButton.classList.add("maplibregl-ctrl-globe"),this._globeButton.title=this._map._getUIString("GlobeControl.Enable"))}}onAdd(f){return this._map=f,this._container=ze.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=ze.create("button","maplibregl-ctrl-globe",this._container),ze.create("span","maplibregl-ctrl-icon",this._globeButton).setAttribute("aria-hidden","true"),this._globeButton.type="button",this._globeButton.addEventListener("click",this._toggleProjection),this._updateGlobeIcon(),this._map.on("styledata",this._updateGlobeIcon),this._map.on("projectiontransition",this._updateGlobeIcon),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateGlobeIcon),this._map.off("projectiontransition",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}},j.Hash=Tn,j.ImageSource=$n,j.KeyboardHandler=tu,j.LngLatBounds=Ie,j.LogoControl=ic,j.Map=ll,j.MapLibreMap=ll,j.MapMouseEvent=Rr,j.MapTouchEvent=Fi,j.MapWheelEvent=Ba,j.Marker=no,j.NavigationControl=class{constructor(f){this._updateZoomButtons=()=>{const t=this._map.getZoom(),n=t===this._map.getMaxZoom(),l=t===this._map.getMinZoom();this._zoomInButton.disabled=n,this._zoomOutButton.disabled=l,this._zoomInButton.setAttribute("aria-disabled",n.toString()),this._zoomOutButton.setAttribute("aria-disabled",l.toString())},this._rotateCompassArrow=()=>{this._compassIcon.style.transform=this.options.visualizePitch&&this.options.visualizeRoll?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateZ(${-this._map.transform.roll}deg) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizeRoll?`rotate(${-this._map.transform.bearing-this._map.transform.roll}deg)`:`rotate(${-this._map.transform.bearing}deg)`},this._setButtonTitle=(t,n)=>{const l=this._map._getUIString(`NavigationControl.${n}`);t.title=l,t.setAttribute("aria-label",l)},this.options=d.e({},Cr,f),this._container=ze.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",(t=>t.preventDefault())),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",(t=>this._map.zoomIn({},{originalEvent:t}))),ze.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",(t=>this._map.zoomOut({},{originalEvent:t}))),ze.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",(t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})})),this._compassIcon=ze.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(f){return this._map=f,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.on("roll",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Va(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){this._container.remove(),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.off("roll",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(f,t){const n=ze.create("button",f,this._container);return n.type="button",n.addEventListener("click",t),n}},j.Popup=class extends d.E{constructor(f){super(),this._updateOpacity=()=>{this.options.locationOccludedOpacity!==void 0&&(this._container.style.opacity=this._map.transform.isLocationOccluded(this.getLngLat())?`${this.options.locationOccludedOpacity}`:"")},this.remove=()=>(this._content&&this._content.remove(),this._container&&(this._container.remove(),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("terrain",this._update),this._map.off("projectiontransition",this._update),this._map.off("mousemove",this._update),this._map.off("mouseup",this._update),this._map.off("drag",this._update),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new d.n("close"))),this),this._update=t=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=ze.create("div","maplibregl-popup",this._map.getContainer()),this._tip=ze.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const T of this.options.className.split(" "))this._container.classList.add(T);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}let n;if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=ul(this._lngLat,this._flatPos,this._map.transform,this._trackPointer),t&&"point"in t&&t.point&&(n=t.point),this._trackPointer&&!n)return;const l=this._flatPos=this._pos=this._trackPointer&&n?n:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&n?n:this._map.transform.locationToScreenPoint(this._lngLat));let h=this.options.anchor;const g=dl(this.options.offset);if(!h){const T=this._container.offsetWidth,P=this._container.offsetHeight,M=(function(R){var L,O,$,Z;return R?{top:(L=R.top)!==null&&L!==void 0?L:0,right:(O=R.right)!==null&&O!==void 0?O:0,bottom:($=R.bottom)!==null&&$!==void 0?$:0,left:(Z=R.left)!==null&&Z!==void 0?Z:0}:{top:0,right:0,bottom:0,left:0}})(this.options.padding);let I;I=l.y+g.bottom.y<P+M.top?["top"]:l.y>this._map.transform.height-P-M.bottom?["bottom"]:[],l.x<T/2+M.left?I.push("left"):l.x>this._map.transform.width-T/2-M.right&&I.push("right"),h=I.length===0?"bottom":I.join("-")}let b=l.add(g[h]);this.options.subpixelPositioning||(b=b.round()),this._container.style.transform=`${Ua[h]} translate(${b.x}px,${b.y}px)`,cl(this._container,h,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=d.e(Object.create(rh),f)}addTo(f){return this._map&&this.remove(),this._map=f,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._map.on("terrain",this._update),this._map.on("projectiontransition",this._update),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._update),this._map.on("mouseup",this._update),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new d.n("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(f){return this._lngLat=d.W.convert(f),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._update),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._update),this._map.on("drag",this._update),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(f){return this.setDOMContent(document.createTextNode(f))}setHTML(f){const t=document.createDocumentFragment(),n=document.createElement("body");let l;for(n.innerHTML=f;l=n.firstChild,l;)t.appendChild(l);return this.setDOMContent(t)}getMaxWidth(){var f;return(f=this._container)===null||f===void 0?void 0:f.style.maxWidth}setMaxWidth(f){return this.options.maxWidth=f,this._update(),this}setDOMContent(f){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=ze.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(f),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(f){return this._container&&this._container.classList.add(f),this}removeClassName(f){return this._container&&this._container.classList.remove(f),this}setOffset(f){return this.options.offset=f,this._update(),this}toggleClassName(f){if(this._container)return this._container.classList.toggle(f)}setSubpixelPositioning(f){this.options.subpixelPositioning=f}setPadding(f){this.options.padding=f,this._update()}_createCloseButton(){this.options.closeButton&&(this._closeButton=ze.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const f=this._container.querySelector(si);f&&f.focus()}},j.RasterDEMTileSource=ir,j.RasterTileSource=Er,j.ScaleControl=class{constructor(f){this._onMove=()=>{ca(this._map,this._container,this.options)},this.setUnit=t=>{this.options.unit=t,ca(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},hl),f)}getDefaultPosition(){return"bottom-left"}onAdd(f){return this._map=f,this._container=ze.create("div","maplibregl-ctrl maplibregl-ctrl-scale",f.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._onMove),this._map=void 0}},j.ScrollZoomHandler=iu,j.Style=us,j.TerrainControl=class{constructor(f){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=f}onAdd(f){return this._map=f,this._container=ze.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=ze.create("button","maplibregl-ctrl-terrain",this._container),ze.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){this._container.remove(),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},j.TwoFingersTouchPitchHandler=un,j.TwoFingersTouchRotateHandler=th,j.TwoFingersTouchZoomHandler=ol,j.TwoFingersTouchZoomRotateHandler=tt,j.VectorTileSource=bt,j.VideoSource=ya,j.addSourceType=(f,t)=>d._(void 0,void 0,void 0,(function*(){if(El(f))throw new Error(`A source type called "${f}" already exists.`);((n,l)=>{Rs[n]=l})(f,t)})),j.clearPrewarmedResources=function(){const f=yt;f&&(f.isPreloaded()&&f.numActive()===1?(f.release($e),yt=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()"))},j.createTileMesh=qs,j.getGlobalDispatcher=Ft,j.getMaxParallelImageRequests=function(){return d.c.MAX_PARALLEL_IMAGE_REQUESTS},j.getRTLTextPluginStatus=function(){return Wo().getRTLTextPluginStatus()},j.getVersion=function(){return su},j.getWorkerCount=function(){return ce.workerCount},j.getWorkerUrl=function(){return d.c.WORKER_URL},j.importScriptInWorkers=function(f){return Ft().broadcast("IS",f)},j.isTimeFrozen=function(){return Ar.isFrozen()},j.now=st,j.prewarm=function(){Nt().acquire($e)},j.restoreNow=function(){Ar.restoreNow()},j.setMaxParallelImageRequests=function(f){d.c.MAX_PARALLEL_IMAGE_REQUESTS=f},j.setNow=function(f){Ar.setNow(f)},j.setRTLTextPlugin=function(f,t){return Wo().setRTLTextPlugin(f,t)},j.setWorkerCount=function(f){ce.workerCount=f},j.setWorkerUrl=function(f){d.c.WORKER_URL=f}}));var ht=ue;return ht}))})(ap)),ap.exports}var Ed=x0();const b0=Go(Ed),w0="https://tile.openstreetmap.org/{z}/{x}/{y}.png",nm="https://basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}@2x.png",om="OpenStreetMap contributors, CARTO",am="https://basemaps.cartocdn.com/gl/voyager-gl-style/style.json",Zp={primaryColor:"#111111",markerColor:"#111111",borderRadius:8,radiusUnit:"km",defaultZoom:5,defaultCenter:{lat:-25.2744,lng:133.7751},darkMode:!1,styleUrl:am,mapPalette:"monotone",tileUrl:nm,tileAttribution:om};function Wp(ae){const ve=ae.trim().replace(/^#/,""),ue=ve.length===3?ve.split("").map(qe=>`${qe}${qe}`).join(""):ve;return/^[0-9a-f]{6}$/i.test(ue)?{r:Number.parseInt(ue.slice(0,2),16),g:Number.parseInt(ue.slice(2,4),16),b:Number.parseInt(ue.slice(4,6),16)}:null}function sp({r:ae,g:ve,b:ue}){const qe=[ae,ve,ue].map(Tt=>{const ht=Tt/255;return ht<=.03928?ht/12.92:((ht+.055)/1.055)**2.4});return .2126*qe[0]+.7152*qe[1]+.0722*qe[2]}function sm(ae,ve){const ue=Math.max(sp(ae),sp(ve)),qe=Math.min(sp(ae),sp(ve));return(ue+.05)/(qe+.05)}function Pd(ae,ve="#111111",ue="#ffffff"){const qe=Wp(ae),Tt=Wp(ve),ht=Wp(ue);return!qe||!Tt||!ht?ue:sm(qe,Tt)>=sm(qe,ht)?ve:ue}function lm(ae={}){return{...Zp,...ae,defaultCenter:{...Zp.defaultCenter,...ae.defaultCenter||{}},styleUrl:ae.styleUrl||am,mapPalette:ae.mapPalette||"monotone",borderRadius:Number.isFinite(Number(ae.borderRadius))?Number(ae.borderRadius):Zp.borderRadius,tileUrl:!ae.tileUrl||ae.tileUrl===w0?nm:ae.tileUrl,tileAttribution:ae.tileAttribution||om,radiusUnit:"km"}}function um(ae,ve){const ue=`/v1/stockist_maps/${encodeURIComponent(ae)}/config`;return ve?`${ve.replace(/\/$/,"")}${ue}`:ue}function cm(ae,ve={}){const ue=typeof window>"u"?"http://localhost":window.location.href,qe=new URL(ae,ue);return ve.query&&qe.searchParams.set("q",ve.query),ve.limit&&qe.searchParams.set("limit",String(ve.limit)),ve.center&&(qe.searchParams.set("lat",String(ve.center.lat)),qe.searchParams.set("lng",String(ve.center.lng))),ve.radiusKm&&qe.searchParams.set("radius_km",String(ve.radiusKm)),ve.category&&qe.searchParams.set("category",ve.category),ve.locationSearch&&qe.searchParams.set("location_search","true"),qe.toString()}async function hm(ae){const ve=await fetch(ae,{headers:{Accept:"application/json"}});if(!ve.ok)throw new Error(`Could not load stockist map config (${ve.status})`);return ve.json()}async function Hp(ae,ve={}){const ue=await fetch(cm(ae,ve),{headers:{Accept:"application/json"}});if(!ue.ok)throw new Error(`Could not search stockists (${ue.status})`);const qe=await ue.json();return{hits:Array.isArray(qe.hits)?qe.hits:[],estimatedTotalHits:Number(qe.estimatedTotalHits||0),center:qe.center||null,resolvedQuery:qe.resolvedQuery||null}}async function T0(ae,ve={}){return(await Hp(ae,ve)).hits}const S0=6371;function lp(ae){return ae*Math.PI/180}function dm(ae,ve){const ue=lp(ve.lat-ae.lat),qe=lp(ve.lng-ae.lng),Tt=Math.sin(ue/2)**2+Math.cos(lp(ae.lat))*Math.cos(lp(ve.lat))*Math.sin(qe/2)**2;return 2*S0*Math.atan2(Math.sqrt(Tt),Math.sqrt(1-Tt))}function pm(ae){return`${ae.toFixed(1)} km`}function E0(ae){const ve=["localhost","127.0.0.1","::1"].includes(window.location.hostname);return window.location.protocol!=="https:"&&!ve?"Browser location is blocked on this local Partbot domain. Chrome and Brave only allow location access on HTTPS, localhost, or origins manually trusted in browser flags.":ae.code===ae.PERMISSION_DENIED?"Location permission is blocked for this site. Allow location access in your browser settings, then try again.":ae.code===ae.POSITION_UNAVAILABLE?"Your browser could not determine your location. Try again, or search by suburb or postcode.":ae.code===ae.TIMEOUT?"Finding your location timed out. Try again, or search by suburb or postcode.":`Browser location failed with error code ${ae.code}. Try again, or search by suburb or postcode.`}function Xp(ae){return ae.stockist_id??ae.id}function P0(ae){const ve=new Set;return ae.filter(ue=>{const qe=Xp(ue);return ve.has(qe)?!1:(ve.add(qe),!0)})}function fm(ae){const ve=ae==null?void 0:ae.trim();if(!ve||ve.startsWith("/")&&!ve.startsWith("//"))return null;const ue=ve.startsWith("//")?`https:${ve}`:/^[a-z][a-z\d+.-]*:/i.test(ve)?ve:`https://${ve}`;try{const qe=new URL(ue);return qe.protocol==="http:"||qe.protocol==="https:"?qe.toString():null}catch{return null}}function mm(ae){return`https://www.google.com/maps/dir/?api=1&destination=${encodeURIComponent(`${ae.lat},${ae.lng}`)}`}const C0=new Map([["bold",Je.createElement(Je.Fragment,null,Je.createElement("path",{d:"M216.49,104.49l-80,80a12,12,0,0,1-17,0l-80-80a12,12,0,0,1,17-17L128,159l71.51-71.52a12,12,0,0,1,17,17Z"}))],["duotone",Je.createElement(Je.Fragment,null,Je.createElement("path",{d:"M208,96l-80,80L48,96Z",opacity:"0.2"}),Je.createElement("path",{d:"M215.39,92.94A8,8,0,0,0,208,88H48a8,8,0,0,0-5.66,13.66l80,80a8,8,0,0,0,11.32,0l80-80A8,8,0,0,0,215.39,92.94ZM128,164.69,67.31,104H188.69Z"}))],["fill",Je.createElement(Je.Fragment,null,Je.createElement("path",{d:"M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,48,88H208a8,8,0,0,1,5.66,13.66Z"}))],["light",Je.createElement(Je.Fragment,null,Je.createElement("path",{d:"M212.24,100.24l-80,80a6,6,0,0,1-8.48,0l-80-80a6,6,0,0,1,8.48-8.48L128,167.51l75.76-75.75a6,6,0,0,1,8.48,8.48Z"}))],["regular",Je.createElement(Je.Fragment,null,Je.createElement("path",{d:"M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z"}))],["thin",Je.createElement(Je.Fragment,null,Je.createElement("path",{d:"M210.83,98.83l-80,80a4,4,0,0,1-5.66,0l-80-80a4,4,0,0,1,5.66-5.66L128,170.34l77.17-77.17a4,4,0,1,1,5.66,5.66Z"}))]]),gm=Je.forwardRef((ae,ve)=>Je.createElement(Gp,{ref:ve,...ae,weights:C0}));gm.displayName="CaretDownIcon";function Ds(...ae){return ae.filter(Boolean).join(" ")}function M0({className:ae,variant:ve="default",size:ue="default",...qe}){return mt.jsx("button",{"data-slot":"button","data-variant":ve,"data-size":ue,className:Ds("pbsm-button",ae),...qe})}function I0({className:ae,...ve}){return mt.jsx("input",{"data-slot":"input",className:Ds("pbsm-input",ae),...ve})}function k0({className:ae,size:ve="default",...ue}){return mt.jsxs("div",{className:"pbsm-native-select-wrapper","data-slot":"native-select-wrapper",children:[mt.jsx("select",{"data-slot":"native-select","data-size":ve,className:Ds("pbsm-native-select",ae),...ue}),mt.jsx(gm,{"aria-hidden":"true",className:"pbsm-native-select-icon","data-slot":"native-select-icon"})]})}function _m({className:ae,...ve}){return mt.jsx("option",{"data-slot":"native-select-option",className:Ds("pbsm-native-select-option",ae),...ve})}function ym({className:ae,...ve}){return mt.jsx("div",{"data-slot":"card",className:Ds("pbsm-card-shell",ae),...ve})}function vm({className:ae,...ve}){return mt.jsx("div",{"data-slot":"card-content",className:Ds("pbsm-card-content",ae),...ve})}function z0({className:ae,variant:ve="default",...ue}){return mt.jsx("div",{"data-slot":"alert","data-variant":ve,role:"alert",className:Ds("pbsm-alert",ae),...ue})}function A0({className:ae,...ve}){return mt.jsx("div",{"data-slot":"alert-title",className:Ds("pbsm-alert-title",ae),...ve})}function D0({className:ae,...ve}){return mt.jsx("div",{"data-slot":"alert-description",className:Ds("pbsm-alert-description",ae),...ve})}function xm({className:ae,...ve}){return mt.jsx("div",{"data-slot":"skeleton",className:Ds("pbsm-skeleton",ae),...ve})}const bh=[10,25,50,100,250],R0=350,Yp=(ae,ve)=>Object.prototype.hasOwnProperty.call(ae,ve);function L0(ae,ve){return{version:8,sources:{"partbot-tiles":{type:"raster",tiles:[ae],tileSize:256,attribution:ve}},layers:[{id:"partbot-tiles",type:"raster",source:"partbot-tiles"}]}}function bm(ae){return ae.styleUrl||L0(ae.tileUrl,ae.tileAttribution)}function F0(ae){return ae.darkMode?{background:"#1c1917",fill:"#292524",park:"#322e2b",water:"#0c0a09",line:"#44403c",road:"#57534e",boundary:"#78716c",text:"#e7e5e4",halo:"#1c1917"}:{background:"#f7f6f2",fill:"#efede8",park:"#e9e7e1",water:"#dedbd2",line:"#d2cfc7",road:"#ffffff",boundary:"#bdb8ae",text:"#5f5a52",halo:"#f7f6f2"}}function Cu(ae,ve,ue,qe){try{ae.setPaintProperty(ve,ue,qe)}catch{}}function wm(ae,ve){var Tt;if(ve.mapPalette!=="monotone"||!ve.styleUrl)return;const ue=ae.getStyle(),qe=F0(ve);(Tt=ue.layers)==null||Tt.forEach(ht=>{const j=ht.id.toLowerCase(),d="source-layer"in ht&&typeof ht["source-layer"]=="string"?ht["source-layer"].toLowerCase():"",Me=`${j} ${d}`;if(ht.type==="background"&&Cu(ae,ht.id,"background-color",qe.background),ht.type==="fill"){const $t=Me.includes("water")?qe.water:Me.includes("park")||Me.includes("green")||Me.includes("landuse")?qe.park:qe.fill;Cu(ae,ht.id,"fill-color",$t),Cu(ae,ht.id,"fill-opacity",1)}if(ht.type==="line"){const $t=Me.includes("road")?qe.road:Me.includes("boundary")||Me.includes("admin")?qe.boundary:qe.line;Cu(ae,ht.id,"line-color",$t)}ht.type==="symbol"&&(Cu(ae,ht.id,"text-color",qe.text),Cu(ae,ht.id,"text-halo-color",qe.halo),Cu(ae,ht.id,"text-halo-width",1),Cu(ae,ht.id,"icon-color",qe.text))})}function Kp(ae,ve){if(ae.isStyleLoaded()){wm(ae,ve);return}ae.once("idle",()=>wm(ae,ve))}function B0(ae,ve,ue,qe){if(ve.length===0){ae.easeTo({center:[ue.lng,ue.lat],zoom:qe,duration:300});return}if(ve.length===1){const ht=ve[0];ae.easeTo({center:[ht._geo.lng,ht._geo.lat],zoom:Math.max(qe,11),duration:350});return}const Tt=ve.reduce((ht,j)=>ht.extend([j._geo.lng,j._geo.lat]),new Ed.LngLatBounds([ve[0]._geo.lng,ve[0]._geo.lat],[ve[0]._geo.lng,ve[0]._geo.lat]));ae.fitBounds(Tt,{padding:56,maxZoom:12,duration:350})}function O0({value:ae,onChange:ve}){const[ue,qe]=Je.useState(!1),Tt=Je.useRef(null),ht=Math.max(0,bh.indexOf(ae)),[j,d]=Je.useState(ht);Je.useEffect(()=>{d(ht)},[ht]),Je.useEffect(()=>{if(!ue)return;const gt=zt=>{const Zt=typeof zt.composedPath=="function"?zt.composedPath():[],Wt=zt.target instanceof Node?zt.target:null;Tt.current&&Zt.includes(Tt.current)||Tt.current&&Wt&&Tt.current.contains(Wt)||qe(!1)};return document.addEventListener("pointerdown",gt),()=>document.removeEventListener("pointerdown",gt)},[ue]);const Me=gt=>{ve(gt),qe(!1)},$t=gt=>{if(gt.key==="ArrowDown"||gt.key==="ArrowUp"){gt.preventDefault(),qe(!0),d(zt=>{const Zt=gt.key==="ArrowDown"?1:-1;return(zt+Zt+bh.length)%bh.length});return}(gt.key==="Enter"||gt.key===" ")&&(gt.preventDefault(),ue?Me(bh[j]):qe(!0)),gt.key==="Escape"&&qe(!1)};return mt.jsxs("div",{className:"pbsm-radius-listbox",ref:Tt,children:[mt.jsxs("button",{"aria-activedescendant":ue?`pbsm-radius-${bh[j]}`:void 0,"aria-expanded":ue,"aria-haspopup":"listbox","aria-label":"Search radius",className:"pbsm-radius-trigger",type:"button",onClick:()=>qe(gt=>!gt),onKeyDown:$t,children:[mt.jsxs("span",{children:[ae," km"]}),mt.jsx("span",{"aria-hidden":"true",className:"pbsm-radius-caret"})]}),ue&&mt.jsx("div",{className:"pbsm-radius-options",role:"listbox","aria-label":"Search radius",children:bh.map((gt,zt)=>mt.jsxs("div",{id:`pbsm-radius-${gt}`,"aria-selected":gt===ae,className:"pbsm-radius-option",role:"option",onClick:()=>Me(gt),onMouseEnter:()=>d(zt),children:[gt," km"]},gt))})]})}function N0(ae,ve){const ue=ae?ve==null?void 0:ve[ae]:void 0;return ue?{"--pbsm-category-color":ue,"--pbsm-category-contrast":Pd(ue)}:void 0}function Qp(ae){var ve;return(ve=ae.categories)!=null&&ve.length?ae.categories:ae.category?[ae.category]:[]}function Jp(ae){return ae.display_address||ae.address}function j0(ae,ve){const ue=fm(ae.website),qe=document.createElement("div");qe.className="pbsm-popup";const Tt=document.createElement("strong");Tt.className="pbsm-popup-title",Tt.textContent=ae.name,qe.append(Tt),Qp(ae).forEach(d=>{const Me=document.createElement("span");Me.className="pbsm-popup-category",Me.textContent=d;const $t=ve==null?void 0:ve[d];$t&&(Me.style.setProperty("--pbsm-category-color",$t),Me.style.setProperty("--pbsm-category-contrast",Pd($t))),qe.append(Me)});const ht=Jp(ae);if(ht){const d=document.createElement("span");d.className="pbsm-popup-address",d.textContent=ht,qe.append(d)}const j=document.createElement("span");if(j.className="pbsm-popup-actions",ae.phone){const d=document.createElement("a");d.href=`tel:${ae.phone}`,d.className="pbsm-popup-action",d.textContent="Call now",j.append(d)}if(ue){const d=document.createElement("a");d.href=ue,d.target="_blank",d.rel="noreferrer",d.className="pbsm-popup-action",d.textContent="Website",j.append(d)}if(ae.email){const d=document.createElement("a");d.href=`mailto:${ae.email}`,d.className="pbsm-popup-action",d.textContent="Email",j.append(d)}if(ae.directions_available!==!1){const d=document.createElement("a");d.href=mm(ae._geo),d.target="_blank",d.rel="noreferrer",d.className="pbsm-popup-action pbsm-popup-action-primary",d.textContent="Get directions",j.append(d)}return qe.append(j),qe}function Tm(ae,ve,ue){var j;const qe=Qp(ve).map(d=>ue==null?void 0:ue[d]).find(Boolean),Tt=(j=qe==null?void 0:qe.url)==null?void 0:j.trim();if(ae.classList.toggle("has-custom-marker",!!Tt),!Tt){ae.replaceChildren(),delete ae.dataset.markerUrl;return}if(ae.dataset.markerUrl===Tt)return;const ht=document.createElement("img");ht.className="pbsm-marker-image",ht.src=Tt,ht.alt="",ht.draggable=!1,ht.addEventListener("error",()=>{ae.dataset.markerUrl!==Tt||ht.parentElement!==ae||(ae.classList.remove("has-custom-marker"),ae.replaceChildren(),delete ae.dataset.markerUrl)}),ae.replaceChildren(ht),ae.dataset.markerUrl=Tt}function ef({token:ae,configUrl:ve,config:ue,theme:qe,initialQuery:Tt="",initialRadiusKm:ht=50,className:j=""}){const[d,Me]=Je.useState(ue||null),[$t,gt]=Je.useState(Tt),[zt,Zt]=Je.useState(ht),[Wt,Ar]=Je.useState(""),[st,Ht]=Je.useState(null),[Br,ze]=Je.useState({center:null,label:null}),[Bt,Sr]=Je.useState([]),[ri,Or]=Je.useState(null),[Nr,Et]=Je.useState(!1),[ee,oe]=Je.useState(!1),[de,De]=Je.useState(null),Ke=Je.useRef(null),_t=Je.useRef(null),et=Je.useRef(new Map),dt=Je.useRef(null),it=Je.useRef(!1),Fe=Je.useRef(null),Le=Je.useRef(0),$e=Je.useRef(0),ce=Je.useRef(""),Ce=Je.useMemo(()=>lm({...(d==null?void 0:d.theme)||{},...qe||{}}),[d==null?void 0:d.theme,qe]),yt=Je.useMemo(()=>{var Ie;return st||((Ie=Bt[0])==null?void 0:Ie._geo)||Ce.defaultCenter},[st,Bt,Ce.defaultCenter]),vt=Bt.find(Ie=>Ie.id===ri)||Bt[0]||null,Nt=Je.useMemo(()=>P0(Bt),[Bt]),jt=(d==null?void 0:d.search.categories)||[],Ft=Je.useCallback(Ie=>{it.current=!0,Or(Ie)},[]);Je.useEffect(()=>{if(!Ke.current||_t.current)return;const Ie=new b0.Map({attributionControl:{compact:!0,customAttribution:""},center:[yt.lng,yt.lat],container:Ke.current,style:bm(Ce),zoom:Ce.defaultZoom});return Ie.addControl(new Ed.NavigationControl({showCompass:!1}),"top-right"),Kp(Ie,Ce),_t.current=Ie,()=>{var Ct;(Ct=dt.current)==null||Ct.remove(),dt.current=null,et.current.forEach(bt=>bt.remove()),et.current.clear(),Ie.remove(),_t.current=null}},[]),Je.useEffect(()=>{const Ie=_t.current;Ie&&(Ie.setStyle(bm(Ce)),Kp(Ie,Ce))},[Ce.styleUrl,Ce.tileAttribution,Ce.tileUrl]),Je.useEffect(()=>{const Ie=_t.current;Ie&&Kp(Ie,Ce)},[Ce.darkMode,Ce.mapPalette,Ce.styleUrl]),Je.useEffect(()=>{const Ie=_t.current;if(!Ie)return;const Ct=new Set(Bt.map(bt=>bt.id));et.current.forEach((bt,Er)=>{Ct.has(Er)||(bt.remove(),et.current.delete(Er))}),Bt.forEach(bt=>{const Er=et.current.get(bt.id);if(Er){Er.setLngLat([bt._geo.lng,bt._geo.lat]),Tm(Er.getElement(),bt,d==null?void 0:d.search.categoryMarkers);return}const ir=document.createElement("button");ir.type="button",ir.className="pbsm-marker",ir.setAttribute("aria-label",bt.name),Tm(ir,bt,d==null?void 0:d.search.categoryMarkers),ir.addEventListener("click",()=>Ft(bt.id));const ii=new Ed.Marker({element:ir,anchor:"center"}).setLngLat([bt._geo.lng,bt._geo.lat]).addTo(Ie);et.current.set(bt.id,ii)}),B0(Ie,Bt,yt,Ce.defaultZoom)},[d==null?void 0:d.search.categoryMarkers,Bt,yt,Ce.defaultZoom,Ft]),Je.useEffect(()=>{var Ct;const Ie=_t.current;if(et.current.forEach((bt,Er)=>{bt.getElement().classList.toggle("is-selected",Er===ri)}),!Ie||!vt||!it.current){(Ct=dt.current)==null||Ct.remove(),dt.current=null;return}dt.current||(dt.current=new Ed.Popup({closeButton:!0,closeOnClick:!1,offset:16})),dt.current.setLngLat([vt._geo.lng,vt._geo.lat]).setDOMContent(j0(vt,d==null?void 0:d.search.categoryColors)).addTo(Ie),Ie.easeTo({center:[vt._geo.lng,vt._geo.lat],duration:250,zoom:Math.max(Ie.getZoom(),10)})},[d==null?void 0:d.search.categoryColors,vt,ri]);const Rt=Je.useCallback(()=>{Fe.current&&(clearTimeout(Fe.current),Fe.current=null)},[]),qt=Je.useCallback(Ie=>{ce.current=Ie,Ar(Ie)},[]);Je.useEffect(()=>{if($e.current+=1,Le.current+=1,Rt(),Me(ue||null),Ht(null),ze({center:null,label:null}),Sr([]),Or(null),oe(!1),qt(""),De(null),ue)return;const Ie=ve||(ae?um(ae):null);if(!Ie)return;let Ct=!1;return hm(Ie).then(bt=>{Ct||Me(bt)}).catch(bt=>{Ct||De(bt.message)}),()=>{Ct=!0}},[Rt,ve,ue,ae,qt]);const $r=Je.useCallback(async(Ie={})=>{var ii,kn;if(!d)return;Rt();const Ct=Yp(Ie,"query")?Ie.query||"":$t,bt=Yp(Ie,"center")?Ie.center||null:Ct.trim()?null:st,Er=Yp(Ie,"category")?Ie.category||"":Wt,ir=Le.current+1;Le.current=ir,Et(!0),De(null);try{const $i=await Hp(d.search.url,{query:Ct,center:bt,radiusKm:zt,category:Er,limit:100}),zn=$i.center||bt||null,An=((ii=$i.resolvedQuery)==null?void 0:ii.label)||(bt?"your location":Ct.trim()?Ct.trim():null),go=zn?$i.hits.map(_o=>({..._o,distanceKm:dm(zn,_o._geo)})).sort((_o,$n)=>(_o.distanceKm||0)-($n.distanceKm||0)):$i.hits;if(ir!==Le.current)return;it.current=!1,ze({center:zn,label:An}),Sr(go),Or(((kn=go[0])==null?void 0:kn.id)||null)}catch($i){if(ir!==Le.current)return;De($i instanceof Error?$i.message:"Could not search stockists")}finally{ir===Le.current&&Et(!1)}},[Wt,st,Rt,d,$t,zt]);Je.useEffect(()=>{if(d)return Le.current+=1,Rt(),Fe.current=setTimeout(()=>{Fe.current=null,$r()},R0),Rt},[Rt,d,$r]),Je.useEffect(()=>()=>{$e.current+=1,Le.current+=1,Rt()},[Rt]);const yn=()=>{if(typeof window<"u"&&window.isSecureContext===!1){De("Browser location is blocked on this local Partbot domain. Chrome and Brave only allow Near me on HTTPS, localhost, or origins manually trusted in browser flags.");return}if(!navigator.geolocation){De("This browser does not support location search. Search by suburb or postcode instead.");return}oe(!0),De(null);const Ie=$e.current;navigator.geolocation.getCurrentPosition(Ct=>{if(Ie!==$e.current)return;const bt={lat:Ct.coords.latitude,lng:Ct.coords.longitude};gt(""),Ht(bt),ze({center:bt,label:"your location"}),oe(!1),$r({query:"",center:bt,category:ce.current})},Ct=>{Ie===$e.current&&(oe(!1),De(E0(Ct)))},{enableHighAccuracy:!1,timeout:8e3})},mo=Br.center?`No stockists found within ${zt} km. Try a larger radius.`:"Search a suburb, postcode, or dealer name to find stockists.";return mt.jsxs("section",{className:`pbsm-root ${Ce.darkMode?"is-dark":""} ${j}`.trim(),style:{"--pbsm-primary":Ce.primaryColor,"--pbsm-primary-contrast":Pd(Ce.primaryColor),"--pbsm-marker":Ce.markerColor,"--pbsm-marker-contrast":Pd(Ce.markerColor),"--pbsm-radius":`${Math.max(0,Ce.borderRadius)}px`},children:[de&&mt.jsxs(z0,{variant:"destructive",children:[mt.jsx(A0,{children:"Map unavailable"}),mt.jsx(D0,{children:de})]}),mt.jsxs("div",{className:`pbsm-toolbar ${jt.length>0?"has-categories":""}`.trim(),children:[mt.jsx(I0,{"aria-label":"Search stockists",placeholder:(d==null?void 0:d.search.placeholder)||"Search by suburb, postcode, or dealer",value:$t,onChange:Ie=>{const Ct=Ie.target.value;Le.current+=1,Rt(),gt(Ct),Ct.trim()&&(Ht(null),ze({center:null,label:Ct.trim()}))},onKeyDown:Ie=>{Ie.key==="Enter"&&(Ie.preventDefault(),$r())}}),jt.length>0&&mt.jsxs(k0,{className:"pbsm-category-select",name:"stockist-category","aria-label":"Stockist category",value:Wt,onChange:Ie=>qt(Ie.target.value),children:[mt.jsx(_m,{value:"",children:"All categories"}),jt.map(Ie=>mt.jsx(_m,{value:Ie,children:Ie},Ie))]}),mt.jsx(O0,{value:zt,onChange:Zt}),mt.jsxs(M0,{className:"pbsm-location-button",variant:"outline",type:"button",onClick:yn,disabled:ee||Nr,"aria-label":"Use my location",children:[mt.jsx(rm,{"aria-hidden":"true","data-slot":"icon",weight:"bold"}),mt.jsx("span",{className:"pbsm-button-label",children:ee?"Finding you":"Use my location"})]})]}),mt.jsxs("div",{className:"pbsm-layout",children:[mt.jsx(ym,{className:"pbsm-map-card",children:mt.jsx(vm,{className:"pbsm-map-content",children:mt.jsxs("div",{className:"pbsm-map","aria-label":"Stockist map",children:[mt.jsx("div",{ref:Ke,className:"pbsm-map-canvas"}),mt.jsx("div",{className:"pbsm-map-shade"}),Nr&&Bt.length===0?mt.jsx(xm,{className:"pbsm-map-skeleton"}):null]})})}),mt.jsx(ym,{className:"pbsm-list-card","aria-live":"polite",children:mt.jsxs(vm,{className:"pbsm-list",children:[Nr&&Bt.length===0?[0,1,2].map(Ie=>mt.jsx(xm,{className:"pbsm-result-skeleton"},Ie)):Nt.map(Ie=>{const Ct=fm(Ie.website);return mt.jsxs("article",{className:`pbsm-result-card ${vt&&Xp(Ie)===Xp(vt)?"is-selected":""}`,children:[mt.jsxs("button",{className:"pbsm-result-main",type:"button",onClick:()=>Ft(Ie.id),children:[mt.jsxs("span",{className:"pbsm-result-heading",children:[mt.jsx("span",{className:"pbsm-result-title",children:Ie.name}),mt.jsx("span",{className:"pbsm-result-categories",children:Qp(Ie).map(bt=>mt.jsx("span",{className:"pbsm-result-category",style:N0(bt,d==null?void 0:d.search.categoryColors),children:bt},bt))})]}),Jp(Ie)&&mt.jsx("span",{className:"pbsm-result-address",children:Jp(Ie)})]}),mt.jsxs("span",{className:"pbsm-card-actions",children:[Ie.phone&&mt.jsx("a",{href:`tel:${Ie.phone}`,children:"Call now"}),Ct&&mt.jsx("a",{href:Ct,target:"_blank",rel:"noreferrer",children:"Website"}),Ie.email&&mt.jsx("a",{href:`mailto:${Ie.email}`,children:"Email"}),Ie.directions_available!==!1&&mt.jsxs(mt.Fragment,{children:[mt.jsx("a",{href:mm(Ie._geo),target:"_blank",rel:"noreferrer",children:"Get directions"}),typeof Ie.distanceKm=="number"&&mt.jsx("span",{className:"pbsm-distance",children:pm(Ie.distanceKm)})]})]})]},Ie.id)}),!Nr&&Nt.length===0&&mt.jsx("div",{className:"pbsm-empty",children:mo})]})})]})]})}const V0=':host{display:block;height:var(--pbsm-height, 720px);min-height:0}[data-partbot-stockist-map-root]{display:block;height:100%;min-height:0}.pbsm-root,.pbsm-root *,.pbsm-root *:before,.pbsm-root *:after{box-sizing:border-box}.pbsm-root{--pbsm-primary: #111111;--pbsm-primary-contrast: #ffffff;--pbsm-marker: #111111;--pbsm-marker-contrast: #ffffff;--pbsm-action-color: var(--pbsm-primary);--pbsm-surface: #fdfcfa;--pbsm-control-surface: #fffefd;--pbsm-control-border: #d6d3d1;--pbsm-muted-surface: #f5f3f0;--pbsm-border: #e7e5e4;--pbsm-text: #1c1917;--pbsm-muted-text: #78716c;--pbsm-placeholder-text: #57534e;--pbsm-danger-surface: #fff1f2;--pbsm-danger-border: #fecdd3;--pbsm-danger-text: #9f1239;--pbsm-elevation: 0 14px 34px rgb(28 25 23 / .18), 0 2px 8px rgb(28 25 23 / .08);color:var(--pbsm-text);container-type:inline-size;display:flex;flex-direction:column;font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif;font-size:14px;height:var(--pbsm-height, 720px);line-height:1.5;min-height:0;overflow:hidden;width:100%}.pbsm-preview{height:100%}.pbsm-toolbar{align-items:center;background:var(--pbsm-surface);border:1px solid var(--pbsm-border);border-bottom:0;border-radius:var(--pbsm-radius) var(--pbsm-radius) 0 0;display:grid;gap:8px;grid-template-areas:"search radius location";grid-template-columns:minmax(220px,1fr) 104px auto;padding:10px 12px}.pbsm-toolbar.has-categories{grid-template-areas:"search category radius location";grid-template-columns:minmax(220px,1fr) minmax(132px,180px) 104px auto}.pbsm-toolbar>.pbsm-input{grid-area:search}.pbsm-radius-listbox{grid-area:radius}.pbsm-toolbar>.pbsm-native-select-wrapper{grid-area:category}.pbsm-category-select{min-width:0;text-overflow:ellipsis}.pbsm-location-button{grid-area:location}.pbsm-input,.pbsm-native-select,.pbsm-radius-trigger{background:var(--pbsm-control-surface, #fffefd);border:1px solid var(--pbsm-control-border);border-radius:6px;color:var(--pbsm-text);font:inherit;min-height:38px;padding:7px 10px;transition:border-color .16s ease,box-shadow .16s ease}.pbsm-input:focus,.pbsm-native-select:focus-visible,.pbsm-radius-trigger:focus{border-color:color-mix(in srgb,var(--pbsm-primary) 55%,#d6d3d1);box-shadow:0 0 0 3px color-mix(in srgb,var(--pbsm-primary) 16%,transparent);outline:none}.pbsm-input::placeholder{color:var(--pbsm-placeholder-text);opacity:1}.pbsm-native-select-wrapper{min-width:0;position:relative;width:100%}.pbsm-native-select-wrapper:has(select:disabled){opacity:.5}.pbsm-native-select{-webkit-appearance:none;-moz-appearance:none;appearance:none;box-shadow:0 1px 2px #1c19170d;cursor:pointer;padding-right:34px;width:100%}.pbsm-native-select:disabled{cursor:not-allowed;pointer-events:none}.pbsm-native-select-icon{color:var(--pbsm-muted-text);height:16px;opacity:.55;pointer-events:none;position:absolute;right:12px;top:50%;transform:translateY(-50%);width:16px}.pbsm-native-select-option{background:Canvas;color:CanvasText}.pbsm-button{align-items:center;border:1px solid var(--pbsm-control-border);border-radius:6px;cursor:pointer;display:inline-flex;font:inherit;font-weight:600;gap:8px;justify-content:center;min-height:38px;padding:7px 12px;transition:background-color .16s ease,border-color .16s ease,box-shadow .16s ease,transform .16s ease;white-space:nowrap}.pbsm-button [data-slot=icon]{height:16px;flex:0 0 auto;width:16px}.pbsm-radius-listbox{position:relative}.pbsm-radius-trigger{align-items:center;cursor:pointer;display:flex;gap:8px;justify-content:space-between;width:100%}.pbsm-radius-caret{border-color:var(--pbsm-muted-text) transparent transparent;border-style:solid;border-width:5px 4px 0;height:0;width:0}.pbsm-radius-options{background:var(--pbsm-control-surface, #fffefd);border:1px solid var(--pbsm-control-border);border-radius:6px;box-shadow:var(--pbsm-elevation);display:grid;left:0;min-width:100%;overflow:hidden;padding:4px;position:absolute;top:calc(100% + 6px);z-index:10}.pbsm-radius-option{background:transparent;border:0;border-radius:4px;color:var(--pbsm-text);cursor:pointer;font:inherit;padding:7px 8px;text-align:left;white-space:nowrap}.pbsm-radius-option:hover,.pbsm-radius-option[aria-selected=true]{background:color-mix(in srgb,var(--pbsm-primary) 8%,var(--pbsm-control-surface, #fff))}.pbsm-button[data-variant=default]{background:var(--pbsm-primary);border-color:var(--pbsm-primary);color:var(--pbsm-primary-contrast)}.pbsm-button[data-variant=secondary],.pbsm-button[data-variant=outline]{background:var(--pbsm-control-surface, #fffefd);color:var(--pbsm-text)}.pbsm-button:not(:disabled):hover{box-shadow:0 1px 2px #1c191714;transform:translateY(-1px)}.pbsm-button:not(:disabled):active{box-shadow:none;transform:translateY(0)}.pbsm-button:focus-visible{box-shadow:0 0 0 3px color-mix(in srgb,var(--pbsm-primary) 18%,transparent);outline:none}.pbsm-button[data-variant=ghost]{background:transparent;border-color:transparent;color:var(--pbsm-text)}.pbsm-button:disabled{cursor:not-allowed;opacity:.6}.pbsm-card-shell{background:var(--pbsm-surface);border:1px solid var(--pbsm-control-border);display:flex;flex-direction:column;min-height:0}.pbsm-card-header{align-items:center;border-bottom:1px solid var(--pbsm-border);display:flex;gap:12px;justify-content:space-between;padding:16px}.pbsm-card-title{font-size:14px;font-weight:700;line-height:1.2}.pbsm-card-description{color:var(--pbsm-muted-text);font-size:12px;line-height:1.35;margin-top:2px}.pbsm-card-content{min-height:0}.pbsm-badge{align-items:center;border:1px solid transparent;border-radius:999px;display:inline-flex;font-size:12px;font-weight:700;justify-content:center;min-width:28px;padding:2px 8px;white-space:nowrap}.pbsm-badge[data-variant=default],.pbsm-badge[data-variant=secondary]{background:color-mix(in srgb,var(--pbsm-action-color) 10%,var(--pbsm-control-surface));color:var(--pbsm-action-color)}.pbsm-badge[data-variant=outline]{background:var(--pbsm-control-surface, #fffefd);border-color:var(--pbsm-control-border);color:var(--pbsm-muted-text)}.pbsm-alert{background:var(--pbsm-danger-surface);border:1px solid var(--pbsm-danger-border);border-radius:6px;color:var(--pbsm-danger-text);margin-bottom:12px;padding:8px 10px}.pbsm-alert-title{font-weight:700}.pbsm-alert-description{font-size:13px;line-height:1.45;margin-top:2px}.pbsm-skeleton{animation:pbsm-pulse 1.4s ease-in-out infinite;background:#e7e5e4;border-radius:6px}.pbsm-layout{display:grid;flex:1;gap:0;grid-template-areas:"list map";grid-template-columns:minmax(340px,400px) minmax(0,1fr);grid-template-rows:minmax(0,1fr);min-height:0;overflow:hidden;border-radius:0 0 var(--pbsm-radius) var(--pbsm-radius)}.pbsm-map-card{border-radius:0 0 var(--pbsm-radius) 0;grid-area:map;min-height:0;overflow:hidden}.pbsm-map-content{flex:1}.pbsm-map{background:var(--pbsm-border);height:100%;min-height:360px;overflow:hidden;position:relative}.pbsm-map-canvas{height:100%;top:0;right:0;bottom:0;left:0;position:absolute;width:100%}.pbsm-map-shade{background:linear-gradient(to top,rgb(28 25 23 / .12),transparent 42%),radial-gradient(circle at 70% 20%,color-mix(in srgb,var(--pbsm-primary) 10%,transparent),transparent 34%);top:0;right:0;bottom:0;left:0;pointer-events:none;position:absolute}.pbsm-map-skeleton{top:16px;right:16px;bottom:16px;left:16px;opacity:.55;position:absolute;z-index:1}.pbsm-marker{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:var(--pbsm-marker);border:2px solid #fff;border-radius:999px;box-shadow:0 6px 16px #1c191747;cursor:pointer;height:18px;padding:0;transition:box-shadow .18s ease,height .18s ease,transform .18s ease,width .18s ease;width:18px}.pbsm-marker:hover{transform:scale(1.14)}.pbsm-marker:focus-visible{box-shadow:0 0 0 4px color-mix(in srgb,var(--pbsm-marker) 22%,transparent),0 8px 22px #1c191747;outline:none}.pbsm-marker.is-selected{box-shadow:0 0 0 5px color-mix(in srgb,var(--pbsm-marker) 18%,transparent),0 8px 22px #1c191752;height:26px;width:26px}.pbsm-marker.has-custom-marker{align-items:center;background:transparent;border:0;border-radius:0;box-shadow:none;display:inline-flex;height:36px;justify-content:center;width:36px}.pbsm-marker.has-custom-marker:focus-visible{border-radius:6px;box-shadow:0 0 0 4px color-mix(in srgb,var(--pbsm-primary) 28%,transparent)}.pbsm-marker.has-custom-marker.is-selected{box-shadow:none;height:44px;width:44px}.pbsm-marker.has-custom-marker.is-selected:focus-visible{box-shadow:0 0 0 4px color-mix(in srgb,var(--pbsm-primary) 28%,transparent),0 8px 22px #1c191747}.pbsm-marker-image{filter:drop-shadow(0 5px 6px rgb(28 25 23 / .32));height:100%;object-fit:contain;pointer-events:none;-webkit-user-select:none;user-select:none;width:100%}.pbsm-root .maplibregl-popup-content{background:var(--pbsm-control-surface, #fffefd);border:1px solid color-mix(in srgb,var(--pbsm-action-color) 14%,var(--pbsm-border));border-radius:var(--pbsm-radius);box-shadow:var(--pbsm-elevation);padding:0}.pbsm-root .maplibregl-popup-tip{filter:drop-shadow(0 2px 2px rgb(28 25 23 / .08))}.pbsm-root .maplibregl-popup-close-button{align-items:center;border-radius:999px;color:#78716c;display:inline-flex;font-size:18px;height:26px;justify-content:center;line-height:1;right:7px;top:7px;transition:background-color .14s ease,color .14s ease;width:26px}.pbsm-root .maplibregl-popup-close-button:hover{background:var(--pbsm-muted-surface);color:var(--pbsm-text)}.pbsm-root .maplibregl-ctrl-attrib{font-size:10px}.pbsm-root .maplibregl-ctrl-attrib:not(.maplibregl-compact){max-width:260px}.pbsm-popup{color:var(--pbsm-text);display:grid;font:12px/1.4 Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif;gap:8px;max-width:260px;min-width:220px;padding:14px 38px 14px 14px}.pbsm-popup-title{color:var(--pbsm-text);font-size:13px;font-weight:700;line-height:1.2}.pbsm-popup-address{color:var(--pbsm-muted-text);line-height:1.35}.pbsm-popup-category,.pbsm-result-category{background:var( --pbsm-category-color, color-mix(in srgb, var(--pbsm-action-color) 10%, var(--pbsm-control-surface, #fff)) );border-radius:999px;color:var(--pbsm-category-contrast, var(--pbsm-action-color));font-size:11px;font-weight:700;line-height:1.2;padding:3px 7px;width:fit-content}.pbsm-popup-actions{display:flex;flex-wrap:wrap;gap:6px;margin-top:4px}.pbsm-popup-action{align-items:center;background:var(--pbsm-muted-surface);border:1px solid var(--pbsm-border);border-radius:999px;color:var(--pbsm-action-color);display:inline-flex;font-size:11px;font-weight:700;line-height:1.2;padding:6px 9px;text-decoration:none;transition:background-color .14s ease,border-color .14s ease,color .14s ease,transform .14s ease}.pbsm-popup-action:hover{background:var(--pbsm-control-surface, #fff);border-color:color-mix(in srgb,var(--pbsm-action-color) 28%,var(--pbsm-control-border));transform:translateY(-1px)}.pbsm-popup-action-primary{background:color-mix(in srgb,var(--pbsm-action-color) 12%,var(--pbsm-control-surface, #fff));border-color:color-mix(in srgb,var(--pbsm-action-color) 24%,var(--pbsm-control-border))}.pbsm-list-card{border-radius:0 0 0 var(--pbsm-radius);grid-area:list;min-height:0;overflow:hidden}.pbsm-list{-ms-overflow-style:none;flex:1;max-height:none;min-height:0;overflow:auto;scrollbar-width:none}.pbsm-list::-webkit-scrollbar{display:none}.pbsm-result-card{background:var(--pbsm-surface);border:0;border-bottom:1px solid var(--pbsm-border);color:inherit;display:grid;gap:10px;padding:18px 16px;text-align:left;transition:background-color .16s ease,box-shadow .16s ease,transform .16s ease;width:100%}.pbsm-result-main{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:transparent;border:0;color:inherit;cursor:pointer;display:grid;gap:10px;padding:0;text-align:left;width:100%}.pbsm-result-card:hover{background:color-mix(in srgb,var(--pbsm-primary) 5%,var(--pbsm-surface))}.pbsm-result-card:has(.pbsm-result-main:active){transform:scale(.998)}.pbsm-result-card:focus-within{box-shadow:inset 0 0 0 2px color-mix(in srgb,var(--pbsm-primary) 48%,transparent);outline:none}.pbsm-result-main:focus-visible{outline:none}.pbsm-result-card.is-selected{background:color-mix(in srgb,var(--pbsm-primary) 8%,var(--pbsm-surface));box-shadow:inset 4px 0 0 var(--pbsm-primary)}.pbsm-result-heading{align-items:start;display:flex;gap:14px;justify-content:space-between}.pbsm-result-title{flex:1 1 auto;font-size:13px;font-weight:600;line-height:1.3;min-width:0}.pbsm-result-categories{align-items:flex-start;display:flex;flex-wrap:wrap;gap:7px;justify-content:flex-end;max-width:58%}.pbsm-result-address{color:var(--pbsm-muted-text);font-size:12px;line-height:1.45}.pbsm-distance{background:color-mix(in srgb,var(--pbsm-action-color) 10%,var(--pbsm-control-surface, #fff));border-radius:999px;color:var(--pbsm-action-color);flex:0 0 auto;font-size:11px;font-weight:700;line-height:1.2;padding:3px 7px}.pbsm-result-skeleton{height:88px;margin:12px}.pbsm-card-actions{align-items:center;display:flex;flex-wrap:wrap;gap:12px;margin-top:4px}.pbsm-card-actions a{color:var(--pbsm-action-color);font-size:12px;font-weight:600;text-decoration:none}.pbsm-card-actions a:hover{text-decoration:underline;text-underline-offset:3px}.pbsm-empty{color:var(--pbsm-muted-text);line-height:1.4;padding:28px 18px;text-align:center}@keyframes pbsm-pulse{0%,to{opacity:.55}50%{opacity:1}}@container (max-width: 760px){.pbsm-toolbar{grid-template-areas:"search radius location";grid-template-columns:minmax(0,1fr) 88px 38px;gap:6px;padding:6px}.pbsm-toolbar.has-categories{grid-template-areas:"search radius location" "category category category"}.pbsm-layout{grid-template-columns:1fr}.pbsm-layout{grid-template-areas:"map" "list";grid-template-rows:minmax(300px,3fr) minmax(0,2fr);overflow:hidden}.pbsm-map{min-height:300px}.pbsm-button{min-height:38px;padding-inline:0}.pbsm-location-button{aspect-ratio:1;width:38px}.pbsm-button-label{clip:rect(0 0 0 0);border:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}.pbsm-map-card{border-radius:0}.pbsm-list-card{border-radius:0 0 var(--pbsm-radius) var(--pbsm-radius)}.pbsm-list{max-height:none}}.pbsm-root.pbsm-preview-mobile .pbsm-toolbar{grid-template-areas:"search radius location";grid-template-columns:minmax(0,1fr) 88px 38px;gap:6px;padding:6px}.pbsm-root.pbsm-preview-mobile .pbsm-toolbar.has-categories{grid-template-areas:"search radius location" "category category category"}.pbsm-root.pbsm-preview-mobile .pbsm-layout{grid-template-areas:"map" "list";grid-template-columns:1fr;grid-template-rows:minmax(300px,3fr) minmax(0,2fr);overflow:hidden}.pbsm-root.pbsm-preview-mobile .pbsm-map{min-height:300px}.pbsm-root.pbsm-preview-mobile .pbsm-button{min-height:38px;padding-inline:0}.pbsm-root.pbsm-preview-mobile .pbsm-location-button{aspect-ratio:1;width:38px}.pbsm-root.pbsm-preview-mobile .pbsm-button-label{clip:rect(0 0 0 0);border:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}.pbsm-root.pbsm-preview-mobile .pbsm-map-card{border-radius:0}.pbsm-root.pbsm-preview-mobile .pbsm-list-card{border-radius:0 0 var(--pbsm-radius) var(--pbsm-radius)}.pbsm-root.pbsm-preview-mobile .pbsm-list{max-height:none}.pbsm-root.pbsm-preview-mobile .pbsm-result-heading{flex-direction:column;gap:7px}.pbsm-root.pbsm-preview-mobile .pbsm-result-categories{justify-content:flex-start;max-width:none}@container (max-width: 480px){.pbsm-toolbar{grid-template-columns:minmax(0,1fr) 82px 38px}.pbsm-result-heading{flex-direction:column;gap:7px}.pbsm-result-categories{justify-content:flex-start;max-width:none}}.pbsm-root.pbsm-preview-mobile .pbsm-toolbar{grid-template-columns:minmax(0,1fr) 88px 38px}:where(.dark) .pbsm-root,.pbsm-root.is-dark{--pbsm-action-color: #f5f3f0;--pbsm-surface: #1c1917;--pbsm-control-surface: #292524;--pbsm-control-border: rgb(255 255 255 / .12);--pbsm-muted-surface: #292524;--pbsm-border: rgb(255 255 255 / .1);--pbsm-text: #f5f3f0;--pbsm-muted-text: #a8a29e;--pbsm-placeholder-text: #d6d3d1;--pbsm-danger-surface: rgb(127 29 29 / .28);--pbsm-danger-border: rgb(244 63 94 / .28);--pbsm-danger-text: #fecdd3;--pbsm-elevation: 0 18px 42px rgb(0 0 0 / .42), 0 2px 10px rgb(0 0 0 / .22)}:where(.dark) .pbsm-input,:where(.dark) .pbsm-native-select,.pbsm-root.is-dark .pbsm-input,.pbsm-root.is-dark .pbsm-native-select{color-scheme:dark}:where(.dark) .pbsm-marker,.pbsm-root.is-dark .pbsm-marker{border-color:#f5f3f0}:where(.dark) .pbsm-map-shade,.pbsm-root.is-dark .pbsm-map-shade{background:linear-gradient(to top,rgb(0 0 0 / .2),transparent 42%),radial-gradient(circle at 70% 20%,rgb(255 255 255 / .06),transparent 34%)}@media(prefers-color-scheme:dark){.pbsm-root{--pbsm-action-color: #f5f3f0;--pbsm-surface: #1c1917;--pbsm-control-surface: #292524;--pbsm-control-border: rgb(255 255 255 / .12);--pbsm-muted-surface: #292524;--pbsm-border: rgb(255 255 255 / .1);--pbsm-text: #f5f3f0;--pbsm-muted-text: #a8a29e;--pbsm-placeholder-text: #d6d3d1;--pbsm-danger-surface: rgb(127 29 29 / .28);--pbsm-danger-border: rgb(244 63 94 / .28);--pbsm-danger-text: #fecdd3;--pbsm-elevation: 0 18px 42px rgb(0 0 0 / .42), 0 2px 10px rgb(0 0 0 / .22)}.pbsm-input,.pbsm-native-select{color-scheme:dark}.pbsm-marker{border-color:#f5f3f0}.pbsm-map-shade{background:linear-gradient(to top,rgb(0 0 0 / .2),transparent 42%),radial-gradient(circle at 70% 20%,rgb(255 255 255 / .06),transparent 34%)}}@media(prefers-reduced-motion:reduce){.pbsm-button,.pbsm-input,.pbsm-marker,.pbsm-popup-action,.pbsm-result-card,.pbsm-native-select{transition:none}.pbsm-button:not(:disabled):hover,.pbsm-marker:hover,.pbsm-popup-action:hover,.pbsm-result-card:active{transform:none}}';function Sm(ae,ve){const ue=tm.createRoot(ae);return ue.render(mt.jsx(ef,{...ve})),ue}const Em="data-partbot-stockist-map-styles",Pm="data-partbot-stockist-map-root",U0=`${g0}
842
+ ${T.shaderPreludeCode.vertexSource}`,define:T.shaderDefine},defaultProjectionData:M},R=b.renderingMode?b.renderingMode:"2d";if(f.renderPass==="offscreen"){const L=b.prerender;L&&(f.setCustomLayerDefaults(),g.setColorMode(f.colorModeForRenderPass()),L.call(b,g.gl,I),g.setDirty(),f.setBaseState())}else if(f.renderPass==="translucent"){f.setCustomLayerDefaults(),g.setColorMode(f.colorModeForRenderPass()),g.setStencilMode(kt.disabled);const L=R==="3d"?f.getDepthModeFor3D():f.getDepthModeForSublayer(0,It.ReadOnly);g.setDepthMode(L),b.render(g.gl,I),g.setDirty(),f.setBaseState(),g.bindFramebuffer.set(null)}},debug:function(f,t,n){for(const l of n)Xi(f,t,l)},debugPadding:function(f){const t=f.transform.padding;Li(f,f.transform.height-(t.top||0),3,ra),Li(f,t.bottom||0,3,wr),na(f,t.left||0,3,yr),na(f,f.transform.width-(t.right||0),3,ia);const n=f.transform.centerPoint;(function(l,h,g,b){ko(l,h-1,g-10,2,20,b),ko(l,h-10,g-1,20,2,b)})(f,n.x,f.transform.height-n.y,jr)},terrainDepth:function(f,t){const n=f.context,l=n.gl,h=f.transform,g=ar.unblended,b=new It(l.LEQUAL,It.ReadWrite,[0,1]),T=t.tileManager.getRenderableTiles(),P=f.useProgram("terrainDepth");n.bindFramebuffer.set(t.getFramebuffer("depth").framebuffer),n.viewport.set([0,0,f.width/devicePixelRatio,f.height/devicePixelRatio]),n.clear({color:d.bo.transparent,depth:1});for(const M of T){const I=t.getTerrainMesh(M.tileID),R=t.getTerrainData(M.tileID),L=h.getProjectionData({overscaledTileID:M.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),O={u_ele_delta:t.getMeshFrameDelta(h.zoom)};P.draw(n,l.TRIANGLES,b,kt.disabled,g,Vt.backCCW,O,R,L,"terrain",I.vertexBuffer,I.indexBuffer,I.segments)}n.bindFramebuffer.set(null),n.viewport.set([0,0,f.width,f.height])},terrainCoords:function(f,t){const n=f.context,l=n.gl,h=f.transform,g=ar.unblended,b=new It(l.LEQUAL,It.ReadWrite,[0,1]),T=t.getCoordsTexture(),P=t.tileManager.getRenderableTiles(),M=f.useProgram("terrainCoords");n.bindFramebuffer.set(t.getFramebuffer("coords").framebuffer),n.viewport.set([0,0,f.width/devicePixelRatio,f.height/devicePixelRatio]),n.clear({color:d.bo.transparent,depth:1}),t.coordsIndex=[];for(const I of P){const R=t.getTerrainMesh(I.tileID),L=t.getTerrainData(I.tileID);n.activeTexture.set(l.TEXTURE0),l.bindTexture(l.TEXTURE_2D,T.texture);const O={u_terrain_coords_id:(255-t.coordsIndex.length)/255,u_texture:0,u_ele_delta:t.getMeshFrameDelta(h.zoom)},$=h.getProjectionData({overscaledTileID:I.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});M.draw(n,l.TRIANGLES,b,kt.disabled,g,Vt.backCCW,O,L,$,"terrain",R.vertexBuffer,R.indexBuffer,R.segments),t.coordsIndex.push(I.tileID.key)}n.bindFramebuffer.set(null),n.viewport.set([0,0,f.width,f.height])}};class La{constructor(t,n){this.drawFunctions=Qc,this.context=new Wu(t),this.transform=n,this._tileTextures={},this.terrainFacilitator={depthDirty:!0,coordsDirty:!1,matrix:d.ap(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=bi.maxOverzooming+bi.maxUnderzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Wr}resize(t,n,l){if(this.width=Math.floor(t*l),this.height=Math.floor(n*l),this.pixelRatio=l,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const h of this.style._order)this.style._layers[h].resize()}setup(){const t=this.context,n=new d.aU;n.emplaceBack(0,0),n.emplaceBack(d.a6,0),n.emplaceBack(0,d.a6),n.emplaceBack(d.a6,d.a6),this.tileExtentBuffer=t.createVertexBuffer(n,Xo.members),this.tileExtentSegments=d.aV.simpleSegment(0,0,4,2);const l=new d.aU;l.emplaceBack(0,0),l.emplaceBack(d.a6,0),l.emplaceBack(0,d.a6),l.emplaceBack(d.a6,d.a6),this.debugBuffer=t.createVertexBuffer(l,Xo.members),this.debugSegments=d.aV.simpleSegment(0,0,4,5);const h=new d.ch;h.emplaceBack(0,0,0,0),h.emplaceBack(d.a6,0,d.a6,0),h.emplaceBack(0,d.a6,0,d.a6),h.emplaceBack(d.a6,d.a6,d.a6,d.a6),this.rasterBoundsBuffer=t.createVertexBuffer(h,jl.members),this.rasterBoundsSegments=d.aV.simpleSegment(0,0,4,2);const g=new d.aU;g.emplaceBack(0,0),g.emplaceBack(d.a6,0),g.emplaceBack(0,d.a6),g.emplaceBack(d.a6,d.a6),this.rasterBoundsBufferPosOnly=t.createVertexBuffer(g,Xo.members),this.rasterBoundsSegmentsPosOnly=d.aV.simpleSegment(0,0,4,5);const b=new d.aU;b.emplaceBack(0,0),b.emplaceBack(1,0),b.emplaceBack(0,1),b.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(b,Xo.members),this.viewportSegments=d.aV.simpleSegment(0,0,4,2);const T=new d.ci;T.emplaceBack(0),T.emplaceBack(1),T.emplaceBack(3),T.emplaceBack(2),T.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(T);const P=new d.aW;P.emplaceBack(1,0,2),P.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(P);const M=this.context.gl;this.stencilClearMode=new kt({func:M.ALWAYS,mask:0},0,255,M.ZERO,M.ZERO,M.ZERO),this.tileExtentMesh=new fr(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){const t=this.context,n=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const l=d.O();d.c7(l,0,this.width,this.height,0,0,1),d.S(l,l,[n.drawingBufferWidth,n.drawingBufferHeight,0]);const h={mainMatrix:l,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:l};this.useProgram("clippingMask",null,!0).draw(t,n.TRIANGLES,It.disabled,this.stencilClearMode,ar.disabled,Vt.disabled,null,null,h,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,n,l){if(this.currentStencilSource===t.source||!t.isTileClipped()||!(n!=null&&n.length))return;this.currentStencilSource=t.source,this.nextStencilID+n.length>256&&this.clearStencil();const h=this.context;h.setColorMode(ar.disabled),h.setDepthMode(It.disabled);const g={};for(const b of n)g[b.key]=this.nextStencilID++;this._renderTileMasks(g,n,l,!0),this._renderTileMasks(g,n,l,!1),this._tileClippingMaskIDs=g}_renderTileMasks(t,n,l,h){var g;const b=this.context,T=b.gl,P=this.style.projection,M=this.transform,I=this.useProgram("clippingMask");for(const R of n){const L=t[R.key],O=(g=this.style.map.terrain)===null||g===void 0?void 0:g.getTerrainData(R),$=P.getMeshFromTileID(this.context,R.canonical,h,!0,"stencil"),Z=M.getProjectionData({overscaledTileID:R,applyGlobeMatrix:!l,applyTerrainMatrix:!0});I.draw(b,T.TRIANGLES,It.disabled,new kt({func:T.ALWAYS,mask:0},L,255,T.KEEP,T.KEEP,T.REPLACE),ar.disabled,l?Vt.disabled:Vt.backCCW,null,O,Z,"$clipping",$.vertexBuffer,$.indexBuffer,$.segments)}}_renderTilesDepthBuffer(){var t;const n=this.context,l=n.gl,h=this.style.projection,g=this.transform,b=this.useProgram("depth"),T=this.getDepthModeFor3D(),P=Gn(g,{tileSize:g.tileSize});for(const M of P){const I=(t=this.style.map.terrain)===null||t===void 0?void 0:t.getTerrainData(M),R=h.getMeshFromTileID(this.context,M.canonical,!0,!0,"raster"),L=g.getProjectionData({overscaledTileID:M,applyGlobeMatrix:!0,applyTerrainMatrix:!0});b.draw(n,l.TRIANGLES,T,kt.disabled,ar.disabled,Vt.backCCW,null,I,L,"$clipping",R.vertexBuffer,R.indexBuffer,R.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,n=this.context.gl;return new kt({func:n.NOTEQUAL,mask:255},t,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(t){const n=this.context.gl;return new kt({func:n.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,n.KEEP,n.KEEP,n.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(t){const n=this.context.gl,l=t.sort(((b,T)=>T.overscaledZ-b.overscaledZ)),h=l[l.length-1].overscaledZ,g=l[0].overscaledZ-h+1;if(g>1){this.currentStencilSource=void 0,this.nextStencilID+g>256&&this.clearStencil();const b={};for(let T=0;T<g;T++)b[T+h]=new kt({func:n.GEQUAL,mask:255},T+this.nextStencilID,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID+=g,[b,l]}return[{[h]:kt.disabled},l]}stencilConfigForOverlapTwoPass(t){const n=this.context.gl,l=t.sort(((b,T)=>T.overscaledZ-b.overscaledZ)),h=l[l.length-1].overscaledZ,g=l[0].overscaledZ-h+1;if(this.clearStencil(),g>1){const b={},T={};for(let P=0;P<g;P++)b[P+h]=new kt({func:n.GREATER,mask:255},g+1+P,255,n.KEEP,n.KEEP,n.REPLACE),T[P+h]=new kt({func:n.GREATER,mask:255},1+P,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID=2*g+1,[b,T,l]}return this.nextStencilID=3,[{[h]:new kt({func:n.GREATER,mask:255},2,255,n.KEEP,n.KEEP,n.REPLACE)},{[h]:new kt({func:n.GREATER,mask:255},1,255,n.KEEP,n.KEEP,n.REPLACE)},l]}colorModeForRenderPass(){const t=this.context.gl;return this._showOverdrawInspector?new ar([t.CONSTANT_COLOR,t.ONE],new d.bo(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?ar.unblended:ar.alphaBlended}getDepthModeForSublayer(t,n,l){if(!this.opaquePassEnabledForLayer())return It.disabled;const h=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new It(l||this.context.gl.LEQUAL,n,[h,h])}getDepthModeFor3D(){return new It(this.context.gl.LEQUAL,It.ReadWrite,this.depthRangeFor3D)}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(t,n){var l,h,g;this.style=t,this.options=n,this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(st()),this.imageManager.beginFrame();const b=this.style._order,T=this.style.tileManagers,P={},M={},I={},R={isRenderingToTexture:!1,isRenderingGlobe:((l=t.projection)===null||l===void 0?void 0:l.transitionState)>0};for(const O in T){const $=T[O];$.used&&$.prepare(this.context),P[O]=$.getVisibleCoordinates(!1),M[O]=P[O].slice().reverse(),I[O]=$.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let O=0;O<b.length;O++)if(this.style._layers[b[O]].is3D()){this.opaquePassCutoff=O;break}this.maybeDrawDepth(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const O of b){const $=this.style._layers[O];if(!$.hasOffscreenPass()||$.isHidden(this.transform.zoom))continue;const Z=M[$.source];($.type==="custom"||Z.length)&&this.renderLayer(this,T[$.source],$,Z,R)}if((h=this.style.projection)===null||h===void 0||h.updateGPUdependent({context:this.context,useProgram:O=>this.useProgram(O)}),this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:n.showOverdrawInspector?d.bo.black:d.bo.transparent,depth:1}),this.clearStencil(),this.style.sky&&this.drawFunctions.sky(this,this.style.sky),this._showOverdrawInspector=n.showOverdrawInspector,this.depthRangeFor3D=[0,1-(t._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=b.length-1;this.currentLayer>=0;this.currentLayer--){const O=this.style._layers[b[this.currentLayer]],$=T[O.source],Z=P[O.source];this._renderTileClippingMasks(O,Z,!1),this.renderLayer(this,$,O,Z,R)}this.renderPass="translucent";let L=!1;for(this.currentLayer=0;this.currentLayer<b.length;this.currentLayer++){const O=this.style._layers[b[this.currentLayer]],$=T[O.source];if(!((g=this.renderToTexture)===null||g===void 0)&&g.renderLayer(O,R))continue;this.opaquePassEnabledForLayer()||L||(L=!0,R.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());const Z=(O.type==="symbol"?I:M)[O.source];this._renderTileClippingMasks(O,P[O.source],!!this.renderToTexture),this.renderLayer(this,$,O,Z,R)}if(R.isRenderingGlobe&&this.drawFunctions.atmosphere(this,this.style.sky,this.style.light),this.options.showTileBoundaries){const O=(function($,Z){let Y=null;const H=Object.values($._layers).flatMap((X=>X.source&&!X.isHidden(Z)?[$.tileManagers[X.source]]:[])),K=H.filter((X=>X.getSource().type==="vector")),ie=H.filter((X=>X.getSource().type!=="vector")),Q=X=>{(!Y||Y.getSource().maxzoom<X.getSource().maxzoom)&&(Y=X)};for(const X of K)Q(X);if(!Y)for(const X of ie)Q(X);return Y})(this.style,this.transform.zoom);O&&this.drawFunctions.debug(this,O,O.getVisibleCoordinates())}this.options.showPadding&&this.drawFunctions.debugPadding(this),this.context.setDefault()}maybeDrawDepth(t){var n,l;if(!(!((l=(n=this.style)===null||n===void 0?void 0:n.map)===null||l===void 0)&&l.terrain))return;const h=this.terrainFacilitator.matrix,g=this.transform.modelViewProjectionMatrix;let b=this.terrainFacilitator.depthDirty;b||(b=t?!d.cj(h,g):!d.ck(h,g)),b||(b=this.style.map.terrain.tileManager.anyTilesAfterTime(this.terrainFacilitator.renderTime)),b&&(d.cl(h,g),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.depthDirty=!1,this.terrainFacilitator.coordsDirty=!0,this.drawFunctions.terrainDepth(this,this.style.map.terrain))}maybeDrawCoords(){var t,n;!((n=(t=this.style)===null||t===void 0?void 0:t.map)===null||n===void 0)&&n.terrain&&this.terrainFacilitator.coordsDirty&&(this.terrainFacilitator.coordsDirty=!1,this.drawFunctions.terrainCoords(this,this.style.map.terrain))}renderLayer(t,n,l,h,g){if(l.isHidden(this.transform.zoom)||l.type!=="background"&&l.type!=="custom"&&!(h||[]).length)return;this.id=l.id;const b=this.drawFunctions;d.aQ(l)?b.symbol(t,n,l,h,this.style.placement.variableOffsets,g):d.cm(l)?b.circle(t,n,l,h,g):d.cn(l)?b.heatmap(t,n,l,h,g):d.co(l)?b.line(t,n,l,h,g):d.cp(l)?b.fill(t,n,l,h,g):d.cq(l)?b.fillExtrusion(t,n,l,h,g):d.cr(l)?b.hillshade(t,n,l,h,g):d.cs(l)?b.colorRelief(t,n,l,h,g):d.bU(l)?b.raster(t,n,l,h,g):d.ct(l)?b.background(t,n,l,h,g):d.cu(l)&&b.custom(t,n,l,g)}saveTileTexture(t){const n=this._tileTextures[t.size[0]];n?n.length<La.MAX_TEXTURE_POOL_SIZE_PER_BUCKET?n.push(t):t.destroy():this._tileTextures[t.size[0]]=[t]}getTileTexture(t){const n=this._tileTextures[t];return n&&n.length>0?n.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;const n=this.imageManager.getPattern(t.from.toString()),l=this.imageManager.getPattern(t.to.toString());return!n||!l}useProgram(t,n,l=!1,h=[]){var g;this.cache||(this.cache={});const b=!!this.style.map.terrain,T=this.style.projection,P=l?Pr.projectionMercator:T.shaderPreludeCode,M=l?hi:T.shaderDefine,I=t+(n?n.cacheKey:"")+`/${l?on:T.shaderVariantName}`+(this._showOverdrawInspector?"/overdraw":"")+(b?"/terrain":"")+(h?`/${h.join("/")}`:"");return(g=this.cache)[I]||(g[I]=new Vl(this.context,Pr[t],n,Mh[t],this._showOverdrawInspector,b,P,M,h)),this.cache[I]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new d.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){var t,n;if(this._tileTextures){for(const l in this._tileTextures){const h=this._tileTextures[l];if(h)for(const g of h)g.destroy()}this._tileTextures={}}if(this.tileExtentBuffer&&this.tileExtentBuffer.destroy(),this.debugBuffer&&this.debugBuffer.destroy(),this.rasterBoundsBuffer&&this.rasterBoundsBuffer.destroy(),this.rasterBoundsBufferPosOnly&&this.rasterBoundsBufferPosOnly.destroy(),this.viewportBuffer&&this.viewportBuffer.destroy(),this.tileBorderIndexBuffer&&this.tileBorderIndexBuffer.destroy(),this.quadTriangleIndexBuffer&&this.quadTriangleIndexBuffer.destroy(),this.tileExtentMesh&&((t=this.tileExtentMesh.vertexBuffer)===null||t===void 0||t.destroy()),this.tileExtentMesh&&((n=this.tileExtentMesh.indexBuffer)===null||n===void 0||n.destroy()),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this.cache){for(const l in this.cache){const h=this.cache[l];h!=null&&h.program&&this.context.gl.deleteProgram(h.program)}this.cache={}}this.context&&this.context.setDefault()}overLimit(){const{drawingBufferWidth:t,drawingBufferHeight:n}=this.context.gl;return this.width!==t||this.height!==n}}function Yu(f,t){let n,l=!1,h=null;const g=()=>{h=null,l&&(f(...n),h=setTimeout(g,t),l=!1)};return(...b)=>(l=!0,n=b,h||g(),h)}La.MAX_TEXTURE_POOL_SIZE_PER_BUCKET=50;class Tn{constructor(t){this._getCurrentHash=()=>{const n=window.location.hash.replace("#","");if(this._hashName){let l;const h=n.split("&").map((g=>g.split("=")));for(const g of h)g[0]===this._hashName&&(l=g);return(l&&l[1]||"").split("/")}return n.split("/")},this._onHashChange=()=>{const n=this._getCurrentHash();if(!this._isValidHash(n))return!1;const l=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(n[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+n[2],+n[1]],zoom:+n[0],bearing:l,pitch:+(n[4]||0)}),!0},this._updateHashUnthrottled=()=>{const n=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,n)},this._removeHash=()=>{const n=this._getCurrentHash();if(n.length===0)return;const l=n.join("/");let h=l;h.split("&").length>0&&(h=h.split("&")[0]),this._hashName&&(h=`${this._hashName}=${l}`);let g=window.location.hash.replace(h,"");g.startsWith("#&")?g=g.slice(0,1)+g.slice(2):g==="#"&&(g="");let b=window.location.href.replace(/(#.+)?$/,g);b=b.replace("&&","&"),window.history.replaceState(window.history.state,null,b)},this._updateHash=Yu(this._updateHashUnthrottled,300),this._hashName=t&&encodeURIComponent(t)}addTo(t){return this._map=t,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(t){const n=this._map.getCenter(),l=Math.round(100*this._map.getZoom())/100,h=Math.ceil((l*Math.LN2+Math.log(512/360/.5))/Math.LN10),g=Math.pow(10,h),b=Math.round(n.lng*g)/g,T=Math.round(n.lat*g)/g,P=this._map.getBearing(),M=this._map.getPitch();let I="";if(I+=t?`/${b}/${T}/${l}`:`${l}/${T}/${b}`,(P||M)&&(I+="/"+Math.round(10*P)/10),M&&(I+=`/${Math.round(M)}`),this._hashName){const R=this._hashName;let L=!1;const O=window.location.hash.slice(1).split("&").map(($=>{const Z=$.split("=")[0];return Z===R?(L=!0,`${Z}=${I}`):$})).filter(($=>$));return L||O.push(`${R}=${I}`),`#${O.join("&")}`}return`#${I}`}_isValidHash(t){if(t.length<3||t.some(isNaN))return!1;try{new d.W(+t[2],+t[1])}catch{return!1}const n=+t[0],l=+(t[3]||0),h=+(t[4]||0);return n>=this._map.getMinZoom()&&n<=this._map.getMaxZoom()&&l>=-180&&l<=180&&h>=this._map.getMinPitch()&&h<=this._map.getMaxPitch()}}const oa={linearity:.3,easing:d.cv(0,0,.3,1)},sn=d.e({deceleration:2500,maxSpeed:1400},oa),Nn=d.e({deceleration:20,maxSpeed:1400},oa),Bh=d.e({deceleration:1e3,maxSpeed:360},oa),pi=d.e({deceleration:1e3,maxSpeed:90},oa),rl=d.e({deceleration:1e3,maxSpeed:360},oa);class il{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:st(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,n=st();for(;t.length>0&&n-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const n={zoom:0,bearing:0,pitch:0,roll:0,pan:new d.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:g}of this._inertiaBuffer)n.zoom+=g.zoomDelta||0,n.bearing+=g.bearingDelta||0,n.pitch+=g.pitchDelta||0,n.roll+=g.rollDelta||0,g.panDelta&&n.pan._add(g.panDelta),g.around&&(n.around=g.around),g.pinchAround&&(n.pinchAround=g.pinchAround);const l=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,h={};if(n.pan.mag()){const g=Sn(n.pan.mag(),l,d.e({},sn,t||{})),b=n.pan.mult(g.amount/n.pan.mag()),T=this._map.cameraHelper.handlePanInertia(b,this._map.transform);h.center=T.easingCenter,h.offset=T.easingOffset,Fa(h,g)}if(n.zoom){const g=Sn(n.zoom,l,Nn);h.zoom=d.cw(this._map.transform.zoom+g.amount,this._map.getZoomSnap(),g.amount),Fa(h,g)}if(n.bearing){const g=Sn(n.bearing,l,Bh);h.bearing=this._map.transform.bearing+d.al(g.amount,-179,179),Fa(h,g)}if(n.pitch){const g=Sn(n.pitch,l,pi);h.pitch=this._map.transform.pitch+g.amount,Fa(h,g)}if(n.roll){const g=Sn(n.roll,l,rl);h.roll=this._map.transform.roll+d.al(g.amount,-179,179),Fa(h,g)}if(h.zoom||h.bearing){const g=n.pinchAround===void 0?n.around:n.pinchAround;h.around=g?this._map.unproject(g):this._map.getCenter()}return this.clear(),d.e(h,{noMoveStart:!0})}}function Fa(f,t){(!f.duration||f.duration<t.duration)&&(f.duration=t.duration,f.easing=t.easing)}function Sn(f,t,n){const{maxSpeed:l,linearity:h,deceleration:g}=n,b=d.al(f*h/(t/1e3),-l,l),T=Math.abs(b)/(g*h);return{easing:n.easing,duration:1e3*T,amount:b*(T/2)}}class Rr extends d.n{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,l,h={}){l=l instanceof MouseEvent?l:new MouseEvent(t,l);const g=ze.mousePos(n.getCanvas(),l),b=n.unproject(g);super(t,d.e({point:g,lngLat:b,originalEvent:l},h)),this._defaultPrevented=!1,this.target=n}}class Fi extends d.n{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,l){const h=t==="touchend"?l.changedTouches:l.touches,g=ze.touchPos(n.getCanvasContainer(),h),b=g.map((P=>n.unproject(P))),T=g.reduce(((P,M,I,R)=>P.add(M.div(R.length))),new d.P(0,0));super(t,{points:g,point:T,lngLats:b,lngLat:n.unproject(T),originalEvent:l}),this._defaultPrevented=!1}}class Ba extends d.n{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,l){super(t,{originalEvent:l}),this._defaultPrevented=!1}}class aa{constructor(t,n){this._map=t,this._clickTolerance=n.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new Ba(t.type,this._map,t))}mousedown(t,n){return this._mousedownPos=n,this._firePreventable(new Rr(t.type,this._map,t))}mouseup(t){this._map.fire(new Rr(t.type,this._map,t))}click(t,n){this._mousedownPos&&this._mousedownPos.dist(n)>=this._clickTolerance||this._map.fire(new Rr(t.type,this._map,t))}dblclick(t){return this._firePreventable(new Rr(t.type,this._map,t))}mouseover(t){this._map.fire(new Rr(t.type,this._map,t))}mouseout(t){this._map.fire(new Rr(t.type,this._map,t))}touchstart(t){return this._firePreventable(new Fi(t.type,this._map,t))}touchmove(t){this._map.fire(new Fi(t.type,this._map,t))}touchend(t){this._map.fire(new Fi(t.type,this._map,t))}touchcancel(t){this._map.fire(new Fi(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class zo{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new Rr(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Rr("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new Rr(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Yi{constructor(t){this._map=t}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(t){return this.transform.screenPointToLocation(d.P.convert(t),this._map.terrain)}}class eo{constructor(t,n){this._map=t,this._tr=new Yi(t),this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=n.clickTolerance||1,n.boxZoom&&typeof n.boxZoom=="object"&&(this._boxZoomEnd=n.boxZoom.boxZoomEnd)}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,n){this.isEnabled()&&t.shiftKey&&t.button===0&&(ze.disableDrag(),this._startPos=this._lastPos=n,this._active=!0)}mousemoveWindow(t,n){if(!this._active)return;const l=n;if(this._lastPos.equals(l)||!this._box&&l.dist(this._startPos)<this._clickTolerance)return;const h=this._startPos;this._lastPos=l,this._box||(this._box=ze.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",t));const g=Math.min(h.x,l.x),b=Math.max(h.x,l.x),T=Math.min(h.y,l.y),P=Math.max(h.y,l.y);this._box.style.transform=`translate(${g}px,${T}px)`,this._box.style.width=b-g+"px",this._box.style.height=P-T+"px"}mouseupWindow(t,n){if(!this._active||t.button!==0)return;const l=this._startPos,h=n;if(this.reset(),ze.suppressClick(),l.x!==h.x||l.y!==h.y)return this._map.fire(new d.n("boxzoomend",{originalEvent:t})),this._boxZoomEnd?void this._boxZoomEnd(this._map,l,h,t):{cameraAnimation:g=>g.fitScreenCoordinates(l,h,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",t)}keydown(t){this._active&&t.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(this._box.remove(),this._box=null),ze.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,n){return this._map.fire(new d.n(t,{originalEvent:n}))}}function Qe(f,t){if(f.length!==t.length)throw new Error(`The number of touches and points are not equal - touches ${f.length}, points ${t.length}`);const n={};for(let l=0;l<f.length;l++)n[f[l].identifier]=t[l];return n}class Ku{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(t,n,l){(this.centroid||l.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=t.timeStamp),l.length===this.numTouches&&(this.centroid=(function(h){const g=new d.P(0,0);for(const b of h)g._add(b);return g.div(h.length)})(n),this.touches=Qe(l,n)))}touchmove(t,n,l){if(this.aborted||!this.centroid)return;const h=Qe(l,n);for(const g in this.touches){const b=h[g];(!b||b.dist(this.touches[g])>30)&&(this.aborted=!0)}}touchend(t,n,l){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),l.length===0){const h=!this.aborted&&this.centroid;if(this.reset(),h)return h}}}class Ei{constructor(t){this.singleTap=new Ku(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,n,l){this.singleTap.touchstart(t,n,l)}touchmove(t,n,l){this.singleTap.touchmove(t,n,l)}touchend(t,n,l){const h=this.singleTap.touchend(t,n,l);if(h){const g=t.timeStamp-this.lastTime<500,b=!this.lastTap||this.lastTap.dist(h)<30;if(g&&b||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=h,this.count===this.numTaps)return this.reset(),h}}}class ln{constructor(t){this._tr=new Yi(t),this._zoomIn=new Ei({numTouches:1,numTaps:2}),this._zoomOut=new Ei({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,n,l){this._zoomIn.touchstart(t,n,l),this._zoomOut.touchstart(t,n,l)}touchmove(t,n,l){this._zoomIn.touchmove(t,n,l),this._zoomOut.touchmove(t,n,l)}touchend(t,n,l){const h=this._zoomIn.touchend(t,n,l),g=this._zoomOut.touchend(t,n,l),b=this._tr;return h?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:T=>T.easeTo({duration:300,zoom:d.cw(b.zoom+1,T.getZoomSnap()),around:b.unproject(h)},{originalEvent:t})}):g?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:T=>T.easeTo({duration:300,zoom:d.cw(b.zoom-1,T.getZoomSnap()),around:b.unproject(g)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class rr{constructor(t){this._enabled=!!t.enable,this._moveStateManager=t.moveStateManager,this._clickTolerance=t.clickTolerance||1,this._moveFunction=t.move,this._activateOnStart=!!t.activateOnStart,t.assignEvents(this),this.reset()}reset(t){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(t)}_move(...t){const n=this._moveFunction(...t);if(n.bearingDelta||n.pitchDelta||n.rollDelta||n.around||n.panDelta)return this._active=!0,n}dragStart(t,n){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(t)&&(this._moveStateManager.startMove(t),this._lastPoint=Array.isArray(n)?n[0]:n,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(t,n){if(!this.isEnabled())return;const l=this._lastPoint;if(!l)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t))return void this.reset(t);const h=Array.isArray(n)?n[0]:n;return!this._moved&&h.dist(l)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=h,this._move(l,h))}dragEnd(t){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(t)&&(this._moved&&ze.suppressClick(),this.reset(t))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}const Ki=0,Qu=2,Oh={[Ki]:1,[Qu]:2};class sa{constructor(t){this._correctEvent=t.checkCorrectEvent}startMove(t){this._eventButton=t.button}endMove(t){delete this._eventButton}isValidStartEvent(t){return this._correctEvent(t)}isValidMoveEvent(t){return!(function(n,l){const h=Oh[l];return n.buttons===void 0||(n.buttons&h)!==h})(t,this._eventButton)}isValidEndEvent(t){return t.button===this._eventButton}}class Ju{constructor(){this._firstTouch=void 0}_isOneFingerTouch(t){return t.targetTouches.length===1}_isSameTouchEvent(t){return t.targetTouches[0].identifier===this._firstTouch}startMove(t){this._firstTouch=t.targetTouches[0].identifier}endMove(t){delete this._firstTouch}isValidStartEvent(t){return this._isOneFingerTouch(t)}isValidMoveEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}isValidEndEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}}class ec{constructor(t=new sa({checkCorrectEvent:()=>!0}),n=new Ju){this.mouseMoveStateManager=t,this.oneFingerTouchMoveStateManager=n}_executeRelevantHandler(t,n,l){return t instanceof MouseEvent?n(t):typeof TouchEvent<"u"&&t instanceof TouchEvent?l(t):void 0}startMove(t){this._executeRelevantHandler(t,(n=>{this.mouseMoveStateManager.startMove(n)}),(n=>{this.oneFingerTouchMoveStateManager.startMove(n)}))}endMove(t){this._executeRelevantHandler(t,(n=>{this.mouseMoveStateManager.endMove(n)}),(n=>{this.oneFingerTouchMoveStateManager.endMove(n)}))}isValidStartEvent(t){return this._executeRelevantHandler(t,(n=>this.mouseMoveStateManager.isValidStartEvent(n)),(n=>this.oneFingerTouchMoveStateManager.isValidStartEvent(n)))}isValidMoveEvent(t){return this._executeRelevantHandler(t,(n=>this.mouseMoveStateManager.isValidMoveEvent(n)),(n=>this.oneFingerTouchMoveStateManager.isValidMoveEvent(n)))}isValidEndEvent(t){return this._executeRelevantHandler(t,(n=>this.mouseMoveStateManager.isValidEndEvent(n)),(n=>this.oneFingerTouchMoveStateManager.isValidEndEvent(n)))}}const ys=f=>{f.mousedown=f.dragStart,f.mousemoveWindow=f.dragMove,f.mouseup=f.dragEnd,f.contextmenu=t=>{t.preventDefault()}};class Jc{constructor(t,n){this._clickTolerance=t.clickTolerance||1,this._map=n,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new d.P(0,0)}_shouldBePrevented(t){return t<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(t,n,l){return this._calculateTransform(t,n,l)}touchmove(t,n,l){if(this._active){if(!this._shouldBePrevented(l.length))return t.preventDefault(),this._calculateTransform(t,n,l);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",t)}}touchend(t,n,l){this._calculateTransform(t,n,l),this._active&&this._shouldBePrevented(l.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,n,l){l.length>0&&(this._active=!0);const h=Qe(l,n),g=new d.P(0,0),b=new d.P(0,0);let T=0;for(const M in h){const I=h[M],R=this._touches[M];R&&(g._add(I),b._add(I.sub(R)),T++,h[M]=I)}if(this._touches=h,this._shouldBePrevented(T)||!b.mag())return;const P=b.div(T);return this._sum._add(P),this._sum.mag()<this._clickTolerance?void 0:{around:g.div(T),panDelta:P}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Oa{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(t,n,l){this._firstTwoTouches||l.length<2||(this._firstTwoTouches=[l[0].identifier,l[1].identifier],this._start([n[0],n[1]]))}touchmove(t,n,l){if(!this._firstTwoTouches)return;t.preventDefault();const[h,g]=this._firstTwoTouches,b=nl(l,n,h),T=nl(l,n,g);if(!b||!T)return;const P=this._aroundCenter?null:b.add(T).div(2);return this._move([b,T],P,t)}touchend(t,n,l){if(!this._firstTwoTouches)return;const[h,g]=this._firstTwoTouches,b=nl(l,n,h),T=nl(l,n,g);b&&T||(this._active&&ze.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(t){this._enabled=!0,this._aroundCenter=!!t&&t.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function nl(f,t,n){for(let l=0;l<f.length;l++)if(f[l].identifier===n)return t[l]}function eh(f,t){return Math.log(f/t)/Math.LN2}class ol extends Oa{constructor(){super(),this._zoomRate=1,this._zoomThreshold=.1}setZoomRate(t){this._zoomRate=t??1}setZoomThreshold(t){this._zoomThreshold=t??.1}reset(){super.reset(),delete this._distance,delete this._startDistance}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,n){const l=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(eh(this._distance,this._startDistance))<this._zoomThreshold))return this._active=!0,{zoomDelta:eh(this._distance,l)*this._zoomRate,pinchAround:n}}}function al(f,t){return 180*f.angleWith(t)/Math.PI}class th extends Oa{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(t){this._startVector=this._vector=t[0].sub(t[1]),this._minDiameter=t[0].dist(t[1])}_move(t,n,l){const h=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:al(this._vector,h),pinchAround:n}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const n=25/(Math.PI*this._minDiameter)*360,l=al(t,this._startVector);return Math.abs(l)<n}}function tc(f){return Math.abs(f.y)>Math.abs(f.x)}class un extends Oa{constructor(t){super(),this._currentTouchCount=0,this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,n,l){super.touchstart(t,n,l),this._currentTouchCount=l.length}_start(t){this._lastPoints=t,tc(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,n,l){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const h=t[0].sub(this._lastPoints[0]),g=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(h,g,l.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(h.y+g.y)/2*-.5}):void 0}gestureBeginsVertically(t,n,l){if(this._valid!==void 0)return this._valid;const h=t.mag()>=2,g=n.mag()>=2;if(!h&&!g)return;if(!h||!g)return this._firstMove===void 0&&(this._firstMove=l),l-this._firstMove<100&&void 0;const b=t.y>0==n.y>0;return tc(t)&&tc(n)&&b}}const hr={panStep:100,bearingStep:15,pitchStep:10};class tu{constructor(t){this._tr=new Yi(t);const n=hr;this._panStep=n.panStep,this._bearingStep=n.bearingStep,this._pitchStep=n.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let n=0,l=0,h=0,g=0,b=0;switch(t.keyCode){case 61:case 107:case 171:case 187:n=1;break;case 189:case 109:case 173:n=-1;break;case 37:t.shiftKey?l=-1:(t.preventDefault(),g=-1);break;case 39:t.shiftKey?l=1:(t.preventDefault(),g=1);break;case 38:t.shiftKey?h=1:(t.preventDefault(),b=-1);break;case 40:t.shiftKey?h=-1:(t.preventDefault(),b=1);break;default:return}return this._rotationDisabled&&(l=0,h=0),{cameraAnimation:T=>{const P=this._tr;T.easeTo({duration:300,easeId:"keyboardHandler",easing:vs,zoom:n?d.cw(P.zoom+n*(t.shiftKey?2:1),T.getZoomSnap()):P.zoom,bearing:P.bearing+l*this._bearingStep,pitch:P.pitch+h*this._pitchStep,offset:[-g*this._panStep,-b*this._panStep],center:P.center},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function vs(f){return f*(2-f)}const Ao=4.000244140625,ru=1/450;class iu{constructor(t,n){this._onTimeout=l=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(l)},this._map=t,this._tr=new Yi(t),this._triggerRenderFrame=n,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=ru}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!t&&t.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(t){return!!this._map.cooperativeGestures.isEnabled()&&!(t.ctrlKey||this._map.cooperativeGestures.isBypassed(t))}wheel(t){if(!this.isEnabled())return;if(this._shouldBePrevented(t))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",t);let n=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const l=st(),h=l-(this._lastWheelEventTime||0);this._lastWheelEventTime=l,n!==0&&n%Ao==0?this._type="wheel":n!==0&&Math.abs(n)<4?this._type="trackpad":h>400?(this._type=null,this._lastValue=n,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(h*n)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,n+=this._lastValue)),t.shiftKey&&n&&(n/=4),this._type&&(this._lastWheelEvent=t,this._delta-=n,this._active||this._start(t)),t.preventDefault()}_start(t){if(!this._delta)return;this._needsRerender=!1,this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const n=ze.mousePos(this._map.getCanvas(),t),l=this._tr;this._aroundPoint=this._aroundCenter?l.transform.locationToScreenPoint(d.W.convert(l.center)):n,this._needsRerender||(this._needsRerender=!0,this._triggerRenderFrame())}renderFrame(){if(!this._needsRerender||(this._needsRerender=!1,!this.isActive()))return;const t=this._tr.transform;if(typeof this._lastExpectedZoom=="number"){const T=t.zoom-this._lastExpectedZoom;typeof this._startZoom=="number"&&(this._startZoom+=T),typeof this._targetZoom=="number"&&(this._targetZoom+=T)}if(this._delta!==0){const T=this._type==="wheel"&&Math.abs(this._delta)>Ao?this._wheelZoomRate:this._defaultZoomRate;let P=2/(1+Math.exp(-Math.abs(this._delta*T)));this._delta<0&&P!==0&&(P=1/P);const M=typeof this._targetZoom!="number"?t.scale:d.ao(this._targetZoom),I=t.applyConstrain(t.getCameraLngLat(),d.ar(M*P)).zoom,R=this._map.getZoomSnap();if(this._type==="wheel"&&R>0){const L=d.cw(t.zoom,R);this._targetZoom=d.cw(I,R,I-L)}else this._targetZoom=I;this._type==="wheel"&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const n=typeof this._targetZoom!="number"?t.zoom:this._targetZoom,l=this._startZoom,h=this._easing;let g,b=!1;if(this._type==="wheel"&&l&&h){const T=st()-this._lastWheelEventTime,P=Math.min((T+5)/200,1),M=h(P);g=d.H.number(l,n,M),P<1?this._needsRerender=!0:b=!0}else g=n,b=!0;return this._active=!0,b&&(this._active=!1,this._finishTimeout=setTimeout((()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout}),200)),this._lastExpectedZoom=g,{noInertia:!0,needsRenderFrame:!b,zoomDelta:g-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let n=d.cy;if(this._prevEase){const l=this._prevEase,h=(st()-l.start)/l.duration,g=l.easing(h+.01)-l.easing(h),b=.27/Math.sqrt(g*g+1e-4)*.01,T=Math.sqrt(.0729-b*b);n=d.cv(b,T,.25,1)}return this._prevEase={start:st(),duration:t,easing:n},n}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class nu{constructor(t,n){this._clickZoom=t,this._tapZoom=n}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class rc{constructor(t){this._tr=new Yi(t),this.reset()}reset(){this._active=!1}dblclick(t,n){return t.preventDefault(),{cameraAnimation:l=>{l.easeTo({duration:300,zoom:d.cw(this._tr.zoom+(t.shiftKey?-1:1),l.getZoomSnap()),around:this._tr.unproject(n)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class sl{constructor(){this._tap=new Ei({numTouches:1,numTaps:1}),this._zoomRate=1,this.reset()}setZoomRate(t){this._zoomRate=t??1}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(t,n,l){if(!this._swipePoint)if(this._tapTime){const h=n[0],g=t.timeStamp-this._tapTime<500,b=this._tapPoint.dist(h)<30;g&&b?l.length>0&&(this._swipePoint=h,this._swipeTouch=l[0].identifier):this.reset()}else this._tap.touchstart(t,n,l)}touchmove(t,n,l){if(this._tapTime){if(this._swipePoint){if(l[0].identifier!==this._swipeTouch)return;const h=n[0],g=h.y-this._swipePoint.y;return this._swipePoint=h,t.preventDefault(),this._active=!0,{zoomDelta:g/128*this._zoomRate}}}else this._tap.touchmove(t,n,l)}touchend(t,n,l){if(this._tapTime)this._swipePoint&&l.length===0&&this.reset();else{const h=this._tap.touchend(t,n,l);h&&(this._tapTime=t.timeStamp,this._tapPoint=h)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Gr{constructor(t,n,l){this._el=t,this._mousePan=n,this._touchPan=l}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class to{constructor(t,n,l,h){this._pitchWithRotate=t.pitchWithRotate,this._rollEnabled=t.rollEnabled,this._mouseRotate=n,this._mousePitch=l,this._mouseRoll=h}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable(),this._rollEnabled&&this._mouseRoll.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable(),this._mouseRoll.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())&&(!this._rollEnabled||this._mouseRoll.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()||this._mouseRoll.isActive()}}class tt{constructor(t,n,l,h){this._el=t,this._touchZoom=n,this._touchRotate=l,this._tapDragZoom=h,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}setZoomRate(t){this._touchZoom.setZoomRate(t),this._tapDragZoom.setZoomRate(t)}setZoomThreshold(t){this._touchZoom.setZoomThreshold(t)}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class lt{constructor(t,n){this._bypassKey=navigator.userAgent.includes("Mac")?"metaKey":"ctrlKey",this._map=t,this._options=n,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const t=this._map.getCanvasContainer();t.classList.add("maplibregl-cooperative-gestures"),this._container=ze.create("div","maplibregl-cooperative-gesture-screen",t);let n=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(n=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const l=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),h=document.createElement("div");h.className="maplibregl-desktop-message",h.textContent=n,this._container.appendChild(h);const g=document.createElement("div");g.className="maplibregl-mobile-message",g.textContent=l,this._container.appendChild(g),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(this._container.remove(),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(t){return t[this._bypassKey]}notifyGestureBlocked(t,n){this._enabled&&(this._map.fire(new d.n("cooperativegestureprevented",{gestureType:t,originalEvent:n})),this._container.classList.add("maplibregl-show"),setTimeout((()=>{this._container.classList.remove("maplibregl-show")}),100))}}const Bi=f=>f.zoom||f.drag||f.roll||f.pitch||f.rotate;class la extends d.n{}function Na(f){var t;return((t=f.panDelta)===null||t===void 0?void 0:t.mag())||f.zoomDelta||f.bearingDelta||f.pitchDelta||f.rollDelta}class Oi{get _ownerDocument(){var t;return((t=this._el)===null||t===void 0?void 0:t.ownerDocument)||document}get _ownerWindow(){var t,n;return((n=(t=this._el)===null||t===void 0?void 0:t.ownerDocument)===null||n===void 0?void 0:n.defaultView)||window}constructor(t,n){this.handleWindowEvent=h=>{this.handleEvent(h,`${h.type}Window`)},this.handleEvent=(h,g)=>{if(h.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const b=h.type==="renderFrame"?void 0:h,T={needsRenderFrame:!1},P={},M={};for(const{handlerName:L,handler:O,allowed:$}of this._handlers){if(!O.isEnabled())continue;let Z;if(this._blockedByActive(M,$,L))O.reset();else if(O[g||h.type]){if(d.cz(h,g||h.type)){const Y=ze.mousePos(this._map.getCanvas(),h);Z=O[g||h.type](h,Y)}else if(d.cA(h,g||h.type)){const Y=this._getMapTouches(h.touches),H=ze.touchPos(this._map.getCanvas(),Y);Z=O[g||h.type](h,H,Y)}else d.cB(g||h.type)||(Z=O[g||h.type](h));this.mergeHandlerResult(T,P,Z,L,b),Z!=null&&Z.needsRenderFrame&&this._triggerRenderFrame()}(Z||O.isActive())&&(M[L]=O)}const I={};for(const L in this._previousActiveHandlers)M[L]||(I[L]=b);this._previousActiveHandlers=M,(Object.keys(I).length||Na(T))&&(this._changes.push([T,P,I]),this._triggerRenderFrame()),(Object.keys(M).length||Na(T))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:R}=T;R&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],R(this._map))},this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new il(t),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(n);const l=this._el;this._listeners=[[l,"touchstart",{passive:!0}],[l,"touchmove",{passive:!1}],[l,"touchend",void 0],[l,"touchcancel",void 0],[l,"mousedown",void 0],[l,"mousemove",void 0],[l,"mouseup",void 0],[this._ownerDocument,"mousemove",{capture:!0}],[this._ownerDocument,"mouseup",void 0],[l,"mouseover",void 0],[l,"mouseout",void 0],[l,"dblclick",void 0],[l,"click",void 0],[l,"keydown",{capture:!1}],[l,"keyup",void 0],[l,"wheel",{passive:!1}],[l,"contextmenu",void 0],[this._ownerWindow,"blur",void 0]];for(const[h,g,b]of this._listeners)h.addEventListener(g,h===this._ownerDocument?this.handleWindowEvent:this.handleEvent,b)}destroy(){for(const[t,n,l]of this._listeners)t.removeEventListener(n,t===this._ownerDocument?this.handleWindowEvent:this.handleEvent,l)}_addDefaultHandlers(t){const n=this._map,l=n.getCanvasContainer();this._add("mapEvent",new aa(n,t));const h=n.boxZoom=new eo(n,t);this._add("boxZoom",h),t.interactive&&t.boxZoom&&h.enable();const g=n.cooperativeGestures=new lt(n,t.cooperativeGestures);this._add("cooperativeGestures",g),t.cooperativeGestures&&g.enable();const b=new ln(n),T=new rc(n);n.doubleClickZoom=new nu(T,b),this._add("tapZoom",b),this._add("clickZoom",T),t.interactive&&t.doubleClickZoom&&n.doubleClickZoom.enable();const P=new sl;this._add("tapDragZoom",P);const M=n.touchPitch=new un(n);this._add("touchPitch",M),t.interactive&&t.touchPitch&&n.touchPitch.enable(t.touchPitch);const I=()=>n.project(n.getCenter()),R=(function({enable:Q,clickTolerance:X,aroundCenter:re=!0,minPixelCenterThreshold:J=100,rotateDegreesPerPixelMoved:pe=.8},xe){const Te=new sa({checkCorrectEvent:Re=>Re.button===0&&Re.ctrlKey||Re.button===2&&!Re.ctrlKey});return new rr({clickTolerance:X,move:(Re,Ae)=>{const rt=xe();if(re&&Math.abs(rt.y-Re.y)>J)return{bearingDelta:d.cx(new d.P(Re.x,Ae.y),Ae,rt)};let Ge=(Ae.x-Re.x)*pe;return re&&Ae.y<rt.y&&(Ge=-Ge),{bearingDelta:Ge}},moveStateManager:Te,enable:Q,assignEvents:ys})})(t,I),L=(function({enable:Q,clickTolerance:X,pitchDegreesPerPixelMoved:re=-.5}){const J=new sa({checkCorrectEvent:pe=>pe.button===0&&pe.ctrlKey||pe.button===2});return new rr({clickTolerance:X,move:(pe,xe)=>({pitchDelta:(xe.y-pe.y)*re}),moveStateManager:J,enable:Q,assignEvents:ys})})(t),O=(function({enable:Q,clickTolerance:X,rollDegreesPerPixelMoved:re=.3},J){const pe=new sa({checkCorrectEvent:xe=>xe.button===2&&xe.ctrlKey});return new rr({clickTolerance:X,move:(xe,Te)=>{const Re=J();let Ae=(Te.x-xe.x)*re;return Te.y<Re.y&&(Ae=-Ae),{rollDelta:Ae}},moveStateManager:pe,enable:Q,assignEvents:ys})})(t,I);n.dragRotate=new to(t,R,L,O),this._add("mouseRotate",R,["mousePitch"]),this._add("mousePitch",L,["mouseRotate","mouseRoll"]),this._add("mouseRoll",O,["mousePitch"]),t.interactive&&t.dragRotate&&n.dragRotate.enable();const $=(function({enable:Q,clickTolerance:X}){const re=new sa({checkCorrectEvent:J=>J.button===0&&!J.ctrlKey});return new rr({clickTolerance:X,move:(J,pe)=>({around:pe,panDelta:pe.sub(J)}),activateOnStart:!0,moveStateManager:re,enable:Q,assignEvents:ys})})(t),Z=new Jc(t,n);n.dragPan=new Gr(l,$,Z),this._add("mousePan",$),this._add("touchPan",Z,["touchZoom","touchRotate"]),t.interactive&&t.dragPan&&n.dragPan.enable(t.dragPan);const Y=new th,H=new ol;n.touchZoomRotate=new tt(l,H,Y,P),this._add("touchRotate",Y,["touchPan","touchZoom"]),this._add("touchZoom",H,["touchPan","touchRotate"]),t.interactive&&t.touchZoomRotate&&n.touchZoomRotate.enable(t.touchZoomRotate),this._add("blockableMapEvent",new zo(n));const K=n.scrollZoom=new iu(n,(()=>this._triggerRenderFrame()));this._add("scrollZoom",K,["mousePan"]),t.interactive&&t.scrollZoom&&n.scrollZoom.enable(t.scrollZoom);const ie=n.keyboard=new tu(n);this._add("keyboard",ie),t.interactive&&t.keyboard&&n.keyboard.enable()}_add(t,n,l){this._handlers.push({handlerName:t,handler:n,allowed:l}),this._handlersById[t]=n}stop(t){if(!this._updatingCamera){for(const{handler:n}of this._handlers)n.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}isActive(){for(const{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Bi(this._eventsInProgress)||this.isZooming()}_blockedByActive(t,n,l){for(const h in t)if(h!==l&&!(n!=null&&n.includes(h)))return!0;return!1}_getMapTouches(t){const n=[];for(const l of t)this._el.contains(l.target)&&n.push(l);return n}mergeHandlerResult(t,n,l,h,g){if(!l)return;d.e(t,l);const b={handlerName:h,originalEvent:l.originalEvent||g};l.zoomDelta!==void 0&&(n.zoom=b),l.panDelta!==void 0&&(n.drag=b),l.rollDelta!==void 0&&(n.roll=b),l.pitchDelta!==void 0&&(n.pitch=b),l.bearingDelta!==void 0&&(n.rotate=b)}_applyChanges(){const t={},n={},l={};for(const[h,g,b]of this._changes)h.panDelta&&(t.panDelta=(t.panDelta||new d.P(0,0))._add(h.panDelta)),h.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+h.zoomDelta),h.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+h.bearingDelta),h.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+h.pitchDelta),h.rollDelta&&(t.rollDelta=(t.rollDelta||0)+h.rollDelta),h.around!==void 0&&(t.around=h.around),h.pinchAround!==void 0&&(t.pinchAround=h.pinchAround),h.noInertia&&(t.noInertia=h.noInertia),d.e(n,g),d.e(l,b);this._updateMapTransform(t,n,l),this._changes=[]}_updateMapTransform(t,n,l){const h=this._map,g=h._getTransformForUpdate(),b=h.terrain;if(!(Na(t)||b&&this._terrainMovement))return void this._fireEvents(n,l,!0);h._stop(!0);let{panDelta:T,zoomDelta:P,bearingDelta:M,pitchDelta:I,rollDelta:R,around:L,pinchAround:O}=t;O!==void 0&&(L=O),L||(L=h.transform.centerPoint),b&&!g.isPointOnMapSurface(L)&&(L=g.centerPoint);const $={panDelta:T,zoomDelta:P,rollDelta:R,pitchDelta:I,bearingDelta:M,around:L};this._map.cameraHelper.useGlobeControls&&!g.isPointOnMapSurface(L)&&(L=g.centerPoint);const Z=L.distSqr(g.centerPoint)<.01?g.center:g.screenPointToLocation(T?L.sub(T):L);this._handleMapControls({terrain:b,tr:g,deltasForHelper:$,preZoomAroundLoc:Z,combinedEventsInProgress:n,panDelta:T}),h._applyUpdatedTransform(g),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(n,l,!0)}_handleMapControls({terrain:t,tr:n,deltasForHelper:l,preZoomAroundLoc:h,combinedEventsInProgress:g,panDelta:b}){const T=this._map.cameraHelper;if(T.handleMapControlsRollPitchBearingZoom(l,n),t)return T.useGlobeControls?(this._terrainMovement||!g.drag&&!g.zoom||(this._terrainMovement=!0,this._map._elevationFreeze=!0),void T.handleMapControlsPan(l,n,h)):this._terrainMovement||!g.drag&&!g.zoom?void(g.drag&&this._terrainMovement&&b?n.setCenter(n.screenPointToLocation(n.centerPoint.sub(b))):T.handleMapControlsPan(l,n,h)):(this._terrainMovement=!0,this._map._elevationFreeze=!0,void T.handleMapControlsPan(l,n,h));T.handleMapControlsPan(l,n,h)}_fireEvents(t,n,l){const h=Bi(this._eventsInProgress),g=Bi(t),b={};for(const R in t){const{originalEvent:L}=t[R];this._eventsInProgress[R]||(b[`${R}start`]=L),this._eventsInProgress[R]=t[R]}!h&&g&&this._fireEvent("movestart",g.originalEvent);for(const R in b)this._fireEvent(R,b[R]);g&&this._fireEvent("move",g.originalEvent);for(const R in t){const{originalEvent:L}=t[R];this._fireEvent(R,L)}const T={};let P;for(const R in this._eventsInProgress){const{handlerName:L,originalEvent:O}=this._eventsInProgress[R];this._handlersById[L].isActive()||(delete this._eventsInProgress[R],P=n[L]||O,T[`${R}end`]=P)}for(const R in T)this._fireEvent(R,T[R]);const M=Bi(this._eventsInProgress),I=(h||g)&&!M;if(I&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const R=this._map._getTransformForUpdate();this._map.getCenterClampedToGround()&&R.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(R)}if(l&&I){this._updatingCamera=!0;const R=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),L=O=>O!==0&&-this._bearingSnap<O&&O<this._bearingSnap;!R||!R.essential&&Wt.prefersReducedMotion?(this._map.fire(new d.n("moveend",{originalEvent:P})),L(this._map.getBearing())&&this._map.resetNorth()):(L(R.bearing||this._map.getBearing())&&(R.bearing=0),R.freezeElevation=!0,this._map.easeTo(R,{originalEvent:P})),this._updatingCamera=!1}}_fireEvent(t,n){this._map.fire(new d.n(t,n?{originalEvent:n}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add((t=>{delete this._frameId,this.handleEvent(new la("renderFrame",{timeStamp:t})),this._applyChanges()}))}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class Do extends d.E{constructor(t,n,l){super(),this._renderFrameCallback=()=>{const h=Math.min((st()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(h)),h<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=l.bearingSnap,this._zoomSnap=l.zoomSnap,this.cameraHelper=n,this.on("moveend",(()=>{delete this._requestedCameraState}))}migrateProjection(t,n){t.apply(this.transform,!0),this.transform=t,this.cameraHelper=n}getCenter(){return new d.W(this.transform.center.lng,this.transform.center.lat)}setCenter(t,n){return this.jumpTo({center:t},n)}getCenterElevation(){return this.transform.elevation}setCenterElevation(t,n){return this.jumpTo({elevation:t},n),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(t){this._centerClampedToGround=t}panBy(t,n,l){return t=d.P.convert(t).mult(-1),this.panTo(this.transform.center,d.e({offset:t},n),l)}panTo(t,n,l){return this.easeTo(d.e({center:t},n),l)}getZoom(){return this.transform.zoom}setZoom(t,n){return this.jumpTo({zoom:t},n),this}zoomTo(t,n,l){return this.easeTo(d.e({zoom:t},n),l)}zoomIn(t,n){return this.zoomTo(d.cw(this.getZoom()+1,this._zoomSnap),t,n),this}zoomOut(t,n){return this.zoomTo(d.cw(this.getZoom()-1,this._zoomSnap),t,n),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(t,n){return t!=this.transform.fov&&(this.transform.setFov(t),this.fire(new d.n("movestart",n)).fire(new d.n("move",n)).fire(new d.n("moveend",n))),this}getBearing(){return this.transform.bearing}setZoomSnap(t){return this._zoomSnap=t,this}getZoomSnap(){return this._zoomSnap}setBearing(t,n){return this.jumpTo({bearing:t},n),this}getPadding(){return this.transform.padding}setPadding(t,n){return this.jumpTo({padding:t},n),this}rotateTo(t,n,l){return this.easeTo(d.e({bearing:t},n),l)}resetNorth(t,n){return this.rotateTo(0,d.e({duration:1e3},t),n),this}resetNorthPitch(t,n){return this.easeTo(d.e({bearing:0,pitch:0,roll:0,duration:1e3},t),n),this}snapToNorth(t,n){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,n):this}getPitch(){return this.transform.pitch}setPitch(t,n){return this.jumpTo({pitch:t},n),this}getRoll(){return this.transform.roll}setRoll(t,n){return this.jumpTo({roll:t},n),this}cameraForBounds(t,n){t=Ie.convert(t).adjustAntiMeridian();const l=(n==null?void 0:n.bearing)||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),l,n)}_cameraForBoxAndBearing(t,n,l,h){const g={top:0,bottom:0,right:0,left:0};if(typeof(h=d.e({padding:g,offset:[0,0],maxZoom:this.transform.maxZoom},h)).padding=="number"){const I=h.padding;h.padding={top:I,bottom:I,right:I,left:I}}const b=d.e(g,h.padding);h.padding=b;const T=this.transform,P=new Ie(t,n),M=this.cameraHelper.cameraForBoxAndBearing(h,b,P,l,T);return M&&this._zoomSnap&&(M.zoom=d.cw(M.zoom,this._zoomSnap,-1)),M}fitBounds(t,n,l){return this._fitInternal(this.cameraForBounds(t,n),n,l)}fitScreenCoordinates(t,n,l,h,g){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(d.P.convert(t)),this.transform.screenPointToLocation(d.P.convert(n)),l,h),h,g)}_fitInternal(t,n,l){return t?(delete(n=d.e(t,n)).padding,n.linear?this.easeTo(n,l):this.flyTo(n,l)):this}jumpTo(t,n){this.stop(),"zoom"in t&&this._zoomSnap&&(t.zoom=d.cw(t.zoom,this._zoomSnap));const l=this._getTransformForUpdate();let h=!1,g=!1,b=!1;const T=l.zoom;this.terrain&&l.setElevation(this.terrain.getElevationForLngLatZoom(t.center?d.W.convert(t.center):l.center,t.zoom||l.tileZoom)),this.cameraHelper.handleJumpToCenterZoom(l,t);const P=l.zoom!==T;return"elevation"in t&&l.elevation!==+t.elevation&&l.setElevation(+t.elevation),"bearing"in t&&l.bearing!==+t.bearing&&(h=!0,l.setBearing(+t.bearing)),"pitch"in t&&l.pitch!==+t.pitch&&(g=!0,l.setPitch(+t.pitch)),"roll"in t&&l.roll!==+t.roll&&(b=!0,l.setRoll(+t.roll)),t.padding==null||l.isPaddingEqual(t.padding)||l.setPadding(t.padding),this._applyUpdatedTransform(l),this.fire(new d.n("movestart",n)).fire(new d.n("move",n)),P&&this.fire(new d.n("zoomstart",n)).fire(new d.n("zoom",n)).fire(new d.n("zoomend",n)),h&&this.fire(new d.n("rotatestart",n)).fire(new d.n("rotate",n)).fire(new d.n("rotateend",n)),g&&this.fire(new d.n("pitchstart",n)).fire(new d.n("pitch",n)).fire(new d.n("pitchend",n)),b&&this.fire(new d.n("rollstart",n)).fire(new d.n("roll",n)).fire(new d.n("rollend",n)),this.fire(new d.n("moveend",n))}calculateCameraOptionsFromTo(t,n,l,h=0){const g=d.a7.fromLngLat(t,n),b=d.a7.fromLngLat(l,h),T=b.x-g.x,P=b.y-g.y,M=b.z-g.z,I=Math.hypot(T,P,M);if(I===0)throw new Error("Can't calculate camera options with same From and To");const R=Math.hypot(T,P),L=d.ar(this.transform.cameraToCenterDistance/I/this.transform.tileSize),O=180*Math.atan2(T,-P)/Math.PI;let $=180*Math.acos(R/I)/Math.PI;return $=M<0?90-$:90+$,{center:b.toLngLat(),elevation:h,zoom:L,pitch:$,bearing:O}}calculateCameraOptionsFromCameraLngLatAltRotation(t,n,l,h,g){const b=this.transform.calculateCenterFromCameraLngLatAlt(t,n,l,h);return{center:b.center,elevation:b.elevation,zoom:b.zoom,bearing:l,pitch:h,roll:g}}easeTo(t,n){this._stop(!1,t.easeId),"zoom"in(t=d.e({offset:[0,0],duration:500,easing:d.cy},t))&&this._zoomSnap&&(t.zoom=d.cw(t.zoom,this._zoomSnap)),(t.animate===!1||!t.essential&&Wt.prefersReducedMotion)&&(t.duration=0);const l=this._getTransformForUpdate(),h=this.getBearing(),g=l.pitch,b=l.roll,T="bearing"in t?this._normalizeBearing(t.bearing,h):h,P="pitch"in t?+t.pitch:g,M="roll"in t?this._normalizeBearing(t.roll,b):b,I="padding"in t?t.padding:l.padding,R=d.P.convert(t.offset);let L,O;t.around&&(L=d.W.convert(t.around),O=l.locationToScreenPoint(L));const $={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},Z=this.cameraHelper.handleEaseTo(l,{bearing:T,pitch:P,roll:M,padding:I,around:L,aroundPoint:O,offsetAsPoint:R,offset:t.offset,zoom:t.zoom,center:t.center});return this._rotating||(this._rotating=h!==T),this._pitching||(this._pitching=P!==g),this._rolling||(this._rolling=M!==b),this._padding=!l.isPaddingEqual(I),this._zooming||(this._zooming=Z.isZooming),this._easeId=t.easeId,this._prepareEase(n,t.noMoveStart,$),this.terrain&&this._prepareElevation(Z.elevationCenter),this._ease((Y=>{Z.easeFunc(Y),this.terrain&&!t.freezeElevation&&this._updateElevation(Y),this._applyUpdatedTransform(l),this._fireMoveEvents(n)}),(Y=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(n,Y)}),t),this}_prepareEase(t,n,l={}){this._moving=!0,n||l.moving||this.fire(new d.n("movestart",t)),this._zooming&&!l.zooming&&this.fire(new d.n("zoomstart",t)),this._rotating&&!l.rotating&&this.fire(new d.n("rotatestart",t)),this._pitching&&!l.pitching&&this.fire(new d.n("pitchstart",t)),this._rolling&&!l.rolling&&this.fire(new d.n("rollstart",t))}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(t,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(t){this._elevationStart!==void 0&&this._elevationCenter!==void 0||this._prepareElevation(this.transform.center),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));const n=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(t<1&&n!==this._elevationTarget){const l=this._elevationTarget-this._elevationStart;this._elevationStart+=t*(l-(n-(l*t+this._elevationStart))/(1-t)),this._elevationTarget=n}this.transform.setElevation(d.H.number(this._elevationStart,this._elevationTarget,t))}_finalizeElevation(){this._elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(t){if(!this.terrain&&t.elevation>=0&&t.pitch<=90)return{};const n=t.getCameraLngLat(),l=t.getCameraAltitude(),h=this.terrain?this.terrain.getElevationForLngLatZoom(n,t.zoom):0;if(l<h){const g=this.calculateCameraOptionsFromTo(n,h,t.center,t.elevation);return{pitch:g.pitch,zoom:g.zoom}}return{}}_applyUpdatedTransform(t){const n=[];if(n.push((h=>this._elevateCameraIfInsideTerrain(h))),this.transformCameraUpdate&&n.push((h=>this.transformCameraUpdate(h))),!n.length)return;const l=t.clone();for(const h of n){const g=l.clone(),{center:b,zoom:T,roll:P,pitch:M,bearing:I,elevation:R}=h(g);b&&g.setCenter(b),R!==void 0&&g.setElevation(R),T!==void 0&&g.setZoom(T),P!==void 0&&g.setRoll(P),M!==void 0&&g.setPitch(M),I!==void 0&&g.setBearing(I),l.apply(g,!1)}this.transform.apply(l,!1)}_fireMoveEvents(t){this.fire(new d.n("move",t)),this._zooming&&this.fire(new d.n("zoom",t)),this._rotating&&this.fire(new d.n("rotate",t)),this._pitching&&this.fire(new d.n("pitch",t)),this._rolling&&this.fire(new d.n("roll",t))}_afterEase(t,n){if(this._easeId&&n&&this._easeId===n)return;delete this._easeId;const l=this._zooming,h=this._rotating,g=this._pitching,b=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,l&&this.fire(new d.n("zoomend",t)),h&&this.fire(new d.n("rotateend",t)),g&&this.fire(new d.n("pitchend",t)),b&&this.fire(new d.n("rollend",t)),this.fire(new d.n("moveend",t))}flyTo(t,n){if(!t.essential&&Wt.prefersReducedMotion){const Ae=d.V(t,["center","zoom","bearing","pitch","roll","elevation","padding"]);return this.jumpTo(Ae,n)}this.stop(),"zoom"in(t=d.e({offset:[0,0],speed:1.2,curve:1.42,easing:d.cy},t))&&this._zoomSnap&&(t.zoom=d.cw(t.zoom,this._zoomSnap));const l=this._getTransformForUpdate(),h=l.bearing,g=l.pitch,b=l.roll,T=l.padding,P="bearing"in t?this._normalizeBearing(t.bearing,h):h,M="pitch"in t?+t.pitch:g,I="roll"in t?this._normalizeBearing(t.roll,b):b,R="padding"in t?t.padding:l.padding,L=d.P.convert(t.offset);let O=l.centerPoint.add(L);const $=l.screenPointToLocation(O),Z=this.cameraHelper.handleFlyTo(l,{bearing:P,pitch:M,roll:I,padding:R,locationAtOffset:$,offsetAsPoint:L,center:t.center,minZoom:t.minZoom,zoom:t.zoom});let Y=t.curve;const H=Math.max(l.width,l.height),K=H/Z.scaleOfZoom,ie=Z.pixelPathLength;typeof Z.scaleOfMinZoom=="number"&&(Y=Math.sqrt(H/Z.scaleOfMinZoom/ie*2));const Q=Y*Y;function X(Ae){const rt=(K*K-H*H+(Ae?-1:1)*Q*Q*ie*ie)/(2*(Ae?K:H)*Q*ie);return Math.log(Math.sqrt(rt*rt+1)-rt)}function re(Ae){return(Math.exp(Ae)-Math.exp(-Ae))/2}function J(Ae){return(Math.exp(Ae)+Math.exp(-Ae))/2}const pe=X(!1);let xe=function(Ae){return J(pe)/J(pe+Y*Ae)},Te=function(Ae){return H*((J(pe)*(re(rt=pe+Y*Ae)/J(rt))-re(pe))/Q)/ie;var rt},Re=(X(!0)-pe)/Y;if(Math.abs(ie)<2e-6||!isFinite(Re)){if(Math.abs(H-K)<1e-6)return this.easeTo(t,n);const Ae=K<H?-1:1;Re=Math.abs(Math.log(K/H))/Y,Te=()=>0,xe=rt=>Math.exp(Ae*Y*rt)}return t.duration="duration"in t?+t.duration:1e3*Re/("screenSpeed"in t?+t.screenSpeed/Y:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=h!==P,this._pitching=M!==g,this._rolling=I!==b,this._padding=!l.isPaddingEqual(R),this._prepareEase(n,!1),this.terrain&&this._prepareElevation(Z.targetCenter),this._ease((Ae=>{const rt=Ae*Re,Ge=1/xe(rt),ke=Te(rt);this._rotating&&l.setBearing(d.H.number(h,P,Ae)),this._pitching&&l.setPitch(d.H.number(g,M,Ae)),this._rolling&&l.setRoll(d.H.number(b,I,Ae)),this._padding&&(l.interpolatePadding(T,R,Ae),O=l.centerPoint.add(L)),Z.easeFunc(Ae,Ge,ke,O),this.terrain&&!t.freezeElevation&&this._updateElevation(Ae),this._applyUpdatedTransform(l),this._fireMoveEvents(n)}),(()=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(n)}),t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,n){var l;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const h=this._onEaseEnd;delete this._onEaseEnd,h.call(this,n)}return t||(l=this.handlers)===null||l===void 0||l.stop(!1),this}_ease(t,n,l){l.animate===!1||l.duration===0?(t(1),n()):(this._easeStart=st(),this._easeOptions=l,this._onEaseFrame=t,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(t,n){t=d.X(t,-180,180);const l=Math.abs(t-n);return Math.abs(t-360-n)<l&&(t-=360),Math.abs(t+360-n)<l&&(t+=360),t}queryTerrainElevation(t){return this.terrain?this.terrain.getElevationForLngLat(d.W.convert(t),this.transform):null}}const ro={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class Qi{constructor(t=ro){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=n=>{!n||n.sourceDataType!=="metadata"&&n.sourceDataType!=="visibility"&&n.dataType!=="style"&&n.type!=="terrain"||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=t}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options.compact,this._container=ze.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=ze.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=ze.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(t,n){const l=this._map._getUIString(`AttributionControl.${n}`);t.title=l,t.setAttribute("aria-label",l)}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map((h=>typeof h!="string"?"":h))):typeof this.options.customAttribution=="string"&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const h=this._map.style.stylesheet;this.styleOwner=h.owner,this.styleId=h.id}const n=this._map.style.tileManagers;for(const h in n){const g=n[h];if(g.used||g.usedForTerrain){const b=g.getSource();b.attribution&&!t.includes(b.attribution)&&t.push(b.attribution)}}t=t.filter((h=>String(h).trim())),t.sort(((h,g)=>h.length-g.length)),t=t.filter(((h,g)=>{for(let b=g+1;b<t.length;b++)if(t[b].includes(h))return!1;return!0}));const l=t.join(" | ");l!==this._attribHTML&&(this._attribHTML=l,t.length?(this._innerContainer.innerHTML=ze.sanitize(l),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class ic{constructor(t={}){this._updateCompact=()=>{const n=this._container.children;if(n.length){const l=n[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&l.classList.add("maplibregl-compact"):l.classList.remove("maplibregl-compact")}},this.options=t}getDefaultPosition(){return"bottom-left"}onAdd(t){var n;this._map=t,this._compact=(n=this.options)===null||n===void 0?void 0:n.compact,this._container=ze.create("div","maplibregl-ctrl");const l=ze.create("a","maplibregl-ctrl-logo");return l.target="_blank",l.rel="noopener nofollow",l.href="https://maplibre.org/",l.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),l.setAttribute("rel","noopener nofollow"),this._container.appendChild(l),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class nc{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const n=++this._id;return this._queue.push({callback:t,id:n,cancelled:!1}),n}remove(t){const n=this._currentlyRunning,l=n?this._queue.concat(n):this._queue;for(const h of l)if(h.id===t)return void(h.cancelled=!0)}run(t=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const n=this._currentlyRunning=this._queue;this._queue=[];for(const l of n)if(!l.cancelled&&(l.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var Nh=d.aS([{name:"a_pos3d",type:"Int16",components:3}]);class ou extends d.E{constructor(t){super(),this._lastTilesetChange=st(),this.tileManager=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=t._source.tileSize*2**this.deltaZoom,t.usedForTerrain=!0,t.tileSize=this.tileSize}destruct(){this.tileManager.usedForTerrain=!1,this.tileManager.tileSize=null}getSource(){return this.tileManager._source}update(t,n){this.tileManager.update(t,n),this._renderableTilesKeys=[];const l={};for(const h of Gn(t,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:n,calculateTileZoom:this.tileManager._source.calculateTileZoom}))l[h.key]=!0,this._renderableTilesKeys.push(h.key),this._tiles[h.key]||(h.terrainRttPosMatrix32f=new Float64Array(16),d.c7(h.terrainRttPosMatrix32f,0,d.a6,d.a6,0,0,1),this._tiles[h.key]=new va(h,this.tileSize),this._lastTilesetChange=st());for(const h in this._tiles)l[h]||delete this._tiles[h]}freeRtt(t){for(const n in this._tiles){const l=this._tiles[n];(!t||l.tileID.equals(t)||l.tileID.isChildOf(t)||t.isChildOf(l.tileID))&&(l.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map((t=>this.getTileByID(t)))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t,n){return n?this._getTerrainCoordsForTileRanges(t,n):this._getTerrainCoordsForRegularTile(t)}_getTerrainCoordsForRegularTile(t){const n={};for(const l of this._renderableTilesKeys){const h=this._tiles[l].tileID,g=t.clone(),b=d.bj();if(h.canonical.equals(t.canonical))d.c7(b,0,d.a6,d.a6,0,0,1);else if(h.canonical.isChildOf(t.canonical)){const T=h.canonical.z-t.canonical.z,P=h.canonical.x-(h.canonical.x>>T<<T),M=h.canonical.y-(h.canonical.y>>T<<T),I=d.a6>>T;d.c7(b,0,I,I,0,0,1),d.Q(b,b,[-P*I,-M*I,0])}else{if(!t.canonical.isChildOf(h.canonical))continue;{const T=t.canonical.z-h.canonical.z,P=t.canonical.x-(t.canonical.x>>T<<T),M=t.canonical.y-(t.canonical.y>>T<<T),I=d.a6>>T;d.c7(b,0,d.a6,d.a6,0,0,1),d.Q(b,b,[P*I,M*I,0]),d.S(b,b,[1/2**T,1/2**T,0])}}g.terrainRttPosMatrix32f=new Float32Array(b),n[l]=g}return n}_getTerrainCoordsForTileRanges(t,n){const l={};for(const h of this._renderableTilesKeys){const g=this._tiles[h].tileID;if(!this._isWithinTileRanges(g,n))continue;const b=t.clone(),T=d.bj();if(g.canonical.z===t.canonical.z){const P=t.canonical.x-g.canonical.x+t.wrap*(1<<t.canonical.z),M=t.canonical.y-g.canonical.y;d.c7(T,0,d.a6,d.a6,0,0,1),d.Q(T,T,[P*d.a6,M*d.a6,0])}else if(g.canonical.z>t.canonical.z){const P=g.canonical.z-t.canonical.z,M=g.canonical.x-(g.canonical.x>>P<<P)+t.wrap*(1<<g.canonical.z),I=g.canonical.y-(g.canonical.y>>P<<P),R=t.canonical.x-(g.canonical.x>>P),L=t.canonical.y-(g.canonical.y>>P),O=d.a6>>P;d.c7(T,0,O,O,0,0,1),d.Q(T,T,[-M*O+R*d.a6,-I*O+L*d.a6,0])}else{const P=t.canonical.z-g.canonical.z,M=t.canonical.x-(t.canonical.x>>P<<P)+t.wrap*(1<<t.canonical.z),I=t.canonical.y-(t.canonical.y>>P<<P),R=(t.canonical.x>>P)-g.canonical.x,L=(t.canonical.y>>P)-g.canonical.y,O=d.a6<<P;d.c7(T,0,O,O,0,0,1),d.Q(T,T,[M*d.a6+R*O,I*d.a6+L*O,0])}b.terrainRttPosMatrix32f=new Float32Array(T),l[h]=b}return l}getSourceTile(t,n){var l,h;const g=this.tileManager._source;let b=t.overscaledZ-this.deltaZoom;if(b>g.maxzoom&&(b=g.maxzoom),b<g.minzoom)return;(l=this._sourceTileCache)[h=t.key]||(l[h]=t.scaledTo(b).key);let T=this.findTileInCaches(this._sourceTileCache[t.key]);if(!(T!=null&&T.dem)&&n)for(;b>=g.minzoom&&!(T!=null&&T.dem);)T=this.findTileInCaches(t.scaledTo(b--).key);return T}findTileInCaches(t){let n=this.tileManager.getTileByID(t);return n||(n=this.tileManager._outOfViewCache.getByKey(t),n)}anyTilesAfterTime(t=Date.now()){return this._lastTilesetChange>=t}_isWithinTileRanges(t,n){const l=n[t.canonical.z];return!!l&&(t.wrap>l.minWrap||t.wrap<l.maxWrap||t.canonical.x>=l.minTileXWrapped&&t.canonical.x<=l.maxTileXWrapped&&t.canonical.y>=l.minTileY&&t.canonical.y<=l.maxTileY)}}class cn{constructor(t,n,l){this._meshCache={},this.painter=t,this.tileManager=new ou(n),this.options=l,this.exaggeration=typeof l.exaggeration=="number"?l.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}destroy(){this._fbo&&(this._fbo.destroy(),this._fbo=null),this._fboCoordsTexture&&(this._fboCoordsTexture.destroy(),this._fboCoordsTexture=null),this._fboDepthTexture&&(this._fboDepthTexture.destroy(),this._fboDepthTexture=null),this._emptyDemTexture&&(this._emptyDemTexture.destroy(),this._emptyDemTexture=null),this._emptyDepthTexture&&(this._emptyDepthTexture.destroy(),this._emptyDepthTexture=null),this._coordsTexture&&(this._coordsTexture.destroy(),this._coordsTexture=null);for(const t in this._meshCache)this._meshCache[t].destroy();this._meshCache={},this.tileManager.destruct()}getDEMElevation(t,n,l,h=d.a6){var g;const b=t.normalizeCoordinates(n,l,h);if(!b)return 0;const T=this.getTerrainData(b.tileID),P=(g=T.tile)===null||g===void 0?void 0:g.dem;if(!P)return 0;const M=d.cC([],[b.x/h*d.a6,b.y/h*d.a6],T.u_terrain_matrix),I=[M[0]*P.dim,M[1]*P.dim],R=Math.floor(I[0]),L=Math.floor(I[1]),O=I[0]-R,$=I[1]-L;return P.get(R,L)*(1-O)*(1-$)+P.get(R+1,L)*O*(1-$)+P.get(R,L+1)*(1-O)*$+P.get(R+1,L+1)*O*$}getElevationForLngLatZoom(t,n){if(!d.cD(n,t.wrap()))return 0;const{tileID:l,mercatorX:h,mercatorY:g}=this._getOverscaledTileIDFromLngLatZoom(t,n);return this.getElevation(l,h%d.a6,g%d.a6,d.a6)}getElevationForLngLat(t,n){const l=Gn(n,{maxzoom:this.tileManager.maxzoom,minzoom:this.tileManager.minzoom,tileSize:512,terrain:this});let h=0;for(const g of l)g.canonical.z>h&&(h=Math.min(g.canonical.z,this.tileManager.maxzoom));return this.getElevationForLngLatZoom(t,h)}getElevation(t,n,l,h=d.a6){return this.getDEMElevation(t,n,l,h)*this.exaggeration}getTerrainData(t){var n,l;if(!this._emptyDemTexture){const b=this.painter.context,T=new d.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new d.T(b,T,b.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new d.T(b,new d.R({width:1,height:1}),b.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(b.gl.NEAREST,b.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=d.ap([])}const h=this.tileManager.getSourceTile(t,!0);if(h!=null&&h.dem&&(!h.demTexture||h.needsTerrainPrepare)){const b=this.painter.context;h.demTexture=this.painter.getTileTexture(h.dem.stride),h.demTexture?h.demTexture.update(h.dem.getPixels(),{premultiply:!1}):h.demTexture=new d.T(b,h.dem.getPixels(),b.gl.RGBA,{premultiply:!1}),h.demTexture.bind(b.gl.NEAREST,b.gl.CLAMP_TO_EDGE),h.needsTerrainPrepare=!1}const g=h&&h.toString()+h.tileID.key+t.key;if(g&&!this._demMatrixCache[g]){const b=this.tileManager.getSource().maxzoom;let T=t.canonical.z-h.tileID.canonical.z;t.overscaledZ>t.canonical.z&&(t.canonical.z>=b?T=t.canonical.z-b:d.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const P=t.canonical.x-(t.canonical.x>>T<<T),M=t.canonical.y-(t.canonical.y>>T<<T),I=d.cE(new Float64Array(16),[1/(d.a6<<T),1/(d.a6<<T),0]);d.Q(I,I,[P*d.a6,M*d.a6,0]),this._demMatrixCache[g]={matrix:I,coord:t}}return{u_depth:2,u_terrain:3,u_terrain_dim:((n=h==null?void 0:h.dem)===null||n===void 0?void 0:n.dim)||1,u_terrain_matrix:g?this._demMatrixCache[g].matrix:this._emptyDemMatrix,u_terrain_unpack:((l=h==null?void 0:h.dem)===null||l===void 0?void 0:l.getUnpackVector())||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:((h==null?void 0:h.demTexture)||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:h}}getFramebuffer(t){const n=this.painter,l=n.width/devicePixelRatio,h=n.height/devicePixelRatio;return!this._fbo||this._fbo.width===l&&this._fbo.height===h||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new d.T(n.context,{width:l,height:h,data:null},n.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(n.context.gl.NEAREST,n.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new d.T(n.context,{width:l,height:h,data:null},n.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(n.context.gl.NEAREST,n.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=n.context.createFramebuffer(l,h,!0,!1),this._fbo.depthAttachment.set(n.context.createRenderbuffer(n.context.gl.DEPTH_COMPONENT16,l,h))),this._fbo.colorAttachment.set(t==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const t=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const n=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let g=0,b=0;g<this._coordsTextureSize;g++)for(let T=0;T<this._coordsTextureSize;T++,b+=4)n[b+0]=255&T,n[b+1]=255&g,n[b+2]=T>>8<<4|g>>8,n[b+3]=0;const l=new d.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(n.buffer)),h=new d.T(t,l,t.gl.RGBA,{premultiply:!1});return h.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=h,h}pointCoordinate(t){this.painter.maybeDrawDepth(!0),this.painter.maybeDrawCoords();const n=new Uint8Array(4),l=this.painter.context,h=l.gl,g=Math.round(t.x*this.painter.pixelRatio/devicePixelRatio),b=Math.round(t.y*this.painter.pixelRatio/devicePixelRatio),T=Math.round(this.painter.height/devicePixelRatio);l.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),h.readPixels(g,T-b-1,1,1,h.RGBA,h.UNSIGNED_BYTE,n),l.bindFramebuffer.set(null);const P=n[0]+(n[2]>>4<<8),M=n[1]+((15&n[2])<<8),I=this.coordsIndex[255-n[3]],R=I&&this.tileManager.getTileByID(I);if(!R)return null;const L=this._coordsTextureSize,O=(1<<R.tileID.canonical.z)*L;return new d.a7((R.tileID.canonical.x*L+P)/O+R.tileID.wrap,(R.tileID.canonical.y*L+M)/O,this.getElevation(R.tileID,P,M,L))}depthAtPoint(t){const n=new Uint8Array(4),l=this.painter.context,h=l.gl;return l.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),h.readPixels(t.x,this.painter.height/devicePixelRatio-t.y-1,1,1,h.RGBA,h.UNSIGNED_BYTE,n),l.bindFramebuffer.set(null),(n[0]/16777216+n[1]/65536+n[2]/256+n[3])/256}getTerrainMesh(t){var n;const l=((n=this.painter.style.projection)===null||n===void 0?void 0:n.transitionState)>0,h=l&&t.canonical.y===0,g=l&&t.canonical.y===(1<<t.canonical.z)-1,b=`m_${h?"n":""}_${g?"s":""}`;if(this._meshCache[b])return this._meshCache[b];const T=this.painter.context,P=new d.cF,M=new d.aW,I=this.meshSize,R=d.a6/I,L=I*I;for(let J=0;J<=I;J++)for(let pe=0;pe<=I;pe++)P.emplaceBack(pe*R,J*R,0);for(let J=0;J<L;J+=I+1)for(let pe=0;pe<I;pe++)M.emplaceBack(pe+J,I+pe+J+1,I+pe+J+2),M.emplaceBack(pe+J,I+pe+J+2,pe+J+1);const O=P.length,$=O+(I+1),Z=(I+1)*I,Y=h?d.bq:0,H=h?0:1,K=g?d.br:d.a6,ie=g?0:1;for(let J=0;J<=I;J++)P.emplaceBack(J*R,Y,H);for(let J=0;J<=I;J++)P.emplaceBack(J*R,K,ie);for(let J=0;J<I;J++)M.emplaceBack(Z+J,$+J,$+J+1),M.emplaceBack(Z+J,$+J+1,Z+J+1),M.emplaceBack(0+J,O+J+1,O+J),M.emplaceBack(0+J,0+J+1,O+J+1);const Q=P.length,X=Q+2*(I+1);for(const J of[0,1])for(let pe=0;pe<=I;pe++)for(const xe of[0,1])P.emplaceBack(J*d.a6,pe*R,xe);for(let J=0;J<2*I;J+=2)M.emplaceBack(Q+J,Q+J+1,Q+J+3),M.emplaceBack(Q+J,Q+J+3,Q+J+2),M.emplaceBack(X+J,X+J+3,X+J+1),M.emplaceBack(X+J,X+J+2,X+J+3);const re=new fr(T.createVertexBuffer(P,Nh.members),T.createIndexBuffer(M),d.aV.simpleSegment(0,0,P.length,M.length));return this._meshCache[b]=re,re}getMeshFrameDelta(t){return 2*Math.PI*d.bD/Math.pow(2,Math.max(t,0))/5}getMinTileElevationForLngLatZoom(t,n){var l;if(!d.cD(n,t.wrap()))return 0;const{tileID:h}=this._getOverscaledTileIDFromLngLatZoom(t,n);return(l=this.getMinMaxElevation(h).minElevation)!==null&&l!==void 0?l:0}getMinMaxElevation(t){const n=this.getTerrainData(t).tile,l={minElevation:null,maxElevation:null};return n!=null&&n.dem&&(l.minElevation=n.dem.min*this.exaggeration,l.maxElevation=n.dem.max*this.exaggeration),l}_getOverscaledTileIDFromLngLatZoom(t,n){const l=d.a7.fromLngLat(t.wrap()),h=(1<<n)*d.a6,g=l.x*h,b=l.y*h,T=Math.floor(g/d.a6),P=Math.floor(b/d.a6);return{tileID:new d.a3(n,0,n,T,P),mercatorX:g,mercatorY:b}}}class mr{constructor(t,n,l){this._context=t,this._size=n,this._tileSize=l,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const t of this._objects)t.texture.destroy(),t.fbo.destroy()}_createObject(t){const n=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),l=new d.T(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return l.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),this._context.extTextureFilterAnisotropic&&this._context.gl.texParameterf(this._context.gl.TEXTURE_2D,this._context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this._context.extTextureFilterAnisotropicMax),n.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),n.colorAttachment.set(l.texture),{id:t,fbo:n,texture:l,stamp:-1,inUse:!1}}getObjectForId(t){return this._objects[t]}useObject(t){t.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter((n=>t.id!==n)),this._recentlyUsed.push(t.id)}stampObject(t){t.stamp=++this._stamp}getOrCreateFreeObject(){for(const n of this._recentlyUsed)if(!this._objects[n].inUse)return this._objects[n];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const t=this._createObject(this._objects.length);return this._objects.push(t),t}freeObject(t){t.inUse=!1}freeAllObjects(){for(const t of this._objects)this.freeObject(t)}isFull(){return!(this._objects.length<this._size)&&this._objects.some((t=>!t.inUse))===!1}}const sr={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0,"color-relief":!0};class ja{constructor(t,n){this.painter=t,this.terrain=n,this.pool=new mr(t.context,30,n.tileManager.tileSize*n.qualityFactor)}destruct(){this.pool.destruct()}getTexture(t){return this.pool.getObjectForId(t.rtt[this._stacks.length-1].id).texture}prepareForRender(t,n){var l,h,g;this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.tileManager.getRenderableTiles(),this._renderableLayerIds=t._order.filter((b=>!t._layers[b].isHidden(n))),this._coordsAscending={};for(const b in t.tileManagers){this._coordsAscending[b]={};const T=t.tileManagers[b].getVisibleCoordinates(),P=t.tileManagers[b].getSource(),M=P instanceof $n?P.terrainTileRanges:null;for(const I of T){const R=this.terrain.tileManager.getTerrainCoords(I,M);for(const L in R)(g=this._coordsAscending[b])[L]||(g[L]=[]),this._coordsAscending[b][L].push(R[L])}}this._rttFingerprints={};for(const b of t._order){const T=t._layers[b],P=T.source;if(sr[T.type]&&!this._rttFingerprints[P]){this._rttFingerprints[P]={};const M=(h=(l=t.tileManagers[P])===null||l===void 0?void 0:l.getState().revision)!==null&&h!==void 0?h:0;for(const I in this._coordsAscending[P])this._rttFingerprints[P][I]=`${this._coordsAscending[P][I].map((R=>R.key)).sort().join()}#${M}`}}for(const b of this._renderableTiles)for(const T in this._rttFingerprints){const P=this._rttFingerprints[T][b.tileID.key];P&&P!==b.rttFingerprint[T]&&(b.rtt=[])}}renderLayer(t,n){if(t.isHidden(this.painter.transform.zoom))return!1;const l=Object.assign(Object.assign({},n),{isRenderingToTexture:!0}),h=t.type,g=this.painter,b=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(sr[h]&&(this._prevType&&sr[this._prevType]||this._stacks.push([]),this._prevType=h,this._stacks[this._stacks.length-1].push(t.id),!b))return!0;if(sr[this._prevType]||sr[h]&&b){this._prevType=h;const T=this._stacks.length-1,P=this._stacks[T]||[];for(const M of this._renderableTiles){if(this.pool.isFull()&&(tl(this.painter,this.terrain,this._rttTiles,l),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(M),M.rtt[T]){const R=this.pool.getObjectForId(M.rtt[T].id);if(R.stamp===M.rtt[T].stamp){this.pool.useObject(R);continue}}const I=this.pool.getOrCreateFreeObject();this.pool.useObject(I),this.pool.stampObject(I),M.rtt[T]={id:I.id,stamp:I.stamp},g.context.bindFramebuffer.set(I.fbo.framebuffer),g.context.clear({color:d.bo.transparent,stencil:0}),g.currentStencilSource=void 0;for(const R of P){const L=g.style._layers[R],O=L.source?this._coordsAscending[L.source][M.tileID.key]:[M.tileID];g.context.viewport.set([0,0,I.fbo.width,I.fbo.height]),g._renderTileClippingMasks(L,O,!0),g.renderLayer(g,g.style.tileManagers[L.source],L,O,l),L.source&&(M.rttFingerprint[L.source]=this._rttFingerprints[L.source][M.tileID.key])}}return tl(this.painter,this.terrain,this._rttTiles,l),this._rttTiles=[],this.pool.freeAllObjects(),sr[h]}return!1}}const xs={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Drag to rotate map, click to reset north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","GlobeControl.Enable":"Enable globe","GlobeControl.Disable":"Disable globe","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use ⌘ + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},ua=Me,au={hash:!1,interactive:!0,bearingSnap:7,zoomSnap:0,attributionControl:ro,maplibreLogo:!1,refreshExpiredTiles:!0,canvasContextAttributes:{antialias:!1,preserveDrawingBuffer:!1,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,desynchronized:!1,contextType:void 0},scrollZoom:!0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],elevation:0,zoom:0,bearing:0,pitch:0,roll:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:d.c.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,transformConstrain:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,rollEnabled:!1,reduceMotion:void 0,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0,experimentalZoomLevelsToOverscale:void 0,anisotropicFilterPitch:20};let ll=class extends Do{get _ownerWindow(){var f,t;return((t=(f=this._container)===null||f===void 0?void 0:f.ownerDocument)===null||t===void 0?void 0:t.defaultView)||window}constructor(f){var t,n,l;const h=Object.assign(Object.assign(Object.assign({},au),f),{canvasContextAttributes:Object.assign(Object.assign({},au.canvasContextAttributes),f.canvasContextAttributes)});if(h.minZoom!=null&&h.maxZoom!=null&&h.minZoom>h.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(h.minPitch!=null&&h.maxPitch!=null&&h.minPitch>h.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(h.minPitch!=null&&h.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(h.maxPitch!=null&&h.maxPitch>180)throw new Error("maxPitch must be less than or equal to 180");const g=new Eo,b=new Yo;h.minZoom!==void 0&&g.setMinZoom(h.minZoom),h.maxZoom!==void 0&&g.setMaxZoom(h.maxZoom),h.minPitch!==void 0&&g.setMinPitch(h.minPitch),h.maxPitch!==void 0&&g.setMaxPitch(h.maxPitch),h.renderWorldCopies!==void 0&&g.setRenderWorldCopies(h.renderWorldCopies),h.transformConstrain!==null&&g.setConstrainOverride(h.transformConstrain),super(g,b,{bearingSnap:h.bearingSnap,zoomSnap:h.zoomSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new nc,this._controls=[],this._mapId=d.ad(),this._lostContextStyle={style:null,images:null},this._contextLost=P=>{if(P.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.painter.destroy(),this._lostContextStyle=this._getStyleAndImages(),this.style){for(const M of Object.values(this.style._layers))if(M.type==="custom"&&console.warn(`Custom layer with id '${M.id}' cannot be restored after WebGL context loss. You will need to re-add it manually after context restoration.`),M._listeners)for(const[I]of Object.entries(M._listeners))console.warn(`Custom layer with id '${M.id}' had event listeners for event '${I}' which cannot be restored after WebGL context loss. You will need to re-add them manually after context restoration.`);this.style.destroy(),this.style=null,this.fire(new d.n("webglcontextlost",{originalEvent:P}))}else this.fire(new d.n("webglcontextlost",{originalEvent:P}))},this._contextRestored=P=>{this._lostContextStyle.style&&this.setStyle(this._lostContextStyle.style,{diff:!1}),this._lostContextStyle.images&&this.style&&(this.style.imageManager.images=this._lostContextStyle.images),this._lostContextStyle={style:null,images:null},this._setupPainter(),this.resize(),this._update(),this._resizeInternal(),this.fire(new d.n("webglcontextrestored",{originalEvent:P}))},this._onMapScroll=P=>{if(P.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=h.interactive,this._maxTileCacheSize=h.maxTileCacheSize,this._maxTileCacheZoomLevels=h.maxTileCacheZoomLevels,this._canvasContextAttributes=Object.assign({},h.canvasContextAttributes),this._trackResize=h.trackResize===!0,this._bearingSnap=h.bearingSnap,this._zoomSnap=h.zoomSnap,this._centerClampedToGround=h.centerClampedToGround,this._refreshExpiredTiles=h.refreshExpiredTiles===!0,this._fadeDuration=h.fadeDuration,this._crossSourceCollisions=h.crossSourceCollisions===!0,this._collectResourceTiming=h.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},xs),h.locale),this._clickTolerance=h.clickTolerance,this._overridePixelRatio=h.pixelRatio,this._maxCanvasSize=h.maxCanvasSize,this._zoomLevelsToOverscale=h.experimentalZoomLevelsToOverscale,this.transformCameraUpdate=h.transformCameraUpdate,this.transformConstrain=h.transformConstrain,this.cancelPendingTileRequestsWhileZooming=h.cancelPendingTileRequestsWhileZooming===!0,this.setAnisotropicFilterPitch(h.anisotropicFilterPitch),h.reduceMotion!==void 0&&(Wt.prefersReducedMotion=h.reduceMotion),this._imageQueueHandle=Br.addThrottleControl((()=>this.isMoving())),this._requestManager=new Bt(h.transformRequest),this._container=this._resolveContainer(h.container),h.maxBounds&&this.setMaxBounds(h.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",(()=>this._update(!1))),this.on("moveend",(()=>this._update(!1))),this.on("zoom",(()=>this._update(!0))),this.on("terrain",(()=>{this.painter.terrainFacilitator.depthDirty=!0,this._update(!0)})),this.once("idle",(()=>this._idleTriggered=!0)),typeof window<"u"&&(this._ownerWindow.addEventListener("online",this._onWindowOnline,!1),this._setupResizeObserver()),this.handlers=new Oi(this,h),this._hash=h.hash?new Tn(typeof h.hash=="string"&&h.hash||void 0).addTo(this):void 0,!((t=this._hash)===null||t===void 0)&&t._onHashChange()||(this.jumpTo({center:h.center,elevation:h.elevation,zoom:h.zoom,bearing:h.bearing,pitch:h.pitch,roll:h.roll}),h.bounds&&(this.resize(),this.fitBounds(h.bounds,d.e({},h.fitBoundsOptions,{duration:0}))));const T=typeof h.style=="string"||((l=(n=h.style)===null||n===void 0?void 0:n.projection)===null||l===void 0?void 0:l.type)!=="globe";this.resize(null,T),this._localIdeographFontFamily=h.localIdeographFontFamily,this._validateStyle=h.validateStyle,h.style&&this.setStyle(h.style,{localIdeographFontFamily:h.localIdeographFontFamily}),h.attributionControl&&this.addControl(new Qi(typeof h.attributionControl=="boolean"?void 0:h.attributionControl)),h.maplibreLogo&&this.addControl(new ic,h.logoPosition),this.on("style.load",(()=>{if(T||this._resizeTransform(),this.transform.unmodified){const P=d.V(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(P)}})),this.on("data",(P=>{this._update(P.dataType==="style"),this.fire(new d.n(`${P.dataType}data`,P))})),this.on("dataloading",(P=>{this.fire(new d.n(`${P.dataType}dataloading`,P))})),this.on("dataabort",(P=>{this.fire(new d.n("sourcedataabort",P))}))}_getMapId(){return this._mapId}setGlobalStateProperty(f,t){return this.style.setGlobalStateProperty(f,t),this._update(!0)}getGlobalState(){return this.style.getGlobalState()}addControl(f,t){if(t===void 0&&(t=f.getDefaultPosition?f.getDefaultPosition():"top-right"),!(f!=null&&f.onAdd))return this.fire(new d.l(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const n=f.onAdd(this);this._controls.push(f);const l=this._controlPositions[t];return t.includes("bottom")?l.insertBefore(n,l.firstChild):l.appendChild(n),this}removeControl(f){if(!(f!=null&&f.onRemove))return this.fire(new d.l(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(f);return t>-1&&this._controls.splice(t,1),f.onRemove(this),this}hasControl(f){return this._controls.includes(f)}coveringTiles(f){return Gn(this.transform,f)}calculateCameraOptionsFromTo(f,t,n,l){return l==null&&this.terrain&&(l=this.terrain.getElevationForLngLat(n,this.transform)),super.calculateCameraOptionsFromTo(f,t,n,l)}resize(f,t=!0){if(this._lostContextStyle.style!==null)return this;this._resizeInternal(t);const n=!this._moving;return n&&(this.stop(),this.fire(new d.n("movestart",f)).fire(new d.n("move",f))),this.fire(new d.n("resize",f)),n&&this.fire(new d.n("moveend",f)),this}_resizeInternal(f=!0){const[t,n]=this._containerDimensions(),l=this._getClampedPixelRatio(t,n);if(this._resizeCanvas(t,n,l),this.painter.resize(t,n,l),this.painter.overLimit()){const h=this.painter.context.gl;this._maxCanvasSize=[h.drawingBufferWidth,h.drawingBufferHeight];const g=this._getClampedPixelRatio(t,n);this._resizeCanvas(t,n,g),this.painter.resize(t,n,g)}this._resizeTransform(f)}_resizeTransform(f=!0){var t;const[n,l]=this._containerDimensions();this.transform.resize(n,l,f),(t=this._requestedCameraState)===null||t===void 0||t.resize(n,l,f)}_getClampedPixelRatio(f,t){const{0:n,1:l}=this._maxCanvasSize,h=this.getPixelRatio(),g=f*h,b=t*h;return Math.min(g>n?n/g:1,b>l?l/b:1)*h}getPixelRatio(){var f;return(f=this._overridePixelRatio)!==null&&f!==void 0?f:devicePixelRatio}setPixelRatio(f){this._overridePixelRatio=f,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(f){return this.transform.setMaxBounds(Ie.convert(f)),this._update()}setMinZoom(f){if((f=f??-2)>=-2&&f<=this.transform.maxZoom){const t=this.transform.zoom,n=this._getTransformForUpdate();return n.setMinZoom(f),this._applyUpdatedTransform(n),this._update(),t!==this.transform.zoom&&this.fire(new d.n("zoomstart")).fire(new d.n("zoom")).fire(new d.n("zoomend")).fire(new d.n("movestart")).fire(new d.n("move")).fire(new d.n("moveend")),this}throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(f){if((f=f??22)>=this.transform.minZoom){const t=this.transform.zoom,n=this._getTransformForUpdate();return n.setMaxZoom(f),this._applyUpdatedTransform(n),this._update(),t!==this.transform.zoom&&this.fire(new d.n("zoomstart")).fire(new d.n("zoom")).fire(new d.n("zoomend")).fire(new d.n("movestart")).fire(new d.n("move")).fire(new d.n("moveend")),this}throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(f){if((f=f??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(f>=0&&f<=this.transform.maxPitch){const t=this.transform.pitch,n=this._getTransformForUpdate();return n.setMinPitch(f),this._applyUpdatedTransform(n),this._update(),t!==this.transform.pitch&&this.fire(new d.n("pitchstart")).fire(new d.n("pitch")).fire(new d.n("pitchend")).fire(new d.n("movestart")).fire(new d.n("move")).fire(new d.n("moveend")),this}throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(f){if((f=f??60)>180)throw new Error("maxPitch must be less than or equal to 180");if(f>=this.transform.minPitch){const t=this.transform.pitch,n=this._getTransformForUpdate();return n.setMaxPitch(f),this._applyUpdatedTransform(n),this._update(),t!==this.transform.pitch&&this.fire(new d.n("pitchstart")).fire(new d.n("pitch")).fire(new d.n("pitchend")).fire(new d.n("movestart")).fire(new d.n("move")).fire(new d.n("moveend")),this}throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getAnisotropicFilterPitch(){return this._anisotropicFilterPitch}setAnisotropicFilterPitch(f){if((f=f??20)>180)throw new Error("anisotropicFilterPitch must be less than or equal to 180");if(f<0)throw new Error("anisotropicFilterPitch must be greater than or equal to 0");return this._anisotropicFilterPitch=f,this._update()}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(f){return this.transform.setRenderWorldCopies(f),this._update()}setTransformConstrain(f){return this.transform.setConstrainOverride(f),this._update()}project(f){return this.transform.locationToScreenPoint(d.W.convert(f),this.style&&this.terrain)}unproject(f){return this.transform.screenPointToLocation(d.P.convert(f),this.terrain)}isMoving(){var f;return this._moving||((f=this.handlers)===null||f===void 0?void 0:f.isMoving())}isZooming(){var f;return this._zooming||((f=this.handlers)===null||f===void 0?void 0:f.isZooming())}isRotating(){var f;return this._rotating||((f=this.handlers)===null||f===void 0?void 0:f.isRotating())}_createDelegatedListener(f,t,n){if(f==="mouseenter"||f==="mouseover"){let l=!1;return{layers:t,listener:n,delegates:{mousemove:g=>{const b=t.filter((P=>this.getLayer(P))),T=b.length!==0?this.queryRenderedFeatures(g.point,{layers:b}):[];T.length?l||(l=!0,n.call(this,new Rr(f,this,g.originalEvent,{features:T}))):l=!1},mouseout:()=>{l=!1}}}}if(f==="mouseleave"||f==="mouseout"){let l=!1;return{layers:t,listener:n,delegates:{mousemove:b=>{const T=t.filter((P=>this.getLayer(P)));(T.length!==0?this.queryRenderedFeatures(b.point,{layers:T}):[]).length?l=!0:l&&(l=!1,n.call(this,new Rr(f,this,b.originalEvent)))},mouseout:b=>{l&&(l=!1,n.call(this,new Rr(f,this,b.originalEvent)))}}}}{const l=h=>{const g=t.filter((T=>this.getLayer(T))),b=g.length!==0?this.queryRenderedFeatures(h.point,{layers:g}):[];b.length&&(h.features=b,n.call(this,h),delete h.features)};return{layers:t,listener:n,delegates:{[f]:l}}}}_saveDelegatedListener(f,t){var n;this._delegatedListeners||(this._delegatedListeners={}),(n=this._delegatedListeners)[f]||(n[f]=[]),this._delegatedListeners[f].push(t)}_removeDelegatedListener(f,t,n){var l;if(!(!((l=this._delegatedListeners)===null||l===void 0)&&l[f]))return;const h=this._delegatedListeners[f];for(let g=0;g<h.length;g++){const b=h[g];if(b.listener===n&&b.layers.length===t.length&&b.layers.every((T=>t.includes(T)))){for(const T in b.delegates)this.off(T,b.delegates[T]);return void h.splice(g,1)}}}on(f,t,n){if(n===void 0)return super.on(f,t);const l=typeof t=="string"?[t]:t,h=this._createDelegatedListener(f,l,n);this._saveDelegatedListener(f,h);for(const g in h.delegates)this.on(g,h.delegates[g]);return{unsubscribe:()=>{this._removeDelegatedListener(f,l,n)}}}once(f,t,n){if(n===void 0)return super.once(f,t);const l=typeof t=="string"?[t]:t,h=this._createDelegatedListener(f,l,n);for(const g in h.delegates){const b=h.delegates[g];h.delegates[g]=(...T)=>{this._removeDelegatedListener(f,l,n),b(...T)}}this._saveDelegatedListener(f,h);for(const g in h.delegates)this.once(g,h.delegates[g]);return this}off(f,t,n){return n===void 0?super.off(f,t):(this._removeDelegatedListener(f,typeof t=="string"?[t]:t,n),this)}queryRenderedFeatures(f,t){if(!this.style)return[];let n;const l=f instanceof d.P||Array.isArray(f),h=l?f:[[0,0],[this.transform.width,this.transform.height]];if(t||(t=(l?{}:f)||{}),h instanceof d.P||typeof h[0]=="number")n=[d.P.convert(h)];else{const g=d.P.convert(h[0]),b=d.P.convert(h[1]);n=[g,new d.P(b.x,g.y),b,new d.P(g.x,b.y),g]}return this.style.queryRenderedFeatures(n,t,this.transform)}querySourceFeatures(f,t){return this.style.querySourceFeatures(f,t)}setStyle(f,t){return(t=d.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},t)).diff!==!1&&t.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&f?(this._diffStyle(f,t),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._updateStyle(f,t))}setTransformRequest(f){return this._requestManager.setTransformRequest(f),this}_getUIString(f){const t=this._locale[f];if(t==null)throw new Error(`Missing UI string '${f}'`);return t}_updateStyle(f,t){var n,l,h;if((n=this._diffStyleRequest)===null||n===void 0||n.abort(),this._diffStyleRequest=null,t.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",(()=>this._updateStyle(f,t)));const g=this.style&&t.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!f)),f?(this.style=new us(this,t||{}),this.style.setEventedParent(this,{style:this.style}),typeof f=="string"?this.style.loadURL(f,t,g):this.style.loadJSON(f,t,g),this):(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),(h=(l=this.style)===null||l===void 0?void 0:l.projection)===null||h===void 0||h.destroy(),delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new us(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(f,t){return d._(this,void 0,void 0,(function*(){var n;if((n=this._diffStyleRequest)===null||n===void 0||n.abort(),typeof f=="string"){const l=f;this._diffStyleRequest=new AbortController;const h=this._diffStyleRequest;try{const g=yield this._requestManager.transformRequest(l,"Style");if(h.signal.aborted)return void(this._diffStyleRequest=null);const b=yield d.k(g,h);this._diffStyleRequest=null,this._updateDiff(b.data,t)}catch(g){this._diffStyleRequest=null,d.$(g)||this.fire(new d.l(d.d(g)))}}else typeof f=="object"&&(this._diffStyleRequest=null,this._updateDiff(f,t))}))}_updateDiff(f,t){try{this.style.setState(f,t)&&this._update(!0)}catch(n){d.w(`Unable to perform style diff: ${d.d(n).message}. Rebuilding the style from scratch.`),this._updateStyle(f,t)}}getStyle(){if(this.style)return this.style.serialize()}_getStyleAndImages(){return this.style?{style:this.style.serialize(),images:this.style.imageManager.cloneImages()}:{style:null,images:{}}}isStyleLoaded(){if(this.style)return this.style.loaded();d.w("There is no style added to the map.")}addSource(f,t){return this._lazyInitEmptyStyle(),this.style.addSource(f,t),this._update(!0)}isSourceLoaded(f){var t;const n=(t=this.style)===null||t===void 0?void 0:t.tileManagers[f];if(n!==void 0)return n.loaded();this.fire(new d.l(new Error(`There is no tile manager with ID '${f}'`)))}setTerrain(f){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),f){const t=this.style.tileManagers[f.source];if(!t)throw new Error(`cannot load terrain, because there exists no source with ID: ${f.source}`);this.terrain===null&&t.reload();for(const n in this.style._layers){const l=this.style._layers[n];l.type==="hillshade"&&l.source===f.source&&d.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality."),l.type==="color-relief"&&l.source===f.source&&d.w("You are using the same source for a color-relief layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new cn(this.painter,t,f),this.painter.renderToTexture=new ja(this.painter,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._terrainDataCallback=n=>{var l;n.dataType==="style"?this.terrain.tileManager.freeRtt():n.dataType==="source"&&n.tile&&(n.sourceId!==f.source||this._elevationFreeze||(this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))),((l=n.source)===null||l===void 0?void 0:l.type)==="image"?this.terrain.tileManager.freeRtt():this.terrain.tileManager.freeRtt(n.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.destroy(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0);return this.fire(new d.n("terrain",{terrain:f})),this}getTerrain(){var f,t;return(t=(f=this.terrain)===null||f===void 0?void 0:f.options)!==null&&t!==void 0?t:null}areTilesLoaded(){var f;const t=(f=this.style)===null||f===void 0?void 0:f.tileManagers;for(const n of Object.values(t))if(!n.areTilesLoaded())return!1;return!0}removeSource(f){return this.style.removeSource(f),this._update(!0)}getSource(f){return this.style.getSource(f)}setSourceTileLodParams(f,t,n){if(n){const l=this.getSource(n);if(!l)throw new Error(`There is no source with ID "${n}", cannot set LOD parameters`);l.calculateTileZoom=ku(Math.max(1,f),Math.max(1,t))}else for(const l in this.style.tileManagers)this.style.tileManagers[l].getSource().calculateTileZoom=ku(Math.max(1,f),Math.max(1,t));return this._update(!0),this}refreshTiles(f,t){const n=this.style.tileManagers[f];if(!n)throw new Error(`There is no tile manager with ID "${f}", cannot refresh tile`);t===void 0?n.reload(!0):n.refreshTiles(t.map((l=>new d.aa(l.z,l.x,l.y))))}addImage(f,t,n={}){const{pixelRatio:l=1,sdf:h=!1,stretchX:g,stretchY:b,content:T,textFitWidth:P,textFitHeight:M}=n;if(this._lazyInitEmptyStyle(),!(t instanceof HTMLImageElement||d.b(t))){if(t.width===void 0||t.height===void 0)return this.fire(new d.l(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:I,height:R,data:L}=t,O=t;return this.style.addImage(f,{data:new d.R({width:I,height:R},new Uint8Array(L)),pixelRatio:l,stretchX:g,stretchY:b,content:T,textFitWidth:P,textFitHeight:M,sdf:h,version:0,userImage:O}),O.onAdd&&O.onAdd(this,f),this}}{const{width:I,height:R,data:L}=Wt.getImageData(t);this.style.addImage(f,{data:new d.R({width:I,height:R},L),pixelRatio:l,stretchX:g,stretchY:b,content:T,textFitWidth:P,textFitHeight:M,sdf:h,version:0})}}updateImage(f,t){const n=this.style.getImage(f);if(!n)return this.fire(new d.l(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const l=t instanceof HTMLImageElement||d.b(t)?Wt.getImageData(t):t,{width:h,height:g,data:b}=l;if(h===void 0||g===void 0)return this.fire(new d.l(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(h!==n.data.width||g!==n.data.height)return this.fire(new d.l(new Error("The width and height of the updated image must be that same as the previous version of the image")));const T=!(t instanceof HTMLImageElement||d.b(t));return n.data.replace(b,T),this.style.updateImage(f,n),this}getImage(f){return this.style.getImage(f)}hasImage(f){return f?!!this.style.getImage(f):(this.fire(new d.l(new Error("Missing required image id"))),!1)}removeImage(f){this.style.removeImage(f)}loadImage(f){return d._(this,void 0,void 0,(function*(){return Br.getImage(yield this._requestManager.transformRequest(f,"Image"),new AbortController)}))}listImages(){return this.style.listImages()}addLayer(f,t){return this._lazyInitEmptyStyle(),this.style.addLayer(f,t),this._update(!0)}moveLayer(f,t){return this.style.moveLayer(f,t),this._update(!0)}removeLayer(f){return this.style.removeLayer(f),this._update(!0)}getLayer(f){return this.style.getLayer(f)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(f,t,n){return this.style.setLayerZoomRange(f,t,n),this._update(!0)}setFilter(f,t,n={}){return this.style.setFilter(f,t,n),this._update(!0)}getFilter(f){return this.style.getFilter(f)}setPaintProperty(f,t,n,l={}){return this.style.setPaintProperty(f,t,n,l),this._update(!0)}getPaintProperty(f,t){return this.style.getPaintProperty(f,t)}setLayoutProperty(f,t,n,l={}){return this.style.setLayoutProperty(f,t,n,l),this._update(!0)}getLayoutProperty(f,t){return this.style.getLayoutProperty(f,t)}setGlyphs(f,t={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(f,t),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(f,t,n={}){return this._lazyInitEmptyStyle(),this.style.addSprite(f,t,n,(l=>{l||this._update(!0)})),this}removeSprite(f){return this._lazyInitEmptyStyle(),this.style.removeSprite(f),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(f,t={}){return this._lazyInitEmptyStyle(),this.style.setSprite(f,t,(n=>{n||this._update(!0)})),this}setLight(f,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(f,t),this._update(!0)}getLight(){return this.style.getLight()}setSky(f,t={}){return this._lazyInitEmptyStyle(),this.style.setSky(f,t),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(f,t){return this.style.setFeatureState(f,t),this._update()}removeFeatureState(f,t){return this.style.removeFeatureState(f,t),this._update()}getFeatureState(f){return this.style.getFeatureState(f)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let f=0,t=0;return this._container&&(f=this._container.clientWidth||400,t=this._container.clientHeight||300),[f,t]}_setupResizeObserver(){var f;let t=!1;const n=Yu((h=>{this._trackResize&&!this._removed&&(this.resize(h),this.redraw())}),50),l=(f=this._ownerWindow.ResizeObserver)!==null&&f!==void 0?f:ResizeObserver;this._resizeObserver=new l((h=>{t?n(h):t=!0})),this._resizeObserver.observe(this._container)}_resolveContainer(f){if(typeof f=="string"){const t=document.getElementById(f);if(!t)throw new Error(`Container '${f}' not found.`);return t}if(f instanceof HTMLElement||f&&typeof f=="object"&&f.nodeType===1)return f;throw new Error("Invalid type: 'container' must be a String or HTMLElement.")}_setupContainer(){const f=this._container;f.classList.add("maplibregl-map");const t=this._canvasContainer=ze.create("div","maplibregl-canvas-container",f);this._interactive&&t.classList.add("maplibregl-interactive"),this._canvas=ze.create("canvas","maplibregl-canvas",t),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");const n=this._containerDimensions(),l=this._getClampedPixelRatio(n[0],n[1]);this._resizeCanvas(n[0],n[1],l);const h=this._controlContainer=ze.create("div","maplibregl-control-container",f),g=this._controlPositions={};for(const b of["top-left","top-right","bottom-left","bottom-right"])g[b]=ze.create("div",`maplibregl-ctrl-${b} `,h);this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(f,t,n){this._canvas.width=Math.floor(n*f),this._canvas.height=Math.floor(n*t),this._canvas.style.width=`${f}px`,this._canvas.style.height=`${t}px`}_setupPainter(){const f=Object.assign(Object.assign({},this._canvasContextAttributes),{alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0});let t=null;this._canvas.addEventListener("webglcontextcreationerror",(l=>{t={requestedAttributes:f},l&&(t.statusMessage=l.statusMessage,t.type=l.type)}),{once:!0});let n=null;if(n=this._canvasContextAttributes.contextType?this._canvas.getContext(this._canvasContextAttributes.contextType,f):this._canvas.getContext("webgl2",f)||this._canvas.getContext("webgl",f),!n){const l="Failed to initialize WebGL";throw t?(t.message=l,new Error(JSON.stringify(t))):new Error(l)}this.painter=new La(n,this.transform)}migrateProjection(f,t){super.migrateProjection(f,t),this.painter.transform=f,this.fire(new d.n("projectiontransition",{newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(f){var t;return!((t=this.style)===null||t===void 0)&&t._loaded?(this._styleDirty||(this._styleDirty=f),this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(f){return this._update(),this._renderTaskQueue.add(f)}_cancelRenderFrame(f){this._renderTaskQueue.remove(f)}_render(f){var t,n,l,h,g,b;const T=this._idleTriggered?this._fadeDuration:0,P=((t=this.style.projection)===null||t===void 0?void 0:t.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(f),this._removed)return;let M=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const L=this.transform.zoom,O=st();this.style.zoomHistory.update(L,O);const $=new d.J(L,{now:O,fadeDuration:T,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),Z=$.crossFadingFactor();Z===1&&Z===this._crossFadingFactor||(M=!0,this._crossFadingFactor=Z),this.style.update($)}const I=((n=this.style.projection)===null||n===void 0?void 0:n.transitionState)>0!==P;(l=this.style.projection)===null||l===void 0||l.setErrorQueryLatitudeDegrees(this.transform.center.lat),this.transform.setTransitionState((h=this.style.projection)===null||h===void 0?void 0:h.transitionState,(g=this.style.projection)===null||g===void 0?void 0:g.latitudeErrorCorrectionRadians),this.style&&(this._sourcesDirty||I)&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.tileManager.update(this.transform,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),!this._elevationFreeze&&this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0)),this._placementDirty=(b=this.style)===null||b===void 0?void 0:b._updatePlacement(this.transform,this.showCollisionBoxes,T,this._crossSourceCollisions,I),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:T,showPadding:this.showPadding,anisotropicFilterPitch:this.getAnisotropicFilterPitch()}),this.fire(new d.n("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new d.n("load"))),this.style&&(this.style.hasTransitions()||M)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const R=this._sourcesDirty||this._styleDirty||this._placementDirty;return R||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new d.n("idle")),!this._loaded||this._fullyLoaded||R||(this._fullyLoaded=!0),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var f,t;this._hash&&this._hash.remove();for(const l of this._controls)l.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),(f=this._diffStyleRequest)===null||f===void 0||f.abort(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&this._ownerWindow.removeEventListener("online",this._onWindowOnline,!1),Br.removeThrottleControl(this._imageQueueHandle),(t=this._resizeObserver)===null||t===void 0||t.disconnect();const n=this.painter.context.gl.getExtension("WEBGL_lose_context");n!=null&&n.loseContext&&n.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),this._canvasContainer.remove(),this._controlContainer.remove(),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),this._removed=!0,this.fire(new d.n("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,Wt.frame(this._frameRequest,(f=>{this._frameRequest=null;try{this._render(f)}catch(t){if(!d.$(t)&&!(function(n){return n.message===Kl})(t))throw t}}),(()=>{}),this._ownerWindow))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(f){this._showTileBoundaries!==f&&(this._showTileBoundaries=f,this._update())}get showPadding(){return!!this._showPadding}set showPadding(f){this._showPadding!==f&&(this._showPadding=f,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(f){this._showCollisionBoxes!==f&&(this._showCollisionBoxes=f,f?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(f){this._showOverdrawInspector!==f&&(this._showOverdrawInspector=f,this._update())}get repaint(){return!!this._repaint}set repaint(f){this._repaint!==f&&(this._repaint=f,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(f){this._vertices=f,this._update()}get version(){return ua}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(f){return this._lazyInitEmptyStyle(),this.style.setProjection(f),this._update(!0)}};const Cr={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};class Va{constructor(t,n,l=!1){this.mousedown=g=>{this.startMove(g,ze.mousePos(this.element,g)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)},this.mousemove=g=>{this.move(g,ze.mousePos(this.element,g))},this.mouseup=g=>{this._rotatePitchHandler.dragEnd(g),this.offTemp()},this.touchstart=g=>{g.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=ze.touchPos(this.element,g.targetTouches)[0],this.startMove(g,this._startPos),window.addEventListener("touchmove",this.touchmove,{passive:!1}),window.addEventListener("touchend",this.touchend))},this.touchmove=g=>{g.targetTouches.length!==1?this.reset():(this._lastPos=ze.touchPos(this.element,g.targetTouches)[0],this.move(g,this._lastPos))},this.touchend=g=>{g.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()},this.reset=()=>{this._rotatePitchHandler.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10,this.element=n;const h=new ec;this._rotatePitchHandler=new rr({clickTolerance:3,move:(g,b)=>{const T=n.getBoundingClientRect(),P=new d.P((T.bottom-T.top)/2,(T.right-T.left)/2);return{bearingDelta:d.cx(new d.P(g.x,b.y),b,P),pitchDelta:l?-.5*(b.y-g.y):void 0}},moveStateManager:h,enable:!0,assignEvents:()=>{}}),this.map=t,n.addEventListener("mousedown",this.mousedown),n.addEventListener("touchstart",this.touchstart,{passive:!1}),n.addEventListener("touchcancel",this.reset)}startMove(t,n){this._rotatePitchHandler.dragStart(t,n),ze.disableDrag()}move(t,n){const l=this.map,{bearingDelta:h,pitchDelta:g}=this._rotatePitchHandler.dragMove(t,n)||{};h&&l.setBearing(l.getBearing()+h),g&&l.setPitch(l.getPitch()+g)}off(){const t=this.element;t.removeEventListener("mousedown",this.mousedown),t.removeEventListener("touchstart",this.touchstart),window.removeEventListener("touchmove",this.touchmove),window.removeEventListener("touchend",this.touchend),t.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){ze.enableDrag(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup),window.removeEventListener("touchmove",this.touchmove),window.removeEventListener("touchend",this.touchend)}}let io;function ul(f,t,n,l=!1){if(l||!n.getCoveringTilesDetailsProvider().allowWorldCopies())return f==null?void 0:f.wrap();const h=new d.W(f.lng,f.lat);if(f=new d.W(f.lng,f.lat),t){const g=new d.W(f.lng-360,f.lat),b=new d.W(f.lng+360,f.lat),T=n.locationToScreenPoint(f).distSqr(t);n.locationToScreenPoint(g).distSqr(t)<T?f=g:n.locationToScreenPoint(b).distSqr(t)<T&&(f=b)}for(;Math.abs(f.lng-n.center.lng)>180;){const g=n.locationToScreenPoint(f);if(g.x>=0&&g.y>=0&&g.x<=n.width&&g.y<=n.height)break;f.lng>n.center.lng?f.lng-=360:f.lng+=360}return f.lng!==h.lng&&n.isPointOnMapSurface(n.locationToScreenPoint(f))?f:h}const Ua={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 cl(f,t,n){const l=f.classList;for(const h in Ua)l.remove(`maplibregl-${n}-anchor-${h}`);l.add(`maplibregl-${n}-anchor-${t}`)}class no extends d.E{constructor(t){if(super(),this._onClick=n=>{this.fire(new d.n("click",{originalEvent:n}))},this._onKeyPress=n=>{n.code!=="Space"&&n.code!=="Enter"||this.togglePopup()},this._onMapClick=n=>{const l=n.originalEvent.target,h=this._element;this._popup&&(l===h||h.contains(l))&&this.togglePopup()},this._update=n=>{if(!this._map)return;const l=this._map.loaded()&&!this._map.isMoving();((n==null?void 0:n.type)==="terrain"||(n==null?void 0:n.type)==="render"&&!l)&&this._map.once("render",this._update),this._lngLat=ul(this._lngLat,this._flatPos,this._map.transform),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationToScreenPoint(this._lngLat)._add(this._offset));let h="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?h=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(h=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let g="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?g="rotateX(0deg)":this._pitchAlignment==="map"&&(g=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||n&&n.type!=="moveend"||(this._pos=this._pos.round()),this._element.style.transform=`${Ua[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${g} ${h}`,Wt.frameAsync(new AbortController,this._map._ownerWindow).then((()=>{this._updateOpacity((n==null?void 0:n.type)==="moveend")})).catch((()=>{}))},this._onMove=n=>{if(!this._isDragging){const l=this._clickTolerance||this._map._clickTolerance;this._isDragging=n.point.dist(this._pointerdownPos)>=l}this._isDragging&&(this._pos=n.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 d.n("dragstart"))),this.fire(new d.n("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new d.n("dragend")),this._state="inactive"},this._addDragHandler=n=>{this._element.contains(n.originalEvent.target)&&(n.preventDefault(),this._positionDelta=n.point.sub(this._pos).add(this._offset),this._pointerdownPos=n.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=(t==null?void 0:t.anchor)||"center",this._color=(t==null?void 0:t.color)||"#3FB1CE",this._scale=(t==null?void 0:t.scale)||1,this._draggable=(t==null?void 0:t.draggable)||!1,this._clickTolerance=(t==null?void 0:t.clickTolerance)||0,this._subpixelPositioning=(t==null?void 0:t.subpixelPositioning)||!1,this._isDragging=!1,this._state="inactive",this._rotation=(t==null?void 0:t.rotation)||0,this._rotationAlignment=(t==null?void 0:t.rotationAlignment)||"auto",this._pitchAlignment=t!=null&&t.pitchAlignment&&t.pitchAlignment!=="auto"?t.pitchAlignment:this._rotationAlignment,this.setOpacity(t==null?void 0:t.opacity,t==null?void 0:t.opacityWhenCovered),t==null?void 0:t.element)this._element=t.element,this._offset=d.P.convert((t==null?void 0:t.offset)||[0,0]);else{this._defaultMarker=!0,this._element=ze.create("div");const n=ze.createNS("http://www.w3.org/2000/svg","svg"),l=41,h=27;n.setAttributeNS(null,"display","block"),n.setAttributeNS(null,"height",`${l}px`),n.setAttributeNS(null,"width",`${h}px`),n.setAttributeNS(null,"viewBox",`0 0 ${h} ${l}`);const g=ze.createNS("http://www.w3.org/2000/svg","g");g.setAttributeNS(null,"stroke","none"),g.setAttributeNS(null,"stroke-width","1"),g.setAttributeNS(null,"fill","none"),g.setAttributeNS(null,"fill-rule","evenodd");const b=ze.createNS("http://www.w3.org/2000/svg","g");b.setAttributeNS(null,"fill-rule","nonzero");const T=ze.createNS("http://www.w3.org/2000/svg","g");T.setAttributeNS(null,"transform","translate(3.0, 29.0)"),T.setAttributeNS(null,"fill","#000000");const P=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const H of P){const K=ze.createNS("http://www.w3.org/2000/svg","ellipse");K.setAttributeNS(null,"opacity","0.04"),K.setAttributeNS(null,"cx","10.5"),K.setAttributeNS(null,"cy","5.80029008"),K.setAttributeNS(null,"rx",H.rx),K.setAttributeNS(null,"ry",H.ry),T.appendChild(K)}const M=ze.createNS("http://www.w3.org/2000/svg","g");M.setAttributeNS(null,"fill",this._color);const I=ze.createNS("http://www.w3.org/2000/svg","path");I.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),M.appendChild(I);const R=ze.createNS("http://www.w3.org/2000/svg","g");R.setAttributeNS(null,"opacity","0.25"),R.setAttributeNS(null,"fill","#000000");const L=ze.createNS("http://www.w3.org/2000/svg","path");L.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"),R.appendChild(L);const O=ze.createNS("http://www.w3.org/2000/svg","g");O.setAttributeNS(null,"transform","translate(6.0, 7.0)"),O.setAttributeNS(null,"fill","#FFFFFF");const $=ze.createNS("http://www.w3.org/2000/svg","g");$.setAttributeNS(null,"transform","translate(8.0, 8.0)");const Z=ze.createNS("http://www.w3.org/2000/svg","circle");Z.setAttributeNS(null,"fill","#000000"),Z.setAttributeNS(null,"opacity","0.25"),Z.setAttributeNS(null,"cx","5.5"),Z.setAttributeNS(null,"cy","5.5"),Z.setAttributeNS(null,"r","5.4999962");const Y=ze.createNS("http://www.w3.org/2000/svg","circle");Y.setAttributeNS(null,"fill","#FFFFFF"),Y.setAttributeNS(null,"cx","5.5"),Y.setAttributeNS(null,"cy","5.5"),Y.setAttributeNS(null,"r","5.4999962"),$.appendChild(Z),$.appendChild(Y),b.appendChild(T),b.appendChild(M),b.appendChild(R),b.appendChild(O),b.appendChild($),n.appendChild(b),n.setAttributeNS(null,"height",l*this._scale+"px"),n.setAttributeNS(null,"width",h*this._scale+"px"),this._element.appendChild(n),this._offset=d.P.convert((t==null?void 0:t.offset)||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",(n=>{n.preventDefault()})),this._element.addEventListener("mousedown",(n=>{n.preventDefault()})),cl(this._element,this._anchor,"marker"),t==null?void 0:t.className)for(const n of t.className.split(" "))this._element.classList.add(n);this._popup=null}addTo(t){return this.remove(),this._map=t,this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label",t._getUIString("Marker.Title")),this._element.hasAttribute("role")||this._element.setAttribute("role","button"),t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),t.on("terrain",this._update),t.on("projectiontransition",this._update),this._element.addEventListener("click",this._onClick),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",this._update),this._map.off("projectiontransition",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),this._element.removeEventListener("click",this._onClick),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=d.W.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){const h=Math.abs(13.5)/Math.SQRT2;t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[h,-1*(38.1-13.5+h)],"bottom-right":[-h,-1*(38.1-13.5+h)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=t,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(t){return this._subpixelPositioning=t,this}getPopup(){return this._popup}togglePopup(){const t=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:t?(t.isOpen()?t.remove():(t.setLngLat(this._lngLat),t.addTo(this._map)),this):this}_updateOpacity(t=!1){var n,l;const h=(n=this._map)===null||n===void 0?void 0:n.terrain,g=this._map.transform.isLocationOccluded(this._lngLat);if(!h||g){const O=g?this._opacityWhenCovered:this._opacity;return void(this._element.style.opacity!==O&&(this._element.style.opacity=O,this._element.classList.toggle("maplibregl-marker-covered",g)))}if(t)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout((()=>{this._opacityTimeout=null}),100)}const b=this._map,T=b.terrain.depthAtPoint(this._pos),P=b.terrain.getElevationForLngLat(this._lngLat,b.transform);if(b.transform.lngLatToCameraDepth(this._lngLat,P)-T<.006)return this._element.style.opacity=this._opacity,void this._element.classList.remove("maplibregl-marker-covered");const M=-this._offset.y/b.transform.pixelsPerMeter,I=Math.sin(b.getPitch()*Math.PI/180)*M,R=b.terrain.depthAtPoint(new d.P(this._pos.x,this._pos.y-this._offset.y)),L=b.transform.lngLatToCameraDepth(this._lngLat,P+I)-R>.006;!((l=this._popup)===null||l===void 0)&&l.isOpen()&&L&&this._popup.remove(),this._element.style.opacity=L?this._opacityWhenCovered:this._opacity,this._element.classList.toggle("maplibregl-marker-covered",L)}getOffset(){return this._offset}setOffset(t){return this._offset=d.P.convert(t),this._update(),this}addClassName(t){this._element.classList.add(t)}removeClassName(t){this._element.classList.remove(t)}toggleClassName(t){return this._element.classList.toggle(t)}setDraggable(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&t!=="auto"?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(t,n){return(this._opacity===void 0||t===void 0&&n===void 0)&&(this._opacity="1",this._opacityWhenCovered="0.2"),t!==void 0&&(this._opacity=String(t)),n!==void 0&&(this._opacityWhenCovered=String(n)),this._map&&this._updateOpacity(!0),this}}const Mr={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Lr=0,Fr=!1;const hl={maxWidth:100,unit:"metric"};function ca(f,t,n){const l=(n==null?void 0:n.maxWidth)||100,h=f._container.clientHeight/2,g=f._container.clientWidth/2,b=f.unproject([g-l/2,h]),T=f.unproject([g+l/2,h]),P=Math.round(f.project(T).x-f.project(b).x),M=Math.min(l,P,f._container.clientWidth),I=b.distanceTo(T);if((n==null?void 0:n.unit)==="imperial"){const R=3.2808*I;R>5280?oo(t,M,R/5280,f._getUIString("ScaleControl.Miles")):oo(t,M,R,f._getUIString("ScaleControl.Feet"))}else(n==null?void 0:n.unit)==="nautical"?oo(t,M,I/1852,f._getUIString("ScaleControl.NauticalMiles")):I>=1e3?oo(t,M,I/1e3,f._getUIString("ScaleControl.Kilometers")):oo(t,M,I,f._getUIString("ScaleControl.Meters"))}function oo(f,t,n,l){const h=(function(g){const b=Math.pow(10,`${Math.floor(g)}`.length-1);let T=g/b;return T=T>=10?10:T>=5?5:T>=3?3:T>=2?2:T>=1?1:(function(P){const M=Math.pow(10,Math.ceil(-Math.log(P)/Math.LN10));return Math.round(P*M)/M})(T),b*T})(n);f.style.width=t*(h/n)+"px",f.innerHTML=`${h}&nbsp;${l}`}const rh={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0,padding:void 0},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 dl(f){if(f){if(typeof f=="number"){const t=Math.round(Math.abs(f)/Math.SQRT2);return{center:new d.P(0,0),top:new d.P(0,f),"top-left":new d.P(t,t),"top-right":new d.P(-t,t),bottom:new d.P(0,-f),"bottom-left":new d.P(t,-t),"bottom-right":new d.P(-t,-t),left:new d.P(f,0),right:new d.P(-f,0)}}if(f instanceof d.P||Array.isArray(f)){const t=d.P.convert(f);return{center:t,top:t,"top-left":t,"top-right":t,bottom:t,"bottom-left":t,"bottom-right":t,left:t,right:t}}return{center:d.P.convert(f.center||[0,0]),top:d.P.convert(f.top||[0,0]),"top-left":d.P.convert(f["top-left"]||[0,0]),"top-right":d.P.convert(f["top-right"]||[0,0]),bottom:d.P.convert(f.bottom||[0,0]),"bottom-left":d.P.convert(f["bottom-left"]||[0,0]),"bottom-right":d.P.convert(f["bottom-right"]||[0,0]),left:d.P.convert(f.left||[0,0]),right:d.P.convert(f.right||[0,0])}}return dl(new d.P(0,0))}const su=Me;j.AJAXError=d.cG,j.EXTENT=d.a6,j.Event=d.n,j.Evented=d.E,j.LngLat=d.W,j.MercatorCoordinate=d.a7,j.Point=d.P,j.addProtocol=d.cH,j.config=d.c,j.removeProtocol=d.cI,j.AttributionControl=Qi,j.BoxZoomHandler=eo,j.CanvasSource=Sl,j.CooperativeGesturesHandler=lt,j.DoubleClickZoomHandler=nu,j.DragPanHandler=Gr,j.DragRotateHandler=to,j.EdgeInsets=wo,j.FullscreenControl=class extends d.E{constructor(f={}){var t;super(),this._onFullscreenChange=()=>{var n;let l=window.document.fullscreenElement||window.document.webkitFullscreenElement;for(;!((n=l==null?void 0:l.shadowRoot)===null||n===void 0)&&n.fullscreenElement;)l=l.shadowRoot.fullscreenElement;l===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,this._pseudo=(t=f.pseudo)!==null&&t!==void 0&&t,f!=null&&f.container&&(f.container instanceof HTMLElement?this._container=f.container:d.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(f){return this._map=f,this._container||(this._container=this._map.getContainer()),this._controlContainer=ze.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const f=this._fullscreenButton=ze.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);ze.create("span","maplibregl-ctrl-icon",f).setAttribute("aria-hidden","true"),f.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const f=this._getTitle();this._fullscreenButton.setAttribute("aria-label",f),this._fullscreenButton.title=f}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new d.n("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new d.n("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){this._pseudo?this._togglePseudoFullScreen():window.document.exitFullscreen?window.document.exitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._pseudo?this._togglePseudoFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},j.GeoJSONSource=_o,j.GeolocateControl=class extends d.E{constructor(f){super(),this._onSuccess=t=>{if(this._map){if(this._isOutOfMapMaxBounds(t))return this._setErrorState(),this.fire(new d.n("outofmaxbounds",t)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(t),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(t),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new d.n("geolocate",t)),this._finish()}},this._updateCamera=t=>{const n=new d.W(t.coords.longitude,t.coords.latitude),l=t.coords.accuracy,h=this._map.getBearing(),g=d.e({bearing:h},this.options.fitBoundsOptions),b=Ie.fromLngLat(n,l);this._map.fitBounds(b,g,{geolocateSource:!0})},this._updateMarker=t=>{if(t){const n=new d.W(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(n).addTo(this._map),this._userLocationDotMarker.setLngLat(n).addTo(this._map),this._accuracy=t.coords.accuracy,this._updateCircleRadiusIfNeeded()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onUpdate=()=>{this._updateCircleRadiusIfNeeded()},this._onError=t=>{if(this._map){if(t.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const n=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(t.code===3&&Fr)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new d.n("error",t)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._onMoveStart=t=>{if(!this._map)return;const n=(t==null?void 0:t[0])instanceof ResizeObserverEntry;t.geolocateSource||this._watchState!=="ACTIVE_LOCK"||n||this._map.isZooming()||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new d.n("trackuserlocationend")),this.fire(new d.n("userlocationlostfocus")))},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",(t=>{t.preventDefault()})),this._geolocateButton=ze.create("button","maplibregl-ctrl-geolocate",this._container),ze.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=t=>{if(this._map){if(t===!1){d.w("Geolocation support is not available so the GeolocateControl will be disabled.");const n=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n)}else{const n=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=ze.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new no({element:this._dotElement}),this._circleElement=ze.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new no({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onUpdate),this._map.on("move",this._onUpdate),this._map.on("rotate",this._onUpdate),this._map.on("pitch",this._onUpdate)),this._geolocateButton.addEventListener("click",(()=>this.trigger())),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",this._onMoveStart)}},this.options=d.e({},Mr,f)}onAdd(f){return this._map=f,this._container=ze.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),(function(){return d._(this,arguments,void 0,(function*(t=!1){if(io!==void 0&&!t)return io;if(window.navigator.permissions===void 0)return io=!!window.navigator.geolocation,io;try{io=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{io=!!window.navigator.geolocation}return io}))})().then((t=>this._finishSetupUI(t))),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(),this._container.remove(),this._map.off("movestart",this._onMoveStart),this._map.off("zoom",this._onUpdate),this._map.off("move",this._onUpdate),this._map.off("rotate",this._onUpdate),this._map.off("pitch",this._onUpdate),this._map=void 0,Lr=0,Fr=!1}_isOutOfMapMaxBounds(f){const t=this._map.getMaxBounds(),n=f.coords;return t&&(n.longitude<t.getWest()||n.longitude>t.getEast()||n.latitude<t.getSouth()||n.latitude>t.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":case"BACKGROUND_ERROR":case"OFF":case void 0:break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadiusIfNeeded(){const f=this._userLocationDotMarker.getLngLat();if(!(this.options.showUserLocation&&this.options.showAccuracyCircle&&this._accuracy&&f))return;const t=this._map.project(f),n=this._map.unproject([t.x+100,t.y]),l=f.distanceTo(n)/100,h=2*this._accuracy/l;this._circleElement.style.width=`${h.toFixed(2)}px`,this._circleElement.style.height=`${h.toFixed(2)}px`}trigger(){if(!this._setup)return d.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new d.n("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Lr--,Fr=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new d.n("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new d.n("trackuserlocationstart")),this.fire(new d.n("userlocationfocus"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let f;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Lr++,Lr>1?(f={maximumAge:6e5,timeout:0},Fr=!0):(f=this.options.positionOptions,Fr=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,f)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},j.GlobeControl=class{constructor(){this._toggleProjection=()=>{var f;const t=(f=this._map.getProjection())===null||f===void 0?void 0:f.type;this._map.setProjection(t!=="mercator"&&t?{type:"mercator"}:{type:"globe"}),this._updateGlobeIcon()},this._updateGlobeIcon=()=>{var f;this._globeButton.classList.remove("maplibregl-ctrl-globe"),this._globeButton.classList.remove("maplibregl-ctrl-globe-enabled"),((f=this._map.getProjection())===null||f===void 0?void 0:f.type)==="globe"?(this._globeButton.classList.add("maplibregl-ctrl-globe-enabled"),this._globeButton.title=this._map._getUIString("GlobeControl.Disable")):(this._globeButton.classList.add("maplibregl-ctrl-globe"),this._globeButton.title=this._map._getUIString("GlobeControl.Enable"))}}onAdd(f){return this._map=f,this._container=ze.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=ze.create("button","maplibregl-ctrl-globe",this._container),ze.create("span","maplibregl-ctrl-icon",this._globeButton).setAttribute("aria-hidden","true"),this._globeButton.type="button",this._globeButton.addEventListener("click",this._toggleProjection),this._updateGlobeIcon(),this._map.on("styledata",this._updateGlobeIcon),this._map.on("projectiontransition",this._updateGlobeIcon),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateGlobeIcon),this._map.off("projectiontransition",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}},j.Hash=Tn,j.ImageSource=$n,j.KeyboardHandler=tu,j.LngLatBounds=Ie,j.LogoControl=ic,j.Map=ll,j.MapLibreMap=ll,j.MapMouseEvent=Rr,j.MapTouchEvent=Fi,j.MapWheelEvent=Ba,j.Marker=no,j.NavigationControl=class{constructor(f){this._updateZoomButtons=()=>{const t=this._map.getZoom(),n=t===this._map.getMaxZoom(),l=t===this._map.getMinZoom();this._zoomInButton.disabled=n,this._zoomOutButton.disabled=l,this._zoomInButton.setAttribute("aria-disabled",n.toString()),this._zoomOutButton.setAttribute("aria-disabled",l.toString())},this._rotateCompassArrow=()=>{this._compassIcon.style.transform=this.options.visualizePitch&&this.options.visualizeRoll?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateZ(${-this._map.transform.roll}deg) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizeRoll?`rotate(${-this._map.transform.bearing-this._map.transform.roll}deg)`:`rotate(${-this._map.transform.bearing}deg)`},this._setButtonTitle=(t,n)=>{const l=this._map._getUIString(`NavigationControl.${n}`);t.title=l,t.setAttribute("aria-label",l)},this.options=d.e({},Cr,f),this._container=ze.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",(t=>t.preventDefault())),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",(t=>this._map.zoomIn({},{originalEvent:t}))),ze.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",(t=>this._map.zoomOut({},{originalEvent:t}))),ze.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",(t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})})),this._compassIcon=ze.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(f){return this._map=f,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.on("roll",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Va(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){this._container.remove(),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.off("roll",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(f,t){const n=ze.create("button",f,this._container);return n.type="button",n.addEventListener("click",t),n}},j.Popup=class extends d.E{constructor(f){super(),this._updateOpacity=()=>{this.options.locationOccludedOpacity!==void 0&&(this._container.style.opacity=this._map.transform.isLocationOccluded(this.getLngLat())?`${this.options.locationOccludedOpacity}`:"")},this.remove=()=>(this._content&&this._content.remove(),this._container&&(this._container.remove(),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("terrain",this._update),this._map.off("projectiontransition",this._update),this._map.off("mousemove",this._update),this._map.off("mouseup",this._update),this._map.off("drag",this._update),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new d.n("close"))),this),this._update=t=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=ze.create("div","maplibregl-popup",this._map.getContainer()),this._tip=ze.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const T of this.options.className.split(" "))this._container.classList.add(T);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}let n;if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=ul(this._lngLat,this._flatPos,this._map.transform,this._trackPointer),t&&"point"in t&&t.point&&(n=t.point),this._trackPointer&&!n)return;const l=this._flatPos=this._pos=this._trackPointer&&n?n:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&n?n:this._map.transform.locationToScreenPoint(this._lngLat));let h=this.options.anchor;const g=dl(this.options.offset);if(!h){const T=this._container.offsetWidth,P=this._container.offsetHeight,M=(function(R){var L,O,$,Z;return R?{top:(L=R.top)!==null&&L!==void 0?L:0,right:(O=R.right)!==null&&O!==void 0?O:0,bottom:($=R.bottom)!==null&&$!==void 0?$:0,left:(Z=R.left)!==null&&Z!==void 0?Z:0}:{top:0,right:0,bottom:0,left:0}})(this.options.padding);let I;I=l.y+g.bottom.y<P+M.top?["top"]:l.y>this._map.transform.height-P-M.bottom?["bottom"]:[],l.x<T/2+M.left?I.push("left"):l.x>this._map.transform.width-T/2-M.right&&I.push("right"),h=I.length===0?"bottom":I.join("-")}let b=l.add(g[h]);this.options.subpixelPositioning||(b=b.round()),this._container.style.transform=`${Ua[h]} translate(${b.x}px,${b.y}px)`,cl(this._container,h,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=d.e(Object.create(rh),f)}addTo(f){return this._map&&this.remove(),this._map=f,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._map.on("terrain",this._update),this._map.on("projectiontransition",this._update),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._update),this._map.on("mouseup",this._update),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new d.n("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(f){return this._lngLat=d.W.convert(f),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._update),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._update),this._map.on("drag",this._update),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(f){return this.setDOMContent(document.createTextNode(f))}setHTML(f){const t=document.createDocumentFragment(),n=document.createElement("body");let l;for(n.innerHTML=f;l=n.firstChild,l;)t.appendChild(l);return this.setDOMContent(t)}getMaxWidth(){var f;return(f=this._container)===null||f===void 0?void 0:f.style.maxWidth}setMaxWidth(f){return this.options.maxWidth=f,this._update(),this}setDOMContent(f){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=ze.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(f),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(f){return this._container&&this._container.classList.add(f),this}removeClassName(f){return this._container&&this._container.classList.remove(f),this}setOffset(f){return this.options.offset=f,this._update(),this}toggleClassName(f){if(this._container)return this._container.classList.toggle(f)}setSubpixelPositioning(f){this.options.subpixelPositioning=f}setPadding(f){this.options.padding=f,this._update()}_createCloseButton(){this.options.closeButton&&(this._closeButton=ze.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const f=this._container.querySelector(si);f&&f.focus()}},j.RasterDEMTileSource=ir,j.RasterTileSource=Er,j.ScaleControl=class{constructor(f){this._onMove=()=>{ca(this._map,this._container,this.options)},this.setUnit=t=>{this.options.unit=t,ca(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},hl),f)}getDefaultPosition(){return"bottom-left"}onAdd(f){return this._map=f,this._container=ze.create("div","maplibregl-ctrl maplibregl-ctrl-scale",f.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._onMove),this._map=void 0}},j.ScrollZoomHandler=iu,j.Style=us,j.TerrainControl=class{constructor(f){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=f}onAdd(f){return this._map=f,this._container=ze.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=ze.create("button","maplibregl-ctrl-terrain",this._container),ze.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){this._container.remove(),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},j.TwoFingersTouchPitchHandler=un,j.TwoFingersTouchRotateHandler=th,j.TwoFingersTouchZoomHandler=ol,j.TwoFingersTouchZoomRotateHandler=tt,j.VectorTileSource=bt,j.VideoSource=ya,j.addSourceType=(f,t)=>d._(void 0,void 0,void 0,(function*(){if(El(f))throw new Error(`A source type called "${f}" already exists.`);((n,l)=>{Rs[n]=l})(f,t)})),j.clearPrewarmedResources=function(){const f=yt;f&&(f.isPreloaded()&&f.numActive()===1?(f.release($e),yt=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()"))},j.createTileMesh=qs,j.getGlobalDispatcher=Ft,j.getMaxParallelImageRequests=function(){return d.c.MAX_PARALLEL_IMAGE_REQUESTS},j.getRTLTextPluginStatus=function(){return Wo().getRTLTextPluginStatus()},j.getVersion=function(){return su},j.getWorkerCount=function(){return ce.workerCount},j.getWorkerUrl=function(){return d.c.WORKER_URL},j.importScriptInWorkers=function(f){return Ft().broadcast("IS",f)},j.isTimeFrozen=function(){return Ar.isFrozen()},j.now=st,j.prewarm=function(){Nt().acquire($e)},j.restoreNow=function(){Ar.restoreNow()},j.setMaxParallelImageRequests=function(f){d.c.MAX_PARALLEL_IMAGE_REQUESTS=f},j.setNow=function(f){Ar.setNow(f)},j.setRTLTextPlugin=function(f,t){return Wo().setRTLTextPlugin(f,t)},j.setWorkerCount=function(f){ce.workerCount=f},j.setWorkerUrl=function(f){d.c.WORKER_URL=f}}));var ht=ue;return ht}))})(ap)),ap.exports}var Ed=x0();const b0=Go(Ed),w0="https://tile.openstreetmap.org/{z}/{x}/{y}.png",nm="https://basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}@2x.png",om="OpenStreetMap contributors, CARTO",am="https://basemaps.cartocdn.com/gl/voyager-gl-style/style.json",Zp={primaryColor:"#111111",markerColor:"#111111",borderRadius:8,radiusUnit:"km",defaultZoom:5,defaultCenter:{lat:-25.2744,lng:133.7751},darkMode:!1,styleUrl:am,mapPalette:"monotone",tileUrl:nm,tileAttribution:om};function Wp(ae){const ve=ae.trim().replace(/^#/,""),ue=ve.length===3?ve.split("").map(qe=>`${qe}${qe}`).join(""):ve;return/^[0-9a-f]{6}$/i.test(ue)?{r:Number.parseInt(ue.slice(0,2),16),g:Number.parseInt(ue.slice(2,4),16),b:Number.parseInt(ue.slice(4,6),16)}:null}function sp({r:ae,g:ve,b:ue}){const qe=[ae,ve,ue].map(Tt=>{const ht=Tt/255;return ht<=.03928?ht/12.92:((ht+.055)/1.055)**2.4});return .2126*qe[0]+.7152*qe[1]+.0722*qe[2]}function sm(ae,ve){const ue=Math.max(sp(ae),sp(ve)),qe=Math.min(sp(ae),sp(ve));return(ue+.05)/(qe+.05)}function Pd(ae,ve="#111111",ue="#ffffff"){const qe=Wp(ae),Tt=Wp(ve),ht=Wp(ue);return!qe||!Tt||!ht?ue:sm(qe,Tt)>=sm(qe,ht)?ve:ue}function lm(ae={}){return{...Zp,...ae,defaultCenter:{...Zp.defaultCenter,...ae.defaultCenter||{}},styleUrl:ae.styleUrl||am,mapPalette:ae.mapPalette||"monotone",borderRadius:Number.isFinite(Number(ae.borderRadius))?Number(ae.borderRadius):Zp.borderRadius,tileUrl:!ae.tileUrl||ae.tileUrl===w0?nm:ae.tileUrl,tileAttribution:ae.tileAttribution||om,radiusUnit:"km"}}function um(ae,ve){const ue=`/v1/stockist_maps/${encodeURIComponent(ae)}/config`;return ve?`${ve.replace(/\/$/,"")}${ue}`:ue}function cm(ae,ve={}){const ue=typeof window>"u"?"http://localhost":window.location.href,qe=new URL(ae,ue);return ve.query&&qe.searchParams.set("q",ve.query),ve.limit&&qe.searchParams.set("limit",String(ve.limit)),ve.center&&(qe.searchParams.set("lat",String(ve.center.lat)),qe.searchParams.set("lng",String(ve.center.lng))),ve.radiusKm&&qe.searchParams.set("radius_km",String(ve.radiusKm)),ve.category&&qe.searchParams.set("category",ve.category),ve.locationSearch&&qe.searchParams.set("location_search","true"),qe.toString()}async function hm(ae){const ve=await fetch(ae,{headers:{Accept:"application/json"}});if(!ve.ok)throw new Error(`Could not load stockist map config (${ve.status})`);return ve.json()}async function Hp(ae,ve={}){const ue=await fetch(cm(ae,ve),{headers:{Accept:"application/json"}});if(!ue.ok)throw new Error(`Could not search stockists (${ue.status})`);const qe=await ue.json();return{hits:Array.isArray(qe.hits)?qe.hits:[],estimatedTotalHits:Number(qe.estimatedTotalHits||0),center:qe.center||null,resolvedQuery:qe.resolvedQuery||null}}async function T0(ae,ve={}){return(await Hp(ae,ve)).hits}const S0=6371;function lp(ae){return ae*Math.PI/180}function dm(ae,ve){const ue=lp(ve.lat-ae.lat),qe=lp(ve.lng-ae.lng),Tt=Math.sin(ue/2)**2+Math.cos(lp(ae.lat))*Math.cos(lp(ve.lat))*Math.sin(qe/2)**2;return 2*S0*Math.atan2(Math.sqrt(Tt),Math.sqrt(1-Tt))}function pm(ae){return`${ae.toFixed(1)} km`}function E0(ae){const ve=["localhost","127.0.0.1","::1"].includes(window.location.hostname);return window.location.protocol!=="https:"&&!ve?"Browser location is blocked on this local Partbot domain. Chrome and Brave only allow location access on HTTPS, localhost, or origins manually trusted in browser flags.":ae.code===ae.PERMISSION_DENIED?"Location permission is blocked for this site. Allow location access in your browser settings, then try again.":ae.code===ae.POSITION_UNAVAILABLE?"Your browser could not determine your location. Try again, or search by suburb or postcode.":ae.code===ae.TIMEOUT?"Finding your location timed out. Try again, or search by suburb or postcode.":`Browser location failed with error code ${ae.code}. Try again, or search by suburb or postcode.`}function Xp(ae){return ae.stockist_id??ae.id}function P0(ae){const ve=new Set;return ae.filter(ue=>{const qe=Xp(ue);return ve.has(qe)?!1:(ve.add(qe),!0)})}function fm(ae){const ve=ae==null?void 0:ae.trim();if(!ve||ve.startsWith("/")&&!ve.startsWith("//"))return null;const ue=ve.startsWith("//")?`https:${ve}`:/^[a-z][a-z\d+.-]*:/i.test(ve)?ve:`https://${ve}`;try{const qe=new URL(ue);return qe.protocol==="http:"||qe.protocol==="https:"?qe.toString():null}catch{return null}}function mm(ae){return`https://www.google.com/maps/dir/?api=1&destination=${encodeURIComponent(`${ae.lat},${ae.lng}`)}`}const C0=new Map([["bold",Je.createElement(Je.Fragment,null,Je.createElement("path",{d:"M216.49,104.49l-80,80a12,12,0,0,1-17,0l-80-80a12,12,0,0,1,17-17L128,159l71.51-71.52a12,12,0,0,1,17,17Z"}))],["duotone",Je.createElement(Je.Fragment,null,Je.createElement("path",{d:"M208,96l-80,80L48,96Z",opacity:"0.2"}),Je.createElement("path",{d:"M215.39,92.94A8,8,0,0,0,208,88H48a8,8,0,0,0-5.66,13.66l80,80a8,8,0,0,0,11.32,0l80-80A8,8,0,0,0,215.39,92.94ZM128,164.69,67.31,104H188.69Z"}))],["fill",Je.createElement(Je.Fragment,null,Je.createElement("path",{d:"M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,48,88H208a8,8,0,0,1,5.66,13.66Z"}))],["light",Je.createElement(Je.Fragment,null,Je.createElement("path",{d:"M212.24,100.24l-80,80a6,6,0,0,1-8.48,0l-80-80a6,6,0,0,1,8.48-8.48L128,167.51l75.76-75.75a6,6,0,0,1,8.48,8.48Z"}))],["regular",Je.createElement(Je.Fragment,null,Je.createElement("path",{d:"M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z"}))],["thin",Je.createElement(Je.Fragment,null,Je.createElement("path",{d:"M210.83,98.83l-80,80a4,4,0,0,1-5.66,0l-80-80a4,4,0,0,1,5.66-5.66L128,170.34l77.17-77.17a4,4,0,1,1,5.66,5.66Z"}))]]),gm=Je.forwardRef((ae,ve)=>Je.createElement(Gp,{ref:ve,...ae,weights:C0}));gm.displayName="CaretDownIcon";function Ds(...ae){return ae.filter(Boolean).join(" ")}function M0({className:ae,variant:ve="default",size:ue="default",...qe}){return mt.jsx("button",{"data-slot":"button","data-variant":ve,"data-size":ue,className:Ds("pbsm-button",ae),...qe})}function I0({className:ae,...ve}){return mt.jsx("input",{"data-slot":"input",className:Ds("pbsm-input",ae),...ve})}function k0({className:ae,size:ve="default",...ue}){return mt.jsxs("div",{className:"pbsm-native-select-wrapper","data-slot":"native-select-wrapper",children:[mt.jsx("select",{"data-slot":"native-select","data-size":ve,className:Ds("pbsm-native-select",ae),...ue}),mt.jsx(gm,{"aria-hidden":"true",className:"pbsm-native-select-icon","data-slot":"native-select-icon"})]})}function _m({className:ae,...ve}){return mt.jsx("option",{"data-slot":"native-select-option",className:Ds("pbsm-native-select-option",ae),...ve})}function ym({className:ae,...ve}){return mt.jsx("div",{"data-slot":"card",className:Ds("pbsm-card-shell",ae),...ve})}function vm({className:ae,...ve}){return mt.jsx("div",{"data-slot":"card-content",className:Ds("pbsm-card-content",ae),...ve})}function z0({className:ae,variant:ve="default",...ue}){return mt.jsx("div",{"data-slot":"alert","data-variant":ve,role:"alert",className:Ds("pbsm-alert",ae),...ue})}function A0({className:ae,...ve}){return mt.jsx("div",{"data-slot":"alert-title",className:Ds("pbsm-alert-title",ae),...ve})}function D0({className:ae,...ve}){return mt.jsx("div",{"data-slot":"alert-description",className:Ds("pbsm-alert-description",ae),...ve})}function xm({className:ae,...ve}){return mt.jsx("div",{"data-slot":"skeleton",className:Ds("pbsm-skeleton",ae),...ve})}const bh=[10,25,50,100,250],R0=350,Yp=(ae,ve)=>Object.prototype.hasOwnProperty.call(ae,ve);function L0(ae,ve){return{version:8,sources:{"partbot-tiles":{type:"raster",tiles:[ae],tileSize:256,attribution:ve}},layers:[{id:"partbot-tiles",type:"raster",source:"partbot-tiles"}]}}function bm(ae){return ae.styleUrl||L0(ae.tileUrl,ae.tileAttribution)}function F0(ae){return ae.darkMode?{background:"#1c1917",fill:"#292524",park:"#322e2b",water:"#0c0a09",line:"#44403c",road:"#57534e",boundary:"#78716c",text:"#e7e5e4",halo:"#1c1917"}:{background:"#f7f6f2",fill:"#efede8",park:"#e9e7e1",water:"#dedbd2",line:"#d2cfc7",road:"#ffffff",boundary:"#bdb8ae",text:"#5f5a52",halo:"#f7f6f2"}}function Cu(ae,ve,ue,qe){try{ae.setPaintProperty(ve,ue,qe)}catch{}}function wm(ae,ve){var Tt;if(ve.mapPalette!=="monotone"||!ve.styleUrl)return;const ue=ae.getStyle(),qe=F0(ve);(Tt=ue.layers)==null||Tt.forEach(ht=>{const j=ht.id.toLowerCase(),d="source-layer"in ht&&typeof ht["source-layer"]=="string"?ht["source-layer"].toLowerCase():"",Me=`${j} ${d}`;if(ht.type==="background"&&Cu(ae,ht.id,"background-color",qe.background),ht.type==="fill"){const $t=Me.includes("water")?qe.water:Me.includes("park")||Me.includes("green")||Me.includes("landuse")?qe.park:qe.fill;Cu(ae,ht.id,"fill-color",$t),Cu(ae,ht.id,"fill-opacity",1)}if(ht.type==="line"){const $t=Me.includes("road")?qe.road:Me.includes("boundary")||Me.includes("admin")?qe.boundary:qe.line;Cu(ae,ht.id,"line-color",$t)}ht.type==="symbol"&&(Cu(ae,ht.id,"text-color",qe.text),Cu(ae,ht.id,"text-halo-color",qe.halo),Cu(ae,ht.id,"text-halo-width",1),Cu(ae,ht.id,"icon-color",qe.text))})}function Kp(ae,ve){if(ae.isStyleLoaded()){wm(ae,ve);return}ae.once("idle",()=>wm(ae,ve))}function B0(ae,ve,ue,qe){if(ve.length===0){ae.easeTo({center:[ue.lng,ue.lat],zoom:qe,duration:300});return}if(ve.length===1){const ht=ve[0];ae.easeTo({center:[ht._geo.lng,ht._geo.lat],zoom:Math.max(qe,11),duration:350});return}const Tt=ve.reduce((ht,j)=>ht.extend([j._geo.lng,j._geo.lat]),new Ed.LngLatBounds([ve[0]._geo.lng,ve[0]._geo.lat],[ve[0]._geo.lng,ve[0]._geo.lat]));ae.fitBounds(Tt,{padding:56,maxZoom:12,duration:350})}function O0({value:ae,onChange:ve}){const[ue,qe]=Je.useState(!1),Tt=Je.useRef(null),ht=Math.max(0,bh.indexOf(ae)),[j,d]=Je.useState(ht);Je.useEffect(()=>{d(ht)},[ht]),Je.useEffect(()=>{if(!ue)return;const gt=zt=>{const Zt=typeof zt.composedPath=="function"?zt.composedPath():[],Wt=zt.target instanceof Node?zt.target:null;Tt.current&&Zt.includes(Tt.current)||Tt.current&&Wt&&Tt.current.contains(Wt)||qe(!1)};return document.addEventListener("pointerdown",gt),()=>document.removeEventListener("pointerdown",gt)},[ue]);const Me=gt=>{ve(gt),qe(!1)},$t=gt=>{if(gt.key==="ArrowDown"||gt.key==="ArrowUp"){gt.preventDefault(),qe(!0),d(zt=>{const Zt=gt.key==="ArrowDown"?1:-1;return(zt+Zt+bh.length)%bh.length});return}(gt.key==="Enter"||gt.key===" ")&&(gt.preventDefault(),ue?Me(bh[j]):qe(!0)),gt.key==="Escape"&&qe(!1)};return mt.jsxs("div",{className:"pbsm-radius-listbox",ref:Tt,children:[mt.jsxs("button",{"aria-activedescendant":ue?`pbsm-radius-${bh[j]}`:void 0,"aria-expanded":ue,"aria-haspopup":"listbox","aria-label":"Search radius",className:"pbsm-radius-trigger",type:"button",onClick:()=>qe(gt=>!gt),onKeyDown:$t,children:[mt.jsxs("span",{children:[ae," km"]}),mt.jsx("span",{"aria-hidden":"true",className:"pbsm-radius-caret"})]}),ue&&mt.jsx("div",{className:"pbsm-radius-options",role:"listbox","aria-label":"Search radius",children:bh.map((gt,zt)=>mt.jsxs("div",{id:`pbsm-radius-${gt}`,"aria-selected":gt===ae,className:"pbsm-radius-option",role:"option",onClick:()=>Me(gt),onMouseEnter:()=>d(zt),children:[gt," km"]},gt))})]})}function N0(ae,ve){const ue=ae?ve==null?void 0:ve[ae]:void 0;return ue?{"--pbsm-category-color":ue,"--pbsm-category-contrast":Pd(ue)}:void 0}function Qp(ae){var ve;return(ve=ae.categories)!=null&&ve.length?ae.categories:ae.category?[ae.category]:[]}function Jp(ae){return ae.display_address||ae.address}function j0(ae,ve){const ue=fm(ae.website),qe=document.createElement("div");qe.className="pbsm-popup";const Tt=document.createElement("strong");Tt.className="pbsm-popup-title",Tt.textContent=ae.name,qe.append(Tt),Qp(ae).forEach(d=>{const Me=document.createElement("span");Me.className="pbsm-popup-category",Me.textContent=d;const $t=ve==null?void 0:ve[d];$t&&(Me.style.setProperty("--pbsm-category-color",$t),Me.style.setProperty("--pbsm-category-contrast",Pd($t))),qe.append(Me)});const ht=Jp(ae);if(ht){const d=document.createElement("span");d.className="pbsm-popup-address",d.textContent=ht,qe.append(d)}const j=document.createElement("span");if(j.className="pbsm-popup-actions",ae.phone){const d=document.createElement("a");d.href=`tel:${ae.phone}`,d.className="pbsm-popup-action",d.textContent="Call now",j.append(d)}if(ue){const d=document.createElement("a");d.href=ue,d.target="_blank",d.rel="noreferrer",d.className="pbsm-popup-action",d.textContent="Website",j.append(d)}if(ae.email){const d=document.createElement("a");d.href=`mailto:${ae.email}`,d.className="pbsm-popup-action",d.textContent="Email",j.append(d)}if(ae.directions_available!==!1){const d=document.createElement("a");d.href=mm(ae._geo),d.target="_blank",d.rel="noreferrer",d.className="pbsm-popup-action pbsm-popup-action-primary",d.textContent="Get directions",j.append(d)}return qe.append(j),qe}function Tm(ae,ve,ue){var j;const qe=Qp(ve).map(d=>ue==null?void 0:ue[d]).find(Boolean),Tt=(j=qe==null?void 0:qe.url)==null?void 0:j.trim();if(ae.classList.toggle("has-custom-marker",!!Tt),!Tt){ae.replaceChildren(),delete ae.dataset.markerUrl;return}if(ae.dataset.markerUrl===Tt)return;const ht=document.createElement("img");ht.className="pbsm-marker-image",ht.src=Tt,ht.alt="",ht.draggable=!1,ht.addEventListener("error",()=>{ae.dataset.markerUrl!==Tt||ht.parentElement!==ae||(ae.classList.remove("has-custom-marker"),ae.replaceChildren(),delete ae.dataset.markerUrl)}),ae.replaceChildren(ht),ae.dataset.markerUrl=Tt}function ef({token:ae,configUrl:ve,config:ue,theme:qe,initialQuery:Tt="",initialRadiusKm:ht=50,className:j=""}){const[d,Me]=Je.useState(ue||null),[$t,gt]=Je.useState(Tt),[zt,Zt]=Je.useState(ht),[Wt,Ar]=Je.useState(""),[st,Ht]=Je.useState(null),[Br,ze]=Je.useState({center:null,label:null}),[Bt,Sr]=Je.useState([]),[ri,Or]=Je.useState(null),[Nr,Et]=Je.useState(!1),[ee,oe]=Je.useState(!1),[de,De]=Je.useState(null),Ke=Je.useRef(null),_t=Je.useRef(null),et=Je.useRef(new Map),dt=Je.useRef(null),it=Je.useRef(!1),Fe=Je.useRef(null),Le=Je.useRef(0),$e=Je.useRef(0),ce=Je.useRef(""),Ce=Je.useMemo(()=>lm({...(d==null?void 0:d.theme)||{},...qe||{}}),[d==null?void 0:d.theme,qe]),yt=Je.useMemo(()=>{var Ie;return st||((Ie=Bt[0])==null?void 0:Ie._geo)||Ce.defaultCenter},[st,Bt,Ce.defaultCenter]),vt=Bt.find(Ie=>Ie.id===ri)||Bt[0]||null,Nt=Je.useMemo(()=>P0(Bt),[Bt]),jt=(d==null?void 0:d.search.categories)||[],Ft=Je.useCallback(Ie=>{it.current=!0,Or(Ie)},[]);Je.useEffect(()=>{if(!Ke.current||_t.current)return;const Ie=new b0.Map({attributionControl:{compact:!0,customAttribution:""},center:[yt.lng,yt.lat],container:Ke.current,style:bm(Ce),zoom:Ce.defaultZoom});return Ie.addControl(new Ed.NavigationControl({showCompass:!1}),"top-right"),Kp(Ie,Ce),_t.current=Ie,()=>{var Ct;(Ct=dt.current)==null||Ct.remove(),dt.current=null,et.current.forEach(bt=>bt.remove()),et.current.clear(),Ie.remove(),_t.current=null}},[]),Je.useEffect(()=>{const Ie=_t.current;Ie&&(Ie.setStyle(bm(Ce)),Kp(Ie,Ce))},[Ce.styleUrl,Ce.tileAttribution,Ce.tileUrl]),Je.useEffect(()=>{const Ie=_t.current;Ie&&Kp(Ie,Ce)},[Ce.darkMode,Ce.mapPalette,Ce.styleUrl]),Je.useEffect(()=>{const Ie=_t.current;if(!Ie)return;const Ct=new Set(Bt.map(bt=>bt.id));et.current.forEach((bt,Er)=>{Ct.has(Er)||(bt.remove(),et.current.delete(Er))}),Bt.forEach(bt=>{const Er=et.current.get(bt.id);if(Er){Er.setLngLat([bt._geo.lng,bt._geo.lat]),Tm(Er.getElement(),bt,d==null?void 0:d.search.categoryMarkers);return}const ir=document.createElement("button");ir.type="button",ir.className="pbsm-marker",ir.setAttribute("aria-label",bt.name),Tm(ir,bt,d==null?void 0:d.search.categoryMarkers),ir.addEventListener("click",()=>Ft(bt.id));const ii=new Ed.Marker({element:ir,anchor:"center"}).setLngLat([bt._geo.lng,bt._geo.lat]).addTo(Ie);et.current.set(bt.id,ii)}),B0(Ie,Bt,yt,Ce.defaultZoom)},[d==null?void 0:d.search.categoryMarkers,Bt,yt,Ce.defaultZoom,Ft]),Je.useEffect(()=>{var Ct;const Ie=_t.current;if(et.current.forEach((bt,Er)=>{bt.getElement().classList.toggle("is-selected",Er===ri)}),!Ie||!vt||!it.current){(Ct=dt.current)==null||Ct.remove(),dt.current=null;return}dt.current||(dt.current=new Ed.Popup({closeButton:!0,closeOnClick:!1,offset:16})),dt.current.setLngLat([vt._geo.lng,vt._geo.lat]).setDOMContent(j0(vt,d==null?void 0:d.search.categoryColors)).addTo(Ie),Ie.easeTo({center:[vt._geo.lng,vt._geo.lat],duration:250,zoom:Math.max(Ie.getZoom(),10)})},[d==null?void 0:d.search.categoryColors,vt,ri]);const Rt=Je.useCallback(()=>{Fe.current&&(clearTimeout(Fe.current),Fe.current=null)},[]),qt=Je.useCallback(Ie=>{ce.current=Ie,Ar(Ie)},[]);Je.useEffect(()=>{if($e.current+=1,Le.current+=1,Rt(),Me(ue||null),Ht(null),ze({center:null,label:null}),Sr([]),Or(null),oe(!1),qt(""),De(null),ue)return;const Ie=ve||(ae?um(ae):null);if(!Ie)return;let Ct=!1;return hm(Ie).then(bt=>{Ct||Me(bt)}).catch(bt=>{Ct||De(bt.message)}),()=>{Ct=!0}},[Rt,ve,ue,ae,qt]);const $r=Je.useCallback(async(Ie={})=>{var ii,kn;if(!d)return;Rt();const Ct=Yp(Ie,"query")?Ie.query||"":$t,bt=Yp(Ie,"center")?Ie.center||null:Ct.trim()?null:st,Er=Yp(Ie,"category")?Ie.category||"":Wt,ir=Le.current+1;Le.current=ir,Et(!0),De(null);try{const $i=await Hp(d.search.url,{query:Ct,center:bt,radiusKm:zt,category:Er,limit:100}),zn=$i.center||bt||null,An=((ii=$i.resolvedQuery)==null?void 0:ii.label)||(bt?"your location":Ct.trim()?Ct.trim():null),go=zn?$i.hits.map(_o=>({..._o,distanceKm:dm(zn,_o._geo)})).sort((_o,$n)=>(_o.distanceKm||0)-($n.distanceKm||0)):$i.hits;if(ir!==Le.current)return;it.current=!1,ze({center:zn,label:An}),Sr(go),Or(((kn=go[0])==null?void 0:kn.id)||null)}catch($i){if(ir!==Le.current)return;De($i instanceof Error?$i.message:"Could not search stockists")}finally{ir===Le.current&&Et(!1)}},[Wt,st,Rt,d,$t,zt]);Je.useEffect(()=>{if(d)return Le.current+=1,Rt(),Fe.current=setTimeout(()=>{Fe.current=null,$r()},R0),Rt},[Rt,d,$r]),Je.useEffect(()=>()=>{$e.current+=1,Le.current+=1,Rt()},[Rt]);const yn=()=>{if(typeof window<"u"&&window.isSecureContext===!1){De("Browser location is blocked on this local Partbot domain. Chrome and Brave only allow Near me on HTTPS, localhost, or origins manually trusted in browser flags.");return}if(!navigator.geolocation){De("This browser does not support location search. Search by suburb or postcode instead.");return}oe(!0),De(null);const Ie=$e.current;navigator.geolocation.getCurrentPosition(Ct=>{if(Ie!==$e.current)return;const bt={lat:Ct.coords.latitude,lng:Ct.coords.longitude};gt(""),Ht(bt),ze({center:bt,label:"your location"}),oe(!1),$r({query:"",center:bt,category:ce.current})},Ct=>{Ie===$e.current&&(oe(!1),De(E0(Ct)))},{enableHighAccuracy:!1,timeout:8e3})},mo=Br.center?`No stockists found within ${zt} km. Try a larger radius.`:"Search a suburb, postcode, or dealer name to find stockists.";return mt.jsxs("section",{className:`pbsm-root ${Ce.darkMode?"is-dark":""} ${j}`.trim(),style:{"--pbsm-primary":Ce.primaryColor,"--pbsm-primary-contrast":Pd(Ce.primaryColor),"--pbsm-marker":Ce.markerColor,"--pbsm-marker-contrast":Pd(Ce.markerColor),"--pbsm-radius":`${Math.max(0,Ce.borderRadius)}px`},children:[de&&mt.jsxs(z0,{variant:"destructive",children:[mt.jsx(A0,{children:"Map unavailable"}),mt.jsx(D0,{children:de})]}),mt.jsxs("div",{className:`pbsm-toolbar ${jt.length>0?"has-categories":""}`.trim(),children:[mt.jsx(I0,{"aria-label":"Search stockists",placeholder:(d==null?void 0:d.search.placeholder)||"Search by suburb, postcode, or dealer",value:$t,onChange:Ie=>{const Ct=Ie.target.value;Le.current+=1,Rt(),gt(Ct),Ct.trim()&&(Ht(null),ze({center:null,label:Ct.trim()}))},onKeyDown:Ie=>{Ie.key==="Enter"&&(Ie.preventDefault(),$r())}}),jt.length>0&&mt.jsxs(k0,{className:"pbsm-category-select",name:"stockist-category","aria-label":"Stockist category",value:Wt,onChange:Ie=>qt(Ie.target.value),children:[mt.jsx(_m,{value:"",children:"All categories"}),jt.map(Ie=>mt.jsx(_m,{value:Ie,children:Ie},Ie))]}),mt.jsx(O0,{value:zt,onChange:Zt}),mt.jsxs(M0,{className:"pbsm-location-button",variant:"outline",type:"button",onClick:yn,disabled:ee||Nr,"aria-label":"Use my location",children:[mt.jsx(rm,{"aria-hidden":"true","data-slot":"icon",weight:"bold"}),mt.jsx("span",{className:"pbsm-button-label",children:ee?"Finding you":"Use my location"})]})]}),mt.jsxs("div",{className:"pbsm-layout",children:[mt.jsx(ym,{className:"pbsm-map-card",children:mt.jsx(vm,{className:"pbsm-map-content",children:mt.jsxs("div",{className:"pbsm-map","aria-label":"Stockist map",children:[mt.jsx("div",{ref:Ke,className:"pbsm-map-canvas"}),mt.jsx("div",{className:"pbsm-map-shade"}),Nr&&Bt.length===0?mt.jsx(xm,{className:"pbsm-map-skeleton"}):null]})})}),mt.jsx(ym,{className:"pbsm-list-card","aria-live":"polite",children:mt.jsxs(vm,{className:"pbsm-list",children:[Nr&&Bt.length===0?[0,1,2].map(Ie=>mt.jsx(xm,{className:"pbsm-result-skeleton"},Ie)):Nt.map(Ie=>{const Ct=fm(Ie.website);return mt.jsxs("article",{className:`pbsm-result-card ${vt&&Xp(Ie)===Xp(vt)?"is-selected":""}`,children:[mt.jsxs("button",{className:"pbsm-result-main",type:"button",onClick:()=>Ft(Ie.id),children:[mt.jsxs("span",{className:"pbsm-result-heading",children:[mt.jsx("span",{className:"pbsm-result-title",children:Ie.name}),mt.jsx("span",{className:"pbsm-result-categories",children:Qp(Ie).map(bt=>mt.jsx("span",{className:"pbsm-result-category",style:N0(bt,d==null?void 0:d.search.categoryColors),children:bt},bt))})]}),Jp(Ie)&&mt.jsx("span",{className:"pbsm-result-address",children:Jp(Ie)})]}),mt.jsxs("span",{className:"pbsm-card-actions",children:[Ie.phone&&mt.jsx("a",{href:`tel:${Ie.phone}`,children:"Call now"}),Ct&&mt.jsx("a",{href:Ct,target:"_blank",rel:"noreferrer",children:"Website"}),Ie.email&&mt.jsx("a",{href:`mailto:${Ie.email}`,children:"Email"}),Ie.directions_available!==!1&&mt.jsxs(mt.Fragment,{children:[mt.jsx("a",{href:mm(Ie._geo),target:"_blank",rel:"noreferrer",children:"Get directions"}),typeof Ie.distanceKm=="number"&&mt.jsx("span",{className:"pbsm-distance",children:pm(Ie.distanceKm)})]})]})]},Ie.id)}),!Nr&&Nt.length===0&&mt.jsx("div",{className:"pbsm-empty",children:mo})]})})]})]})}const V0=':host{display:block;height:var(--pbsm-height, 720px);max-width:100%;min-height:0;min-width:0;width:100%}[data-partbot-stockist-map-root]{display:block;height:100%;min-height:0}.pbsm-root,.pbsm-root *,.pbsm-root *:before,.pbsm-root *:after{box-sizing:border-box}.pbsm-root{--pbsm-primary: #111111;--pbsm-primary-contrast: #ffffff;--pbsm-marker: #111111;--pbsm-marker-contrast: #ffffff;--pbsm-action-color: var(--pbsm-primary);--pbsm-surface: #fdfcfa;--pbsm-control-surface: #fffefd;--pbsm-control-border: #d6d3d1;--pbsm-muted-surface: #f5f3f0;--pbsm-border: #e7e5e4;--pbsm-text: #1c1917;--pbsm-muted-text: #78716c;--pbsm-placeholder-text: #57534e;--pbsm-danger-surface: #fff1f2;--pbsm-danger-border: #fecdd3;--pbsm-danger-text: #9f1239;--pbsm-elevation: 0 14px 34px rgb(28 25 23 / .18), 0 2px 8px rgb(28 25 23 / .08);color:var(--pbsm-text);container-type:inline-size;display:flex;flex-direction:column;font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif;font-size:14px;height:var(--pbsm-height, 720px);line-height:1.5;min-height:0;min-width:0;overflow:hidden;max-width:100%;width:100%}.pbsm-preview{height:100%}.pbsm-toolbar{align-items:center;background:var(--pbsm-surface);border:1px solid var(--pbsm-border);border-bottom:0;border-radius:var(--pbsm-radius) var(--pbsm-radius) 0 0;display:grid;gap:8px;grid-template-areas:"search radius location";grid-template-columns:minmax(220px,1fr) 104px auto;max-width:100%;min-width:0;padding:10px 12px;width:100%}.pbsm-toolbar>*{max-width:100%;min-width:0}.pbsm-toolbar.has-categories{grid-template-areas:"search category radius location";grid-template-columns:minmax(220px,1fr) minmax(132px,180px) 104px auto}.pbsm-toolbar>.pbsm-input{grid-area:search}.pbsm-radius-listbox{grid-area:radius}.pbsm-toolbar>.pbsm-native-select-wrapper{grid-area:category}.pbsm-category-select{min-width:0;text-overflow:ellipsis}.pbsm-location-button{grid-area:location}.pbsm-input,.pbsm-native-select,.pbsm-radius-trigger{background:var(--pbsm-control-surface, #fffefd);border:1px solid var(--pbsm-control-border);border-radius:6px;color:var(--pbsm-text);font:inherit;min-height:38px;padding:7px 10px;transition:border-color .16s ease,box-shadow .16s ease}.pbsm-input:focus,.pbsm-native-select:focus-visible,.pbsm-radius-trigger:focus{border-color:color-mix(in srgb,var(--pbsm-primary) 55%,#d6d3d1);box-shadow:0 0 0 3px color-mix(in srgb,var(--pbsm-primary) 16%,transparent);outline:none}.pbsm-input::placeholder{color:var(--pbsm-placeholder-text);opacity:1}.pbsm-native-select-wrapper{max-width:100%;min-width:0;position:relative;width:100%}.pbsm-native-select-wrapper:has(select:disabled){opacity:.5}.pbsm-native-select{-webkit-appearance:none;-moz-appearance:none;appearance:none;box-shadow:0 1px 2px #1c19170d;cursor:pointer;display:block;max-width:100%;min-width:0;padding-right:34px;text-overflow:ellipsis;width:100%}.pbsm-native-select:disabled{cursor:not-allowed;pointer-events:none}.pbsm-native-select-icon{color:var(--pbsm-muted-text);height:16px;opacity:.55;pointer-events:none;position:absolute;right:12px;top:50%;transform:translateY(-50%);width:16px}.pbsm-native-select-option{background:Canvas;color:CanvasText}.pbsm-button{align-items:center;border:1px solid var(--pbsm-control-border);border-radius:6px;cursor:pointer;display:inline-flex;font:inherit;font-weight:600;gap:8px;justify-content:center;min-height:38px;padding:7px 12px;transition:background-color .16s ease,border-color .16s ease,box-shadow .16s ease,transform .16s ease;white-space:nowrap}.pbsm-button [data-slot=icon]{height:16px;flex:0 0 auto;width:16px}.pbsm-radius-listbox{position:relative}.pbsm-radius-trigger{align-items:center;cursor:pointer;display:flex;gap:8px;justify-content:space-between;width:100%}.pbsm-radius-caret{border-color:var(--pbsm-muted-text) transparent transparent;border-style:solid;border-width:5px 4px 0;height:0;width:0}.pbsm-radius-options{background:var(--pbsm-control-surface, #fffefd);border:1px solid var(--pbsm-control-border);border-radius:6px;box-shadow:var(--pbsm-elevation);display:grid;left:0;min-width:100%;overflow:hidden;padding:4px;position:absolute;top:calc(100% + 6px);z-index:10}.pbsm-radius-option{background:transparent;border:0;border-radius:4px;color:var(--pbsm-text);cursor:pointer;font:inherit;padding:7px 8px;text-align:left;white-space:nowrap}.pbsm-radius-option:hover,.pbsm-radius-option[aria-selected=true]{background:color-mix(in srgb,var(--pbsm-primary) 8%,var(--pbsm-control-surface, #fff))}.pbsm-button[data-variant=default]{background:var(--pbsm-primary);border-color:var(--pbsm-primary);color:var(--pbsm-primary-contrast)}.pbsm-button[data-variant=secondary],.pbsm-button[data-variant=outline]{background:var(--pbsm-control-surface, #fffefd);color:var(--pbsm-text)}.pbsm-button:not(:disabled):hover{box-shadow:0 1px 2px #1c191714;transform:translateY(-1px)}.pbsm-button:not(:disabled):active{box-shadow:none;transform:translateY(0)}.pbsm-button:focus-visible{box-shadow:0 0 0 3px color-mix(in srgb,var(--pbsm-primary) 18%,transparent);outline:none}.pbsm-button[data-variant=ghost]{background:transparent;border-color:transparent;color:var(--pbsm-text)}.pbsm-button:disabled{cursor:not-allowed;opacity:.6}.pbsm-card-shell{background:var(--pbsm-surface);border:1px solid var(--pbsm-control-border);display:flex;flex-direction:column;min-height:0}.pbsm-card-header{align-items:center;border-bottom:1px solid var(--pbsm-border);display:flex;gap:12px;justify-content:space-between;padding:16px}.pbsm-card-title{font-size:14px;font-weight:700;line-height:1.2}.pbsm-card-description{color:var(--pbsm-muted-text);font-size:12px;line-height:1.35;margin-top:2px}.pbsm-card-content{min-height:0}.pbsm-badge{align-items:center;border:1px solid transparent;border-radius:999px;display:inline-flex;font-size:12px;font-weight:700;justify-content:center;min-width:28px;padding:2px 8px;white-space:nowrap}.pbsm-badge[data-variant=default],.pbsm-badge[data-variant=secondary]{background:color-mix(in srgb,var(--pbsm-action-color) 10%,var(--pbsm-control-surface));color:var(--pbsm-action-color)}.pbsm-badge[data-variant=outline]{background:var(--pbsm-control-surface, #fffefd);border-color:var(--pbsm-control-border);color:var(--pbsm-muted-text)}.pbsm-alert{background:var(--pbsm-danger-surface);border:1px solid var(--pbsm-danger-border);border-radius:6px;color:var(--pbsm-danger-text);margin-bottom:12px;padding:8px 10px}.pbsm-alert-title{font-weight:700}.pbsm-alert-description{font-size:13px;line-height:1.45;margin-top:2px}.pbsm-skeleton{animation:pbsm-pulse 1.4s ease-in-out infinite;background:#e7e5e4;border-radius:6px}.pbsm-layout{display:grid;flex:1;gap:0;grid-template-areas:"list map";grid-template-columns:minmax(340px,400px) minmax(0,1fr);grid-template-rows:minmax(0,1fr);min-height:0;overflow:hidden;border-radius:0 0 var(--pbsm-radius) var(--pbsm-radius)}.pbsm-map-card{border-radius:0 0 var(--pbsm-radius) 0;grid-area:map;min-height:0;overflow:hidden}.pbsm-map-content{flex:1}.pbsm-map{background:var(--pbsm-border);height:100%;min-height:360px;overflow:hidden;position:relative}.pbsm-map-canvas{height:100%;top:0;right:0;bottom:0;left:0;position:absolute;width:100%}.pbsm-map-shade{background:linear-gradient(to top,rgb(28 25 23 / .12),transparent 42%),radial-gradient(circle at 70% 20%,color-mix(in srgb,var(--pbsm-primary) 10%,transparent),transparent 34%);top:0;right:0;bottom:0;left:0;pointer-events:none;position:absolute}.pbsm-map-skeleton{top:16px;right:16px;bottom:16px;left:16px;opacity:.55;position:absolute;z-index:1}.pbsm-marker{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:var(--pbsm-marker);border:2px solid #fff;border-radius:999px;box-shadow:0 6px 16px #1c191747;cursor:pointer;height:18px;padding:0;transition:box-shadow .18s ease,height .18s ease,transform .18s ease,width .18s ease;width:18px}.pbsm-marker:hover{transform:scale(1.14)}.pbsm-marker:focus-visible{box-shadow:0 0 0 4px color-mix(in srgb,var(--pbsm-marker) 22%,transparent),0 8px 22px #1c191747;outline:none}.pbsm-marker.is-selected{box-shadow:0 0 0 5px color-mix(in srgb,var(--pbsm-marker) 18%,transparent),0 8px 22px #1c191752;height:26px;width:26px}.pbsm-marker.has-custom-marker{align-items:center;background:transparent;border:0;border-radius:0;box-shadow:none;display:inline-flex;height:36px;justify-content:center;width:36px}.pbsm-marker.has-custom-marker:focus-visible{border-radius:6px;box-shadow:0 0 0 4px color-mix(in srgb,var(--pbsm-primary) 28%,transparent)}.pbsm-marker.has-custom-marker.is-selected{box-shadow:none;height:44px;width:44px}.pbsm-marker.has-custom-marker.is-selected:focus-visible{box-shadow:0 0 0 4px color-mix(in srgb,var(--pbsm-primary) 28%,transparent),0 8px 22px #1c191747}.pbsm-marker-image{filter:drop-shadow(0 5px 6px rgb(28 25 23 / .32));height:100%;object-fit:contain;pointer-events:none;-webkit-user-select:none;user-select:none;width:100%}.pbsm-root .maplibregl-popup-content{background:var(--pbsm-control-surface, #fffefd);border:1px solid color-mix(in srgb,var(--pbsm-action-color) 14%,var(--pbsm-border));border-radius:var(--pbsm-radius);box-shadow:var(--pbsm-elevation);padding:0}.pbsm-root .maplibregl-popup-tip{filter:drop-shadow(0 2px 2px rgb(28 25 23 / .08))}.pbsm-root .maplibregl-popup-close-button{align-items:center;border-radius:999px;color:#78716c;display:inline-flex;font-size:18px;height:26px;justify-content:center;line-height:1;right:7px;top:7px;transition:background-color .14s ease,color .14s ease;width:26px}.pbsm-root .maplibregl-popup-close-button:hover{background:var(--pbsm-muted-surface);color:var(--pbsm-text)}.pbsm-root .maplibregl-ctrl-attrib{font-size:10px}.pbsm-root .maplibregl-ctrl-attrib:not(.maplibregl-compact){max-width:260px}.pbsm-popup{color:var(--pbsm-text);display:grid;font:12px/1.4 Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif;gap:8px;max-width:260px;min-width:220px;padding:14px 38px 14px 14px}.pbsm-popup-title{color:var(--pbsm-text);font-size:13px;font-weight:700;line-height:1.2}.pbsm-popup-address{color:var(--pbsm-muted-text);line-height:1.35}.pbsm-popup-category,.pbsm-result-category{background:var( --pbsm-category-color, color-mix(in srgb, var(--pbsm-action-color) 10%, var(--pbsm-control-surface, #fff)) );border-radius:999px;color:var(--pbsm-category-contrast, var(--pbsm-action-color));font-size:11px;font-weight:700;line-height:1.2;padding:3px 7px;width:fit-content}.pbsm-popup-actions{display:flex;flex-wrap:wrap;gap:6px;margin-top:4px}.pbsm-popup-action{align-items:center;background:var(--pbsm-muted-surface);border:1px solid var(--pbsm-border);border-radius:999px;color:var(--pbsm-action-color);display:inline-flex;font-size:11px;font-weight:700;line-height:1.2;padding:6px 9px;text-decoration:none;transition:background-color .14s ease,border-color .14s ease,color .14s ease,transform .14s ease}.pbsm-popup-action:hover{background:var(--pbsm-control-surface, #fff);border-color:color-mix(in srgb,var(--pbsm-action-color) 28%,var(--pbsm-control-border));transform:translateY(-1px)}.pbsm-popup-action-primary{background:color-mix(in srgb,var(--pbsm-action-color) 12%,var(--pbsm-control-surface, #fff));border-color:color-mix(in srgb,var(--pbsm-action-color) 24%,var(--pbsm-control-border))}.pbsm-list-card{border-radius:0 0 0 var(--pbsm-radius);grid-area:list;min-height:0;overflow:hidden}.pbsm-list{-ms-overflow-style:none;flex:1;max-height:none;min-height:0;overflow:auto;scrollbar-width:none}.pbsm-list::-webkit-scrollbar{display:none}.pbsm-result-card{background:var(--pbsm-surface);border:0;border-bottom:1px solid var(--pbsm-border);color:inherit;display:grid;gap:10px;padding:18px 16px;text-align:left;transition:background-color .16s ease,box-shadow .16s ease,transform .16s ease;width:100%}.pbsm-result-main{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:transparent;border:0;color:inherit;cursor:pointer;display:grid;gap:10px;padding:0;text-align:left;width:100%}.pbsm-result-card:hover{background:color-mix(in srgb,var(--pbsm-primary) 5%,var(--pbsm-surface))}.pbsm-result-card:has(.pbsm-result-main:active){transform:scale(.998)}.pbsm-result-card:focus-within{box-shadow:inset 0 0 0 2px color-mix(in srgb,var(--pbsm-primary) 48%,transparent);outline:none}.pbsm-result-main:focus-visible{outline:none}.pbsm-result-card.is-selected{background:color-mix(in srgb,var(--pbsm-primary) 8%,var(--pbsm-surface));box-shadow:inset 4px 0 0 var(--pbsm-primary)}.pbsm-result-heading{align-items:start;display:flex;gap:14px;justify-content:space-between}.pbsm-result-title{flex:1 1 auto;font-size:13px;font-weight:600;line-height:1.3;min-width:0}.pbsm-result-categories{align-items:flex-start;display:flex;flex-wrap:wrap;gap:7px;justify-content:flex-end;max-width:58%}.pbsm-result-address{color:var(--pbsm-muted-text);font-size:12px;line-height:1.45}.pbsm-distance{background:color-mix(in srgb,var(--pbsm-action-color) 10%,var(--pbsm-control-surface, #fff));border-radius:999px;color:var(--pbsm-action-color);flex:0 0 auto;font-size:11px;font-weight:700;line-height:1.2;padding:3px 7px}.pbsm-result-skeleton{height:88px;margin:12px}.pbsm-card-actions{align-items:center;display:flex;flex-wrap:wrap;gap:12px;margin-top:4px}.pbsm-card-actions a{color:var(--pbsm-action-color);font-size:12px;font-weight:600;text-decoration:none}.pbsm-card-actions a:hover{text-decoration:underline;text-underline-offset:3px}.pbsm-empty{color:var(--pbsm-muted-text);line-height:1.4;padding:28px 18px;text-align:center}@keyframes pbsm-pulse{0%,to{opacity:.55}50%{opacity:1}}@container (max-width: 760px){.pbsm-toolbar{grid-template-areas:"search radius location";grid-template-columns:minmax(0,1fr) 88px 38px;gap:6px;padding:6px}.pbsm-toolbar.has-categories{grid-template-areas:"search radius location" "category category category";grid-template-columns:minmax(0,1fr) minmax(0,88px) minmax(0,38px)}.pbsm-layout{grid-template-columns:1fr}.pbsm-layout{grid-template-areas:"map" "list";grid-template-rows:minmax(300px,3fr) minmax(0,2fr);overflow:hidden}.pbsm-map{min-height:300px}.pbsm-button{min-height:38px;padding-inline:0}.pbsm-location-button{aspect-ratio:1;width:38px}.pbsm-button-label{clip:rect(0 0 0 0);border:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}.pbsm-map-card{border-radius:0}.pbsm-list-card{border-radius:0 0 var(--pbsm-radius) var(--pbsm-radius)}.pbsm-list{max-height:none}}.pbsm-root.pbsm-preview-mobile .pbsm-toolbar{grid-template-areas:"search radius location";grid-template-columns:minmax(0,1fr) 88px 38px;gap:6px;padding:6px}.pbsm-root.pbsm-preview-mobile .pbsm-toolbar.has-categories{grid-template-areas:"search radius location" "category category category";grid-template-columns:minmax(0,1fr) minmax(0,88px) minmax(0,38px)}.pbsm-root.pbsm-preview-mobile .pbsm-layout{grid-template-areas:"map" "list";grid-template-columns:1fr;grid-template-rows:minmax(300px,3fr) minmax(0,2fr);overflow:hidden}.pbsm-root.pbsm-preview-mobile .pbsm-map{min-height:300px}.pbsm-root.pbsm-preview-mobile .pbsm-button{min-height:38px;padding-inline:0}.pbsm-root.pbsm-preview-mobile .pbsm-location-button{aspect-ratio:1;width:38px}.pbsm-root.pbsm-preview-mobile .pbsm-button-label{clip:rect(0 0 0 0);border:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}.pbsm-root.pbsm-preview-mobile .pbsm-map-card{border-radius:0}.pbsm-root.pbsm-preview-mobile .pbsm-list-card{border-radius:0 0 var(--pbsm-radius) var(--pbsm-radius)}.pbsm-root.pbsm-preview-mobile .pbsm-list{max-height:none}.pbsm-root.pbsm-preview-mobile .pbsm-result-heading{flex-direction:column;gap:7px}.pbsm-root.pbsm-preview-mobile .pbsm-result-categories{justify-content:flex-start;max-width:none}@container (max-width: 480px){.pbsm-toolbar{grid-template-columns:minmax(0,1fr) 82px 38px}.pbsm-result-heading{flex-direction:column;gap:7px}.pbsm-result-categories{justify-content:flex-start;max-width:none}}.pbsm-root.pbsm-preview-mobile .pbsm-toolbar{grid-template-columns:minmax(0,1fr) 88px 38px}:where(.dark) .pbsm-root,.pbsm-root.is-dark{--pbsm-action-color: #f5f3f0;--pbsm-surface: #1c1917;--pbsm-control-surface: #292524;--pbsm-control-border: rgb(255 255 255 / .12);--pbsm-muted-surface: #292524;--pbsm-border: rgb(255 255 255 / .1);--pbsm-text: #f5f3f0;--pbsm-muted-text: #a8a29e;--pbsm-placeholder-text: #d6d3d1;--pbsm-danger-surface: rgb(127 29 29 / .28);--pbsm-danger-border: rgb(244 63 94 / .28);--pbsm-danger-text: #fecdd3;--pbsm-elevation: 0 18px 42px rgb(0 0 0 / .42), 0 2px 10px rgb(0 0 0 / .22)}:where(.dark) .pbsm-input,:where(.dark) .pbsm-native-select,.pbsm-root.is-dark .pbsm-input,.pbsm-root.is-dark .pbsm-native-select{color-scheme:dark}:where(.dark) .pbsm-marker,.pbsm-root.is-dark .pbsm-marker{border-color:#f5f3f0}:where(.dark) .pbsm-map-shade,.pbsm-root.is-dark .pbsm-map-shade{background:linear-gradient(to top,rgb(0 0 0 / .2),transparent 42%),radial-gradient(circle at 70% 20%,rgb(255 255 255 / .06),transparent 34%)}@media(prefers-color-scheme:dark){.pbsm-root{--pbsm-action-color: #f5f3f0;--pbsm-surface: #1c1917;--pbsm-control-surface: #292524;--pbsm-control-border: rgb(255 255 255 / .12);--pbsm-muted-surface: #292524;--pbsm-border: rgb(255 255 255 / .1);--pbsm-text: #f5f3f0;--pbsm-muted-text: #a8a29e;--pbsm-placeholder-text: #d6d3d1;--pbsm-danger-surface: rgb(127 29 29 / .28);--pbsm-danger-border: rgb(244 63 94 / .28);--pbsm-danger-text: #fecdd3;--pbsm-elevation: 0 18px 42px rgb(0 0 0 / .42), 0 2px 10px rgb(0 0 0 / .22)}.pbsm-input,.pbsm-native-select{color-scheme:dark}.pbsm-marker{border-color:#f5f3f0}.pbsm-map-shade{background:linear-gradient(to top,rgb(0 0 0 / .2),transparent 42%),radial-gradient(circle at 70% 20%,rgb(255 255 255 / .06),transparent 34%)}}@media(prefers-reduced-motion:reduce){.pbsm-button,.pbsm-input,.pbsm-marker,.pbsm-popup-action,.pbsm-result-card,.pbsm-native-select{transition:none}.pbsm-button:not(:disabled):hover,.pbsm-marker:hover,.pbsm-popup-action:hover,.pbsm-result-card:active{transform:none}}';function Sm(ae,ve){const ue=tm.createRoot(ae);return ue.render(mt.jsx(ef,{...ve})),ue}const Em="data-partbot-stockist-map-styles",Pm="data-partbot-stockist-map-root",U0=`${g0}
843
843
  ${V0}`;function q0(ae){return ae.shadowRoot||ae.attachShadow({mode:"open"})}function $0(ae){if(ae.querySelector(`style[${Em}]`))return;const ve=document.createElement("style");ve.setAttribute(Em,""),ve.textContent=U0,ae.prepend(ve)}function G0(ae){const ve=ae.querySelector(`div[${Pm}]`);if(ve)return ve;const ue=document.createElement("div");return ue.setAttribute(Pm,""),ae.appendChild(ue),ue}class tf extends HTMLElement{constructor(){super(...arguments);Np(this,"root");Np(this,"mountElement")}connectedCallback(){this.renderStockistMap()}disconnectedCallback(){var ue;(ue=this.root)==null||ue.unmount(),this.root=void 0}attributeChangedCallback(){this.isConnected&&this.renderStockistMap()}renderStockistMap(){const ue=q0(this);$0(ue),this.mountElement||(this.mountElement=G0(ue)),this.root||(this.root=tm.createRoot(this.mountElement)),this.root.render(mt.jsx(ef,{...this.stockistMapProps()}))}stockistMapProps(){const ue=Number.parseInt(this.getAttribute("initial-radius-km")||"",10);return{token:this.getAttribute("token")||void 0,configUrl:this.getAttribute("config-url")||void 0,initialQuery:this.getAttribute("initial-query")||"",initialRadiusKm:Number.isFinite(ue)?ue:void 0}}}Np(tf,"observedAttributes",["token","config-url","initial-query","initial-radius-km"]);function rf(){typeof window>"u"||!window.customElements||window.customElements.get("partbot-stockist-map")||window.customElements.define("partbot-stockist-map",tf)}typeof window<"u"&&(rf(),window.PartbotStockistMap={defineCustomElement:rf,mount:Sm}),ti.PartbotStockistMapElement=tf,ti.StockistMap=ef,ti.buildSearchUrl=cm,ti.contrastTextColor=Pd,ti.defineStockistMapElement=rf,ti.distanceKm=dm,ti.formatDistance=pm,ti.loadConfig=hm,ti.mountStockistMap=Sm,ti.normalizeTheme=lm,ti.searchStockistResults=Hp,ti.searchStockists=T0,ti.tokenConfigUrl=um,Object.defineProperty(ti,Symbol.toStringTag,{value:"Module"})}));