@opengis/partsmap 0.0.48 → 0.0.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/PartsMap.js +4 -7
- package/dist/PartsMap.umd.cjs +2 -2
- package/package.json +1 -1
package/dist/PartsMap.umd.cjs
CHANGED
@@ -577,9 +577,9 @@ uniform ${P} ${k} u_${L};
|
|
577
577
|
#endif
|
578
578
|
`}),staticAttributes:o,staticUniforms:m}}class qs{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,n,o,a,h,m,y,v,b){this.context=t;let P=this.boundPaintVertexBuffers.length!==a.length;for(let k=0;!P&&k<a.length;k++)this.boundPaintVertexBuffers[k]!==a[k]&&(P=!0);!this.vao||this.boundProgram!==n||this.boundLayoutVertexBuffer!==o||P||this.boundIndexBuffer!==h||this.boundVertexOffset!==m||this.boundDynamicVertexBuffer!==y||this.boundDynamicVertexBuffer2!==v||this.boundDynamicVertexBuffer3!==b?this.freshBind(n,o,a,h,m,y,v,b):(t.bindVertexArray.set(this.vao),y&&y.bind(),h&&h.dynamicDraw&&h.bind(),v&&v.bind(),b&&b.bind())}freshBind(t,n,o,a,h,m,y,v){const b=t.numAttributes,P=this.context,k=P.gl;this.vao&&this.destroy(),this.vao=P.createVertexArray(),P.bindVertexArray.set(this.vao),this.boundProgram=t,this.boundLayoutVertexBuffer=n,this.boundPaintVertexBuffers=o,this.boundIndexBuffer=a,this.boundVertexOffset=h,this.boundDynamicVertexBuffer=m,this.boundDynamicVertexBuffer2=y,this.boundDynamicVertexBuffer3=v,n.enableAttributes(k,t);for(const L of o)L.enableAttributes(k,t);m&&m.enableAttributes(k,t),y&&y.enableAttributes(k,t),v&&v.enableAttributes(k,t),n.bind(),n.setVertexAttribPointers(k,t,h);for(const L of o)L.bind(),L.setVertexAttribPointers(k,t,h);m&&(m.bind(),m.setVertexAttribPointers(k,t,h)),a&&a.bind(),y&&(y.bind(),y.setVertexAttribPointers(k,t,h)),v&&(v.bind(),v.setVertexAttribPointers(k,t,h)),P.currentNumAttributes=b}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}const $o=(u,t,n,o,a)=>({u_matrix:u,u_texture:0,u_ele_delta:t,u_fog_matrix:n,u_fog_color:o?o.properties.get("fog-color"):c.aN.white,u_fog_ground_blend:o?o.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:o?o.calculateFogBlendOpacity(a):0,u_horizon_color:o?o.properties.get("horizon-color"):c.aN.white,u_horizon_fog_blend:o?o.properties.get("horizon-fog-blend"):1});function ds(u){const t=[];for(let n=0;n<u.length;n++){if(u[n]===null)continue;const o=u[n].split(" ");t.push(o.pop())}return t}class Zs{constructor(t,n,o,a,h,m){const y=t.gl;this.program=y.createProgram();const v=ds(n.staticAttributes),b=o?o.getBinderAttributes():[],P=v.concat(b),k=Xr.prelude.staticUniforms?ds(Xr.prelude.staticUniforms):[],L=n.staticUniforms?ds(n.staticUniforms):[],B=o?o.getBinderUniforms():[],N=k.concat(L).concat(B),Z=[];for(const ce of N)Z.indexOf(ce)<0&&Z.push(ce);const j=o?o.defines():[];h&&j.push("#define OVERDRAW_INSPECTOR;"),m&&j.push("#define TERRAIN3D;");const H=j.concat(Xr.prelude.fragmentSource,n.fragmentSource).join(`
|
579
579
|
`),Y=j.concat(Xr.prelude.vertexSource,n.vertexSource).join(`
|
580
|
-
`),U=y.createShader(y.FRAGMENT_SHADER);if(y.isContextLost())return void(this.failedToCreate=!0);if(y.shaderSource(U,H),y.compileShader(U),!y.getShaderParameter(U,y.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${y.getShaderInfoLog(U)}`);y.attachShader(this.program,U);const te=y.createShader(y.VERTEX_SHADER);if(y.isContextLost())return void(this.failedToCreate=!0);if(y.shaderSource(te,Y),y.compileShader(te),!y.getShaderParameter(te,y.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${y.getShaderInfoLog(te)}`);y.attachShader(this.program,te),this.attributes={};const se={};this.numAttributes=P.length;for(let ce=0;ce<this.numAttributes;ce++)P[ce]&&(y.bindAttribLocation(this.program,ce,P[ce]),this.attributes[P[ce]]=ce);if(y.linkProgram(this.program),!y.getProgramParameter(this.program,y.LINK_STATUS))throw new Error(`Program failed to link: ${y.getProgramInfoLog(this.program)}`);y.deleteShader(te),y.deleteShader(U);for(let ce=0;ce<Z.length;ce++){const ge=Z[ce];if(ge&&!se[ge]){const we=y.getUniformLocation(this.program,ge);we&&(se[ge]=we)}}this.fixedUniforms=a(t,se),this.terrainUniforms=((ce,ge)=>({u_depth:new c.aI(ce,ge.u_depth),u_terrain:new c.aI(ce,ge.u_terrain),u_terrain_dim:new c.aJ(ce,ge.u_terrain_dim),u_terrain_matrix:new c.aK(ce,ge.u_terrain_matrix),u_terrain_unpack:new c.aL(ce,ge.u_terrain_unpack),u_terrain_exaggeration:new c.aJ(ce,ge.u_terrain_exaggeration)}))(t,se),this.binderUniforms=o?o.getUniforms(t,se):[]}draw(t,n,o,a,h,m,y,v,b,P,k,L,B,N,Z,j,H,Y){const U=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(o),t.setStencilMode(a),t.setColorMode(h),t.setCullFace(m),v){t.activeTexture.set(U.TEXTURE2),U.bindTexture(U.TEXTURE_2D,v.depthTexture),t.activeTexture.set(U.TEXTURE3),U.bindTexture(U.TEXTURE_2D,v.texture);for(const se in this.terrainUniforms)this.terrainUniforms[se].set(v[se])}for(const se in this.fixedUniforms)this.fixedUniforms[se].set(y[se]);Z&&Z.setUniforms(t,this.binderUniforms,B,{zoom:N});let te=0;switch(n){case U.LINES:te=2;break;case U.TRIANGLES:te=3;break;case U.LINE_STRIP:te=1}for(const se of L.get()){const ce=se.vaos||(se.vaos={});(ce[b]||(ce[b]=new qs)).bind(t,this,P,Z?Z.getPaintVertexBuffers():[],k,se.vertexOffset,j,H,Y),U.drawElements(n,se.primitiveLength*te,U.UNSIGNED_SHORT,se.primitiveOffset*te*2)}}}function Gs(u,t,n){const o=1/rt(n,1,t.transform.tileZoom),a=Math.pow(2,n.tileID.overscaledZ),h=n.tileSize*Math.pow(2,t.transform.tileZoom)/a,m=h*(n.tileID.canonical.x+n.tileID.wrap*a),y=h*n.tileID.canonical.y;return{u_image:0,u_texsize:n.imageAtlasTexture.size,u_scale:[o,u.fromScale,u.toScale],u_fade:u.t,u_pixel_coord_upper:[m>>16,y>>16],u_pixel_coord_lower:[65535&m,65535&y]}}const Hs=(u,t,n,o)=>{const a=t.style.light,h=a.properties.get("position"),m=[h.x,h.y,h.z],y=function(){var b=new c.A(9);return c.A!=Float32Array&&(b[1]=0,b[2]=0,b[3]=0,b[5]=0,b[6]=0,b[7]=0),b[0]=1,b[4]=1,b[8]=1,b}();a.properties.get("anchor")==="viewport"&&function(b,P){var k=Math.sin(P),L=Math.cos(P);b[0]=L,b[1]=k,b[2]=0,b[3]=-k,b[4]=L,b[5]=0,b[6]=0,b[7]=0,b[8]=1}(y,-t.transform.angle),function(b,P,k){var L=P[0],B=P[1],N=P[2];b[0]=L*k[0]+B*k[3]+N*k[6],b[1]=L*k[1]+B*k[4]+N*k[7],b[2]=L*k[2]+B*k[5]+N*k[8]}(m,m,y);const v=a.properties.get("color");return{u_matrix:u,u_lightpos:m,u_lightintensity:a.properties.get("intensity"),u_lightcolor:[v.r,v.g,v.b],u_vertical_gradient:+n,u_opacity:o}},Xs=(u,t,n,o,a,h,m)=>c.e(Hs(u,t,n,o),Gs(h,t,m),{u_height_factor:-Math.pow(2,a.overscaledZ)/m.tileSize/8}),ps=u=>({u_matrix:u}),zn=(u,t,n,o)=>c.e(ps(u),Gs(n,t,o)),Fc=(u,t)=>({u_matrix:u,u_world:t}),Oc=(u,t,n,o,a)=>c.e(zn(u,t,n,o),{u_world:a}),pl=(u,t,n,o)=>{const a=u.transform;let h,m;if(o.paint.get("circle-pitch-alignment")==="map"){const y=rt(n,1,a.zoom);h=!0,m=[y,y]}else h=!1,m=a.pixelsToGLUnits;return{u_camera_to_center_distance:a.cameraToCenterDistance,u_scale_with_map:+(o.paint.get("circle-pitch-scale")==="map"),u_matrix:u.translatePosMatrix(t.posMatrix,n,o.paint.get("circle-translate"),o.paint.get("circle-translate-anchor")),u_pitch_with_map:+h,u_device_pixel_ratio:u.pixelRatio,u_extrude_scale:m}},Vc=(u,t,n)=>({u_matrix:u,u_inv_matrix:t,u_camera_to_center_distance:n.cameraToCenterDistance,u_viewport_size:[n.width,n.height]}),Wr=(u,t,n=1)=>({u_matrix:u,u_color:t,u_overlay:0,u_overlay_scale:n}),fs=u=>({u_matrix:u}),Ui=(u,t,n,o)=>({u_matrix:u,u_extrude_scale:rt(t,1,n),u_intensity:o});function ji(u,t){const n=Math.pow(2,t.canonical.z),o=t.canonical.y;return[new c.Z(0,o/n).toLngLat().lat,new c.Z(0,(o+1)/n).toLngLat().lat]}const ms=(u,t,n,o)=>{const a=u.transform;return{u_matrix:gl(u,t,n,o),u_ratio:1/rt(t,1,a.zoom),u_device_pixel_ratio:u.pixelRatio,u_units_to_pixels:[1/a.pixelsToGLUnits[0],1/a.pixelsToGLUnits[1]]}},Ws=(u,t,n,o,a)=>c.e(ms(u,t,n,a),{u_image:0,u_image_height:o}),fl=(u,t,n,o,a)=>{const h=u.transform,m=un(t,h);return{u_matrix:gl(u,t,n,a),u_texsize:t.imageAtlasTexture.size,u_ratio:1/rt(t,1,h.zoom),u_device_pixel_ratio:u.pixelRatio,u_image:0,u_scale:[m,o.fromScale,o.toScale],u_fade:o.t,u_units_to_pixels:[1/h.pixelsToGLUnits[0],1/h.pixelsToGLUnits[1]]}},ml=(u,t,n,o,a,h)=>{const m=u.lineAtlas,y=un(t,u.transform),v=n.layout.get("line-cap")==="round",b=m.getDash(o.from,v),P=m.getDash(o.to,v),k=b.width*a.fromScale,L=P.width*a.toScale;return c.e(ms(u,t,n,h),{u_patternscale_a:[y/k,-b.height/2],u_patternscale_b:[y/L,-P.height/2],u_sdfgamma:m.width/(256*Math.min(k,L)*u.pixelRatio)/2,u_image:0,u_tex_y_a:b.y,u_tex_y_b:P.y,u_mix:a.t})};function un(u,t){return 1/rt(u,1,t.tileZoom)}function gl(u,t,n,o){return u.translatePosMatrix(o?o.posMatrix:t.tileID.posMatrix,t,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}const Nc=(u,t,n,o,a)=>{return{u_matrix:u,u_tl_parent:t,u_scale_parent:n,u_buffer_scale:1,u_fade_t:o.mix,u_opacity:o.opacity*a.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:a.paint.get("raster-brightness-min"),u_brightness_high:a.paint.get("raster-brightness-max"),u_saturation_factor:(m=a.paint.get("raster-saturation"),m>0?1-1/(1.001-m):-m),u_contrast_factor:(h=a.paint.get("raster-contrast"),h>0?1/(1-h):1+h),u_spin_weights:Uc(a.paint.get("raster-hue-rotate"))};var h,m};function Uc(u){u*=Math.PI/180;const t=Math.sin(u),n=Math.cos(u);return[(2*n+1)/3,(-Math.sqrt(3)*t-n+1)/3,(Math.sqrt(3)*t-n+1)/3]}const _l=(u,t,n,o,a,h,m,y,v,b,P,k,L,B)=>{const N=m.transform;return{u_is_size_zoom_constant:+(u==="constant"||u==="source"),u_is_size_feature_constant:+(u==="constant"||u==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:N.cameraToCenterDistance,u_pitch:N.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:N.width/N.height,u_fade_change:m.options.fadeDuration?m.symbolFadeChange:1,u_matrix:y,u_label_plane_matrix:v,u_coord_matrix:b,u_is_text:+k,u_pitch_with_map:+o,u_is_along_line:a,u_is_variable_anchor:h,u_texsize:L,u_texture:0,u_translation:P,u_pitched_scale:B}},yl=(u,t,n,o,a,h,m,y,v,b,P,k,L,B,N)=>{const Z=m.transform;return c.e(_l(u,t,n,o,a,h,m,y,v,b,P,k,L,N),{u_gamma_scale:o?Math.cos(Z._pitch)*Z.cameraToCenterDistance:1,u_device_pixel_ratio:m.pixelRatio,u_is_halo:+B})},jc=(u,t,n,o,a,h,m,y,v,b,P,k,L,B)=>c.e(yl(u,t,n,o,a,h,m,y,v,b,P,!0,k,!0,B),{u_texsize_icon:L,u_texture_icon:1}),Js=(u,t,n)=>({u_matrix:u,u_opacity:t,u_color:n}),qo=(u,t,n,o,a,h)=>c.e(function(m,y,v,b){const P=v.imageManager.getPattern(m.from.toString()),k=v.imageManager.getPattern(m.to.toString()),{width:L,height:B}=v.imageManager.getPixelSize(),N=Math.pow(2,b.tileID.overscaledZ),Z=b.tileSize*Math.pow(2,v.transform.tileZoom)/N,j=Z*(b.tileID.canonical.x+b.tileID.wrap*N),H=Z*b.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:P.tl,u_pattern_br_a:P.br,u_pattern_tl_b:k.tl,u_pattern_br_b:k.br,u_texsize:[L,B],u_mix:y.t,u_pattern_size_a:P.displaySize,u_pattern_size_b:k.displaySize,u_scale_a:y.fromScale,u_scale_b:y.toScale,u_tile_units_to_pixels:1/rt(b,1,v.transform.tileZoom),u_pixel_coord_upper:[j>>16,H>>16],u_pixel_coord_lower:[65535&j,65535&H]}}(o,h,n,a),{u_matrix:u,u_opacity:t}),Ks={fillExtrusion:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_lightpos:new c.aO(u,t.u_lightpos),u_lightintensity:new c.aJ(u,t.u_lightintensity),u_lightcolor:new c.aO(u,t.u_lightcolor),u_vertical_gradient:new c.aJ(u,t.u_vertical_gradient),u_opacity:new c.aJ(u,t.u_opacity)}),fillExtrusionPattern:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_lightpos:new c.aO(u,t.u_lightpos),u_lightintensity:new c.aJ(u,t.u_lightintensity),u_lightcolor:new c.aO(u,t.u_lightcolor),u_vertical_gradient:new c.aJ(u,t.u_vertical_gradient),u_height_factor:new c.aJ(u,t.u_height_factor),u_image:new c.aI(u,t.u_image),u_texsize:new c.aP(u,t.u_texsize),u_pixel_coord_upper:new c.aP(u,t.u_pixel_coord_upper),u_pixel_coord_lower:new c.aP(u,t.u_pixel_coord_lower),u_scale:new c.aO(u,t.u_scale),u_fade:new c.aJ(u,t.u_fade),u_opacity:new c.aJ(u,t.u_opacity)}),fill:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix)}),fillPattern:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_image:new c.aI(u,t.u_image),u_texsize:new c.aP(u,t.u_texsize),u_pixel_coord_upper:new c.aP(u,t.u_pixel_coord_upper),u_pixel_coord_lower:new c.aP(u,t.u_pixel_coord_lower),u_scale:new c.aO(u,t.u_scale),u_fade:new c.aJ(u,t.u_fade)}),fillOutline:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_world:new c.aP(u,t.u_world)}),fillOutlinePattern:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_world:new c.aP(u,t.u_world),u_image:new c.aI(u,t.u_image),u_texsize:new c.aP(u,t.u_texsize),u_pixel_coord_upper:new c.aP(u,t.u_pixel_coord_upper),u_pixel_coord_lower:new c.aP(u,t.u_pixel_coord_lower),u_scale:new c.aO(u,t.u_scale),u_fade:new c.aJ(u,t.u_fade)}),circle:(u,t)=>({u_camera_to_center_distance:new c.aJ(u,t.u_camera_to_center_distance),u_scale_with_map:new c.aI(u,t.u_scale_with_map),u_pitch_with_map:new c.aI(u,t.u_pitch_with_map),u_extrude_scale:new c.aP(u,t.u_extrude_scale),u_device_pixel_ratio:new c.aJ(u,t.u_device_pixel_ratio),u_matrix:new c.aK(u,t.u_matrix)}),collisionBox:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_pixel_extrude_scale:new c.aP(u,t.u_pixel_extrude_scale)}),collisionCircle:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_inv_matrix:new c.aK(u,t.u_inv_matrix),u_camera_to_center_distance:new c.aJ(u,t.u_camera_to_center_distance),u_viewport_size:new c.aP(u,t.u_viewport_size)}),debug:(u,t)=>({u_color:new c.aM(u,t.u_color),u_matrix:new c.aK(u,t.u_matrix),u_overlay:new c.aI(u,t.u_overlay),u_overlay_scale:new c.aJ(u,t.u_overlay_scale)}),clippingMask:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix)}),heatmap:(u,t)=>({u_extrude_scale:new c.aJ(u,t.u_extrude_scale),u_intensity:new c.aJ(u,t.u_intensity),u_matrix:new c.aK(u,t.u_matrix)}),heatmapTexture:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_world:new c.aP(u,t.u_world),u_image:new c.aI(u,t.u_image),u_color_ramp:new c.aI(u,t.u_color_ramp),u_opacity:new c.aJ(u,t.u_opacity)}),hillshade:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_image:new c.aI(u,t.u_image),u_latrange:new c.aP(u,t.u_latrange),u_light:new c.aP(u,t.u_light),u_shadow:new c.aM(u,t.u_shadow),u_highlight:new c.aM(u,t.u_highlight),u_accent:new c.aM(u,t.u_accent)}),hillshadePrepare:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_image:new c.aI(u,t.u_image),u_dimension:new c.aP(u,t.u_dimension),u_zoom:new c.aJ(u,t.u_zoom),u_unpack:new c.aL(u,t.u_unpack)}),line:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_ratio:new c.aJ(u,t.u_ratio),u_device_pixel_ratio:new c.aJ(u,t.u_device_pixel_ratio),u_units_to_pixels:new c.aP(u,t.u_units_to_pixels)}),lineGradient:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_ratio:new c.aJ(u,t.u_ratio),u_device_pixel_ratio:new c.aJ(u,t.u_device_pixel_ratio),u_units_to_pixels:new c.aP(u,t.u_units_to_pixels),u_image:new c.aI(u,t.u_image),u_image_height:new c.aJ(u,t.u_image_height)}),linePattern:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_texsize:new c.aP(u,t.u_texsize),u_ratio:new c.aJ(u,t.u_ratio),u_device_pixel_ratio:new c.aJ(u,t.u_device_pixel_ratio),u_image:new c.aI(u,t.u_image),u_units_to_pixels:new c.aP(u,t.u_units_to_pixels),u_scale:new c.aO(u,t.u_scale),u_fade:new c.aJ(u,t.u_fade)}),lineSDF:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_ratio:new c.aJ(u,t.u_ratio),u_device_pixel_ratio:new c.aJ(u,t.u_device_pixel_ratio),u_units_to_pixels:new c.aP(u,t.u_units_to_pixels),u_patternscale_a:new c.aP(u,t.u_patternscale_a),u_patternscale_b:new c.aP(u,t.u_patternscale_b),u_sdfgamma:new c.aJ(u,t.u_sdfgamma),u_image:new c.aI(u,t.u_image),u_tex_y_a:new c.aJ(u,t.u_tex_y_a),u_tex_y_b:new c.aJ(u,t.u_tex_y_b),u_mix:new c.aJ(u,t.u_mix)}),raster:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_tl_parent:new c.aP(u,t.u_tl_parent),u_scale_parent:new c.aJ(u,t.u_scale_parent),u_buffer_scale:new c.aJ(u,t.u_buffer_scale),u_fade_t:new c.aJ(u,t.u_fade_t),u_opacity:new c.aJ(u,t.u_opacity),u_image0:new c.aI(u,t.u_image0),u_image1:new c.aI(u,t.u_image1),u_brightness_low:new c.aJ(u,t.u_brightness_low),u_brightness_high:new c.aJ(u,t.u_brightness_high),u_saturation_factor:new c.aJ(u,t.u_saturation_factor),u_contrast_factor:new c.aJ(u,t.u_contrast_factor),u_spin_weights:new c.aO(u,t.u_spin_weights)}),symbolIcon:(u,t)=>({u_is_size_zoom_constant:new c.aI(u,t.u_is_size_zoom_constant),u_is_size_feature_constant:new c.aI(u,t.u_is_size_feature_constant),u_size_t:new c.aJ(u,t.u_size_t),u_size:new c.aJ(u,t.u_size),u_camera_to_center_distance:new c.aJ(u,t.u_camera_to_center_distance),u_pitch:new c.aJ(u,t.u_pitch),u_rotate_symbol:new c.aI(u,t.u_rotate_symbol),u_aspect_ratio:new c.aJ(u,t.u_aspect_ratio),u_fade_change:new c.aJ(u,t.u_fade_change),u_matrix:new c.aK(u,t.u_matrix),u_label_plane_matrix:new c.aK(u,t.u_label_plane_matrix),u_coord_matrix:new c.aK(u,t.u_coord_matrix),u_is_text:new c.aI(u,t.u_is_text),u_pitch_with_map:new c.aI(u,t.u_pitch_with_map),u_is_along_line:new c.aI(u,t.u_is_along_line),u_is_variable_anchor:new c.aI(u,t.u_is_variable_anchor),u_texsize:new c.aP(u,t.u_texsize),u_texture:new c.aI(u,t.u_texture),u_translation:new c.aP(u,t.u_translation),u_pitched_scale:new c.aJ(u,t.u_pitched_scale)}),symbolSDF:(u,t)=>({u_is_size_zoom_constant:new c.aI(u,t.u_is_size_zoom_constant),u_is_size_feature_constant:new c.aI(u,t.u_is_size_feature_constant),u_size_t:new c.aJ(u,t.u_size_t),u_size:new c.aJ(u,t.u_size),u_camera_to_center_distance:new c.aJ(u,t.u_camera_to_center_distance),u_pitch:new c.aJ(u,t.u_pitch),u_rotate_symbol:new c.aI(u,t.u_rotate_symbol),u_aspect_ratio:new c.aJ(u,t.u_aspect_ratio),u_fade_change:new c.aJ(u,t.u_fade_change),u_matrix:new c.aK(u,t.u_matrix),u_label_plane_matrix:new c.aK(u,t.u_label_plane_matrix),u_coord_matrix:new c.aK(u,t.u_coord_matrix),u_is_text:new c.aI(u,t.u_is_text),u_pitch_with_map:new c.aI(u,t.u_pitch_with_map),u_is_along_line:new c.aI(u,t.u_is_along_line),u_is_variable_anchor:new c.aI(u,t.u_is_variable_anchor),u_texsize:new c.aP(u,t.u_texsize),u_texture:new c.aI(u,t.u_texture),u_gamma_scale:new c.aJ(u,t.u_gamma_scale),u_device_pixel_ratio:new c.aJ(u,t.u_device_pixel_ratio),u_is_halo:new c.aI(u,t.u_is_halo),u_translation:new c.aP(u,t.u_translation),u_pitched_scale:new c.aJ(u,t.u_pitched_scale)}),symbolTextAndIcon:(u,t)=>({u_is_size_zoom_constant:new c.aI(u,t.u_is_size_zoom_constant),u_is_size_feature_constant:new c.aI(u,t.u_is_size_feature_constant),u_size_t:new c.aJ(u,t.u_size_t),u_size:new c.aJ(u,t.u_size),u_camera_to_center_distance:new c.aJ(u,t.u_camera_to_center_distance),u_pitch:new c.aJ(u,t.u_pitch),u_rotate_symbol:new c.aI(u,t.u_rotate_symbol),u_aspect_ratio:new c.aJ(u,t.u_aspect_ratio),u_fade_change:new c.aJ(u,t.u_fade_change),u_matrix:new c.aK(u,t.u_matrix),u_label_plane_matrix:new c.aK(u,t.u_label_plane_matrix),u_coord_matrix:new c.aK(u,t.u_coord_matrix),u_is_text:new c.aI(u,t.u_is_text),u_pitch_with_map:new c.aI(u,t.u_pitch_with_map),u_is_along_line:new c.aI(u,t.u_is_along_line),u_is_variable_anchor:new c.aI(u,t.u_is_variable_anchor),u_texsize:new c.aP(u,t.u_texsize),u_texsize_icon:new c.aP(u,t.u_texsize_icon),u_texture:new c.aI(u,t.u_texture),u_texture_icon:new c.aI(u,t.u_texture_icon),u_gamma_scale:new c.aJ(u,t.u_gamma_scale),u_device_pixel_ratio:new c.aJ(u,t.u_device_pixel_ratio),u_is_halo:new c.aI(u,t.u_is_halo),u_translation:new c.aP(u,t.u_translation),u_pitched_scale:new c.aJ(u,t.u_pitched_scale)}),background:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_opacity:new c.aJ(u,t.u_opacity),u_color:new c.aM(u,t.u_color)}),backgroundPattern:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_opacity:new c.aJ(u,t.u_opacity),u_image:new c.aI(u,t.u_image),u_pattern_tl_a:new c.aP(u,t.u_pattern_tl_a),u_pattern_br_a:new c.aP(u,t.u_pattern_br_a),u_pattern_tl_b:new c.aP(u,t.u_pattern_tl_b),u_pattern_br_b:new c.aP(u,t.u_pattern_br_b),u_texsize:new c.aP(u,t.u_texsize),u_mix:new c.aJ(u,t.u_mix),u_pattern_size_a:new c.aP(u,t.u_pattern_size_a),u_pattern_size_b:new c.aP(u,t.u_pattern_size_b),u_scale_a:new c.aJ(u,t.u_scale_a),u_scale_b:new c.aJ(u,t.u_scale_b),u_pixel_coord_upper:new c.aP(u,t.u_pixel_coord_upper),u_pixel_coord_lower:new c.aP(u,t.u_pixel_coord_lower),u_tile_units_to_pixels:new c.aJ(u,t.u_tile_units_to_pixels)}),terrain:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_texture:new c.aI(u,t.u_texture),u_ele_delta:new c.aJ(u,t.u_ele_delta),u_fog_matrix:new c.aK(u,t.u_fog_matrix),u_fog_color:new c.aM(u,t.u_fog_color),u_fog_ground_blend:new c.aJ(u,t.u_fog_ground_blend),u_fog_ground_blend_opacity:new c.aJ(u,t.u_fog_ground_blend_opacity),u_horizon_color:new c.aM(u,t.u_horizon_color),u_horizon_fog_blend:new c.aJ(u,t.u_horizon_fog_blend)}),terrainDepth:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_ele_delta:new c.aJ(u,t.u_ele_delta)}),terrainCoords:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_texture:new c.aI(u,t.u_texture),u_terrain_coords_id:new c.aJ(u,t.u_terrain_coords_id),u_ele_delta:new c.aJ(u,t.u_ele_delta)}),sky:(u,t)=>({u_sky_color:new c.aM(u,t.u_sky_color),u_horizon_color:new c.aM(u,t.u_horizon_color),u_horizon:new c.aJ(u,t.u_horizon),u_sky_horizon_blend:new c.aJ(u,t.u_sky_horizon_blend)})};class Zo{constructor(t,n,o){this.context=t;const a=t.gl;this.buffer=a.createBuffer(),this.dynamicDraw=!!o,this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),a.bufferData(a.ELEMENT_ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?a.DYNAMIC_DRAW:a.STATIC_DRAW),this.dynamicDraw||delete n.arrayBuffer}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 Go={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class _r{constructor(t,n,o,a){this.length=n.length,this.attributes=o,this.itemSize=n.bytesPerElement,this.dynamicDraw=a,this.context=t;const h=t.gl;this.buffer=h.createBuffer(),t.bindVertexBuffer.set(this.buffer),h.bufferData(h.ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?h.DYNAMIC_DRAW:h.STATIC_DRAW),this.dynamicDraw||delete n.arrayBuffer}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(let o=0;o<this.attributes.length;o++){const a=n.attributes[this.attributes[o].name];a!==void 0&&t.enableVertexAttribArray(a)}}setVertexAttribPointers(t,n,o){for(let a=0;a<this.attributes.length;a++){const h=this.attributes[a],m=n.attributes[h.name];m!==void 0&&t.vertexAttribPointer(m,h.components,t[Go[h.type]],!1,this.itemSize,h.offset+this.itemSize*(o||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Ho=new WeakMap;function Dn(u){var t;if(Ho.has(u))return Ho.get(u);{const n=(t=u.getParameter(u.VERSION))===null||t===void 0?void 0:t.startsWith("WebGL 2.0");return Ho.set(u,n),n}}class ut{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 gs extends ut{getDefault(){return c.aN.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 $c extends ut{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class Ys extends ut{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class qc extends ut{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 Ln extends ut{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class Zc extends ut{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class xl extends ut{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 Gc extends ut{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 vl extends ut{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 Xo extends ut{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 bl extends ut{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 wl extends ut{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class Sl extends ut{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 Tl extends ut{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 dn extends ut{getDefault(){return c.aN.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 Il extends ut{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}}class Hc extends ut{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 Xc extends ut{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class Pl extends ut{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}class _s extends ut{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}}class Wc extends ut{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class Qs extends ut{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 Jc extends ut{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 Kc extends ut{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 kl extends ut{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 Al extends ut{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 Cl extends ut{getDefault(){return null}set(t){const n=this.gl;n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Wo extends ut{getDefault(){return null}set(t){var n;if(t===this.current&&!this.dirty)return;const o=this.gl;Dn(o)?o.bindVertexArray(t):(n=o.getExtension("OES_vertex_array_object"))===null||n===void 0||n.bindVertexArrayOES(t),this.current=t,this.dirty=!1}}class El extends ut{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 eo extends ut{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 zr extends ut{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 ys extends ut{constructor(t,n){super(t),this.context=t,this.parent=n}getDefault(){return null}}class Jo extends ys{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 Ko extends ys{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 Ml extends ys{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}}class Yo{constructor(t,n,o,a,h){this.context=t,this.width=n,this.height=o;const m=t.gl,y=this.framebuffer=m.createFramebuffer();if(this.colorAttachment=new Jo(t,y),a)this.depthAttachment=h?new Ml(t,y):new Ko(t,y);else if(h)throw new Error("Stencil cannot be set without depth");if(m.checkFramebufferStatus(m.FRAMEBUFFER)!==m.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer is not complete")}destroy(){const t=this.context.gl,n=this.colorAttachment.get();if(n&&t.deleteTexture(n),this.depthAttachment){const o=this.depthAttachment.get();o&&t.deleteRenderbuffer(o)}t.deleteFramebuffer(this.framebuffer)}}class At{constructor(t,n,o){this.blendFunction=t,this.blendColor=n,this.mask=o}}At.Replace=[1,0],At.disabled=new At(At.Replace,c.aN.transparent,[!1,!1,!1,!1]),At.unblended=new At(At.Replace,c.aN.transparent,[!0,!0,!0,!0]),At.alphaBlended=new At([1,771],c.aN.transparent,[!0,!0,!0,!0]);class Qo{constructor(t){var n,o;if(this.gl=t,this.clearColor=new gs(this),this.clearDepth=new $c(this),this.clearStencil=new Ys(this),this.colorMask=new qc(this),this.depthMask=new Ln(this),this.stencilMask=new Zc(this),this.stencilFunc=new xl(this),this.stencilOp=new Gc(this),this.stencilTest=new vl(this),this.depthRange=new Xo(this),this.depthTest=new bl(this),this.depthFunc=new wl(this),this.blend=new Sl(this),this.blendFunc=new Tl(this),this.blendColor=new dn(this),this.blendEquation=new Il(this),this.cullFace=new Hc(this),this.cullFaceSide=new Xc(this),this.frontFace=new Pl(this),this.program=new _s(this),this.activeTexture=new Wc(this),this.viewport=new Qs(this),this.bindFramebuffer=new Jc(this),this.bindRenderbuffer=new Kc(this),this.bindTexture=new kl(this),this.bindVertexBuffer=new Al(this),this.bindElementBuffer=new Cl(this),this.bindVertexArray=new Wo(this),this.pixelStoreUnpack=new El(this),this.pixelStoreUnpackPremultiplyAlpha=new eo(this),this.pixelStoreUnpackFlipY=new zr(this),this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_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),Dn(t)){this.HALF_FLOAT=t.HALF_FLOAT;const a=t.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(n=t.RGBA16F)!==null&&n!==void 0?n:a==null?void 0:a.RGBA16F_EXT,this.RGB16F=(o=t.RGB16F)!==null&&o!==void 0?o:a==null?void 0:a.RGB16F_EXT,t.getExtension("EXT_color_buffer_float")}else{t.getExtension("EXT_color_buffer_half_float"),t.getExtension("OES_texture_half_float_linear");const a=t.getExtension("OES_texture_half_float");this.HALF_FLOAT=a==null?void 0:a.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 Zo(this,t,n)}createVertexBuffer(t,n,o){return new _r(this,t,n,o)}createRenderbuffer(t,n,o){const a=this.gl,h=a.createRenderbuffer();return this.bindRenderbuffer.set(h),a.renderbufferStorage(a.RENDERBUFFER,t,n,o),this.bindRenderbuffer.set(null),h}createFramebuffer(t,n,o,a){return new Yo(this,t,n,o,a)}clear({color:t,depth:n,stencil:o}){const a=this.gl;let h=0;t&&(h|=a.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),n!==void 0&&(h|=a.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(n),this.depthMask.set(!0)),o!==void 0&&(h|=a.STENCIL_BUFFER_BIT,this.clearStencil.set(o),this.stencilMask.set(255)),a.clear(h)}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){c.aF(t.blendFunction,At.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 Dn(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;return Dn(this.gl)?this.gl.deleteVertexArray(t):(n=this.gl.getExtension("OES_vertex_array_object"))===null||n===void 0?void 0:n.deleteVertexArrayOES(t)}unbindVAO(){this.bindVertexArray.set(null)}}class ct{constructor(t,n,o){this.func=t,this.mask=n,this.range=o}}ct.ReadOnly=!1,ct.ReadWrite=!0,ct.disabled=new ct(519,ct.ReadOnly,[0,1]);const ea=7680;class Vt{constructor(t,n,o,a,h,m){this.test=t,this.ref=n,this.mask=o,this.fail=a,this.depthFail=h,this.pass=m}}Vt.disabled=new Vt({func:519,mask:0},0,0,ea,ea,ea);class zt{constructor(t,n,o){this.enable=t,this.mode=n,this.frontFace=o}}let xs;function zl(u,t,n,o,a){const h=u.context,m=h.gl,y=u.useProgram("collisionBox"),v=[];let b=0,P=0;for(let H=0;H<o.length;H++){const Y=o[H],U=t.getTile(Y).getBucket(n);if(!U)continue;const te=a?U.textCollisionBox:U.iconCollisionBox,se=U.collisionCircleArray;if(se.length>0){const ce=c.H();c.aR(ce,U.placementInvProjMatrix,u.transform.glCoordMatrix),c.aR(ce,ce,U.placementViewportMatrix),v.push({circleArray:se,circleOffset:P,transform:Y.posMatrix,invTransform:ce,coord:Y}),b+=se.length/4,P=b}te&&y.draw(h,m.LINES,ct.disabled,Vt.disabled,u.colorModeForRenderPass(),zt.disabled,{u_matrix:Y.posMatrix,u_pixel_extrude_scale:[1/(k=u.transform).width,1/k.height]},u.style.map.terrain&&u.style.map.terrain.getTerrainData(Y),n.id,te.layoutVertexBuffer,te.indexBuffer,te.segments,null,u.transform.zoom,null,null,te.collisionVertexBuffer)}var k;if(!a||!v.length)return;const L=u.useProgram("collisionCircle"),B=new c.aS;B.resize(4*b),B._trim();let N=0;for(const H of v)for(let Y=0;Y<H.circleArray.length/4;Y++){const U=4*Y,te=H.circleArray[U+0],se=H.circleArray[U+1],ce=H.circleArray[U+2],ge=H.circleArray[U+3];B.emplace(N++,te,se,ce,ge,0),B.emplace(N++,te,se,ce,ge,1),B.emplace(N++,te,se,ce,ge,2),B.emplace(N++,te,se,ce,ge,3)}(!xs||xs.length<2*b)&&(xs=function(H){const Y=2*H,U=new c.aU;U.resize(Y),U._trim();for(let te=0;te<Y;te++){const se=6*te;U.uint16[se+0]=4*te+0,U.uint16[se+1]=4*te+1,U.uint16[se+2]=4*te+2,U.uint16[se+3]=4*te+2,U.uint16[se+4]=4*te+3,U.uint16[se+5]=4*te+0}return U}(b));const Z=h.createIndexBuffer(xs,!0),j=h.createVertexBuffer(B,c.aT.members,!0);for(const H of v){const Y=Vc(H.transform,H.invTransform,u.transform);L.draw(h,m.TRIANGLES,ct.disabled,Vt.disabled,u.colorModeForRenderPass(),zt.disabled,Y,u.style.map.terrain&&u.style.map.terrain.getTerrainData(H.coord),n.id,j,Z,c.a0.simpleSegment(0,2*H.circleOffset,H.circleArray.length,H.circleArray.length/2),null,u.transform.zoom,null,null,null)}j.destroy(),Z.destroy()}zt.disabled=new zt(!1,1029,2305),zt.backCCW=new zt(!0,1029,2305);const ta=c.ao(new Float32Array(16));function to(u,t,n,o,a,h){const{horizontalAlign:m,verticalAlign:y}=c.av(u);return new c.P((-(m-.5)*t/a+o[0])*h,(-(y-.5)*n/a+o[1])*h)}function io(u,t,n,o,a,h){const m=t.tileAnchorPoint.add(new c.P(t.translation[0],t.translation[1]));if(t.pitchWithMap){let y=o.mult(h);return n||(y=y.rotate(-a)),G(m.add(y),t.labelPlaneMatrix,t.getElevation).point}if(n){const y=pe(t.tileAnchorPoint.x+1,t.tileAnchorPoint.y,t).point.sub(u),v=Math.atan(y.y/y.x)+(y.x<0?Math.PI:0);return u.add(o.rotate(v))}return u.add(o)}function ro(u,t,n,o,a,h,m,y,v,b,P,k,L,B){const N=u.text.placedSymbolArray,Z=u.text.dynamicLayoutVertexArray,j=u.icon.dynamicLayoutVertexArray,H={};Z.clear();for(let Y=0;Y<N.length;Y++){const U=N.get(Y),te=U.hidden||!U.crossTileID||u.allowVerticalPlacement&&!U.placedOrientation?null:o[U.crossTileID];if(te){const se=new c.P(U.anchorX,U.anchorY),ce={getElevation:B,width:a.width,height:a.height,labelPlaneMatrix:h,lineVertexArray:null,pitchWithMap:n,projection:P,projectionCache:null,tileAnchorPoint:se,translation:k,unwrappedTileID:L},ge=n?G(se,m,B):pe(se.x,se.y,ce),we=z(a.cameraToCenterDistance,ge.signedDistanceFromCamera);let Le=c.aj(u.textSizeData,v,U)*we/c.aq;n&&(Le*=u.tilePixelRatio/y);const{width:Be,height:Se,anchor:Te,textOffset:Ne,textBoxScale:et}=te,ke=to(Te,Be,Se,Ne,et,Le),Me=P.getPitchedTextCorrection(a,se.add(new c.P(k[0],k[1])),L),Ye=io(ge.point,ce,t,ke,a.angle,Me),Lt=u.allowVerticalPlacement&&U.placedOrientation===c.ai.vertical?Math.PI/2:0;for(let st=0;st<U.numGlyphs;st++)c.ak(Z,Ye,Lt);b&&U.associatedIconIndex>=0&&(H[U.associatedIconIndex]={shiftedAnchor:Ye,angle:Lt})}else Xe(U.numGlyphs,Z)}if(b){j.clear();const Y=u.icon.placedSymbolArray;for(let U=0;U<Y.length;U++){const te=Y.get(U);if(te.hidden)Xe(te.numGlyphs,j);else{const se=H[U];if(se)for(let ce=0;ce<te.numGlyphs;ce++)c.ak(j,se.shiftedAnchor,se.angle);else Xe(te.numGlyphs,j)}}u.icon.dynamicLayoutVertexBuffer.updateData(j)}u.text.dynamicLayoutVertexBuffer.updateData(Z)}function ia(u,t,n){return n.iconsInText&&t?"symbolTextAndIcon":u?"symbolSDF":"symbolIcon"}function Jr(u,t,n,o,a,h,m,y,v,b,P,k){const L=u.context,B=L.gl,N=u.transform,Z=js(),j=y==="map",H=v==="map",Y=y!=="viewport"&&n.layout.get("symbol-placement")!=="point",U=j&&!H&&!Y,te=!H&&Y,se=!n.layout.get("symbol-sort-key").isConstant();let ce=!1;const ge=u.depthModeForSublayer(0,ct.ReadOnly),we=n._unevaluatedLayout.hasValue("text-variable-anchor")||n._unevaluatedLayout.hasValue("text-variable-anchor-offset"),Le=[],Be=Z.getCircleRadiusCorrection(N);for(const Se of o){const Te=t.getTile(Se),Ne=Te.getBucket(n);if(!Ne)continue;const et=a?Ne.text:Ne.icon;if(!et||!et.segments.get().length||!et.hasVisibleVertices)continue;const ke=et.programConfigurations.get(n.id),Me=a||Ne.sdfIcons,Ye=a?Ne.textSizeData:Ne.iconSizeData,Lt=H||N.pitch!==0,st=u.useProgram(ia(Me,a,Ne),ke),ht=c.ah(Ye,N.zoom),Rt=u.style.map.terrain&&u.style.map.terrain.getTerrainData(Se);let di,rr,Bt,Mi,Ii=[0,0],pi=null;if(a)rr=Te.glyphAtlasTexture,Bt=B.LINEAR,di=Te.glyphAtlasTexture.size,Ne.iconsInText&&(Ii=Te.imageAtlasTexture.size,pi=Te.imageAtlasTexture,Mi=Lt||u.options.rotating||u.options.zooming||Ye.kind==="composite"||Ye.kind==="camera"?B.LINEAR:B.NEAREST);else{const Nt=n.layout.get("icon-size").constantOr(0)!==1||Ne.iconsNeedLinear;rr=Te.imageAtlasTexture,Bt=Me||u.options.rotating||u.options.zooming||Nt||Lt?B.LINEAR:B.NEAREST,di=Te.imageAtlasTexture.size}const fi=rt(Te,1,u.transform.zoom),nr=te?Se.posMatrix:ta,vn=Gr(nr,H,j,u.transform,fi),xo=gr(nr,H,j,u.transform,fi),$n=gr(Se.posMatrix,H,j,u.transform,fi),bn=Z.translatePosition(u.transform,Te,h,m),vo=we&&Ne.hasTextData(),Da=n.layout.get("icon-text-fit")!=="none"&&vo&&Ne.hasIconData();if(Y){const Nt=u.style.map.terrain?(La,ti)=>u.style.map.terrain.getElevation(Se,La,ti):null,Zn=n.layout.get("text-rotation-alignment")==="map";O(Ne,Se.posMatrix,u,a,vn,$n,H,b,Zn,Z,Se.toUnwrapped(),N.width,N.height,bn,Nt)}const oi=Se.posMatrix,sr=a&&we||Da,Qr=Y||sr?ta:vn,qn=xo,mi=Me&&n.paint.get(a?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let gi;gi=Me?Ne.iconsInText?jc(Ye.kind,ht,U,H,Y,sr,u,oi,Qr,qn,bn,di,Ii,Be):yl(Ye.kind,ht,U,H,Y,sr,u,oi,Qr,qn,bn,a,di,!0,Be):_l(Ye.kind,ht,U,H,Y,sr,u,oi,Qr,qn,bn,a,di,Be);const ri={program:st,buffers:et,uniformValues:gi,atlasTexture:rr,atlasTextureIcon:pi,atlasInterpolation:Bt,atlasInterpolationIcon:Mi,isSDF:Me,hasHalo:mi};if(se&&Ne.canOverlap){ce=!0;const Nt=et.segments.get();for(const Zn of Nt)Le.push({segments:new c.a0([Zn]),sortKey:Zn.sortKey,state:ri,terrainData:Rt})}else Le.push({segments:et.segments,sortKey:0,state:ri,terrainData:Rt})}ce&&Le.sort((Se,Te)=>Se.sortKey-Te.sortKey);for(const Se of Le){const Te=Se.state;if(L.activeTexture.set(B.TEXTURE0),Te.atlasTexture.bind(Te.atlasInterpolation,B.CLAMP_TO_EDGE),Te.atlasTextureIcon&&(L.activeTexture.set(B.TEXTURE1),Te.atlasTextureIcon&&Te.atlasTextureIcon.bind(Te.atlasInterpolationIcon,B.CLAMP_TO_EDGE)),Te.isSDF){const Ne=Te.uniformValues;Te.hasHalo&&(Ne.u_is_halo=1,pn(Te.buffers,Se.segments,n,u,Te.program,ge,P,k,Ne,Se.terrainData)),Ne.u_is_halo=0}pn(Te.buffers,Se.segments,n,u,Te.program,ge,P,k,Te.uniformValues,Se.terrainData)}}function pn(u,t,n,o,a,h,m,y,v,b){const P=o.context;a.draw(P,P.gl.TRIANGLES,h,m,y,zt.disabled,v,b,n.id,u.layoutVertexBuffer,u.indexBuffer,t,n.paint,o.transform.zoom,u.programConfigurations.get(n.id),u.dynamicLayoutVertexBuffer,u.opacityVertexBuffer)}function $i(u,t,n,o,a){if(!n||!o||!o.imageAtlas)return;const h=o.imageAtlas.patternPositions;let m=h[n.to.toString()],y=h[n.from.toString()];if(!m&&y&&(m=y),!y&&m&&(y=m),!m||!y){const v=a.getPaintProperty(t);m=h[v],y=h[v]}m&&y&&u.setConstantPatternPositions(m,y)}function ra(u,t,n,o,a,h,m){const y=u.context.gl,v="fill-pattern",b=n.paint.get(v),P=b&&b.constantOr(1),k=n.getCrossfadeParameters();let L,B,N,Z,j;m?(B=P&&!n.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",L=y.LINES):(B=P?"fillPattern":"fill",L=y.TRIANGLES);const H=b.constantOr(null);for(const Y of o){const U=t.getTile(Y);if(P&&!U.patternsLoaded())continue;const te=U.getBucket(n);if(!te)continue;const se=te.programConfigurations.get(n.id),ce=u.useProgram(B,se),ge=u.style.map.terrain&&u.style.map.terrain.getTerrainData(Y);P&&(u.context.activeTexture.set(y.TEXTURE0),U.imageAtlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE),se.updatePaintBuffers(k)),$i(se,v,H,U,n);const we=ge?Y:null,Le=u.translatePosMatrix(we?we.posMatrix:Y.posMatrix,U,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));if(m){Z=te.indexBuffer2,j=te.segments2;const Be=[y.drawingBufferWidth,y.drawingBufferHeight];N=B==="fillOutlinePattern"&&P?Oc(Le,u,k,U,Be):Fc(Le,Be)}else Z=te.indexBuffer,j=te.segments,N=P?zn(Le,u,k,U):ps(Le);ce.draw(u.context,L,a,u.stencilModeForClipping(Y),h,zt.disabled,N,ge,n.id,te.layoutVertexBuffer,Z,j,n.paint,u.transform.zoom,se)}}function no(u,t,n,o,a,h,m){const y=u.context,v=y.gl,b="fill-extrusion-pattern",P=n.paint.get(b),k=P.constantOr(1),L=n.getCrossfadeParameters(),B=n.paint.get("fill-extrusion-opacity"),N=P.constantOr(null);for(const Z of o){const j=t.getTile(Z),H=j.getBucket(n);if(!H)continue;const Y=u.style.map.terrain&&u.style.map.terrain.getTerrainData(Z),U=H.programConfigurations.get(n.id),te=u.useProgram(k?"fillExtrusionPattern":"fillExtrusion",U);k&&(u.context.activeTexture.set(v.TEXTURE0),j.imageAtlasTexture.bind(v.LINEAR,v.CLAMP_TO_EDGE),U.updatePaintBuffers(L)),$i(U,b,N,j,n);const se=u.translatePosMatrix(Z.posMatrix,j,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),ce=n.paint.get("fill-extrusion-vertical-gradient"),ge=k?Xs(se,u,ce,B,Z,L,j):Hs(se,u,ce,B);te.draw(y,y.gl.TRIANGLES,a,h,m,zt.backCCW,ge,Y,n.id,H.layoutVertexBuffer,H.indexBuffer,H.segments,n.paint,u.transform.zoom,U,u.style.map.terrain&&H.centroidVertexBuffer)}}function na(u,t,n,o,a,h,m){const y=u.context,v=y.gl,b=n.fbo;if(!b)return;const P=u.useProgram("hillshade"),k=u.style.map.terrain&&u.style.map.terrain.getTerrainData(t);y.activeTexture.set(v.TEXTURE0),v.bindTexture(v.TEXTURE_2D,b.colorAttachment.get()),P.draw(y,v.TRIANGLES,a,h,m,zt.disabled,((L,B,N,Z)=>{const j=N.paint.get("hillshade-shadow-color"),H=N.paint.get("hillshade-highlight-color"),Y=N.paint.get("hillshade-accent-color");let U=N.paint.get("hillshade-illumination-direction")*(Math.PI/180);N.paint.get("hillshade-illumination-anchor")==="viewport"&&(U-=L.transform.angle);const te=!L.options.moving;return{u_matrix:Z?Z.posMatrix:L.transform.calculatePosMatrix(B.tileID.toUnwrapped(),te),u_image:0,u_latrange:ji(0,B.tileID),u_light:[N.paint.get("hillshade-exaggeration"),U],u_shadow:j,u_highlight:H,u_accent:Y}})(u,n,o,k?t:null),k,o.id,u.rasterBoundsBuffer,u.quadTriangleIndexBuffer,u.rasterBoundsSegments)}function fn(u,t,n,o,a,h){const m=u.context,y=m.gl,v=t.dem;if(v&&v.data){const b=v.dim,P=v.stride,k=v.getPixels();if(m.activeTexture.set(y.TEXTURE1),m.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||u.getTileTexture(P),t.demTexture){const B=t.demTexture;B.update(k,{premultiply:!1}),B.bind(y.NEAREST,y.CLAMP_TO_EDGE)}else t.demTexture=new bt(m,k,y.RGBA,{premultiply:!1}),t.demTexture.bind(y.NEAREST,y.CLAMP_TO_EDGE);m.activeTexture.set(y.TEXTURE0);let L=t.fbo;if(!L){const B=new bt(m,{width:b,height:b,data:null},y.RGBA);B.bind(y.LINEAR,y.CLAMP_TO_EDGE),L=t.fbo=m.createFramebuffer(b,b,!0,!1),L.colorAttachment.set(B.texture)}m.bindFramebuffer.set(L.framebuffer),m.viewport.set([0,0,b,b]),u.useProgram("hillshadePrepare").draw(m,y.TRIANGLES,o,a,h,zt.disabled,((B,N)=>{const Z=N.stride,j=c.H();return c.aQ(j,0,c.X,-c.X,0,0,1),c.J(j,j,[0,-c.X,0]),{u_matrix:j,u_image:1,u_dimension:[Z,Z],u_zoom:B.overscaledZ,u_unpack:N.getUnpackVector()}})(t.tileID,v),null,n.id,u.rasterBoundsBuffer,u.quadTriangleIndexBuffer,u.rasterBoundsSegments),t.needsHillshadePrepare=!1}}function so(u,t,n,o,a,h){const m=o.paint.get("raster-fade-duration");if(!h&&m>0){const y=le.now(),v=(y-u.timeAdded)/m,b=t?(y-t.timeAdded)/m:-1,P=n.getSource(),k=a.coveringZoomLevel({tileSize:P.tileSize,roundZoom:P.roundZoom}),L=!t||Math.abs(t.tileID.overscaledZ-k)>Math.abs(u.tileID.overscaledZ-k),B=L&&u.refreshedUponExpiration?1:c.ad(L?v:1-b,0,1);return u.refreshedUponExpiration&&v>=1&&(u.refreshedUponExpiration=!1),t?{opacity:1,mix:1-B}:{opacity:B,mix:0}}return{opacity:1,mix:0}}const oo=new c.aN(1,0,0,1),vs=new c.aN(0,1,0,1),ao=new c.aN(0,0,1,1),Dl=new c.aN(1,0,1,1),Rn=new c.aN(0,1,1,1);function mn(u,t,n,o){Bn(u,0,t+n/2,u.transform.width,n,o)}function sa(u,t,n,o){Bn(u,t-n/2,0,n,u.transform.height,o)}function Bn(u,t,n,o,a,h){const m=u.context,y=m.gl;y.enable(y.SCISSOR_TEST),y.scissor(t*u.pixelRatio,n*u.pixelRatio,o*u.pixelRatio,a*u.pixelRatio),m.clear({color:h}),y.disable(y.SCISSOR_TEST)}function ft(u,t,n){const o=u.context,a=o.gl,h=n.posMatrix,m=u.useProgram("debug"),y=ct.disabled,v=Vt.disabled,b=u.colorModeForRenderPass(),P="$debug",k=u.style.map.terrain&&u.style.map.terrain.getTerrainData(n);o.activeTexture.set(a.TEXTURE0);const L=t.getTileByID(n.key).latestRawTileData,B=Math.floor((L&&L.byteLength||0)/1024),N=t.getTile(n).tileSize,Z=512/Math.min(N,512)*(n.overscaledZ/u.transform.zoom)*.5;let j=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(j+=` => ${n.overscaledZ}`),function(H,Y){H.initDebugOverlayCanvas();const U=H.debugOverlayCanvas,te=H.context.gl,se=H.debugOverlayCanvas.getContext("2d");se.clearRect(0,0,U.width,U.height),se.shadowColor="white",se.shadowBlur=2,se.lineWidth=1.5,se.strokeStyle="white",se.textBaseline="top",se.font="bold 36px Open Sans, sans-serif",se.fillText(Y,5,5),se.strokeText(Y,5,5),H.debugOverlayTexture.update(U),H.debugOverlayTexture.bind(te.LINEAR,te.CLAMP_TO_EDGE)}(u,`${j} ${B}kB`),m.draw(o,a.TRIANGLES,y,v,At.alphaBlended,zt.disabled,Wr(h,c.aN.transparent,Z),null,P,u.debugBuffer,u.quadTriangleIndexBuffer,u.debugSegments),m.draw(o,a.LINE_STRIP,y,v,b,zt.disabled,Wr(h,c.aN.red),k,P,u.debugBuffer,u.tileBorderIndexBuffer,u.debugSegments)}function bs(u,t,n){const o=u.context,a=o.gl,h=u.colorModeForRenderPass(),m=new ct(a.LEQUAL,ct.ReadWrite,u.depthRangeFor3D),y=u.useProgram("terrain"),v=t.getTerrainMesh();o.bindFramebuffer.set(null),o.viewport.set([0,0,u.width,u.height]);for(const b of n){const P=u.renderToTexture.getTexture(b),k=t.getTerrainData(b.tileID);o.activeTexture.set(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,P.texture);const L=u.transform.calculatePosMatrix(b.tileID.toUnwrapped()),B=t.getMeshFrameDelta(u.transform.zoom),N=u.transform.calculateFogMatrix(b.tileID.toUnwrapped()),Z=$o(L,B,N,u.style.sky,u.transform.pitch);y.draw(o,a.TRIANGLES,m,Vt.disabled,h,zt.backCCW,Z,k,"terrain",v.vertexBuffer,v.indexBuffer,v.segments)}}class Ll{constructor(t,n,o){this.vertexBuffer=t,this.indexBuffer=n,this.segments=o}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}class Rl{constructor(t,n){this.context=new Qo(t),this.transform=n,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:c.ao(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Ke.maxUnderzooming+Ke.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Xi}resize(t,n,o){if(this.width=Math.floor(t*o),this.height=Math.floor(n*o),this.pixelRatio=o,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const a of this.style._order)this.style._layers[a].resize()}setup(){const t=this.context,n=new c.aX;n.emplaceBack(0,0),n.emplaceBack(c.X,0),n.emplaceBack(0,c.X),n.emplaceBack(c.X,c.X),this.tileExtentBuffer=t.createVertexBuffer(n,us.members),this.tileExtentSegments=c.a0.simpleSegment(0,0,4,2);const o=new c.aX;o.emplaceBack(0,0),o.emplaceBack(c.X,0),o.emplaceBack(0,c.X),o.emplaceBack(c.X,c.X),this.debugBuffer=t.createVertexBuffer(o,us.members),this.debugSegments=c.a0.simpleSegment(0,0,4,5);const a=new c.$;a.emplaceBack(0,0,0,0),a.emplaceBack(c.X,0,c.X,0),a.emplaceBack(0,c.X,0,c.X),a.emplaceBack(c.X,c.X,c.X,c.X),this.rasterBoundsBuffer=t.createVertexBuffer(a,qr.members),this.rasterBoundsSegments=c.a0.simpleSegment(0,0,4,2);const h=new c.aX;h.emplaceBack(0,0),h.emplaceBack(1,0),h.emplaceBack(0,1),h.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(h,us.members),this.viewportSegments=c.a0.simpleSegment(0,0,4,2);const m=new c.aZ;m.emplaceBack(0),m.emplaceBack(1),m.emplaceBack(3),m.emplaceBack(2),m.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(m);const y=new c.aY;y.emplaceBack(0,1,2),y.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(y);const v=this.context.gl;this.stencilClearMode=new Vt({func:v.ALWAYS,mask:0},0,255,v.ZERO,v.ZERO,v.ZERO)}clearStencil(){const t=this.context,n=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const o=c.H();c.aQ(o,0,this.width,this.height,0,0,1),c.K(o,o,[n.drawingBufferWidth,n.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(t,n.TRIANGLES,ct.disabled,this.stencilClearMode,At.disabled,zt.disabled,fs(o),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,n){if(this.currentStencilSource===t.source||!t.isTileClipped()||!n||!n.length)return;this.currentStencilSource=t.source;const o=this.context,a=o.gl;this.nextStencilID+n.length>256&&this.clearStencil(),o.setColorMode(At.disabled),o.setDepthMode(ct.disabled);const h=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const m of n){const y=this._tileClippingMaskIDs[m.key]=this.nextStencilID++,v=this.style.map.terrain&&this.style.map.terrain.getTerrainData(m);h.draw(o,a.TRIANGLES,ct.disabled,new Vt({func:a.ALWAYS,mask:0},y,255,a.KEEP,a.KEEP,a.REPLACE),At.disabled,zt.disabled,fs(m.posMatrix),v,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,n=this.context.gl;return new Vt({func:n.NOTEQUAL,mask:255},t,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(t){const n=this.context.gl;return new Vt({func:n.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,n.KEEP,n.KEEP,n.REPLACE)}stencilConfigForOverlap(t){const n=this.context.gl,o=t.sort((m,y)=>y.overscaledZ-m.overscaledZ),a=o[o.length-1].overscaledZ,h=o[0].overscaledZ-a+1;if(h>1){this.currentStencilSource=void 0,this.nextStencilID+h>256&&this.clearStencil();const m={};for(let y=0;y<h;y++)m[y+a]=new Vt({func:n.GEQUAL,mask:255},y+this.nextStencilID,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID+=h,[m,o]}return[{[a]:Vt.disabled},o]}colorModeForRenderPass(){const t=this.context.gl;return this._showOverdrawInspector?new At([t.CONSTANT_COLOR,t.ONE],new c.aN(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?At.unblended:At.alphaBlended}depthModeForSublayer(t,n,o){if(!this.opaquePassEnabledForLayer())return ct.disabled;const a=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new ct(o||this.context.gl.LEQUAL,n,[a,a])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(t,n){var o;this.style=t,this.options=n,this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(le.now()),this.imageManager.beginFrame();const a=this.style._order,h=this.style.sourceCaches,m={},y={},v={};for(const b in h){const P=h[b];P.used&&P.prepare(this.context),m[b]=P.getVisibleCoordinates(),y[b]=m[b].slice().reverse(),v[b]=P.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let b=0;b<a.length;b++)if(this.style._layers[a[b]].is3D()){this.opaquePassCutoff=b;break}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const b of a){const P=this.style._layers[b];if(!P.hasOffscreenPass()||P.isHidden(this.transform.zoom))continue;const k=y[P.source];(P.type==="custom"||k.length)&&this.renderLayer(this,h[P.source],P,k)}if(this.context.bindFramebuffer.set(null),this.context.clear({color:n.showOverdrawInspector?c.aN.black:c.aN.transparent,depth:1}),this.clearStencil(),!((o=this.style.stylesheet)===null||o===void 0)&&o.sky&&function(b,P){const k=b.context,L=k.gl,B=((Y,U,te)=>({u_sky_color:Y.properties.get("sky-color"),u_horizon_color:Y.properties.get("horizon-color"),u_horizon:(U.height/2+U.getHorizon())*te,u_sky_horizon_blend:Y.properties.get("sky-horizon-blend")*U.height/2*te}))(P,b.style.map.transform,b.pixelRatio),N=new ct(L.LEQUAL,ct.ReadWrite,[0,1]),Z=Vt.disabled,j=b.colorModeForRenderPass(),H=b.useProgram("sky");if(!P.mesh){const Y=new c.aX;Y.emplaceBack(-1,-1),Y.emplaceBack(1,-1),Y.emplaceBack(1,1),Y.emplaceBack(-1,1);const U=new c.aY;U.emplaceBack(0,1,2),U.emplaceBack(0,2,3),P.mesh=new Ll(k.createVertexBuffer(Y,us.members),k.createIndexBuffer(U),c.a0.simpleSegment(0,0,Y.length,U.length))}H.draw(k,L.TRIANGLES,N,Z,j,zt.disabled,B,void 0,"sky",P.mesh.vertexBuffer,P.mesh.indexBuffer,P.mesh.segments)}(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=a.length-1;this.currentLayer>=0;this.currentLayer--){const b=this.style._layers[a[this.currentLayer]],P=h[b.source],k=m[b.source];this._renderTileClippingMasks(b,k),this.renderLayer(this,P,b,k)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<a.length;this.currentLayer++){const b=this.style._layers[a[this.currentLayer]],P=h[b.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(b))continue;const k=(b.type==="symbol"?v:y)[b.source];this._renderTileClippingMasks(b,m[b.source]),this.renderLayer(this,P,b,k)}if(this.options.showTileBoundaries){const b=function(P,k){let L=null;const B=Object.values(P._layers).flatMap(H=>H.source&&!H.isHidden(k)?[P.sourceCaches[H.source]]:[]),N=B.filter(H=>H.getSource().type==="vector"),Z=B.filter(H=>H.getSource().type!=="vector"),j=H=>{(!L||L.getSource().maxzoom<H.getSource().maxzoom)&&(L=H)};return N.forEach(H=>j(H)),L||Z.forEach(H=>j(H)),L}(this.style,this.transform.zoom);b&&function(P,k,L){for(let B=0;B<L.length;B++)ft(P,k,L[B])}(this,b,b.getVisibleCoordinates())}this.options.showPadding&&function(b){const P=b.transform.padding;mn(b,b.transform.height-(P.top||0),3,oo),mn(b,P.bottom||0,3,vs),sa(b,P.left||0,3,ao),sa(b,b.transform.width-(P.right||0),3,Dl);const k=b.transform.centerPoint;(function(L,B,N,Z){Bn(L,B-1,N-10,2,20,Z),Bn(L,B-10,N-1,20,2,Z)})(b,k.x,b.transform.height-k.y,Rn)}(this),this.context.setDefault()}maybeDrawDepthAndCoords(t){if(!this.style||!this.style.map||!this.style.map.terrain)return;const n=this.terrainFacilitator.matrix,o=this.transform.modelViewProjectionMatrix;let a=this.terrainFacilitator.dirty;a||(a=t?!c.a_(n,o):!c.a$(n,o)),a||(a=this.style.map.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime).length>0),a&&(c.b0(n,o),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(h,m){const y=h.context,v=y.gl,b=At.unblended,P=new ct(v.LEQUAL,ct.ReadWrite,[0,1]),k=m.getTerrainMesh(),L=m.sourceCache.getRenderableTiles(),B=h.useProgram("terrainDepth");y.bindFramebuffer.set(m.getFramebuffer("depth").framebuffer),y.viewport.set([0,0,h.width/devicePixelRatio,h.height/devicePixelRatio]),y.clear({color:c.aN.transparent,depth:1});for(const N of L){const Z=m.getTerrainData(N.tileID),j={u_matrix:h.transform.calculatePosMatrix(N.tileID.toUnwrapped()),u_ele_delta:m.getMeshFrameDelta(h.transform.zoom)};B.draw(y,v.TRIANGLES,P,Vt.disabled,b,zt.backCCW,j,Z,"terrain",k.vertexBuffer,k.indexBuffer,k.segments)}y.bindFramebuffer.set(null),y.viewport.set([0,0,h.width,h.height])}(this,this.style.map.terrain),function(h,m){const y=h.context,v=y.gl,b=At.unblended,P=new ct(v.LEQUAL,ct.ReadWrite,[0,1]),k=m.getTerrainMesh(),L=m.getCoordsTexture(),B=m.sourceCache.getRenderableTiles(),N=h.useProgram("terrainCoords");y.bindFramebuffer.set(m.getFramebuffer("coords").framebuffer),y.viewport.set([0,0,h.width/devicePixelRatio,h.height/devicePixelRatio]),y.clear({color:c.aN.transparent,depth:1}),m.coordsIndex=[];for(const Z of B){const j=m.getTerrainData(Z.tileID);y.activeTexture.set(v.TEXTURE0),v.bindTexture(v.TEXTURE_2D,L.texture);const H={u_matrix:h.transform.calculatePosMatrix(Z.tileID.toUnwrapped()),u_terrain_coords_id:(255-m.coordsIndex.length)/255,u_texture:0,u_ele_delta:m.getMeshFrameDelta(h.transform.zoom)};N.draw(y,v.TRIANGLES,P,Vt.disabled,b,zt.backCCW,H,j,"terrain",k.vertexBuffer,k.indexBuffer,k.segments),m.coordsIndex.push(Z.tileID.key)}y.bindFramebuffer.set(null),y.viewport.set([0,0,h.width,h.height])}(this,this.style.map.terrain))}renderLayer(t,n,o,a){if(!o.isHidden(this.transform.zoom)&&(o.type==="background"||o.type==="custom"||(a||[]).length))switch(this.id=o.id,o.type){case"symbol":(function(h,m,y,v,b){if(h.renderPass!=="translucent")return;const P=Vt.disabled,k=h.colorModeForRenderPass();(y._unevaluatedLayout.hasValue("text-variable-anchor")||y._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(L,B,N,Z,j,H,Y,U,te){const se=B.transform,ce=js(),ge=j==="map",we=H==="map";for(const Le of L){const Be=Z.getTile(Le),Se=Be.getBucket(N);if(!Se||!Se.text||!Se.text.segments.get().length)continue;const Te=c.ah(Se.textSizeData,se.zoom),Ne=rt(Be,1,B.transform.zoom),et=Gr(Le.posMatrix,we,ge,B.transform,Ne),ke=N.layout.get("icon-text-fit")!=="none"&&Se.hasIconData();if(Te){const Me=Math.pow(2,se.zoom-Be.tileID.overscaledZ),Ye=B.style.map.terrain?(st,ht)=>B.style.map.terrain.getElevation(Le,st,ht):null,Lt=ce.translatePosition(se,Be,Y,U);ro(Se,ge,we,te,se,et,Le.posMatrix,Me,Te,ke,ce,Lt,Le.toUnwrapped(),Ye)}}}(v,h,y,m,y.layout.get("text-rotation-alignment"),y.layout.get("text-pitch-alignment"),y.paint.get("text-translate"),y.paint.get("text-translate-anchor"),b),y.paint.get("icon-opacity").constantOr(1)!==0&&Jr(h,m,y,v,!1,y.paint.get("icon-translate"),y.paint.get("icon-translate-anchor"),y.layout.get("icon-rotation-alignment"),y.layout.get("icon-pitch-alignment"),y.layout.get("icon-keep-upright"),P,k),y.paint.get("text-opacity").constantOr(1)!==0&&Jr(h,m,y,v,!0,y.paint.get("text-translate"),y.paint.get("text-translate-anchor"),y.layout.get("text-rotation-alignment"),y.layout.get("text-pitch-alignment"),y.layout.get("text-keep-upright"),P,k),m.map.showCollisionBoxes&&(zl(h,m,y,v,!0),zl(h,m,y,v,!1))})(t,n,o,a,this.style.placement.variableOffsets);break;case"circle":(function(h,m,y,v){if(h.renderPass!=="translucent")return;const b=y.paint.get("circle-opacity"),P=y.paint.get("circle-stroke-width"),k=y.paint.get("circle-stroke-opacity"),L=!y.layout.get("circle-sort-key").isConstant();if(b.constantOr(1)===0&&(P.constantOr(1)===0||k.constantOr(1)===0))return;const B=h.context,N=B.gl,Z=h.depthModeForSublayer(0,ct.ReadOnly),j=Vt.disabled,H=h.colorModeForRenderPass(),Y=[];for(let U=0;U<v.length;U++){const te=v[U],se=m.getTile(te),ce=se.getBucket(y);if(!ce)continue;const ge=ce.programConfigurations.get(y.id),we=h.useProgram("circle",ge),Le=ce.layoutVertexBuffer,Be=ce.indexBuffer,Se=h.style.map.terrain&&h.style.map.terrain.getTerrainData(te),Te={programConfiguration:ge,program:we,layoutVertexBuffer:Le,indexBuffer:Be,uniformValues:pl(h,te,se,y),terrainData:Se};if(L){const Ne=ce.segments.get();for(const et of Ne)Y.push({segments:new c.a0([et]),sortKey:et.sortKey,state:Te})}else Y.push({segments:ce.segments,sortKey:0,state:Te})}L&&Y.sort((U,te)=>U.sortKey-te.sortKey);for(const U of Y){const{programConfiguration:te,program:se,layoutVertexBuffer:ce,indexBuffer:ge,uniformValues:we,terrainData:Le}=U.state;se.draw(B,N.TRIANGLES,Z,j,H,zt.disabled,we,Le,y.id,ce,ge,U.segments,y.paint,h.transform.zoom,te)}})(t,n,o,a);break;case"heatmap":(function(h,m,y,v){if(y.paint.get("heatmap-opacity")!==0)if(h.renderPass==="offscreen"){const b=h.context,P=b.gl,k=Vt.disabled,L=new At([P.ONE,P.ONE],c.aN.transparent,[!0,!0,!0,!0]);(function(B,N,Z){const j=B.gl;B.activeTexture.set(j.TEXTURE1),B.viewport.set([0,0,N.width/4,N.height/4]);let H=Z.heatmapFbo;if(H)j.bindTexture(j.TEXTURE_2D,H.colorAttachment.get()),B.bindFramebuffer.set(H.framebuffer);else{const Y=j.createTexture();j.bindTexture(j.TEXTURE_2D,Y),j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE),j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE),j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MIN_FILTER,j.LINEAR),j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MAG_FILTER,j.LINEAR),H=Z.heatmapFbo=B.createFramebuffer(N.width/4,N.height/4,!1,!1),function(U,te,se,ce){var ge,we;const Le=U.gl,Be=(ge=U.HALF_FLOAT)!==null&&ge!==void 0?ge:Le.UNSIGNED_BYTE,Se=(we=U.RGBA16F)!==null&&we!==void 0?we:Le.RGBA;Le.texImage2D(Le.TEXTURE_2D,0,Se,te.width/4,te.height/4,0,Le.RGBA,Be,null),ce.colorAttachment.set(se)}(B,N,Y,H)}})(b,h,y),b.clear({color:c.aN.transparent});for(let B=0;B<v.length;B++){const N=v[B];if(m.hasRenderableParent(N))continue;const Z=m.getTile(N),j=Z.getBucket(y);if(!j)continue;const H=j.programConfigurations.get(y.id),Y=h.useProgram("heatmap",H),{zoom:U}=h.transform;Y.draw(b,P.TRIANGLES,ct.disabled,k,L,zt.disabled,Ui(N.posMatrix,Z,U,y.paint.get("heatmap-intensity")),null,y.id,j.layoutVertexBuffer,j.indexBuffer,j.segments,y.paint,h.transform.zoom,H)}b.viewport.set([0,0,h.width,h.height])}else h.renderPass==="translucent"&&(h.context.setColorMode(h.colorModeForRenderPass()),function(b,P){const k=b.context,L=k.gl,B=P.heatmapFbo;if(!B)return;k.activeTexture.set(L.TEXTURE0),L.bindTexture(L.TEXTURE_2D,B.colorAttachment.get()),k.activeTexture.set(L.TEXTURE1);let N=P.colorRampTexture;N||(N=P.colorRampTexture=new bt(k,P.colorRamp,L.RGBA)),N.bind(L.LINEAR,L.CLAMP_TO_EDGE),b.useProgram("heatmapTexture").draw(k,L.TRIANGLES,ct.disabled,Vt.disabled,b.colorModeForRenderPass(),zt.disabled,((Z,j,H,Y)=>{const U=c.H();c.aQ(U,0,Z.width,Z.height,0,0,1);const te=Z.context.gl;return{u_matrix:U,u_world:[te.drawingBufferWidth,te.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:j.paint.get("heatmap-opacity")}})(b,P),null,P.id,b.viewportBuffer,b.quadTriangleIndexBuffer,b.viewportSegments,P.paint,b.transform.zoom)}(h,y))})(t,n,o,a);break;case"line":(function(h,m,y,v){if(h.renderPass!=="translucent")return;const b=y.paint.get("line-opacity"),P=y.paint.get("line-width");if(b.constantOr(1)===0||P.constantOr(1)===0)return;const k=h.depthModeForSublayer(0,ct.ReadOnly),L=h.colorModeForRenderPass(),B=y.paint.get("line-dasharray"),N=y.paint.get("line-pattern"),Z=N.constantOr(1),j=y.paint.get("line-gradient"),H=y.getCrossfadeParameters(),Y=Z?"linePattern":B?"lineSDF":j?"lineGradient":"line",U=h.context,te=U.gl;let se=!0;for(const ce of v){const ge=m.getTile(ce);if(Z&&!ge.patternsLoaded())continue;const we=ge.getBucket(y);if(!we)continue;const Le=we.programConfigurations.get(y.id),Be=h.context.program.get(),Se=h.useProgram(Y,Le),Te=se||Se.program!==Be,Ne=h.style.map.terrain&&h.style.map.terrain.getTerrainData(ce),et=N.constantOr(null);if(et&&ge.imageAtlas){const Ye=ge.imageAtlas,Lt=Ye.patternPositions[et.to.toString()],st=Ye.patternPositions[et.from.toString()];Lt&&st&&Le.setConstantPatternPositions(Lt,st)}const ke=Ne?ce:null,Me=Z?fl(h,ge,y,H,ke):B?ml(h,ge,y,B,H,ke):j?Ws(h,ge,y,we.lineClipsArray.length,ke):ms(h,ge,y,ke);if(Z)U.activeTexture.set(te.TEXTURE0),ge.imageAtlasTexture.bind(te.LINEAR,te.CLAMP_TO_EDGE),Le.updatePaintBuffers(H);else if(B&&(Te||h.lineAtlas.dirty))U.activeTexture.set(te.TEXTURE0),h.lineAtlas.bind(U);else if(j){const Ye=we.gradients[y.id];let Lt=Ye.texture;if(y.gradientVersion!==Ye.version){let st=256;if(y.stepInterpolant){const ht=m.getSource().maxzoom,Rt=ce.canonical.z===ht?Math.ceil(1<<h.transform.maxZoom-ce.canonical.z):1;st=c.ad(c.aV(we.maxLineLength/c.X*1024*Rt),256,U.maxTextureSize)}Ye.gradient=c.aW({expression:y.gradientExpression(),evaluationKey:"lineProgress",resolution:st,image:Ye.gradient||void 0,clips:we.lineClipsArray}),Ye.texture?Ye.texture.update(Ye.gradient):Ye.texture=new bt(U,Ye.gradient,te.RGBA),Ye.version=y.gradientVersion,Lt=Ye.texture}U.activeTexture.set(te.TEXTURE0),Lt.bind(y.stepInterpolant?te.NEAREST:te.LINEAR,te.CLAMP_TO_EDGE)}Se.draw(U,te.TRIANGLES,k,h.stencilModeForClipping(ce),L,zt.disabled,Me,Ne,y.id,we.layoutVertexBuffer,we.indexBuffer,we.segments,y.paint,h.transform.zoom,Le,we.layoutVertexBuffer2),se=!1}})(t,n,o,a);break;case"fill":(function(h,m,y,v){const b=y.paint.get("fill-color"),P=y.paint.get("fill-opacity");if(P.constantOr(1)===0)return;const k=h.colorModeForRenderPass(),L=y.paint.get("fill-pattern"),B=h.opaquePassEnabledForLayer()&&!L.constantOr(1)&&b.constantOr(c.aN.transparent).a===1&&P.constantOr(0)===1?"opaque":"translucent";if(h.renderPass===B){const N=h.depthModeForSublayer(1,h.renderPass==="opaque"?ct.ReadWrite:ct.ReadOnly);ra(h,m,y,v,N,k,!1)}if(h.renderPass==="translucent"&&y.paint.get("fill-antialias")){const N=h.depthModeForSublayer(y.getPaintProperty("fill-outline-color")?2:0,ct.ReadOnly);ra(h,m,y,v,N,k,!0)}})(t,n,o,a);break;case"fill-extrusion":(function(h,m,y,v){const b=y.paint.get("fill-extrusion-opacity");if(b!==0&&h.renderPass==="translucent"){const P=new ct(h.context.gl.LEQUAL,ct.ReadWrite,h.depthRangeFor3D);if(b!==1||y.paint.get("fill-extrusion-pattern").constantOr(1))no(h,m,y,v,P,Vt.disabled,At.disabled),no(h,m,y,v,P,h.stencilModeFor3D(),h.colorModeForRenderPass());else{const k=h.colorModeForRenderPass();no(h,m,y,v,P,Vt.disabled,k)}}})(t,n,o,a);break;case"hillshade":(function(h,m,y,v){if(h.renderPass!=="offscreen"&&h.renderPass!=="translucent")return;const b=h.context,P=h.depthModeForSublayer(0,ct.ReadOnly),k=h.colorModeForRenderPass(),[L,B]=h.renderPass==="translucent"?h.stencilConfigForOverlap(v):[{},v];for(const N of B){const Z=m.getTile(N);Z.needsHillshadePrepare!==void 0&&Z.needsHillshadePrepare&&h.renderPass==="offscreen"?fn(h,Z,y,P,Vt.disabled,k):h.renderPass==="translucent"&&na(h,N,Z,y,P,L[N.overscaledZ],k)}b.viewport.set([0,0,h.width,h.height])})(t,n,o,a);break;case"raster":(function(h,m,y,v){if(h.renderPass!=="translucent"||y.paint.get("raster-opacity")===0||!v.length)return;const b=h.context,P=b.gl,k=m.getSource(),L=h.useProgram("raster"),B=h.colorModeForRenderPass(),[N,Z]=k instanceof Cr?[{},v]:h.stencilConfigForOverlap(v),j=Z[Z.length-1].overscaledZ,H=!h.options.moving;for(const Y of Z){const U=h.depthModeForSublayer(Y.overscaledZ-j,y.paint.get("raster-opacity")===1?ct.ReadWrite:ct.ReadOnly,P.LESS),te=m.getTile(Y);te.registerFadeDuration(y.paint.get("raster-fade-duration"));const se=m.findLoadedParent(Y,0),ce=m.findLoadedSibling(Y),ge=so(te,se||ce||null,m,y,h.transform,h.style.map.terrain);let we,Le;const Be=y.paint.get("raster-resampling")==="nearest"?P.NEAREST:P.LINEAR;b.activeTexture.set(P.TEXTURE0),te.texture.bind(Be,P.CLAMP_TO_EDGE,P.LINEAR_MIPMAP_NEAREST),b.activeTexture.set(P.TEXTURE1),se?(se.texture.bind(Be,P.CLAMP_TO_EDGE,P.LINEAR_MIPMAP_NEAREST),we=Math.pow(2,se.tileID.overscaledZ-te.tileID.overscaledZ),Le=[te.tileID.canonical.x*we%1,te.tileID.canonical.y*we%1]):te.texture.bind(Be,P.CLAMP_TO_EDGE,P.LINEAR_MIPMAP_NEAREST),te.texture.useMipmap&&b.extTextureFilterAnisotropic&&h.transform.pitch>20&&P.texParameterf(P.TEXTURE_2D,b.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,b.extTextureFilterAnisotropicMax);const Se=h.style.map.terrain&&h.style.map.terrain.getTerrainData(Y),Te=Se?Y:null,Ne=Te?Te.posMatrix:h.transform.calculatePosMatrix(Y.toUnwrapped(),H),et=Nc(Ne,Le||[0,0],we||1,ge,y);k instanceof Cr?L.draw(b,P.TRIANGLES,U,Vt.disabled,B,zt.disabled,et,Se,y.id,k.boundsBuffer,h.quadTriangleIndexBuffer,k.boundsSegments):L.draw(b,P.TRIANGLES,U,N[Y.overscaledZ],B,zt.disabled,et,Se,y.id,h.rasterBoundsBuffer,h.quadTriangleIndexBuffer,h.rasterBoundsSegments)}})(t,n,o,a);break;case"background":(function(h,m,y,v){const b=y.paint.get("background-color"),P=y.paint.get("background-opacity");if(P===0)return;const k=h.context,L=k.gl,B=h.transform,N=B.tileSize,Z=y.paint.get("background-pattern");if(h.isPatternMissing(Z))return;const j=!Z&&b.a===1&&P===1&&h.opaquePassEnabledForLayer()?"opaque":"translucent";if(h.renderPass!==j)return;const H=Vt.disabled,Y=h.depthModeForSublayer(0,j==="opaque"?ct.ReadWrite:ct.ReadOnly),U=h.colorModeForRenderPass(),te=h.useProgram(Z?"backgroundPattern":"background"),se=v||B.coveringTiles({tileSize:N,terrain:h.style.map.terrain});Z&&(k.activeTexture.set(L.TEXTURE0),h.imageManager.bind(h.context));const ce=y.getCrossfadeParameters();for(const ge of se){const we=v?ge.posMatrix:h.transform.calculatePosMatrix(ge.toUnwrapped()),Le=Z?qo(we,P,h,Z,{tileID:ge,tileSize:N},ce):Js(we,P,b),Be=h.style.map.terrain&&h.style.map.terrain.getTerrainData(ge);te.draw(k,L.TRIANGLES,Y,H,U,zt.disabled,Le,Be,y.id,h.tileExtentBuffer,h.quadTriangleIndexBuffer,h.tileExtentSegments)}})(t,0,o,a);break;case"custom":(function(h,m,y){const v=h.context,b=y.implementation;if(h.renderPass==="offscreen"){const P=b.prerender;P&&(h.setCustomLayerDefaults(),v.setColorMode(h.colorModeForRenderPass()),P.call(b,v.gl,h.transform.customLayerMatrix()),v.setDirty(),h.setBaseState())}else if(h.renderPass==="translucent"){h.setCustomLayerDefaults(),v.setColorMode(h.colorModeForRenderPass()),v.setStencilMode(Vt.disabled);const P=b.renderingMode==="3d"?new ct(h.context.gl.LEQUAL,ct.ReadWrite,h.depthRangeFor3D):h.depthModeForSublayer(0,ct.ReadOnly);v.setDepthMode(P),b.render(v.gl,h.transform.customLayerMatrix(),{farZ:h.transform.farZ,nearZ:h.transform.nearZ,fov:h.transform._fov,modelViewProjectionMatrix:h.transform.modelViewProjectionMatrix,projectionMatrix:h.transform.projectionMatrix}),v.setDirty(),h.setBaseState(),v.bindFramebuffer.set(null)}})(t,0,o)}}translatePosMatrix(t,n,o,a,h){if(!o[0]&&!o[1])return t;const m=h?a==="map"?this.transform.angle:0:a==="viewport"?-this.transform.angle:0;if(m){const b=Math.sin(m),P=Math.cos(m);o=[o[0]*P-o[1]*b,o[0]*b+o[1]*P]}const y=[h?o[0]:rt(n,o[0],this.transform.zoom),h?o[1]:rt(n,o[1],this.transform.zoom),0],v=new Float32Array(16);return c.J(v,t,y),v}saveTileTexture(t){const n=this._tileTextures[t.size[0]];n?n.push(t):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()),o=this.imageManager.getPattern(t.to.toString());return!n||!o}useProgram(t,n){this.cache=this.cache||{};const o=t+(n?n.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[o]||(this.cache[o]=new Zs(this.context,Xr[t],n,Ks[t],this._showOverdrawInspector,this.style.map.terrain)),this.cache[o]}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 bt(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:t,drawingBufferHeight:n}=this.context.gl;return this.width!==t||this.height!==n}}class gn{constructor(t,n){this.points=t,this.planes=n}static fromInvProjectionMatrix(t,n,o){const a=Math.pow(2,o),h=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(y=>{const v=1/(y=c.ag([],y,t))[3]/n*a;return c.b1(y,y,[v,v,1/y[3],v])}),m=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(y=>{const v=function(L,B){var N=B[0],Z=B[1],j=B[2],H=N*N+Z*Z+j*j;return H>0&&(H=1/Math.sqrt(H)),L[0]=B[0]*H,L[1]=B[1]*H,L[2]=B[2]*H,L}([],function(L,B,N){var Z=B[0],j=B[1],H=B[2],Y=N[0],U=N[1],te=N[2];return L[0]=j*te-H*U,L[1]=H*Y-Z*te,L[2]=Z*U-j*Y,L}([],jt([],h[y[0]],h[y[1]]),jt([],h[y[2]],h[y[1]]))),b=-((P=v)[0]*(k=h[y[1]])[0]+P[1]*k[1]+P[2]*k[2]);var P,k;return v.concat(b)});return new gn(h,m)}}class lo{constructor(t,n){this.min=t,this.max=n,this.center=function(o,a,h){return o[0]=.5*a[0],o[1]=.5*a[1],o[2]=.5*a[2],o}([],function(o,a,h){return o[0]=a[0]+h[0],o[1]=a[1]+h[1],o[2]=a[2]+h[2],o}([],this.min,this.max))}quadrant(t){const n=[t%2==0,t<2],o=Tt(this.min),a=Tt(this.max);for(let h=0;h<n.length;h++)o[h]=n[h]?this.min[h]:this.center[h],a[h]=n[h]?this.center[h]:this.max[h];return a[2]=this.max[2],new lo(o,a)}distanceX(t){return Math.max(Math.min(this.max[0],t[0]),this.min[0])-t[0]}distanceY(t){return Math.max(Math.min(this.max[1],t[1]),this.min[1])-t[1]}intersects(t){const n=[[this.min[0],this.min[1],this.min[2],1],[this.max[0],this.min[1],this.min[2],1],[this.max[0],this.max[1],this.min[2],1],[this.min[0],this.max[1],this.min[2],1],[this.min[0],this.min[1],this.max[2],1],[this.max[0],this.min[1],this.max[2],1],[this.max[0],this.max[1],this.max[2],1],[this.min[0],this.max[1],this.max[2],1]];let o=!0;for(let a=0;a<t.planes.length;a++){const h=t.planes[a];let m=0;for(let y=0;y<n.length;y++)c.b2(h,n[y])>=0&&m++;if(m===0)return 0;m!==n.length&&(o=!1)}if(o)return 2;for(let a=0;a<3;a++){let h=Number.MAX_VALUE,m=-Number.MAX_VALUE;for(let y=0;y<t.points.length;y++){const v=t.points[y][a]-this.min[a];h=Math.min(h,v),m=Math.max(m,v)}if(m<0||h>this.max[a]-this.min[a])return 0}return 1}}class co{constructor(t=0,n=0,o=0,a=0){if(isNaN(t)||t<0||isNaN(n)||n<0||isNaN(o)||o<0||isNaN(a)||a<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=n,this.left=o,this.right=a}interpolate(t,n,o){return n.top!=null&&t.top!=null&&(this.top=c.z.number(t.top,n.top,o)),n.bottom!=null&&t.bottom!=null&&(this.bottom=c.z.number(t.bottom,n.bottom,o)),n.left!=null&&t.left!=null&&(this.left=c.z.number(t.left,n.left,o)),n.right!=null&&t.right!=null&&(this.right=c.z.number(t.right,n.right,o)),this}getCenter(t,n){const o=c.ad((this.left+t-this.right)/2,0,t),a=c.ad((this.top+n-this.bottom)/2,0,n);return new c.P(o,a)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new co(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const oa=85.051129;class aa{constructor(t,n,o,a,h){this.tileSize=512,this._renderWorldCopies=h===void 0||!!h,this._minZoom=t||0,this._maxZoom=n||22,this._minPitch=o??0,this._maxPitch=a??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new c.N(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new co,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={},this.minElevationForCurrentTile=0}clone(){const t=new aa(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t.apply(this),t}apply(t){this.tileSize=t.tileSize,this.latRange=t.latRange,this.width=t.width,this.height=t.height,this._center=t._center,this._elevation=t._elevation,this.minElevationForCurrentTile=t.minElevationForCurrentTile,this.zoom=t.zoom,this.angle=t.angle,this._fov=t._fov,this._pitch=t._pitch,this._unmodified=t._unmodified,this._edgeInsets=t._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))}get maxZoom(){return this._maxZoom}set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))}get minPitch(){return this._minPitch}set minPitch(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))}get maxPitch(){return this._maxPitch}set maxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(t){t===void 0?t=!0:t===null&&(t=!1),this._renderWorldCopies=t}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new c.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(t){const n=-c.b3(t,-180,180)*Math.PI/180;this.angle!==n&&(this._unmodified=!1,this.angle=n,this._calcMatrices(),this.rotationMatrix=function(){var o=new c.A(4);return c.A!=Float32Array&&(o[1]=0,o[2]=0),o[0]=1,o[3]=1,o}(),function(o,a,h){var m=a[0],y=a[1],v=a[2],b=a[3],P=Math.sin(h),k=Math.cos(h);o[0]=m*k+v*P,o[1]=y*k+b*P,o[2]=m*-P+v*k,o[3]=y*-P+b*k}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const n=c.ad(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==n&&(this._unmodified=!1,this._pitch=n,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(t){const n=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==n&&(this._unmodified=!1,this._zoom=n,this.tileZoom=Math.max(0,Math.floor(n)),this.scale=this.zoomScale(n),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(t){t!==this._elevation&&(this._elevation=t,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,n,o){this._unmodified=!1,this._edgeInsets.interpolate(t,n,o),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){const n=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,n)}getVisibleUnwrappedCoordinates(t){const n=[new c.b4(0,t)];if(this._renderWorldCopies){const o=this.pointCoordinate(new c.P(0,0)),a=this.pointCoordinate(new c.P(this.width,0)),h=this.pointCoordinate(new c.P(this.width,this.height)),m=this.pointCoordinate(new c.P(0,this.height)),y=Math.floor(Math.min(o.x,a.x,h.x,m.x)),v=Math.floor(Math.max(o.x,a.x,h.x,m.x)),b=1;for(let P=y-b;P<=v+b;P++)P!==0&&n.push(new c.b4(P,t))}return n}coveringTiles(t){var n,o;let a=this.coveringZoomLevel(t);const h=a;if(t.minzoom!==void 0&&a<t.minzoom)return[];t.maxzoom!==void 0&&a>t.maxzoom&&(a=t.maxzoom);const m=this.pointCoordinate(this.getCameraPoint()),y=c.Z.fromLngLat(this.center),v=Math.pow(2,a),b=[v*m.x,v*m.y,0],P=[v*y.x,v*y.y,0],k=gn.fromInvProjectionMatrix(this.invModelViewProjectionMatrix,this.worldSize,a);let L=t.minzoom||0;!t.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(L=a);const B=t.terrain?2/Math.min(this.tileSize,t.tileSize)*this.tileSize:3,N=U=>({aabb:new lo([U*v,0,0],[(U+1)*v,v,0]),zoom:0,x:0,y:0,wrap:U,fullyVisible:!1}),Z=[],j=[],H=a,Y=t.reparseOverscaled?h:a;if(this._renderWorldCopies)for(let U=1;U<=3;U++)Z.push(N(-U)),Z.push(N(U));for(Z.push(N(0));Z.length>0;){const U=Z.pop(),te=U.x,se=U.y;let ce=U.fullyVisible;if(!ce){const Se=U.aabb.intersects(k);if(Se===0)continue;ce=Se===2}const ge=t.terrain?b:P,we=U.aabb.distanceX(ge),Le=U.aabb.distanceY(ge),Be=Math.max(Math.abs(we),Math.abs(Le));if(U.zoom===H||Be>B+(1<<H-U.zoom)-2&&U.zoom>=L){const Se=H-U.zoom,Te=b[0]-.5-(te<<Se),Ne=b[1]-.5-(se<<Se);j.push({tileID:new c.S(U.zoom===H?Y:U.zoom,U.wrap,U.zoom,te,se),distanceSq:Vr([P[0]-.5-te,P[1]-.5-se]),tileDistanceToCamera:Math.sqrt(Te*Te+Ne*Ne)})}else for(let Se=0;Se<4;Se++){const Te=(te<<1)+Se%2,Ne=(se<<1)+(Se>>1),et=U.zoom+1;let ke=U.aabb.quadrant(Se);if(t.terrain){const Me=new c.S(et,U.wrap,et,Te,Ne),Ye=t.terrain.getMinMaxElevation(Me),Lt=(n=Ye.minElevation)!==null&&n!==void 0?n:this.elevation,st=(o=Ye.maxElevation)!==null&&o!==void 0?o:this.elevation;ke=new lo([ke.min[0],ke.min[1],Lt],[ke.max[0],ke.max[1],st])}Z.push({aabb:ke,zoom:et,x:Te,y:Ne,wrap:U.wrap,fullyVisible:ce})}}return j.sort((U,te)=>U.distanceSq-te.distanceSq).map(U=>U.tileID)}resize(t,n){this.width=t,this.height=n,this.pixelsToGLUnits=[2/t,-2/n],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(t){return Math.pow(2,t)}scaleZoom(t){return Math.log(t)/Math.LN2}project(t){const n=c.ad(t.lat,-85.051129,oa);return new c.P(c.O(t.lng)*this.worldSize,c.Q(n)*this.worldSize)}unproject(t){return new c.Z(t.x/this.worldSize,t.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(t){const n=this.elevation,o=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,a=this.pointLocation(this.centerPoint,t),h=t.getElevationForLngLatZoom(a,this.tileZoom);if(!(this.elevation-h))return;const m=o+n-h,y=Math.cos(this._pitch)*this.cameraToCenterDistance/m/c.b5(1,a.lat),v=this.scaleZoom(y/this.tileSize);this._elevation=h,this._center=a,this.zoom=v}setLocationAtPoint(t,n){const o=this.pointCoordinate(n),a=this.pointCoordinate(this.centerPoint),h=this.locationCoordinate(t),m=new c.Z(h.x-(o.x-a.x),h.y-(o.y-a.y));this.center=this.coordinateLocation(m),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(t,n){return n?this.coordinatePoint(this.locationCoordinate(t),n.getElevationForLngLatZoom(t,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(t))}pointLocation(t,n){return this.coordinateLocation(this.pointCoordinate(t,n))}locationCoordinate(t){return c.Z.fromLngLat(t)}coordinateLocation(t){return t&&t.toLngLat()}pointCoordinate(t,n){if(n){const L=n.pointCoordinate(t);if(L!=null)return L}const o=[t.x,t.y,0,1],a=[t.x,t.y,1,1];c.ag(o,o,this.pixelMatrixInverse),c.ag(a,a,this.pixelMatrixInverse);const h=o[3],m=a[3],y=o[1]/h,v=a[1]/m,b=o[2]/h,P=a[2]/m,k=b===P?0:(0-b)/(P-b);return new c.Z(c.z.number(o[0]/h,a[0]/m,k)/this.worldSize,c.z.number(y,v,k)/this.worldSize)}coordinatePoint(t,n=0,o=this.pixelMatrix){const a=[t.x*this.worldSize,t.y*this.worldSize,n,1];return c.ag(a,a,o),new c.P(a[0]/a[3],a[1]/a[3])}getBounds(){const t=Math.max(0,this.height/2-this.getHorizon());return new ue().extend(this.pointLocation(new c.P(0,t))).extend(this.pointLocation(new c.P(this.width,t))).extend(this.pointLocation(new c.P(this.width,this.height))).extend(this.pointLocation(new c.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new ue([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(t){t?(this.lngRange=[t.getWest(),t.getEast()],this.latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-85.051129,oa])}calculateTileMatrix(t){const n=t.canonical,o=this.worldSize/this.zoomScale(n.z),a=n.x+Math.pow(2,n.z)*t.wrap,h=c.ao(new Float64Array(16));return c.J(h,h,[a*o,n.y*o,0]),c.K(h,h,[o/c.X,o/c.X,1]),h}calculatePosMatrix(t,n=!1){const o=t.key,a=n?this._alignedPosMatrixCache:this._posMatrixCache;if(a[o])return a[o];const h=this.calculateTileMatrix(t);return c.L(h,n?this.alignedModelViewProjectionMatrix:this.modelViewProjectionMatrix,h),a[o]=new Float32Array(h),a[o]}calculateFogMatrix(t){const n=t.key,o=this._fogMatrixCache;if(o[n])return o[n];const a=this.calculateTileMatrix(t);return c.L(a,this.fogMatrix,a),o[n]=new Float32Array(a),o[n]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(t,n){n=c.ad(+n,this.minZoom,this.maxZoom);const o={center:new c.N(t.lng,t.lat),zoom:n};let a=this.lngRange;if(!this._renderWorldCopies&&a===null){const U=179.9999999999;a=[-U,U]}const h=this.tileSize*this.zoomScale(o.zoom);let m=0,y=h,v=0,b=h,P=0,k=0;const{x:L,y:B}=this.size;if(this.latRange){const U=this.latRange;m=c.Q(U[1])*h,y=c.Q(U[0])*h,y-m<B&&(P=B/(y-m))}a&&(v=c.b3(c.O(a[0])*h,0,h),b=c.b3(c.O(a[1])*h,0,h),b<v&&(b+=h),b-v<L&&(k=L/(b-v)));const{x:N,y:Z}=this.project.call({worldSize:h},t);let j,H;const Y=Math.max(k||0,P||0);if(Y){const U=new c.P(k?(b+v)/2:N,P?(y+m)/2:Z);return o.center=this.unproject.call({worldSize:h},U).wrap(),o.zoom+=this.scaleZoom(Y),o}if(this.latRange){const U=B/2;Z-U<m&&(H=m+U),Z+U>y&&(H=y-U)}if(a){const U=(v+b)/2;let te=N;this._renderWorldCopies&&(te=c.b3(N,U-h/2,U+h/2));const se=L/2;te-se<v&&(j=v+se),te+se>b&&(j=b-se)}if(j!==void 0||H!==void 0){const U=new c.P(j??N,H??Z);o.center=this.unproject.call({worldSize:h},U).wrap()}return o}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const t=this._unmodified,{center:n,zoom:o}=this.getConstrained(this.center,this.zoom);this.center=n,this.zoom=o,this._unmodified=t,this._constraining=!1}_calcMatrices(){if(!this.height)return;const t=this.centerOffset,n=this.point.x,o=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=c.b5(1,this.center.lat)*this.worldSize;let a=c.ao(new Float64Array(16));c.K(a,a,[this.width/2,-this.height/2,1]),c.J(a,a,[1,-1,0]),this.labelPlaneMatrix=a,a=c.ao(new Float64Array(16)),c.K(a,a,[1,-1,1]),c.J(a,a,[-1,-1,0]),c.K(a,a,[2/this.width,2/this.height,1]),this.glCoordMatrix=a;const h=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),m=Math.min(this.elevation,this.minElevationForCurrentTile),y=h-m*this._pixelPerMeter/Math.cos(this._pitch),v=m<0?y:h,b=Math.PI/2+this._pitch,P=this._fov*(.5+t.y/this.height),k=Math.sin(P)*v/Math.sin(c.ad(Math.PI-b-P,.01,Math.PI-.01)),L=this.getHorizon(),B=2*Math.atan(L/this.cameraToCenterDistance)*(.5+t.y/(2*L)),N=Math.sin(B)*v/Math.sin(c.ad(Math.PI-b-B,.01,Math.PI-.01)),Z=Math.min(k,N);this.farZ=1.01*(Math.cos(Math.PI/2-this._pitch)*Z+v),this.nearZ=this.height/50,a=new Float64Array(16),c.b6(a,this._fov,this.width/this.height,this.nearZ,this.farZ),a[8]=2*-t.x/this.width,a[9]=2*t.y/this.height,this.projectionMatrix=c.af(a),c.K(a,a,[1,-1,1]),c.J(a,a,[0,0,-this.cameraToCenterDistance]),c.b7(a,a,this._pitch),c.ae(a,a,this.angle),c.J(a,a,[-n,-o,0]),this.mercatorMatrix=c.K([],a,[this.worldSize,this.worldSize,this.worldSize]),c.K(a,a,[1,1,this._pixelPerMeter]),this.pixelMatrix=c.L(new Float64Array(16),this.labelPlaneMatrix,a),c.J(a,a,[0,0,-this.elevation]),this.modelViewProjectionMatrix=a,this.invModelViewProjectionMatrix=c.at([],a),this.fogMatrix=new Float64Array(16),c.b6(this.fogMatrix,this._fov,this.width/this.height,h,this.farZ),this.fogMatrix[8]=2*-t.x/this.width,this.fogMatrix[9]=2*t.y/this.height,c.K(this.fogMatrix,this.fogMatrix,[1,-1,1]),c.J(this.fogMatrix,this.fogMatrix,[0,0,-this.cameraToCenterDistance]),c.b7(this.fogMatrix,this.fogMatrix,this._pitch),c.ae(this.fogMatrix,this.fogMatrix,this.angle),c.J(this.fogMatrix,this.fogMatrix,[-n,-o,0]),c.K(this.fogMatrix,this.fogMatrix,[1,1,this._pixelPerMeter]),c.J(this.fogMatrix,this.fogMatrix,[0,0,-this.elevation]),this.pixelMatrix3D=c.L(new Float64Array(16),this.labelPlaneMatrix,a);const j=this.width%2/2,H=this.height%2/2,Y=Math.cos(this.angle),U=Math.sin(this.angle),te=n-Math.round(n)+Y*j+U*H,se=o-Math.round(o)+Y*H+U*j,ce=new Float64Array(a);if(c.J(ce,ce,[te>.5?te-1:te,se>.5?se-1:se,0]),this.alignedModelViewProjectionMatrix=ce,a=c.at(new Float64Array(16),this.pixelMatrix),!a)throw new Error("failed to invert matrix");this.pixelMatrixInverse=a,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const t=this.pointCoordinate(new c.P(0,0)),n=[t.x*this.worldSize,t.y*this.worldSize,0,1];return c.ag(n,n,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new c.P(0,t))}getCameraQueryGeometry(t){const n=this.getCameraPoint();if(t.length===1)return[t[0],n];{let o=n.x,a=n.y,h=n.x,m=n.y;for(const y of t)o=Math.min(o,y.x),a=Math.min(a,y.y),h=Math.max(h,y.x),m=Math.max(m,y.y);return[new c.P(o,a),new c.P(h,a),new c.P(h,m),new c.P(o,m),new c.P(o,a)]}}lngLatToCameraDepth(t,n){const o=this.locationCoordinate(t),a=[o.x*this.worldSize,o.y*this.worldSize,n,1];return c.ag(a,a,this.modelViewProjectionMatrix),a[2]/a[3]}}function ho(u,t){let n,o=!1,a=null,h=null;const m=()=>{a=null,o&&(u.apply(h,n),a=setTimeout(m,t),o=!1)};return(...y)=>(o=!0,h=this,n=y,a||m(),a)}class ws{constructor(t){this._getCurrentHash=()=>{const n=window.location.hash.replace("#","");if(this._hashName){let o;return n.split("&").map(a=>a.split("=")).forEach(a=>{a[0]===this._hashName&&(o=a)}),(o&&o[1]||"").split("/")}return n.split("/")},this._onHashChange=()=>{const n=this._getCurrentHash();if(n.length>=3&&!n.some(o=>isNaN(o))){const o=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:o,pitch:+(n[4]||0)}),!0}return!1},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 o=n.join("/");let a=o;a.split("&").length>0&&(a=a.split("&")[0]),this._hashName&&(a=`${this._hashName}=${o}`);let h=window.location.hash.replace(a,"");h.startsWith("#&")?h=h.slice(0,1)+h.slice(2):h==="#"&&(h="");let m=window.location.href.replace(/(#.+)?$/,h);m=m.replace("&&","&"),window.history.replaceState(window.history.state,null,m)},this._updateHash=ho(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(),o=Math.round(100*this._map.getZoom())/100,a=Math.ceil((o*Math.LN2+Math.log(512/360/.5))/Math.LN10),h=Math.pow(10,a),m=Math.round(n.lng*h)/h,y=Math.round(n.lat*h)/h,v=this._map.getBearing(),b=this._map.getPitch();let P="";if(P+=t?`/${m}/${y}/${o}`:`${o}/${y}/${m}`,(v||b)&&(P+="/"+Math.round(10*v)/10),b&&(P+=`/${Math.round(b)}`),this._hashName){const k=this._hashName;let L=!1;const B=window.location.hash.slice(1).split("&").map(N=>{const Z=N.split("=")[0];return Z===k?(L=!0,`${Z}=${P}`):N}).filter(N=>N);return L||B.push(`${k}=${P}`),`#${B.join("&")}`}return`#${P}`}}const _n={linearity:.3,easing:c.b8(0,0,.3,1)},la=c.e({deceleration:2500,maxSpeed:1400},_n),ca=c.e({deceleration:20,maxSpeed:1400},_n),Bl=c.e({deceleration:1e3,maxSpeed:360},_n),uo=c.e({deceleration:1e3,maxSpeed:90},_n);class po{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:le.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,n=le.now();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,pan:new c.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:h}of this._inertiaBuffer)n.zoom+=h.zoomDelta||0,n.bearing+=h.bearingDelta||0,n.pitch+=h.pitchDelta||0,h.panDelta&&n.pan._add(h.panDelta),h.around&&(n.around=h.around),h.pinchAround&&(n.pinchAround=h.pinchAround);const o=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,a={};if(n.pan.mag()){const h=fo(n.pan.mag(),o,c.e({},la,t||{}));a.offset=n.pan.mult(h.amount/n.pan.mag()),a.center=this._map.transform.center,Fn(a,h)}if(n.zoom){const h=fo(n.zoom,o,ca);a.zoom=this._map.transform.zoom+h.amount,Fn(a,h)}if(n.bearing){const h=fo(n.bearing,o,Bl);a.bearing=this._map.transform.bearing+c.ad(h.amount,-179,179),Fn(a,h)}if(n.pitch){const h=fo(n.pitch,o,uo);a.pitch=this._map.transform.pitch+h.amount,Fn(a,h)}if(a.zoom||a.bearing){const h=n.pinchAround===void 0?n.around:n.pinchAround;a.around=h?this._map.unproject(h):this._map.getCenter()}return this.clear(),c.e(a,{noMoveStart:!0})}}function Fn(u,t){(!u.duration||u.duration<t.duration)&&(u.duration=t.duration,u.easing=t.easing)}function fo(u,t,n){const{maxSpeed:o,linearity:a,deceleration:h}=n,m=c.ad(u*a/(t/1e3),-o,o),y=Math.abs(m)/(h*a);return{easing:n.easing,duration:1e3*y,amount:m*(y/2)}}class Ti extends c.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,o,a={}){const h=ae.mousePos(n.getCanvas(),o),m=n.unproject(h);super(t,c.e({point:h,lngLat:m,originalEvent:o},a)),this._defaultPrevented=!1,this.target=n}}class Ss extends c.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,o){const a=t==="touchend"?o.changedTouches:o.touches,h=ae.touchPos(n.getCanvasContainer(),a),m=h.map(v=>n.unproject(v)),y=h.reduce((v,b,P,k)=>v.add(b.div(k.length)),new c.P(0,0));super(t,{points:h,point:y,lngLats:m,lngLat:n.unproject(y),originalEvent:o}),this._defaultPrevented=!1}}class ha extends c.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,o){super(t,{originalEvent:o}),this._defaultPrevented=!1}}class mo{constructor(t,n){this._map=t,this._clickTolerance=n.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new ha(t.type,this._map,t))}mousedown(t,n){return this._mousedownPos=n,this._firePreventable(new Ti(t.type,this._map,t))}mouseup(t){this._map.fire(new Ti(t.type,this._map,t))}click(t,n){this._mousedownPos&&this._mousedownPos.dist(n)>=this._clickTolerance||this._map.fire(new Ti(t.type,this._map,t))}dblclick(t){return this._firePreventable(new Ti(t.type,this._map,t))}mouseover(t){this._map.fire(new Ti(t.type,this._map,t))}mouseout(t){this._map.fire(new Ti(t.type,this._map,t))}touchstart(t){return this._firePreventable(new Ss(t.type,this._map,t))}touchmove(t){this._map.fire(new Ss(t.type,this._map,t))}touchend(t){this._map.fire(new Ss(t.type,this._map,t))}touchcancel(t){this._map.fire(new Ss(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class ua{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new Ti(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Ti("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new Ti(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class On{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.pointLocation(c.P.convert(t),this._map.terrain)}}class da{constructor(t,n){this._map=t,this._tr=new On(t),this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=n.clickTolerance||1}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&&(ae.disableDrag(),this._startPos=this._lastPos=n,this._active=!0)}mousemoveWindow(t,n){if(!this._active)return;const o=n;if(this._lastPos.equals(o)||!this._box&&o.dist(this._startPos)<this._clickTolerance)return;const a=this._startPos;this._lastPos=o,this._box||(this._box=ae.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",t));const h=Math.min(a.x,o.x),m=Math.max(a.x,o.x),y=Math.min(a.y,o.y),v=Math.max(a.y,o.y);ae.setTransform(this._box,`translate(${h}px,${y}px)`),this._box.style.width=m-h+"px",this._box.style.height=v-y+"px"}mouseupWindow(t,n){if(!this._active||t.button!==0)return;const o=this._startPos,a=n;if(this.reset(),ae.suppressClick(),o.x!==a.x||o.y!==a.y)return this._map.fire(new c.k("boxzoomend",{originalEvent:t})),{cameraAnimation:h=>h.fitScreenCoordinates(o,a,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&&(ae.remove(this._box),this._box=null),ae.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,n){return this._map.fire(new c.k(t,{originalEvent:n}))}}function Vn(u,t){if(u.length!==t.length)throw new Error(`The number of touches and points are not equal - touches ${u.length}, points ${t.length}`);const n={};for(let o=0;o<u.length;o++)n[u[o].identifier]=t[o];return n}class pa{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(t,n,o){(this.centroid||o.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=t.timeStamp),o.length===this.numTouches&&(this.centroid=function(a){const h=new c.P(0,0);for(const m of a)h._add(m);return h.div(a.length)}(n),this.touches=Vn(o,n)))}touchmove(t,n,o){if(this.aborted||!this.centroid)return;const a=Vn(o,n);for(const h in this.touches){const m=a[h];(!m||m.dist(this.touches[h])>30)&&(this.aborted=!0)}}touchend(t,n,o){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),o.length===0){const a=!this.aborted&&this.centroid;if(this.reset(),a)return a}}}class fa{constructor(t){this.singleTap=new pa(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,n,o){this.singleTap.touchstart(t,n,o)}touchmove(t,n,o){this.singleTap.touchmove(t,n,o)}touchend(t,n,o){const a=this.singleTap.touchend(t,n,o);if(a){const h=t.timeStamp-this.lastTime<500,m=!this.lastTap||this.lastTap.dist(a)<30;if(h&&m||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=a,this.count===this.numTaps)return this.reset(),a}}}class Fl{constructor(t){this._tr=new On(t),this._zoomIn=new fa({numTouches:1,numTaps:2}),this._zoomOut=new fa({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,n,o){this._zoomIn.touchstart(t,n,o),this._zoomOut.touchstart(t,n,o)}touchmove(t,n,o){this._zoomIn.touchmove(t,n,o),this._zoomOut.touchmove(t,n,o)}touchend(t,n,o){const a=this._zoomIn.touchend(t,n,o),h=this._zoomOut.touchend(t,n,o),m=this._tr;return a?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:y=>y.easeTo({duration:300,zoom:m.zoom+1,around:m.unproject(a)},{originalEvent:t})}):h?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:y=>y.easeTo({duration:300,zoom:m.zoom-1,around:m.unproject(h)},{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 Dt{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.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=n.length?n[0]:n,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(t,n){if(!this.isEnabled())return;const o=this._lastPoint;if(!o)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t))return void this.reset(t);const a=n.length?n[0]:n;return!this._moved&&a.dist(o)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=a,this._move(o,a))}dragEnd(t){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(t)&&(this._moved&&ae.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 yn={0:1,2:2};class Ei{constructor(t){this._correctEvent=t.checkCorrectEvent}startMove(t){const n=ae.mouseButton(t);this._eventButton=n}endMove(t){delete this._eventButton}isValidStartEvent(t){return this._correctEvent(t)}isValidMoveEvent(t){return!function(n,o){const a=yn[o];return n.buttons===void 0||(n.buttons&a)!==a}(t,this._eventButton)}isValidEndEvent(t){return ae.mouseButton(t)===this._eventButton}}class go{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)}}const Ts=u=>{u.mousedown=u.dragStart,u.mousemoveWindow=u.dragMove,u.mouseup=u.dragEnd,u.contextmenu=t=>{t.preventDefault()}},ma=({enable:u,clickTolerance:t,bearingDegreesPerPixelMoved:n=.8})=>{const o=new Ei({checkCorrectEvent:a=>ae.mouseButton(a)===0&&a.ctrlKey||ae.mouseButton(a)===2});return new Dt({clickTolerance:t,move:(a,h)=>({bearingDelta:(h.x-a.x)*n}),moveStateManager:o,enable:u,assignEvents:Ts})},xn=({enable:u,clickTolerance:t,pitchDegreesPerPixelMoved:n=-.5})=>{const o=new Ei({checkCorrectEvent:a=>ae.mouseButton(a)===0&&a.ctrlKey||ae.mouseButton(a)===2});return new Dt({clickTolerance:t,move:(a,h)=>({pitchDelta:(h.y-a.y)*n}),moveStateManager:o,enable:u,assignEvents:Ts})};class Is{constructor(t,n){this._clickTolerance=t.clickTolerance||1,this._map=n,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new c.P(0,0)}_shouldBePrevented(t){return t<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(t,n,o){return this._calculateTransform(t,n,o)}touchmove(t,n,o){if(this._active){if(!this._shouldBePrevented(o.length))return t.preventDefault(),this._calculateTransform(t,n,o);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",t)}}touchend(t,n,o){this._calculateTransform(t,n,o),this._active&&this._shouldBePrevented(o.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,n,o){o.length>0&&(this._active=!0);const a=Vn(o,n),h=new c.P(0,0),m=new c.P(0,0);let y=0;for(const b in a){const P=a[b],k=this._touches[b];k&&(h._add(P),m._add(P.sub(k)),y++,a[b]=P)}if(this._touches=a,this._shouldBePrevented(y)||!m.mag())return;const v=m.div(y);return this._sum._add(v),this._sum.mag()<this._clickTolerance?void 0:{around:h.div(y),panDelta:v}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ps{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(t,n,o){this._firstTwoTouches||o.length<2||(this._firstTwoTouches=[o[0].identifier,o[1].identifier],this._start([n[0],n[1]]))}touchmove(t,n,o){if(!this._firstTwoTouches)return;t.preventDefault();const[a,h]=this._firstTwoTouches,m=ks(o,n,a),y=ks(o,n,h);if(!m||!y)return;const v=this._aroundCenter?null:m.add(y).div(2);return this._move([m,y],v,t)}touchend(t,n,o){if(!this._firstTwoTouches)return;const[a,h]=this._firstTwoTouches,m=ks(o,n,a),y=ks(o,n,h);m&&y||(this._active&&ae.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 ks(u,t,n){for(let o=0;o<u.length;o++)if(u[o].identifier===n)return t[o]}function ga(u,t){return Math.log(u/t)/Math.LN2}class _a extends Ps{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,n){const o=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(ga(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:ga(this._distance,o),pinchAround:n}}}function ya(u,t){return 180*u.angleWith(t)/Math.PI}class xa extends Ps{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,o){const a=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:ya(this._vector,a),pinchAround:n}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const n=25/(Math.PI*this._minDiameter)*360,o=ya(t,this._startVector);return Math.abs(o)<n}}function Dr(u){return Math.abs(u.y)>Math.abs(u.x)}class va extends Ps{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,o){super.touchstart(t,n,o),this._currentTouchCount=o.length}_start(t){this._lastPoints=t,Dr(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,n,o){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const a=t[0].sub(this._lastPoints[0]),h=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(a,h,o.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(a.y+h.y)/2*-.5}):void 0}gestureBeginsVertically(t,n,o){if(this._valid!==void 0)return this._valid;const a=t.mag()>=2,h=n.mag()>=2;if(!a&&!h)return;if(!a||!h)return this._firstMove===void 0&&(this._firstMove=o),o-this._firstMove<100&&void 0;const m=t.y>0==n.y>0;return Dr(t)&&Dr(n)&&m}}const Ol={panStep:100,bearingStep:15,pitchStep:10};class ba{constructor(t){this._tr=new On(t);const n=Ol;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,o=0,a=0,h=0,m=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?o=-1:(t.preventDefault(),h=-1);break;case 39:t.shiftKey?o=1:(t.preventDefault(),h=1);break;case 38:t.shiftKey?a=1:(t.preventDefault(),m=-1);break;case 40:t.shiftKey?a=-1:(t.preventDefault(),m=1);break;default:return}return this._rotationDisabled&&(o=0,a=0),{cameraAnimation:y=>{const v=this._tr;y.easeTo({duration:300,easeId:"keyboardHandler",easing:Vl,zoom:n?Math.round(v.zoom)+n*(t.shiftKey?2:1):v.zoom,bearing:v.bearing+o*this._bearingStep,pitch:v.pitch+a*this._pitchStep,offset:[-h*this._panStep,-m*this._panStep],center:v.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 Vl(u){return u*(2-u)}const wa=4.000244140625;class Sa{constructor(t,n){this._onTimeout=o=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(o)},this._map=t,this._tr=new On(t),this._triggerRenderFrame=n,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}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 o=le.now(),a=o-(this._lastWheelEventTime||0);this._lastWheelEventTime=o,n!==0&&n%wa==0?this._type="wheel":n!==0&&Math.abs(n)<4?this._type="trackpad":a>400?(this._type=null,this._lastValue=n,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(a*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._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const n=ae.mousePos(this._map.getCanvas(),t),o=this._tr;this._around=n.y>o.transform.height/2-o.transform.getHorizon()?c.N.convert(this._aroundCenter?o.center:o.unproject(n)):c.N.convert(o.center),this._aroundPoint=o.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const t=this._tr.transform;if(this._delta!==0){const v=this._type==="wheel"&&Math.abs(this._delta)>wa?this._wheelZoomRate:this._defaultZoomRate;let b=2/(1+Math.exp(-Math.abs(this._delta*v)));this._delta<0&&b!==0&&(b=1/b);const P=typeof this._targetZoom=="number"?t.zoomScale(this._targetZoom):t.scale;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(P*b))),this._type==="wheel"&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const n=typeof this._targetZoom=="number"?this._targetZoom:t.zoom,o=this._startZoom,a=this._easing;let h,m=!1;const y=le.now()-this._lastWheelEventTime;if(this._type==="wheel"&&o&&a&&y){const v=Math.min(y/200,1),b=a(v);h=c.z.number(o,n,b),v<1?this._frameId||(this._frameId=!0):m=!0}else h=n,m=!0;return this._active=!0,m&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!m,zoomDelta:h-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let n=c.b9;if(this._prevEase){const o=this._prevEase,a=(le.now()-o.start)/o.duration,h=o.easing(a+.01)-o.easing(a),m=.27/Math.sqrt(h*h+1e-4)*.01,y=Math.sqrt(.0729-m*m);n=c.b8(m,y,.25,1)}return this._prevEase={start:le.now(),duration:t,easing:n},n}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class Ta{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 As{constructor(t){this._tr=new On(t),this.reset()}reset(){this._active=!1}dblclick(t,n){return t.preventDefault(),{cameraAnimation:o=>{o.easeTo({duration:300,zoom:this._tr.zoom+(t.shiftKey?-1:1),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 Nl{constructor(){this._tap=new fa({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(t,n,o){if(!this._swipePoint)if(this._tapTime){const a=n[0],h=t.timeStamp-this._tapTime<500,m=this._tapPoint.dist(a)<30;h&&m?o.length>0&&(this._swipePoint=a,this._swipeTouch=o[0].identifier):this.reset()}else this._tap.touchstart(t,n,o)}touchmove(t,n,o){if(this._tapTime){if(this._swipePoint){if(o[0].identifier!==this._swipeTouch)return;const a=n[0],h=a.y-this._swipePoint.y;return this._swipePoint=a,t.preventDefault(),this._active=!0,{zoomDelta:h/128}}}else this._tap.touchmove(t,n,o)}touchend(t,n,o){if(this._tapTime)this._swipePoint&&o.length===0&&this.reset();else{const a=this._tap.touchend(t,n,o);a&&(this._tapTime=t.timeStamp,this._tapPoint=a)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Wi{constructor(t,n,o){this._el=t,this._mousePan=n,this._touchPan=o}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 tr{constructor(t,n,o){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=n,this._mousePitch=o}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class Ia{constructor(t,n,o,a){this._el=t,this._touchZoom=n,this._touchRotate=o,this._tapDragZoom=a,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()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class ir{constructor(t,n){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"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=ae.create("div","maplibregl-cooperative-gesture-screen",t);let n=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(n=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const o=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),a=document.createElement("div");a.className="maplibregl-desktop-message",a.textContent=n,this._container.appendChild(a);const h=document.createElement("div");h.className="maplibregl-mobile-message",h.textContent=o,this._container.appendChild(h),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(ae.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(t){return t[this._bypassKey]}notifyGestureBlocked(t,n){this._enabled&&(this._map.fire(new c.k("cooperativegestureprevented",{gestureType:t,originalEvent:n})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const Lr=u=>u.zoom||u.drag||u.pitch||u.rotate;class Yc extends c.k{}function Pa(u){return u.panDelta&&u.panDelta.mag()||u.zoomDelta||u.bearingDelta||u.pitchDelta}class Qc{constructor(t,n){this.handleWindowEvent=a=>{this.handleEvent(a,`${a.type}Window`)},this.handleEvent=(a,h)=>{if(a.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const m=a.type==="renderFrame"?void 0:a,y={needsRenderFrame:!1},v={},b={},P=a.touches,k=P?this._getMapTouches(P):void 0,L=k?ae.touchPos(this._map.getCanvas(),k):ae.mousePos(this._map.getCanvas(),a);for(const{handlerName:Z,handler:j,allowed:H}of this._handlers){if(!j.isEnabled())continue;let Y;this._blockedByActive(b,H,Z)?j.reset():j[h||a.type]&&(Y=j[h||a.type](a,L,k),this.mergeHandlerResult(y,v,Y,Z,m),Y&&Y.needsRenderFrame&&this._triggerRenderFrame()),(Y||j.isActive())&&(b[Z]=j)}const B={};for(const Z in this._previousActiveHandlers)b[Z]||(B[Z]=m);this._previousActiveHandlers=b,(Object.keys(B).length||Pa(y))&&(this._changes.push([y,v,B]),this._triggerRenderFrame()),(Object.keys(b).length||Pa(y))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:N}=y;N&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],N(this._map))},this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new po(t),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(n);const o=this._el;this._listeners=[[o,"touchstart",{passive:!0}],[o,"touchmove",{passive:!1}],[o,"touchend",void 0],[o,"touchcancel",void 0],[o,"mousedown",void 0],[o,"mousemove",void 0],[o,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[o,"mouseover",void 0],[o,"mouseout",void 0],[o,"dblclick",void 0],[o,"click",void 0],[o,"keydown",{capture:!1}],[o,"keyup",void 0],[o,"wheel",{passive:!1}],[o,"contextmenu",void 0],[window,"blur",void 0]];for(const[a,h,m]of this._listeners)ae.addEventListener(a,h,a===document?this.handleWindowEvent:this.handleEvent,m)}destroy(){for(const[t,n,o]of this._listeners)ae.removeEventListener(t,n,t===document?this.handleWindowEvent:this.handleEvent,o)}_addDefaultHandlers(t){const n=this._map,o=n.getCanvasContainer();this._add("mapEvent",new mo(n,t));const a=n.boxZoom=new da(n,t);this._add("boxZoom",a),t.interactive&&t.boxZoom&&a.enable();const h=n.cooperativeGestures=new ir(n,t.cooperativeGestures);this._add("cooperativeGestures",h),t.cooperativeGestures&&h.enable();const m=new Fl(n),y=new As(n);n.doubleClickZoom=new Ta(y,m),this._add("tapZoom",m),this._add("clickZoom",y),t.interactive&&t.doubleClickZoom&&n.doubleClickZoom.enable();const v=new Nl;this._add("tapDragZoom",v);const b=n.touchPitch=new va(n);this._add("touchPitch",b),t.interactive&&t.touchPitch&&n.touchPitch.enable(t.touchPitch);const P=ma(t),k=xn(t);n.dragRotate=new tr(t,P,k),this._add("mouseRotate",P,["mousePitch"]),this._add("mousePitch",k,["mouseRotate"]),t.interactive&&t.dragRotate&&n.dragRotate.enable();const L=(({enable:Y,clickTolerance:U})=>{const te=new Ei({checkCorrectEvent:se=>ae.mouseButton(se)===0&&!se.ctrlKey});return new Dt({clickTolerance:U,move:(se,ce)=>({around:ce,panDelta:ce.sub(se)}),activateOnStart:!0,moveStateManager:te,enable:Y,assignEvents:Ts})})(t),B=new Is(t,n);n.dragPan=new Wi(o,L,B),this._add("mousePan",L),this._add("touchPan",B,["touchZoom","touchRotate"]),t.interactive&&t.dragPan&&n.dragPan.enable(t.dragPan);const N=new xa,Z=new _a;n.touchZoomRotate=new Ia(o,Z,N,v),this._add("touchRotate",N,["touchPan","touchZoom"]),this._add("touchZoom",Z,["touchPan","touchRotate"]),t.interactive&&t.touchZoomRotate&&n.touchZoomRotate.enable(t.touchZoomRotate);const j=n.scrollZoom=new Sa(n,()=>this._triggerRenderFrame());this._add("scrollZoom",j,["mousePan"]),t.interactive&&t.scrollZoom&&n.scrollZoom.enable(t.scrollZoom);const H=n.keyboard=new ba(n);this._add("keyboard",H),t.interactive&&t.keyboard&&n.keyboard.enable(),this._add("blockableMapEvent",new ua(n))}_add(t,n,o){this._handlers.push({handlerName:t,handler:n,allowed:o}),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!!Lr(this._eventsInProgress)||this.isZooming()}_blockedByActive(t,n,o){for(const a in t)if(a!==o&&(!n||n.indexOf(a)<0))return!0;return!1}_getMapTouches(t){const n=[];for(const o of t)this._el.contains(o.target)&&n.push(o);return n}mergeHandlerResult(t,n,o,a,h){if(!o)return;c.e(t,o);const m={handlerName:a,originalEvent:o.originalEvent||h};o.zoomDelta!==void 0&&(n.zoom=m),o.panDelta!==void 0&&(n.drag=m),o.pitchDelta!==void 0&&(n.pitch=m),o.bearingDelta!==void 0&&(n.rotate=m)}_applyChanges(){const t={},n={},o={};for(const[a,h,m]of this._changes)a.panDelta&&(t.panDelta=(t.panDelta||new c.P(0,0))._add(a.panDelta)),a.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+a.zoomDelta),a.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+a.bearingDelta),a.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+a.pitchDelta),a.around!==void 0&&(t.around=a.around),a.pinchAround!==void 0&&(t.pinchAround=a.pinchAround),a.noInertia&&(t.noInertia=a.noInertia),c.e(n,h),c.e(o,m);this._updateMapTransform(t,n,o),this._changes=[]}_updateMapTransform(t,n,o){const a=this._map,h=a._getTransformForUpdate(),m=a.terrain;if(!(Pa(t)||m&&this._terrainMovement))return this._fireEvents(n,o,!0);let{panDelta:y,zoomDelta:v,bearingDelta:b,pitchDelta:P,around:k,pinchAround:L}=t;L!==void 0&&(k=L),a._stop(!0),k=k||a.transform.centerPoint;const B=h.pointLocation(y?k.sub(y):k);b&&(h.bearing+=b),P&&(h.pitch+=P),v&&(h.zoom+=v),m?this._terrainMovement||!n.drag&&!n.zoom?n.drag&&this._terrainMovement?h.center=h.pointLocation(h.centerPoint.sub(y)):h.setLocationAtPoint(B,k):(this._terrainMovement=!0,this._map._elevationFreeze=!0,h.setLocationAtPoint(B,k)):h.setLocationAtPoint(B,k),a._applyUpdatedTransform(h),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(n,o,!0)}_fireEvents(t,n,o){const a=Lr(this._eventsInProgress),h=Lr(t),m={};for(const k in t){const{originalEvent:L}=t[k];this._eventsInProgress[k]||(m[`${k}start`]=L),this._eventsInProgress[k]=t[k]}!a&&h&&this._fireEvent("movestart",h.originalEvent);for(const k in m)this._fireEvent(k,m[k]);h&&this._fireEvent("move",h.originalEvent);for(const k in t){const{originalEvent:L}=t[k];this._fireEvent(k,L)}const y={};let v;for(const k in this._eventsInProgress){const{handlerName:L,originalEvent:B}=this._eventsInProgress[k];this._handlersById[L].isActive()||(delete this._eventsInProgress[k],v=n[L]||B,y[`${k}end`]=v)}for(const k in y)this._fireEvent(k,y[k]);const b=Lr(this._eventsInProgress),P=(a||h)&&!b;if(P&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const k=this._map._getTransformForUpdate();k.recalculateZoom(this._map.terrain),this._map._applyUpdatedTransform(k)}if(o&&P){this._updatingCamera=!0;const k=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),L=B=>B!==0&&-this._bearingSnap<B&&B<this._bearingSnap;!k||!k.essential&&le.prefersReducedMotion?(this._map.fire(new c.k("moveend",{originalEvent:v})),L(this._map.getBearing())&&this._map.resetNorth()):(L(k.bearing||this._map.getBearing())&&(k.bearing=0),k.freezeElevation=!0,this._map.easeTo(k,{originalEvent:v})),this._updatingCamera=!1}}_fireEvent(t,n){this._map.fire(new c.k(t,n?{originalEvent:n}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(t=>{delete this._frameId,this.handleEvent(new Yc("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class eh extends c.E{constructor(t,n){super(),this._renderFrameCallback=()=>{const o=Math.min((le.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(o)),o<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=n.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new c.N(this.transform.center.lng,this.transform.center.lat)}setCenter(t,n){return this.jumpTo({center:t},n)}panBy(t,n,o){return t=c.P.convert(t).mult(-1),this.panTo(this.transform.center,c.e({offset:t},n),o)}panTo(t,n,o){return this.easeTo(c.e({center:t},n),o)}getZoom(){return this.transform.zoom}setZoom(t,n){return this.jumpTo({zoom:t},n),this}zoomTo(t,n,o){return this.easeTo(c.e({zoom:t},n),o)}zoomIn(t,n){return this.zoomTo(this.getZoom()+1,t,n),this}zoomOut(t,n){return this.zoomTo(this.getZoom()-1,t,n),this}getBearing(){return this.transform.bearing}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,o){return this.easeTo(c.e({bearing:t},n),o)}resetNorth(t,n){return this.rotateTo(0,c.e({duration:1e3},t),n),this}resetNorthPitch(t,n){return this.easeTo(c.e({bearing:0,pitch: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}cameraForBounds(t,n){t=ue.convert(t);const o=n&&n.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),o,n)}_cameraForBoxAndBearing(t,n,o,a){const h={top:0,bottom:0,right:0,left:0};if(typeof(a=c.e({padding:h,offset:[0,0],maxZoom:this.transform.maxZoom},a)).padding=="number"){const Se=a.padding;a.padding={top:Se,bottom:Se,right:Se,left:Se}}a.padding=c.e(h,a.padding);const m=this.transform,y=m.padding,v=new ue(t,n),b=m.project(v.getNorthWest()),P=m.project(v.getNorthEast()),k=m.project(v.getSouthEast()),L=m.project(v.getSouthWest()),B=c.ba(-o),N=b.rotate(B),Z=P.rotate(B),j=k.rotate(B),H=L.rotate(B),Y=new c.P(Math.max(N.x,Z.x,H.x,j.x),Math.max(N.y,Z.y,H.y,j.y)),U=new c.P(Math.min(N.x,Z.x,H.x,j.x),Math.min(N.y,Z.y,H.y,j.y)),te=Y.sub(U),se=(m.width-(y.left+y.right+a.padding.left+a.padding.right))/te.x,ce=(m.height-(y.top+y.bottom+a.padding.top+a.padding.bottom))/te.y;if(ce<0||se<0)return void c.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");const ge=Math.min(m.scaleZoom(m.scale*Math.min(se,ce)),a.maxZoom),we=c.P.convert(a.offset),Le=new c.P((a.padding.left-a.padding.right)/2,(a.padding.top-a.padding.bottom)/2).rotate(c.ba(o)),Be=we.add(Le).mult(m.scale/m.zoomScale(ge));return{center:m.unproject(b.add(k).div(2).sub(Be)),zoom:ge,bearing:o}}fitBounds(t,n,o){return this._fitInternal(this.cameraForBounds(t,n),n,o)}fitScreenCoordinates(t,n,o,a,h){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(c.P.convert(t)),this.transform.pointLocation(c.P.convert(n)),o,a),a,h)}_fitInternal(t,n,o){return t?(delete(n=c.e(t,n)).padding,n.linear?this.easeTo(n,o):this.flyTo(n,o)):this}jumpTo(t,n){this.stop();const o=this._getTransformForUpdate();let a=!1,h=!1,m=!1;return"zoom"in t&&o.zoom!==+t.zoom&&(a=!0,o.zoom=+t.zoom),t.center!==void 0&&(o.center=c.N.convert(t.center)),"bearing"in t&&o.bearing!==+t.bearing&&(h=!0,o.bearing=+t.bearing),"pitch"in t&&o.pitch!==+t.pitch&&(m=!0,o.pitch=+t.pitch),t.padding==null||o.isPaddingEqual(t.padding)||(o.padding=t.padding),this._applyUpdatedTransform(o),this.fire(new c.k("movestart",n)).fire(new c.k("move",n)),a&&this.fire(new c.k("zoomstart",n)).fire(new c.k("zoom",n)).fire(new c.k("zoomend",n)),h&&this.fire(new c.k("rotatestart",n)).fire(new c.k("rotate",n)).fire(new c.k("rotateend",n)),m&&this.fire(new c.k("pitchstart",n)).fire(new c.k("pitch",n)).fire(new c.k("pitchend",n)),this.fire(new c.k("moveend",n))}calculateCameraOptionsFromTo(t,n,o,a=0){const h=c.Z.fromLngLat(t,n),m=c.Z.fromLngLat(o,a),y=m.x-h.x,v=m.y-h.y,b=m.z-h.z,P=Math.hypot(y,v,b);if(P===0)throw new Error("Can't calculate camera options with same From and To");const k=Math.hypot(y,v),L=this.transform.scaleZoom(this.transform.cameraToCenterDistance/P/this.transform.tileSize),B=180*Math.atan2(y,-v)/Math.PI;let N=180*Math.acos(k/P)/Math.PI;return N=b<0?90-N:90+N,{center:m.toLngLat(),zoom:L,pitch:N,bearing:B}}easeTo(t,n){var o;this._stop(!1,t.easeId),((t=c.e({offset:[0,0],duration:500,easing:c.b9},t)).animate===!1||!t.essential&&le.prefersReducedMotion)&&(t.duration=0);const a=this._getTransformForUpdate(),h=a.zoom,m=a.bearing,y=a.pitch,v=a.padding,b="bearing"in t?this._normalizeBearing(t.bearing,m):m,P="pitch"in t?+t.pitch:y,k="padding"in t?t.padding:a.padding,L=c.P.convert(t.offset);let B=a.centerPoint.add(L);const N=a.pointLocation(B),{center:Z,zoom:j}=a.getConstrained(c.N.convert(t.center||N),(o=t.zoom)!==null&&o!==void 0?o:h);this._normalizeCenter(Z,a);const H=a.project(N),Y=a.project(Z).sub(H),U=a.zoomScale(j-h);let te,se;t.around&&(te=c.N.convert(t.around),se=a.locationPoint(te));const ce={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||j!==h,this._rotating=this._rotating||m!==b,this._pitching=this._pitching||P!==y,this._padding=!a.isPaddingEqual(k),this._easeId=t.easeId,this._prepareEase(n,t.noMoveStart,ce),this.terrain&&this._prepareElevation(Z),this._ease(ge=>{if(this._zooming&&(a.zoom=c.z.number(h,j,ge)),this._rotating&&(a.bearing=c.z.number(m,b,ge)),this._pitching&&(a.pitch=c.z.number(y,P,ge)),this._padding&&(a.interpolatePadding(v,k,ge),B=a.centerPoint.add(L)),this.terrain&&!t.freezeElevation&&this._updateElevation(ge),te)a.setLocationAtPoint(te,se);else{const we=a.zoomScale(a.zoom-h),Le=j>h?Math.min(2,U):Math.max(.5,U),Be=Math.pow(Le,1-ge),Se=a.unproject(H.add(Y.mult(ge*Be)).mult(we));a.setLocationAtPoint(a.renderWorldCopies?Se.wrap():Se,B)}this._applyUpdatedTransform(a),this._fireMoveEvents(n)},ge=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(n,ge)},t),this}_prepareEase(t,n,o={}){this._moving=!0,n||o.moving||this.fire(new c.k("movestart",t)),this._zooming&&!o.zooming&&this.fire(new c.k("zoomstart",t)),this._rotating&&!o.rotating&&this.fire(new c.k("rotatestart",t)),this._pitching&&!o.pitching&&this.fire(new c.k("pitchstart",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.transform.minElevationForCurrentTile=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 o=this._elevationTarget-this._elevationStart;this._elevationStart+=t*(o-(n-(o*t+this._elevationStart))/(1-t)),this._elevationTarget=n}this.transform.elevation=c.z.number(this._elevationStart,this._elevationTarget,t)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(t){const n=t.getCameraPosition(),o=this.terrain.getElevationForLngLatZoom(n.lngLat,t.zoom);if(n.altitude<o){const a=this.calculateCameraOptionsFromTo(n.lngLat,o,t.center,t.elevation);return{pitch:a.pitch,zoom:a.zoom}}return{}}_applyUpdatedTransform(t){const n=[];if(this.terrain&&n.push(a=>this._elevateCameraIfInsideTerrain(a)),this.transformCameraUpdate&&n.push(a=>this.transformCameraUpdate(a)),!n.length)return;const o=t.clone();for(const a of n){const h=o.clone(),{center:m,zoom:y,pitch:v,bearing:b,elevation:P}=a(h);m&&(h.center=m),y!==void 0&&(h.zoom=y),v!==void 0&&(h.pitch=v),b!==void 0&&(h.bearing=b),P!==void 0&&(h.elevation=P),o.apply(h)}this.transform.apply(o)}_fireMoveEvents(t){this.fire(new c.k("move",t)),this._zooming&&this.fire(new c.k("zoom",t)),this._rotating&&this.fire(new c.k("rotate",t)),this._pitching&&this.fire(new c.k("pitch",t))}_afterEase(t,n){if(this._easeId&&n&&this._easeId===n)return;delete this._easeId;const o=this._zooming,a=this._rotating,h=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,o&&this.fire(new c.k("zoomend",t)),a&&this.fire(new c.k("rotateend",t)),h&&this.fire(new c.k("pitchend",t)),this.fire(new c.k("moveend",t))}flyTo(t,n){var o;if(!t.essential&&le.prefersReducedMotion){const Me=c.M(t,["center","zoom","bearing","pitch","around"]);return this.jumpTo(Me,n)}this.stop(),t=c.e({offset:[0,0],speed:1.2,curve:1.42,easing:c.b9},t);const a=this._getTransformForUpdate(),h=a.zoom,m=a.bearing,y=a.pitch,v=a.padding,b="bearing"in t?this._normalizeBearing(t.bearing,m):m,P="pitch"in t?+t.pitch:y,k="padding"in t?t.padding:a.padding,L=c.P.convert(t.offset);let B=a.centerPoint.add(L);const N=a.pointLocation(B),{center:Z,zoom:j}=a.getConstrained(c.N.convert(t.center||N),(o=t.zoom)!==null&&o!==void 0?o:h);this._normalizeCenter(Z,a);const H=a.zoomScale(j-h),Y=a.project(N),U=a.project(Z).sub(Y);let te=t.curve;const se=Math.max(a.width,a.height),ce=se/H,ge=U.mag();if("minZoom"in t){const Me=c.ad(Math.min(t.minZoom,h,j),a.minZoom,a.maxZoom),Ye=se/a.zoomScale(Me-h);te=Math.sqrt(Ye/ge*2)}const we=te*te;function Le(Me){const Ye=(ce*ce-se*se+(Me?-1:1)*we*we*ge*ge)/(2*(Me?ce:se)*we*ge);return Math.log(Math.sqrt(Ye*Ye+1)-Ye)}function Be(Me){return(Math.exp(Me)-Math.exp(-Me))/2}function Se(Me){return(Math.exp(Me)+Math.exp(-Me))/2}const Te=Le(!1);let Ne=function(Me){return Se(Te)/Se(Te+te*Me)},et=function(Me){return se*((Se(Te)*(Be(Ye=Te+te*Me)/Se(Ye))-Be(Te))/we)/ge;var Ye},ke=(Le(!0)-Te)/te;if(Math.abs(ge)<1e-6||!isFinite(ke)){if(Math.abs(se-ce)<1e-6)return this.easeTo(t,n);const Me=ce<se?-1:1;ke=Math.abs(Math.log(ce/se))/te,et=()=>0,Ne=Ye=>Math.exp(Me*te*Ye)}return t.duration="duration"in t?+t.duration:1e3*ke/("screenSpeed"in t?+t.screenSpeed/te:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=m!==b,this._pitching=P!==y,this._padding=!a.isPaddingEqual(k),this._prepareEase(n,!1),this.terrain&&this._prepareElevation(Z),this._ease(Me=>{const Ye=Me*ke,Lt=1/Ne(Ye);a.zoom=Me===1?j:h+a.scaleZoom(Lt),this._rotating&&(a.bearing=c.z.number(m,b,Me)),this._pitching&&(a.pitch=c.z.number(y,P,Me)),this._padding&&(a.interpolatePadding(v,k,Me),B=a.centerPoint.add(L)),this.terrain&&!t.freezeElevation&&this._updateElevation(Me);const st=Me===1?Z:a.unproject(Y.add(U.mult(et(Ye))).mult(Lt));a.setLocationAtPoint(a.renderWorldCopies?st.wrap():st,B),this._applyUpdatedTransform(a),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 o;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const a=this._onEaseEnd;delete this._onEaseEnd,a.call(this,n)}return t||(o=this.handlers)===null||o===void 0||o.stop(!1),this}_ease(t,n,o){o.animate===!1||o.duration===0?(t(1),n()):(this._easeStart=le.now(),this._easeOptions=o,this._onEaseFrame=t,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(t,n){t=c.b3(t,-180,180);const o=Math.abs(t-n);return Math.abs(t-360-n)<o&&(t-=360),Math.abs(t+360-n)<o&&(t+=360),t}_normalizeCenter(t,n){if(!n.renderWorldCopies||n.lngRange)return;const o=t.lng-n.center.lng;t.lng+=o>180?-360:o<-180?360:0}queryTerrainElevation(t){return this.terrain?this.terrain.getElevationForLngLatZoom(c.N.convert(t),this.transform.tileZoom)-this.transform.elevation:null}}const ka={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class Nn{constructor(t=ka){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=ae.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=ae.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=ae.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(){ae.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(t,n){const o=this._map._getUIString(`AttributionControl.${n}`);t.title=o,t.setAttribute("aria-label",o)}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map(a=>typeof a!="string"?"":a)):typeof this.options.customAttribution=="string"&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const a=this._map.style.stylesheet;this.styleOwner=a.owner,this.styleId=a.id}const n=this._map.style.sourceCaches;for(const a in n){const h=n[a];if(h.used||h.usedForTerrain){const m=h.getSource();m.attribution&&t.indexOf(m.attribution)<0&&t.push(m.attribution)}}t=t.filter(a=>String(a).trim()),t.sort((a,h)=>a.length-h.length),t=t.filter((a,h)=>{for(let m=h+1;m<t.length;m++)if(t[m].indexOf(a)>=0)return!1;return!0});const o=t.join(" | ");o!==this._attribHTML&&(this._attribHTML=o,t.length?(this._innerContainer.innerHTML=o,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class yr{constructor(t={}){this._updateCompact=()=>{const n=this._container.children;if(n.length){const o=n[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&o.classList.add("maplibregl-compact"):o.classList.remove("maplibregl-compact")}},this.options=t}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=ae.create("div","maplibregl-ctrl");const n=ae.create("a","maplibregl-ctrl-logo");return n.target="_blank",n.rel="noopener nofollow",n.href="https://maplibre.org/",n.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),n.setAttribute("rel","noopener nofollow"),this._container.appendChild(n),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){ae.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class Oe{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,o=n?this._queue.concat(n):this._queue;for(const a of o)if(a.id===t)return void(a.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 o of n)if(!o.cancelled&&(o.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var Ul=c.Y([{name:"a_pos3d",type:"Int16",components:3}]);class Aa extends c.E{constructor(t){super(),this.sourceCache=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,t.usedForTerrain=!0,t.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(t,n){this.sourceCache.update(t,n),this._renderableTilesKeys=[];const o={};for(const a of t.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:n}))o[a.key]=!0,this._renderableTilesKeys.push(a.key),this._tiles[a.key]||(a.posMatrix=new Float64Array(16),c.aQ(a.posMatrix,0,c.X,0,c.X,0,1),this._tiles[a.key]=new Zr(a,this.tileSize));for(const a in this._tiles)o[a]||delete this._tiles[a]}freeRtt(t){for(const n in this._tiles){const o=this._tiles[n];(!t||o.tileID.equals(t)||o.tileID.isChildOf(t)||t.isChildOf(o.tileID))&&(o.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(t=>this.getTileByID(t))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t){const n={};for(const o of this._renderableTilesKeys){const a=this._tiles[o].tileID;if(a.canonical.equals(t.canonical)){const h=t.clone();h.posMatrix=new Float64Array(16),c.aQ(h.posMatrix,0,c.X,0,c.X,0,1),n[o]=h}else if(a.canonical.isChildOf(t.canonical)){const h=t.clone();h.posMatrix=new Float64Array(16);const m=a.canonical.z-t.canonical.z,y=a.canonical.x-(a.canonical.x>>m<<m),v=a.canonical.y-(a.canonical.y>>m<<m),b=c.X>>m;c.aQ(h.posMatrix,0,b,0,b,0,1),c.J(h.posMatrix,h.posMatrix,[-y*b,-v*b,0]),n[o]=h}else if(t.canonical.isChildOf(a.canonical)){const h=t.clone();h.posMatrix=new Float64Array(16);const m=t.canonical.z-a.canonical.z,y=t.canonical.x-(t.canonical.x>>m<<m),v=t.canonical.y-(t.canonical.y>>m<<m),b=c.X>>m;c.aQ(h.posMatrix,0,c.X,0,c.X,0,1),c.J(h.posMatrix,h.posMatrix,[y*b,v*b,0]),c.K(h.posMatrix,h.posMatrix,[1/2**m,1/2**m,0]),n[o]=h}}return n}getSourceTile(t,n){const o=this.sourceCache._source;let a=t.overscaledZ-this.deltaZoom;if(a>o.maxzoom&&(a=o.maxzoom),a<o.minzoom)return null;this._sourceTileCache[t.key]||(this._sourceTileCache[t.key]=t.scaledTo(a).key);let h=this.sourceCache.getTileByID(this._sourceTileCache[t.key]);if((!h||!h.dem)&&n)for(;a>=o.minzoom&&(!h||!h.dem);)h=this.sourceCache.getTileByID(t.scaledTo(a--).key);return h}tilesAfterTime(t=Date.now()){return Object.values(this._tiles).filter(n=>n.timeAdded>=t)}}class jl{constructor(t,n,o){this.painter=t,this.sourceCache=new Aa(n),this.options=o,this.exaggeration=typeof o.exaggeration=="number"?o.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(t,n,o,a=c.X){var h;if(!(n>=0&&n<a&&o>=0&&o<a))return 0;const m=this.getTerrainData(t),y=(h=m.tile)===null||h===void 0?void 0:h.dem;if(!y)return 0;const v=function(N,Z,j){var H=Z[0],Y=Z[1];return N[0]=j[0]*H+j[4]*Y+j[12],N[1]=j[1]*H+j[5]*Y+j[13],N}([],[n/a*c.X,o/a*c.X],m.u_terrain_matrix),b=[v[0]*y.dim,v[1]*y.dim],P=Math.floor(b[0]),k=Math.floor(b[1]),L=b[0]-P,B=b[1]-k;return y.get(P,k)*(1-L)*(1-B)+y.get(P+1,k)*L*(1-B)+y.get(P,k+1)*(1-L)*B+y.get(P+1,k+1)*L*B}getElevationForLngLatZoom(t,n){const{tileID:o,mercatorX:a,mercatorY:h}=this._getOverscaledTileIDFromLngLatZoom(t,n);return this.getElevation(o,a%c.X,h%c.X,c.X)}getElevation(t,n,o,a=c.X){return this.getDEMElevation(t,n,o,a)*this.exaggeration}getTerrainData(t){if(!this._emptyDemTexture){const a=this.painter.context,h=new c.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new bt(a,h,a.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new bt(a,new c.R({width:1,height:1}),a.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(a.gl.NEAREST,a.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=c.ao([])}const n=this.sourceCache.getSourceTile(t,!0);if(n&&n.dem&&(!n.demTexture||n.needsTerrainPrepare)){const a=this.painter.context;n.demTexture=this.painter.getTileTexture(n.dem.stride),n.demTexture?n.demTexture.update(n.dem.getPixels(),{premultiply:!1}):n.demTexture=new bt(a,n.dem.getPixels(),a.gl.RGBA,{premultiply:!1}),n.demTexture.bind(a.gl.NEAREST,a.gl.CLAMP_TO_EDGE),n.needsTerrainPrepare=!1}const o=n&&n+n.tileID.key+t.key;if(o&&!this._demMatrixCache[o]){const a=this.sourceCache.sourceCache._source.maxzoom;let h=t.canonical.z-n.tileID.canonical.z;t.overscaledZ>t.canonical.z&&(t.canonical.z>=a?h=t.canonical.z-a:c.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const m=t.canonical.x-(t.canonical.x>>h<<h),y=t.canonical.y-(t.canonical.y>>h<<h),v=c.bb(new Float64Array(16),[1/(c.X<<h),1/(c.X<<h),0]);c.J(v,v,[m*c.X,y*c.X,0]),this._demMatrixCache[t.key]={matrix:v,coord:t}}return{u_depth:2,u_terrain:3,u_terrain_dim:n&&n.dem&&n.dem.dim||1,u_terrain_matrix:o?this._demMatrixCache[t.key].matrix:this._emptyDemMatrix,u_terrain_unpack:n&&n.dem&&n.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(n&&n.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:n}}getFramebuffer(t){const n=this.painter,o=n.width/devicePixelRatio,a=n.height/devicePixelRatio;return!this._fbo||this._fbo.width===o&&this._fbo.height===a||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new bt(n.context,{width:o,height:a,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 bt(n.context,{width:o,height:a,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(o,a,!0,!1),this._fbo.depthAttachment.set(n.context.createRenderbuffer(n.context.gl.DEPTH_COMPONENT16,o,a))),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 h=0,m=0;h<this._coordsTextureSize;h++)for(let y=0;y<this._coordsTextureSize;y++,m+=4)n[m+0]=255&y,n[m+1]=255&h,n[m+2]=y>>8<<4|h>>8,n[m+3]=0;const o=new c.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(n.buffer)),a=new bt(t,o,t.gl.RGBA,{premultiply:!1});return a.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=a,a}pointCoordinate(t){this.painter.maybeDrawDepthAndCoords(!0);const n=new Uint8Array(4),o=this.painter.context,a=o.gl,h=Math.round(t.x*this.painter.pixelRatio/devicePixelRatio),m=Math.round(t.y*this.painter.pixelRatio/devicePixelRatio),y=Math.round(this.painter.height/devicePixelRatio);o.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),a.readPixels(h,y-m-1,1,1,a.RGBA,a.UNSIGNED_BYTE,n),o.bindFramebuffer.set(null);const v=n[0]+(n[2]>>4<<8),b=n[1]+((15&n[2])<<8),P=this.coordsIndex[255-n[3]],k=P&&this.sourceCache.getTileByID(P);if(!k)return null;const L=this._coordsTextureSize,B=(1<<k.tileID.canonical.z)*L;return new c.Z((k.tileID.canonical.x*L+v)/B+k.tileID.wrap,(k.tileID.canonical.y*L+b)/B,this.getElevation(k.tileID,v,b,L))}depthAtPoint(t){const n=new Uint8Array(4),o=this.painter.context,a=o.gl;return o.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),a.readPixels(t.x,this.painter.height/devicePixelRatio-t.y-1,1,1,a.RGBA,a.UNSIGNED_BYTE,n),o.bindFramebuffer.set(null),(n[0]/16777216+n[1]/65536+n[2]/256+n[3])/256}getTerrainMesh(){if(this._mesh)return this._mesh;const t=this.painter.context,n=new c.bc,o=new c.aY,a=this.meshSize,h=c.X/a,m=a*a;for(let k=0;k<=a;k++)for(let L=0;L<=a;L++)n.emplaceBack(L*h,k*h,0);for(let k=0;k<m;k+=a+1)for(let L=0;L<a;L++)o.emplaceBack(L+k,a+L+k+1,a+L+k+2),o.emplaceBack(L+k,a+L+k+2,L+k+1);const y=n.length,v=y+2*(a+1);for(const k of[0,1])for(let L=0;L<=a;L++)for(const B of[0,1])n.emplaceBack(L*h,k*c.X,B);for(let k=0;k<2*a;k+=2)o.emplaceBack(v+k,v+k+1,v+k+3),o.emplaceBack(v+k,v+k+3,v+k+2),o.emplaceBack(y+k,y+k+3,y+k+1),o.emplaceBack(y+k,y+k+2,y+k+3);const b=n.length,P=b+2*(a+1);for(const k of[0,1])for(let L=0;L<=a;L++)for(const B of[0,1])n.emplaceBack(k*c.X,L*h,B);for(let k=0;k<2*a;k+=2)o.emplaceBack(b+k,b+k+1,b+k+3),o.emplaceBack(b+k,b+k+3,b+k+2),o.emplaceBack(P+k,P+k+3,P+k+1),o.emplaceBack(P+k,P+k+2,P+k+3);return this._mesh=new Ll(t.createVertexBuffer(n,Ul.members),t.createIndexBuffer(o),c.a0.simpleSegment(0,0,n.length,o.length)),this._mesh}getMeshFrameDelta(t){return 2*Math.PI*c.bd/Math.pow(2,t)/5}getMinTileElevationForLngLatZoom(t,n){var o;const{tileID:a}=this._getOverscaledTileIDFromLngLatZoom(t,n);return(o=this.getMinMaxElevation(a).minElevation)!==null&&o!==void 0?o:0}getMinMaxElevation(t){const n=this.getTerrainData(t).tile,o={minElevation:null,maxElevation:null};return n&&n.dem&&(o.minElevation=n.dem.min*this.exaggeration,o.maxElevation=n.dem.max*this.exaggeration),o}_getOverscaledTileIDFromLngLatZoom(t,n){const o=c.Z.fromLngLat(t.wrap()),a=(1<<n)*c.X,h=o.x*a,m=o.y*a,y=Math.floor(h/c.X),v=Math.floor(m/c.X);return{tileID:new c.S(n,0,n,y,v),mercatorX:h,mercatorY:m}}}class Cs{constructor(t,n,o){this._context=t,this._size=n,this._tileSize=o,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),o=new bt(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return o.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),n.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),n.colorAttachment.set(o.texture),{id:t,fbo:n,texture:o,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 xr={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class $l{constructor(t,n){this.painter=t,this.terrain=n,this.pool=new Cs(t.context,30,n.sourceCache.tileSize*n.qualityFactor)}destruct(){this.pool.destruct()}getTexture(t){return this.pool.getObjectForId(t.rtt[this._stacks.length-1].id).texture}prepareForRender(t,n){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=t._order.filter(o=>!t._layers[o].isHidden(n)),this._coordsDescendingInv={};for(const o in t.sourceCaches){this._coordsDescendingInv[o]={};const a=t.sourceCaches[o].getVisibleCoordinates();for(const h of a){const m=this.terrain.sourceCache.getTerrainCoords(h);for(const y in m)this._coordsDescendingInv[o][y]||(this._coordsDescendingInv[o][y]=[]),this._coordsDescendingInv[o][y].push(m[y])}}this._coordsDescendingInvStr={};for(const o of t._order){const a=t._layers[o],h=a.source;if(xr[a.type]&&!this._coordsDescendingInvStr[h]){this._coordsDescendingInvStr[h]={};for(const m in this._coordsDescendingInv[h])this._coordsDescendingInvStr[h][m]=this._coordsDescendingInv[h][m].map(y=>y.key).sort().join()}}for(const o of this._renderableTiles)for(const a in this._coordsDescendingInvStr){const h=this._coordsDescendingInvStr[a][o.tileID.key];h&&h!==o.rttCoords[a]&&(o.rtt=[])}}renderLayer(t){if(t.isHidden(this.painter.transform.zoom))return!1;const n=t.type,o=this.painter,a=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(xr[n]&&(this._prevType&&xr[this._prevType]||this._stacks.push([]),this._prevType=n,this._stacks[this._stacks.length-1].push(t.id),!a))return!0;if(xr[this._prevType]||xr[n]&&a){this._prevType=n;const h=this._stacks.length-1,m=this._stacks[h]||[];for(const y of this._renderableTiles){if(this.pool.isFull()&&(bs(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(y),y.rtt[h]){const b=this.pool.getObjectForId(y.rtt[h].id);if(b.stamp===y.rtt[h].stamp){this.pool.useObject(b);continue}}const v=this.pool.getOrCreateFreeObject();this.pool.useObject(v),this.pool.stampObject(v),y.rtt[h]={id:v.id,stamp:v.stamp},o.context.bindFramebuffer.set(v.fbo.framebuffer),o.context.clear({color:c.aN.transparent,stencil:0}),o.currentStencilSource=void 0;for(let b=0;b<m.length;b++){const P=o.style._layers[m[b]],k=P.source?this._coordsDescendingInv[P.source][y.tileID.key]:[y.tileID];o.context.viewport.set([0,0,v.fbo.width,v.fbo.height]),o._renderTileClippingMasks(P,k),o.renderLayer(o,o.style.sourceCaches[P.source],P,k),P.source&&(y.rttCoords[P.source]=this._coordsDescendingInvStr[P.source][y.tileID.key])}}return bs(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects(),xr[n]}return!1}}const De={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","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"},Ca=ye,th={hash:!1,interactive:!0,bearingSnap:7,attributionControl:ka,maplibreLogo:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,refreshExpiredTiles:!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],zoom:0,bearing:0,pitch:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:c.a.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0},ql=u=>{u.touchstart=u.dragStart,u.touchmoveWindow=u.dragMove,u.touchend=u.dragEnd},Ea={showCompass:!0,showZoom:!0,visualizePitch:!1};class Zl{constructor(t,n,o=!1){this.mousedown=m=>{this.startMouse(c.e({},m,{ctrlKey:!0,preventDefault:()=>m.preventDefault()}),ae.mousePos(this.element,m)),ae.addEventListener(window,"mousemove",this.mousemove),ae.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=m=>{this.moveMouse(m,ae.mousePos(this.element,m))},this.mouseup=m=>{this.mouseRotate.dragEnd(m),this.mousePitch&&this.mousePitch.dragEnd(m),this.offTemp()},this.touchstart=m=>{m.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=ae.touchPos(this.element,m.targetTouches)[0],this.startTouch(m,this._startPos),ae.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),ae.addEventListener(window,"touchend",this.touchend))},this.touchmove=m=>{m.targetTouches.length!==1?this.reset():(this._lastPos=ae.touchPos(this.element,m.targetTouches)[0],this.moveTouch(m,this._lastPos))},this.touchend=m=>{m.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.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10;const a=t.dragRotate._mouseRotate.getClickTolerance(),h=t.dragRotate._mousePitch.getClickTolerance();this.element=n,this.mouseRotate=ma({clickTolerance:a,enable:!0}),this.touchRotate=(({enable:m,clickTolerance:y,bearingDegreesPerPixelMoved:v=.8})=>{const b=new go;return new Dt({clickTolerance:y,move:(P,k)=>({bearingDelta:(k.x-P.x)*v}),moveStateManager:b,enable:m,assignEvents:ql})})({clickTolerance:a,enable:!0}),this.map=t,o&&(this.mousePitch=xn({clickTolerance:h,enable:!0}),this.touchPitch=(({enable:m,clickTolerance:y,pitchDegreesPerPixelMoved:v=-.5})=>{const b=new go;return new Dt({clickTolerance:y,move:(P,k)=>({pitchDelta:(k.y-P.y)*v}),moveStateManager:b,enable:m,assignEvents:ql})})({clickTolerance:h,enable:!0})),ae.addEventListener(n,"mousedown",this.mousedown),ae.addEventListener(n,"touchstart",this.touchstart,{passive:!1}),ae.addEventListener(n,"touchcancel",this.reset)}startMouse(t,n){this.mouseRotate.dragStart(t,n),this.mousePitch&&this.mousePitch.dragStart(t,n),ae.disableDrag()}startTouch(t,n){this.touchRotate.dragStart(t,n),this.touchPitch&&this.touchPitch.dragStart(t,n),ae.disableDrag()}moveMouse(t,n){const o=this.map,{bearingDelta:a}=this.mouseRotate.dragMove(t,n)||{};if(a&&o.setBearing(o.getBearing()+a),this.mousePitch){const{pitchDelta:h}=this.mousePitch.dragMove(t,n)||{};h&&o.setPitch(o.getPitch()+h)}}moveTouch(t,n){const o=this.map,{bearingDelta:a}=this.touchRotate.dragMove(t,n)||{};if(a&&o.setBearing(o.getBearing()+a),this.touchPitch){const{pitchDelta:h}=this.touchPitch.dragMove(t,n)||{};h&&o.setPitch(o.getPitch()+h)}}off(){const t=this.element;ae.removeEventListener(t,"mousedown",this.mousedown),ae.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),ae.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),ae.removeEventListener(window,"touchend",this.touchend),ae.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){ae.enableDrag(),ae.removeEventListener(window,"mousemove",this.mousemove),ae.removeEventListener(window,"mouseup",this.mouseup),ae.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),ae.removeEventListener(window,"touchend",this.touchend)}}let Kr;function Gl(u,t,n){const o=new c.N(u.lng,u.lat);if(u=new c.N(u.lng,u.lat),t){const a=new c.N(u.lng-360,u.lat),h=new c.N(u.lng+360,u.lat),m=n.locationPoint(u).distSqr(t);n.locationPoint(a).distSqr(t)<m?u=a:n.locationPoint(h).distSqr(t)<m&&(u=h)}for(;Math.abs(u.lng-n.center.lng)>180;){const a=n.locationPoint(u);if(a.x>=0&&a.y>=0&&a.x<=n.width&&a.y<=n.height)break;u.lng>n.center.lng?u.lng-=360:u.lng+=360}return u.lng!==o.lng&&n.locationPoint(u).y>n.height/2-n.getHorizon()?u:o}const Ma={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 Yr(u,t,n){const o=u.classList;for(const a in Ma)o.remove(`maplibregl-${n}-anchor-${a}`);o.add(`maplibregl-${n}-anchor-${t}`)}class Ct extends c.E{constructor(t){if(super(),this._onKeyPress=n=>{const o=n.code,a=n.charCode||n.keyCode;o!=="Space"&&o!=="Enter"&&a!==32&&a!==13||this.togglePopup()},this._onMapClick=n=>{const o=n.originalEvent.target,a=this._element;this._popup&&(o===a||a.contains(o))&&this.togglePopup()},this._update=n=>{var o;if(!this._map)return;const a=this._map.loaded()&&!this._map.isMoving();((n==null?void 0:n.type)==="terrain"||(n==null?void 0:n.type)==="render"&&!a)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?Gl(this._lngLat,this._flatPos,this._map.transform):(o=this._lngLat)===null||o===void 0?void 0:o.wrap(),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationPoint(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 m="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?m="rotateX(0deg)":this._pitchAlignment==="map"&&(m=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||n&&n.type!=="moveend"||(this._pos=this._pos.round()),ae.setTransform(this._element,`${Ma[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${m} ${h}`),le.frameAsync(new AbortController).then(()=>{this._updateOpacity(n&&n.type==="moveend")}).catch(()=>{})},this._onMove=n=>{if(!this._isDragging){const o=this._clickTolerance||this._map._clickTolerance;this._isDragging=n.point.dist(this._pointerdownPos)>=o}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 c.k("dragstart"))),this.fire(new c.k("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 c.k("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&&t.anchor||"center",this._color=t&&t.color||"#3FB1CE",this._scale=t&&t.scale||1,this._draggable=t&&t.draggable||!1,this._clickTolerance=t&&t.clickTolerance||0,this._subpixelPositioning=t&&t.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||"auto",this._pitchAlignment=t&&t.pitchAlignment&&t.pitchAlignment!=="auto"?t.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(t==null?void 0:t.opacity,t==null?void 0:t.opacityWhenCovered),t&&t.element)this._element=t.element,this._offset=c.P.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=ae.create("div");const n=ae.createNS("http://www.w3.org/2000/svg","svg"),o=41,a=27;n.setAttributeNS(null,"display","block"),n.setAttributeNS(null,"height",`${o}px`),n.setAttributeNS(null,"width",`${a}px`),n.setAttributeNS(null,"viewBox",`0 0 ${a} ${o}`);const h=ae.createNS("http://www.w3.org/2000/svg","g");h.setAttributeNS(null,"stroke","none"),h.setAttributeNS(null,"stroke-width","1"),h.setAttributeNS(null,"fill","none"),h.setAttributeNS(null,"fill-rule","evenodd");const m=ae.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"fill-rule","nonzero");const y=ae.createNS("http://www.w3.org/2000/svg","g");y.setAttributeNS(null,"transform","translate(3.0, 29.0)"),y.setAttributeNS(null,"fill","#000000");const v=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const H of v){const Y=ae.createNS("http://www.w3.org/2000/svg","ellipse");Y.setAttributeNS(null,"opacity","0.04"),Y.setAttributeNS(null,"cx","10.5"),Y.setAttributeNS(null,"cy","5.80029008"),Y.setAttributeNS(null,"rx",H.rx),Y.setAttributeNS(null,"ry",H.ry),y.appendChild(Y)}const b=ae.createNS("http://www.w3.org/2000/svg","g");b.setAttributeNS(null,"fill",this._color);const P=ae.createNS("http://www.w3.org/2000/svg","path");P.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),b.appendChild(P);const k=ae.createNS("http://www.w3.org/2000/svg","g");k.setAttributeNS(null,"opacity","0.25"),k.setAttributeNS(null,"fill","#000000");const L=ae.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"),k.appendChild(L);const B=ae.createNS("http://www.w3.org/2000/svg","g");B.setAttributeNS(null,"transform","translate(6.0, 7.0)"),B.setAttributeNS(null,"fill","#FFFFFF");const N=ae.createNS("http://www.w3.org/2000/svg","g");N.setAttributeNS(null,"transform","translate(8.0, 8.0)");const Z=ae.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 j=ae.createNS("http://www.w3.org/2000/svg","circle");j.setAttributeNS(null,"fill","#FFFFFF"),j.setAttributeNS(null,"cx","5.5"),j.setAttributeNS(null,"cy","5.5"),j.setAttributeNS(null,"r","5.4999962"),N.appendChild(Z),N.appendChild(j),m.appendChild(y),m.appendChild(b),m.appendChild(k),m.appendChild(B),m.appendChild(N),n.appendChild(m),n.setAttributeNS(null,"height",o*this._scale+"px"),n.setAttributeNS(null,"width",a*this._scale+"px"),this._element.appendChild(n),this._offset=c.P.convert(t&&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()}),Yr(this._element,this._anchor,"marker"),t&&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.setAttribute("aria-label",t._getUIString("Marker.Title")),t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),t.on("terrain",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",this._update),this._map.off("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),ae.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=c.N.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 a=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":[a,-1*(38.1-13.5+a)],"bottom-right":[-a,-1*(38.1-13.5+a)],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,o;if(!(!((n=this._map)===null||n===void 0)&&n.terrain))return void(this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity));if(t)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const a=this._map,h=a.terrain.depthAtPoint(this._pos),m=a.terrain.getElevationForLngLatZoom(this._lngLat,a.transform.tileZoom);if(a.transform.lngLatToCameraDepth(this._lngLat,m)-h<.006)return void(this._element.style.opacity=this._opacity);const y=-this._offset.y/a.transform._pixelPerMeter,v=Math.sin(a.getPitch()*Math.PI/180)*y,b=a.terrain.depthAtPoint(new c.P(this._pos.x,this._pos.y-this._offset.y)),P=a.transform.lngLatToCameraDepth(this._lngLat,m+v)-b>.006;!((o=this._popup)===null||o===void 0)&&o.isOpen()&&P&&this._popup.remove(),this._element.style.opacity=P?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(t){return this._offset=c.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 t===void 0&&n===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),t!==void 0&&(this._opacity=t),n!==void 0&&(this._opacityWhenCovered=n),this._map&&this._updateOpacity(!0),this}}const _o={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Un=0,jn=!1;const Hl={maxWidth:100,unit:"metric"};function za(u,t,n){const o=n&&n.maxWidth||100,a=u._container.clientHeight/2,h=u.unproject([0,a]),m=u.unproject([o,a]),y=h.distanceTo(m);if(n&&n.unit==="imperial"){const v=3.2808*y;v>5280?Es(t,o,v/5280,u._getUIString("ScaleControl.Miles")):Es(t,o,v,u._getUIString("ScaleControl.Feet"))}else n&&n.unit==="nautical"?Es(t,o,y/1852,u._getUIString("ScaleControl.NauticalMiles")):y>=1e3?Es(t,o,y/1e3,u._getUIString("ScaleControl.Kilometers")):Es(t,o,y,u._getUIString("ScaleControl.Meters"))}function Es(u,t,n,o){const a=function(h){const m=Math.pow(10,`${Math.floor(h)}`.length-1);let y=h/m;return y=y>=10?10:y>=5?5:y>=3?3:y>=2?2:y>=1?1:function(v){const b=Math.pow(10,Math.ceil(-Math.log(v)/Math.LN10));return Math.round(v*b)/b}(y),m*y}(n);u.style.width=t*(a/n)+"px",u.innerHTML=`${a} ${o}`}const vr={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},yo=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function qe(u){if(u){if(typeof u=="number"){const t=Math.round(Math.abs(u)/Math.SQRT2);return{center:new c.P(0,0),top:new c.P(0,u),"top-left":new c.P(t,t),"top-right":new c.P(-t,t),bottom:new c.P(0,-u),"bottom-left":new c.P(t,-t),"bottom-right":new c.P(-t,-t),left:new c.P(u,0),right:new c.P(-u,0)}}if(u instanceof c.P||Array.isArray(u)){const t=c.P.convert(u);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:c.P.convert(u.center||[0,0]),top:c.P.convert(u.top||[0,0]),"top-left":c.P.convert(u["top-left"]||[0,0]),"top-right":c.P.convert(u["top-right"]||[0,0]),bottom:c.P.convert(u.bottom||[0,0]),"bottom-left":c.P.convert(u["bottom-left"]||[0,0]),"bottom-right":c.P.convert(u["bottom-right"]||[0,0]),left:c.P.convert(u.left||[0,0]),right:c.P.convert(u.right||[0,0])}}return qe(new c.P(0,0))}const Je=ye;T.AJAXError=c.bg,T.Evented=c.E,T.LngLat=c.N,T.MercatorCoordinate=c.Z,T.Point=c.P,T.addProtocol=c.bh,T.config=c.a,T.removeProtocol=c.bi,T.AttributionControl=Nn,T.BoxZoomHandler=da,T.CanvasSource=Hi,T.CooperativeGesturesHandler=ir,T.DoubleClickZoomHandler=Ta,T.DragPanHandler=Wi,T.DragRotateHandler=tr,T.EdgeInsets=co,T.FullscreenControl=class extends c.E{constructor(u={}){super(),this._onFullscreenChange=()=>{var t;let n=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((t=n==null?void 0:n.shadowRoot)===null||t===void 0)&&t.fullscreenElement;)n=n.shadowRoot.fullscreenElement;n===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,u&&u.container&&(u.container instanceof HTMLElement?this._container=u.container:c.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(u){return this._map=u,this._container||(this._container=this._map.getContainer()),this._controlContainer=ae.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){ae.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const u=this._fullscreenButton=ae.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);ae.create("span","maplibregl-ctrl-icon",u).setAttribute("aria-hidden","true"),u.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const u=this._getTitle();this._fullscreenButton.setAttribute("aria-label",u),this._fullscreenButton.title=u}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new c.k("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new c.k("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},T.GeoJSONSource=ss,T.GeolocateControl=class extends c.E{constructor(u){super(),this._onSuccess=t=>{if(this._map){if(this._isOutOfMapMaxBounds(t))return this._setErrorState(),this.fire(new c.k("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 c.k("geolocate",t)),this._finish()}},this._updateCamera=t=>{const n=new c.N(t.coords.longitude,t.coords.latitude),o=t.coords.accuracy,a=this._map.getBearing(),h=c.e({bearing:a},this.options.fitBoundsOptions),m=ue.fromLngLat(n,o);this._map.fitBounds(m,h,{geolocateSource:!0})},this._updateMarker=t=>{if(t){const n=new c.N(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.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=t=>{if(this._map){if(this.options.trackUserLocation)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&&jn)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new c.k("error",t)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",t=>t.preventDefault()),this._geolocateButton=ae.create("button","maplibregl-ctrl-geolocate",this._container),ae.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){c.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=ae.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Ct({element:this._dotElement}),this._circleElement=ae.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Ct({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",n=>{n.geolocateSource||this._watchState!=="ACTIVE_LOCK"||n.originalEvent&&n.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new c.k("trackuserlocationend")),this.fire(new c.k("userlocationlostfocus")))})}},this.options=c.e({},_o,u)}onAdd(u){return this._map=u,this._container=ae.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return c._(this,arguments,void 0,function*(t=!1){if(Kr!==void 0&&!t)return Kr;if(window.navigator.permissions===void 0)return Kr=!!window.navigator.geolocation,Kr;try{Kr=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{Kr=!!window.navigator.geolocation}return Kr})}().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(),ae.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Un=0,jn=!1}_isOutOfMapMaxBounds(u){const t=this._map.getMaxBounds(),n=u.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":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){const u=this._map.getBounds(),t=u.getSouthEast(),n=u.getNorthEast(),o=t.distanceTo(n),a=Math.ceil(this._accuracy/(o/this._map._container.clientHeight)*2);this._circleElement.style.width=`${a}px`,this._circleElement.style.height=`${a}px`}trigger(){if(!this._setup)return c.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 c.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Un--,jn=!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 c.k("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 c.k("trackuserlocationstart")),this.fire(new c.k("userlocationfocus"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let u;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Un++,Un>1?(u={maximumAge:6e5,timeout:0},jn=!0):(u=this.options.positionOptions,jn=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,u)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},T.Hash=ws,T.ImageSource=Cr,T.KeyboardHandler=ba,T.LngLatBounds=ue,T.LogoControl=yr,T.Map=class extends eh{constructor(u){c.be.mark(c.bf.create);const t=Object.assign(Object.assign({},th),u);if(t.minZoom!=null&&t.maxZoom!=null&&t.minZoom>t.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(t.minPitch!=null&&t.maxPitch!=null&&t.minPitch>t.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(t.minPitch!=null&&t.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(t.maxPitch!=null&&t.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new aa(t.minZoom,t.maxZoom,t.minPitch,t.maxPitch,t.renderWorldCopies),{bearingSnap:t.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new Oe,this._controls=[],this._mapId=c.a4(),this._contextLost=n=>{n.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new c.k("webglcontextlost",{originalEvent:n}))},this._contextRestored=n=>{this._setupPainter(),this.resize(),this._update(),this.fire(new c.k("webglcontextrestored",{originalEvent:n}))},this._onMapScroll=n=>{if(n.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=t.interactive,this._maxTileCacheSize=t.maxTileCacheSize,this._maxTileCacheZoomLevels=t.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=t.failIfMajorPerformanceCaveat===!0,this._preserveDrawingBuffer=t.preserveDrawingBuffer===!0,this._antialias=t.antialias===!0,this._trackResize=t.trackResize===!0,this._bearingSnap=t.bearingSnap,this._refreshExpiredTiles=t.refreshExpiredTiles===!0,this._fadeDuration=t.fadeDuration,this._crossSourceCollisions=t.crossSourceCollisions===!0,this._collectResourceTiming=t.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},De),t.locale),this._clickTolerance=t.clickTolerance,this._overridePixelRatio=t.pixelRatio,this._maxCanvasSize=t.maxCanvasSize,this.transformCameraUpdate=t.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=t.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=Ee.addThrottleControl(()=>this.isMoving()),this._requestManager=new Pt(t.transformRequest),typeof t.container=="string"){if(this._container=document.getElementById(t.container),!this._container)throw new Error(`Container '${t.container}' not found.`)}else{if(!(t.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=t.container}if(t.maxBounds&&this.setMaxBounds(t.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)).on("moveend",()=>this._update(!1)).on("zoom",()=>this._update(!0)).on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}).once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let n=!1;const o=ho(a=>{this._trackResize&&!this._removed&&this.resize(a)._update()},50);this._resizeObserver=new ResizeObserver(a=>{n?o(a):n=!0}),this._resizeObserver.observe(this._container)}this.handlers=new Qc(this,t),this._hash=t.hash&&new ws(typeof t.hash=="string"&&t.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:t.center,zoom:t.zoom,bearing:t.bearing,pitch:t.pitch}),t.bounds&&(this.resize(),this.fitBounds(t.bounds,c.e({},t.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=t.localIdeographFontFamily,this._validateStyle=t.validateStyle,t.style&&this.setStyle(t.style,{localIdeographFontFamily:t.localIdeographFontFamily}),t.attributionControl&&this.addControl(new Nn(typeof t.attributionControl=="boolean"?void 0:t.attributionControl)),t.maplibreLogo&&this.addControl(new yr,t.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",n=>{this._update(n.dataType==="style"),this.fire(new c.k(`${n.dataType}data`,n))}),this.on("dataloading",n=>{this.fire(new c.k(`${n.dataType}dataloading`,n))}),this.on("dataabort",n=>{this.fire(new c.k("sourcedataabort",n))})}_getMapId(){return this._mapId}addControl(u,t){if(t===void 0&&(t=u.getDefaultPosition?u.getDefaultPosition():"top-right"),!u||!u.onAdd)return this.fire(new c.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const n=u.onAdd(this);this._controls.push(u);const o=this._controlPositions[t];return t.indexOf("bottom")!==-1?o.insertBefore(n,o.firstChild):o.appendChild(n),this}removeControl(u){if(!u||!u.onRemove)return this.fire(new c.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(u);return t>-1&&this._controls.splice(t,1),u.onRemove(this),this}hasControl(u){return this._controls.indexOf(u)>-1}calculateCameraOptionsFromTo(u,t,n,o){return o==null&&this.terrain&&(o=this.terrain.getElevationForLngLatZoom(n,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(u,t,n,o)}resize(u){var t;const n=this._containerDimensions(),o=n[0],a=n[1],h=this._getClampedPixelRatio(o,a);if(this._resizeCanvas(o,a,h),this.painter.resize(o,a,h),this.painter.overLimit()){const y=this.painter.context.gl;this._maxCanvasSize=[y.drawingBufferWidth,y.drawingBufferHeight];const v=this._getClampedPixelRatio(o,a);this._resizeCanvas(o,a,v),this.painter.resize(o,a,v)}this.transform.resize(o,a),(t=this._requestedCameraState)===null||t===void 0||t.resize(o,a);const m=!this._moving;return m&&(this.stop(),this.fire(new c.k("movestart",u)).fire(new c.k("move",u))),this.fire(new c.k("resize",u)),m&&this.fire(new c.k("moveend",u)),this}_getClampedPixelRatio(u,t){const{0:n,1:o}=this._maxCanvasSize,a=this.getPixelRatio(),h=u*a,m=t*a;return Math.min(h>n?n/h:1,m>o?o/m:1)*a}getPixelRatio(){var u;return(u=this._overridePixelRatio)!==null&&u!==void 0?u:devicePixelRatio}setPixelRatio(u){this._overridePixelRatio=u,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(u){return this.transform.setMaxBounds(ue.convert(u)),this._update()}setMinZoom(u){if((u=u??-2)>=-2&&u<=this.transform.maxZoom)return this.transform.minZoom=u,this._update(),this.getZoom()<u&&this.setZoom(u),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(u){if((u=u??22)>=this.transform.minZoom)return this.transform.maxZoom=u,this._update(),this.getZoom()>u&&this.setZoom(u),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(u){if((u=u??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(u>=0&&u<=this.transform.maxPitch)return this.transform.minPitch=u,this._update(),this.getPitch()<u&&this.setPitch(u),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(u){if((u=u??60)>85)throw new Error("maxPitch must be less than or equal to 85");if(u>=this.transform.minPitch)return this.transform.maxPitch=u,this._update(),this.getPitch()>u&&this.setPitch(u),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(u){return this.transform.renderWorldCopies=u,this._update()}project(u){return this.transform.locationPoint(c.N.convert(u),this.style&&this.terrain)}unproject(u){return this.transform.pointLocation(c.P.convert(u),this.terrain)}isMoving(){var u;return this._moving||((u=this.handlers)===null||u===void 0?void 0:u.isMoving())}isZooming(){var u;return this._zooming||((u=this.handlers)===null||u===void 0?void 0:u.isZooming())}isRotating(){var u;return this._rotating||((u=this.handlers)===null||u===void 0?void 0:u.isRotating())}_createDelegatedListener(u,t,n){if(u==="mouseenter"||u==="mouseover"){let o=!1;return{layer:t,listener:n,delegates:{mousemove:h=>{const m=this.getLayer(t)?this.queryRenderedFeatures(h.point,{layers:[t]}):[];m.length?o||(o=!0,n.call(this,new Ti(u,this,h.originalEvent,{features:m}))):o=!1},mouseout:()=>{o=!1}}}}if(u==="mouseleave"||u==="mouseout"){let o=!1;return{layer:t,listener:n,delegates:{mousemove:m=>{(this.getLayer(t)?this.queryRenderedFeatures(m.point,{layers:[t]}):[]).length?o=!0:o&&(o=!1,n.call(this,new Ti(u,this,m.originalEvent)))},mouseout:m=>{o&&(o=!1,n.call(this,new Ti(u,this,m.originalEvent)))}}}}{const o=a=>{const h=this.getLayer(t)?this.queryRenderedFeatures(a.point,{layers:[t]}):[];h.length&&(a.features=h,n.call(this,a),delete a.features)};return{layer:t,listener:n,delegates:{[u]:o}}}}on(u,t,n){if(n===void 0)return super.on(u,t);const o=this._createDelegatedListener(u,t,n);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[u]=this._delegatedListeners[u]||[],this._delegatedListeners[u].push(o);for(const a in o.delegates)this.on(a,o.delegates[a]);return this}once(u,t,n){if(n===void 0)return super.once(u,t);const o=this._createDelegatedListener(u,t,n);for(const a in o.delegates)this.once(a,o.delegates[a]);return this}off(u,t,n){return n===void 0?super.off(u,t):(this._delegatedListeners&&this._delegatedListeners[u]&&(o=>{const a=this._delegatedListeners[u];for(let h=0;h<a.length;h++){const m=a[h];if(m.layer===t&&m.listener===n){for(const y in m.delegates)this.off(y,m.delegates[y]);return a.splice(h,1),this}}})(),this)}queryRenderedFeatures(u,t){if(!this.style)return[];let n;const o=u instanceof c.P||Array.isArray(u),a=o?u:[[0,0],[this.transform.width,this.transform.height]];if(t=t||(o?{}:u)||{},a instanceof c.P||typeof a[0]=="number")n=[c.P.convert(a)];else{const h=c.P.convert(a[0]),m=c.P.convert(a[1]);n=[h,new c.P(m.x,h.y),m,new c.P(h.x,m.y),h]}return this.style.queryRenderedFeatures(n,t,this.transform)}querySourceFeatures(u,t){return this.style.querySourceFeatures(u,t)}setStyle(u,t){return(t=c.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},t)).diff!==!1&&t.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&u?(this._diffStyle(u,t),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._updateStyle(u,t))}setTransformRequest(u){return this._requestManager.setTransformRequest(u),this}_getUIString(u){const t=this._locale[u];if(t==null)throw new Error(`Missing UI string '${u}'`);return t}_updateStyle(u,t){if(t.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(u,t));const n=this.style&&t.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!u)),u?(this.style=new jo(this,t||{}),this.style.setEventedParent(this,{style:this.style}),typeof u=="string"?this.style.loadURL(u,t,n):this.style.loadJSON(u,t,n),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new jo(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(u,t){if(typeof u=="string"){const n=this._requestManager.transformRequest(u,"Style");c.h(n,new AbortController).then(o=>{this._updateDiff(o.data,t)}).catch(o=>{o&&this.fire(new c.j(o))})}else typeof u=="object"&&this._updateDiff(u,t)}_updateDiff(u,t){try{this.style.setState(u,t)&&this._update(!0)}catch(n){c.w(`Unable to perform style diff: ${n.message||n.error||n}. Rebuilding the style from scratch.`),this._updateStyle(u,t)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():c.w("There is no style added to the map.")}addSource(u,t){return this._lazyInitEmptyStyle(),this.style.addSource(u,t),this._update(!0)}isSourceLoaded(u){const t=this.style&&this.style.sourceCaches[u];if(t!==void 0)return t.loaded();this.fire(new c.j(new Error(`There is no source with ID '${u}'`)))}setTerrain(u){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),u){const t=this.style.sourceCaches[u.source];if(!t)throw new Error(`cannot load terrain, because there exists no source with ID: ${u.source}`);this.terrain===null&&t.reload();for(const n in this.style._layers){const o=this.style._layers[n];o.type==="hillshade"&&o.source===u.source&&c.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new jl(this.painter,t,u),this.painter.renderToTexture=new $l(this.painter,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=n=>{n.dataType==="style"?this.terrain.sourceCache.freeRtt():n.dataType==="source"&&n.tile&&(n.sourceId!==u.source||this._elevationFreeze||(this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(n.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.minElevationForCurrentTile=0,this.transform.elevation=0;return this.fire(new c.k("terrain",{terrain:u})),this}getTerrain(){var u,t;return(t=(u=this.terrain)===null||u===void 0?void 0:u.options)!==null&&t!==void 0?t:null}areTilesLoaded(){const u=this.style&&this.style.sourceCaches;for(const t in u){const n=u[t]._tiles;for(const o in n){const a=n[o];if(a.state!=="loaded"&&a.state!=="errored")return!1}}return!0}removeSource(u){return this.style.removeSource(u),this._update(!0)}getSource(u){return this.style.getSource(u)}addImage(u,t,n={}){const{pixelRatio:o=1,sdf:a=!1,stretchX:h,stretchY:m,content:y,textFitWidth:v,textFitHeight:b}=n;if(this._lazyInitEmptyStyle(),!(t instanceof HTMLImageElement||c.b(t))){if(t.width===void 0||t.height===void 0)return this.fire(new c.j(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:P,height:k,data:L}=t,B=t;return this.style.addImage(u,{data:new c.R({width:P,height:k},new Uint8Array(L)),pixelRatio:o,stretchX:h,stretchY:m,content:y,textFitWidth:v,textFitHeight:b,sdf:a,version:0,userImage:B}),B.onAdd&&B.onAdd(this,u),this}}{const{width:P,height:k,data:L}=le.getImageData(t);this.style.addImage(u,{data:new c.R({width:P,height:k},L),pixelRatio:o,stretchX:h,stretchY:m,content:y,textFitWidth:v,textFitHeight:b,sdf:a,version:0})}}updateImage(u,t){const n=this.style.getImage(u);if(!n)return this.fire(new c.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const o=t instanceof HTMLImageElement||c.b(t)?le.getImageData(t):t,{width:a,height:h,data:m}=o;if(a===void 0||h===void 0)return this.fire(new c.j(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(a!==n.data.width||h!==n.data.height)return this.fire(new c.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));const y=!(t instanceof HTMLImageElement||c.b(t));return n.data.replace(m,y),this.style.updateImage(u,n),this}getImage(u){return this.style.getImage(u)}hasImage(u){return u?!!this.style.getImage(u):(this.fire(new c.j(new Error("Missing required image id"))),!1)}removeImage(u){this.style.removeImage(u)}loadImage(u){return Ee.getImage(this._requestManager.transformRequest(u,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(u,t){return this._lazyInitEmptyStyle(),this.style.addLayer(u,t),this._update(!0)}moveLayer(u,t){return this.style.moveLayer(u,t),this._update(!0)}removeLayer(u){return this.style.removeLayer(u),this._update(!0)}getLayer(u){return this.style.getLayer(u)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(u,t,n){return this.style.setLayerZoomRange(u,t,n),this._update(!0)}setFilter(u,t,n={}){return this.style.setFilter(u,t,n),this._update(!0)}getFilter(u){return this.style.getFilter(u)}setPaintProperty(u,t,n,o={}){return this.style.setPaintProperty(u,t,n,o),this._update(!0)}getPaintProperty(u,t){return this.style.getPaintProperty(u,t)}setLayoutProperty(u,t,n,o={}){return this.style.setLayoutProperty(u,t,n,o),this._update(!0)}getLayoutProperty(u,t){return this.style.getLayoutProperty(u,t)}setGlyphs(u,t={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(u,t),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(u,t,n={}){return this._lazyInitEmptyStyle(),this.style.addSprite(u,t,n,o=>{o||this._update(!0)}),this}removeSprite(u){return this._lazyInitEmptyStyle(),this.style.removeSprite(u),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(u,t={}){return this._lazyInitEmptyStyle(),this.style.setSprite(u,t,n=>{n||this._update(!0)}),this}setLight(u,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(u,t),this._update(!0)}getLight(){return this.style.getLight()}setSky(u){return this._lazyInitEmptyStyle(),this.style.setSky(u),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(u,t){return this.style.setFeatureState(u,t),this._update()}removeFeatureState(u,t){return this.style.removeFeatureState(u,t),this._update()}getFeatureState(u){return this.style.getFeatureState(u)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let u=0,t=0;return this._container&&(u=this._container.clientWidth||400,t=this._container.clientHeight||300),[u,t]}_setupContainer(){const u=this._container;u.classList.add("maplibregl-map");const t=this._canvasContainer=ae.create("div","maplibregl-canvas-container",u);this._interactive&&t.classList.add("maplibregl-interactive"),this._canvas=ae.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(),o=this._getClampedPixelRatio(n[0],n[1]);this._resizeCanvas(n[0],n[1],o);const a=this._controlContainer=ae.create("div","maplibregl-control-container",u),h=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(m=>{h[m]=ae.create("div",`maplibregl-ctrl-${m} `,a)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(u,t,n){this._canvas.width=Math.floor(n*u),this._canvas.height=Math.floor(n*t),this._canvas.style.width=`${u}px`,this._canvas.style.height=`${t}px`}_setupPainter(){const u={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let t=null;this._canvas.addEventListener("webglcontextcreationerror",o=>{t={requestedAttributes:u},o&&(t.statusMessage=o.statusMessage,t.type=o.type)},{once:!0});const n=this._canvas.getContext("webgl2",u)||this._canvas.getContext("webgl",u);if(!n){const o="Failed to initialize WebGL";throw t?(t.message=o,new Error(JSON.stringify(t))):new Error(o)}this.painter=new Rl(n,this.transform),gt.testSupport(n)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(u){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||u,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(u){return this._update(),this._renderTaskQueue.add(u)}_cancelRenderFrame(u){this._renderTaskQueue.remove(u)}_render(u){const t=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(u),this._removed)return;let n=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const a=this.transform.zoom,h=le.now();this.style.zoomHistory.update(a,h);const m=new c.a9(a,{now:h,fadeDuration:t,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),y=m.crossFadingFactor();y===1&&y===this._crossFadingFactor||(n=!0,this._crossFadingFactor=y),this.style.update(m)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.minElevationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,t,this._crossSourceCollisions),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}),this.fire(new c.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,c.be.mark(c.bf.load),this.fire(new c.k("load"))),this.style&&(this.style.hasTransitions()||n)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const o=this._sourcesDirty||this._styleDirty||this._placementDirty;return o||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new c.k("idle")),!this._loaded||this._fullyLoaded||o||(this._fullyLoaded=!0,c.be.mark(c.bf.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var u;this._hash&&this._hash.remove();for(const n of this._controls)n.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),Ee.removeThrottleControl(this._imageQueueHandle),(u=this._resizeObserver)===null||u===void 0||u.disconnect();const t=this.painter.context.gl.getExtension("WEBGL_lose_context");t!=null&&t.loseContext&&t.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),ae.remove(this._canvasContainer),ae.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),c.be.clearMetrics(),this._removed=!0,this.fire(new c.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,le.frameAsync(this._frameRequest).then(u=>{c.be.frame(u),this._frameRequest=null,this._render(u)}).catch(()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(u){this._showTileBoundaries!==u&&(this._showTileBoundaries=u,this._update())}get showPadding(){return!!this._showPadding}set showPadding(u){this._showPadding!==u&&(this._showPadding=u,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(u){this._showCollisionBoxes!==u&&(this._showCollisionBoxes=u,u?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(u){this._showOverdrawInspector!==u&&(this._showOverdrawInspector=u,this._update())}get repaint(){return!!this._repaint}set repaint(u){this._repaint!==u&&(this._repaint=u,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(u){this._vertices=u,this._update()}get version(){return Ca}getCameraTargetElevation(){return this.transform.elevation}},T.MapMouseEvent=Ti,T.MapTouchEvent=Ss,T.MapWheelEvent=ha,T.Marker=Ct,T.NavigationControl=class{constructor(u){this._updateZoomButtons=()=>{const t=this._map.getZoom(),n=t===this._map.getMaxZoom(),o=t===this._map.getMinZoom();this._zoomInButton.disabled=n,this._zoomOutButton.disabled=o,this._zoomInButton.setAttribute("aria-disabled",n.toString()),this._zoomOutButton.setAttribute("aria-disabled",o.toString())},this._rotateCompassArrow=()=>{const t=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=t},this._setButtonTitle=(t,n)=>{const o=this._map._getUIString(`NavigationControl.${n}`);t.title=o,t.setAttribute("aria-label",o)},this.options=c.e({},Ea,u),this._container=ae.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})),ae.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})),ae.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=ae.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(u){return this._map=u,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Zl(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){ae.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(u,t){const n=ae.create("button",u,this._container);return n.type="button",n.addEventListener("click",t),n}},T.Popup=class extends c.E{constructor(u){super(),this.remove=()=>(this._content&&ae.remove(this._content),this._container&&(ae.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new c.k("close"))),this),this._onMouseUp=t=>{this._update(t.point)},this._onMouseMove=t=>{this._update(t.point)},this._onDrag=t=>{this._update(t.point)},this._update=t=>{var n;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=ae.create("div","maplibregl-popup",this._map.getContainer()),this._tip=ae.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const y of this.options.className.split(" "))this._container.classList.add(y);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=this._map.transform.renderWorldCopies&&!this._trackPointer?Gl(this._lngLat,this._flatPos,this._map.transform):(n=this._lngLat)===null||n===void 0?void 0:n.wrap(),this._trackPointer&&!t)return;const o=this._flatPos=this._pos=this._trackPointer&&t?t:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&t?t:this._map.transform.locationPoint(this._lngLat));let a=this.options.anchor;const h=qe(this.options.offset);if(!a){const y=this._container.offsetWidth,v=this._container.offsetHeight;let b;b=o.y+h.bottom.y<v?["top"]:o.y>this._map.transform.height-v?["bottom"]:[],o.x<y/2?b.push("left"):o.x>this._map.transform.width-y/2&&b.push("right"),a=b.length===0?"bottom":b.join("-")}let m=o.add(h[a]);this.options.subpixelPositioning||(m=m.round()),ae.setTransform(this._container,`${Ma[a]} translate(${m.x}px,${m.y}px)`),Yr(this._container,a,"popup")},this._onClose=()=>{this.remove()},this.options=c.e(Object.create(vr),u)}addTo(u){return this._map&&this.remove(),this._map=u,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new c.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(u){return this._lngLat=c.N.convert(u),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(u){return this.setDOMContent(document.createTextNode(u))}setHTML(u){const t=document.createDocumentFragment(),n=document.createElement("body");let o;for(n.innerHTML=u;o=n.firstChild,o;)t.appendChild(o);return this.setDOMContent(t)}getMaxWidth(){var u;return(u=this._container)===null||u===void 0?void 0:u.style.maxWidth}setMaxWidth(u){return this.options.maxWidth=u,this._update(),this}setDOMContent(u){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=ae.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(u),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(u){return this._container&&this._container.classList.add(u),this}removeClassName(u){return this._container&&this._container.classList.remove(u),this}setOffset(u){return this.options.offset=u,this._update(),this}toggleClassName(u){if(this._container)return this._container.classList.toggle(u)}setSubpixelPositioning(u){this.options.subpixelPositioning=u}_createCloseButton(){this.options.closeButton&&(this._closeButton=ae.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const u=this._container.querySelector(yo);u&&u.focus()}},T.RasterDEMTileSource=$t,T.RasterTileSource=_t,T.ScaleControl=class{constructor(u){this._onMove=()=>{za(this._map,this._container,this.options)},this.setUnit=t=>{this.options.unit=t,za(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Hl),u)}getDefaultPosition(){return"bottom-left"}onAdd(u){return this._map=u,this._container=ae.create("div","maplibregl-ctrl maplibregl-ctrl-scale",u.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){ae.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},T.ScrollZoomHandler=Sa,T.Style=jo,T.TerrainControl=class{constructor(u){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=u}onAdd(u){return this._map=u,this._container=ae.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=ae.create("button","maplibregl-ctrl-terrain",this._container),ae.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(){ae.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},T.TwoFingersTouchPitchHandler=va,T.TwoFingersTouchRotateHandler=xa,T.TwoFingersTouchZoomHandler=_a,T.TwoFingersTouchZoomRotateHandler=Ia,T.VectorTileSource=ns,T.VideoSource=Mn,T.addSourceType=(u,t)=>c._(void 0,void 0,void 0,function*(){if(as(u))throw new Error(`A source type called "${u}" already exists.`);((n,o)=>{os[n]=o})(u,t)}),T.clearPrewarmedResources=function(){const u=Fi;u&&(u.isPreloaded()&&u.numActive()===1?(u.release(Ur),Fi=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()"))},T.getMaxParallelImageRequests=function(){return c.a.MAX_PARALLEL_IMAGE_REQUESTS},T.getRTLTextPluginStatus=function(){return fr().getRTLTextPluginStatus()},T.getVersion=function(){return Je},T.getWorkerCount=function(){return dr.workerCount},T.getWorkerUrl=function(){return c.a.WORKER_URL},T.importScriptInWorkers=function(u){return rs().broadcast("IS",u)},T.prewarm=function(){an().acquire(Ur)},T.setMaxParallelImageRequests=function(u){c.a.MAX_PARALLEL_IMAGE_REQUESTS=u},T.setRTLTextPlugin=function(u,t){return fr().setRTLTextPlugin(u,t)},T.setWorkerCount=function(u){dr.workerCount=u},T.setWorkerUrl=function(u){c.a.WORKER_URL=u}});var W=A;return W})})(Gh);var Cp=Gh.exports;const il=Ap(Cp);function Ep(g){return[{type:"fill",paint:{"fill-color":g.color||"#ccc","fill-outline-color":g.color||"blue","fill-opacity":g.opacity||1}}]}function Mp(g){return[{type:"line",paint:{"line-color":g.color||"#ccc","line-opacity":g.opacity||1}}]}function zp(g){return[{type:"circle",paint:{"circle-radius":g.radius||6,"circle-stroke-color":g.stroke||"#ccc","circle-stroke-width":g.width||1,"circle-color":g.color||"blue"}}]}function Hh(g){if(!g)return null;const S=g.type||"point";return S==="polygon"?Ep(g):S==="line"?Mp(g):zp(g)}const yc={data(){return{layerList:[],activeLayer:""}},computed:{interactiveSources(){return this.layerList.filter(g=>g==null?void 0:g.interactive).map(g=>g.id)}},methods:{moveLayer(g,S=this.map){S.getStyle().layers.forEach(A=>{A.id.match(g)&&S.moveLayer(A.id)})},async setVisible(g,S=!0,A=this.map){if(!g)return;const E=(g==null?void 0:g.id)||g,V=this.layerList.find(T=>T.id===g)||g;if(!(V!=null&&V.id))throw new Error("MixinError: Layer has no id");const W=A.getStyle().layers.filter(T=>T.id.match(E));W.forEach(T=>{A.setLayoutProperty(T.id,"visibility",S?"visible":"none")}),!W.length&&S&&await this.addLayer(V)},async addLayer(g,S={},A=this==null?void 0:this.map){var W,T,c;const E=this.layerList.find(ye=>ye.id===g)||g;this.map.getStyle().layers.find(ye=>ye.id===E.id)||(this.layerList.find(ye=>ye.id===E.id)||this.layerList.push(E),(E.service==="vtile"||E.service==="vector"||(W=E.url)!=null&&W.includes(".vmt"))&&this.addVtileLayer(E,A),E.service==="geojson"&&this.addGeoJsonLayer(E,A),((T=E.url)!=null&&T.includes(".png")||["tms","raster"].includes((c=E.service)==null?void 0:c.toLowerCase()))&&await this.addRasterLayer(E,S,A))},async addRasterLayer(g,S,A=this==null?void 0:this.map){await A.addSource(g.id,{type:"raster",tiles:[g==null?void 0:g.url],tileSize:256,...g!=null&&g.scheme?{scheme:g==null?void 0:g.scheme}:{}});const E=S.order===0?this.getOrder(S.order):null;await A.addLayer({id:g.id,type:"raster",source:g.id,minzoom:0,maxzoom:(g==null?void 0:g.maxzoom)||22},E)},async addVtileLayer(g,S=this==null?void 0:this.map){var W;const A=["props","pointZoom"].filter(T=>g[T]).map(T=>`&${T}=${g[T]}`),E={type:"vector",tiles:[`${(W=g==null?void 0:g.url)!=null&&W.startsWith("http")?"":window.location.origin}${g==null?void 0:g.url}${A}`],minzoom:g.minzoom||5,maxzoom:g.maxzoom||24};S.addSource(g.id,E),(Hh(g.style)||g.layers||[]).forEach((T,c)=>{const ye={...T,id:`${g.id}-${c}`,source:g.id,"source-layer":T["source-layer"]||g.source||g.id,maxzoom:+T.maxzoom||24,minzoom:+T.minzoom||0};S.addLayer(ye)})},async addGeoJsonLayer(g,S=this.map){var V;const A=g.data||((V=g==null?void 0:g.url)!=null&&V.startsWith("http")?"":window.location.origin)+g.url;S.addSource(g.id,{type:"geojson",data:A}),(Hh(g.style)||g.layers||[]).forEach(W=>{const T={...W,source:g.id,id:W.id||g.id,maxzoom:+W.maxzoom||24,minzoom:+W.minzoom||0,type:W.type||"circle"};S.addLayer(T)})},setLayerData(g,S){this.layerList=this.layerList.map(A=>A.id===g?{...A,...S}:A)},async removeLayer(g,S=this.map){await S.getStyle().layers.forEach(async A=>{A.source===g&&await S.removeLayer(A.id)}),S.getSource(g)&&await S.removeSource(g)},async setFilter(g,S){const A=this.layerList.find(V=>V.id===g);await(await this.map.getSource(g)).setTiles([`${window.location.origin}${A.url.split("&filter")[0]}${A.url.includes("?")?"&":"?"}filter=${S}${A.props?`&props=${A.props}`:""}`])},getOrder(g){var S;return((S=this.map.getStyle().layers[g])==null?void 0:S.id)||null},async changeBaseLayer(g){g!==this.activeLayer&&(this.activeLayer&&this.map.setLayoutProperty(this.activeLayer,"visibility","none"),await this.addLayer(g,{order:0}),this.map.setLayoutProperty(g,"visibility","visible"),this.activeLayer=g)},async refreshLayer(g,S=this.map){await S.getStyle().layers.forEach(A=>{A.source===g&&S.removeLayer(A.id)}),await S.removeSource(g),this.setVisible(g)}}},Or=(g,S)=>{const A=g.__vccOpts||g;for(const[E,V]of S)A[E]=V;return A},Dp={},Lp={class:"w-48 mx-auto mb-4",width:"178",height:"90",viewBox:"0 0 178 90",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Rp=[K.createStaticVNode('<rect x="27" y="50.5" width="124" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="27" y="50.5" width="124" height="39" rx="7.5" stroke="currentColor" class="stroke-stone-50 dark:stroke-neutral-700/10"></rect><rect x="34.5" y="58" width="24" height="24" rx="4" fill="currentColor" class="fill-stone-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="61" width="60" height="6" rx="3" fill="currentColor" class="fill-stone-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="73" width="77" height="6" rx="3" fill="currentColor" class="fill-stone-50 dark:fill-neutral-700/30"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" stroke="currentColor" class="stroke-stone-100 dark:stroke-neutral-700/30"></rect><rect x="27" y="36" width="24" height="24" rx="4" fill="currentColor" class="fill-stone-100 dark:fill-neutral-700/70"></rect><rect x="59" y="39" width="60" height="6" rx="3" fill="currentColor" class="fill-stone-100 dark:fill-neutral-700/70"></rect><rect x="59" y="51" width="92" height="6" rx="3" fill="currentColor" class="fill-stone-100 dark:fill-neutral-700/70"></rect><g filter="url(#filter2)"><rect x="12" y="6" width="154" height="40" rx="8" fill="currentColor" class="fill-white dark:fill-neutral-800" shape-rendering="crispEdges"></rect><rect x="12.5" y="6.5" width="153" height="39" rx="7.5" stroke="currentColor" class="stroke-stone-100 dark:stroke-neutral-700/60" shape-rendering="crispEdges"></rect><rect x="20" y="14" width="24" height="24" rx="4" fill="currentColor" class="fill-stone-200 dark:fill-neutral-700"></rect><rect x="52" y="17" width="60" height="6" rx="3" fill="currentColor" class="fill-stone-200 dark:fill-neutral-700"></rect><rect x="52" y="29" width="106" height="6" rx="3" fill="currentColor" class="fill-stone-200 dark:fill-neutral-700"></rect></g><defs><filter id="filter2" x="0" y="0" width="178" height="64" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"></feColorMatrix><feOffset dy="6"></feOffset><feGaussianBlur stdDeviation="6"></feGaussianBlur><feComposite in2="hardAlpha" operator="out"></feComposite><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0"></feColorMatrix><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1187_14810"></feBlend><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_1187_14810" result="shape"></feBlend></filter></defs>',12)];function Bp(g,S){return K.openBlock(),K.createElementBlock("svg",Lp,Rp)}const Fp=Or(Dp,[["render",Bp]]);function Xh(g,S){return function(){return g.apply(S,arguments)}}const{toString:Op}=Object.prototype,{getPrototypeOf:xc}=Object,rl=(g=>S=>{const A=Op.call(S);return g[A]||(g[A]=A.slice(8,-1).toLowerCase())})(Object.create(null)),Tr=g=>(g=g.toLowerCase(),S=>rl(S)===g),nl=g=>S=>typeof S===g,{isArray:Os}=Array,Bo=nl("undefined");function Vp(g){return g!==null&&!Bo(g)&&g.constructor!==null&&!Bo(g.constructor)&&Ki(g.constructor.isBuffer)&&g.constructor.isBuffer(g)}const Wh=Tr("ArrayBuffer");function Np(g){let S;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?S=ArrayBuffer.isView(g):S=g&&g.buffer&&Wh(g.buffer),S}const Up=nl("string"),Ki=nl("function"),Jh=nl("number"),sl=g=>g!==null&&typeof g=="object",jp=g=>g===!0||g===!1,ol=g=>{if(rl(g)!=="object")return!1;const S=xc(g);return(S===null||S===Object.prototype||Object.getPrototypeOf(S)===null)&&!(Symbol.toStringTag in g)&&!(Symbol.iterator in g)},$p=Tr("Date"),qp=Tr("File"),Zp=Tr("Blob"),Gp=Tr("FileList"),Hp=g=>sl(g)&&Ki(g.pipe),Xp=g=>{let S;return g&&(typeof FormData=="function"&&g instanceof FormData||Ki(g.append)&&((S=rl(g))==="formdata"||S==="object"&&Ki(g.toString)&&g.toString()==="[object FormData]"))},Wp=Tr("URLSearchParams"),[Jp,Kp,Yp,Qp]=["ReadableStream","Request","Response","Headers"].map(Tr),ef=g=>g.trim?g.trim():g.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Fo(g,S,{allOwnKeys:A=!1}={}){if(g===null||typeof g>"u")return;let E,V;if(typeof g!="object"&&(g=[g]),Os(g))for(E=0,V=g.length;E<V;E++)S.call(null,g[E],E,g);else{const W=A?Object.getOwnPropertyNames(g):Object.keys(g),T=W.length;let c;for(E=0;E<T;E++)c=W[E],S.call(null,g[c],c,g)}}function Kh(g,S){S=S.toLowerCase();const A=Object.keys(g);let E=A.length,V;for(;E-- >0;)if(V=A[E],S===V.toLowerCase())return V;return null}const es=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Yh=g=>!Bo(g)&&g!==es;function vc(){const{caseless:g}=Yh(this)&&this||{},S={},A=(E,V)=>{const W=g&&Kh(S,V)||V;ol(S[W])&&ol(E)?S[W]=vc(S[W],E):ol(E)?S[W]=vc({},E):Os(E)?S[W]=E.slice():S[W]=E};for(let E=0,V=arguments.length;E<V;E++)arguments[E]&&Fo(arguments[E],A);return S}const tf=(g,S,A,{allOwnKeys:E}={})=>(Fo(S,(V,W)=>{A&&Ki(V)?g[W]=Xh(V,A):g[W]=V},{allOwnKeys:E}),g),rf=g=>(g.charCodeAt(0)===65279&&(g=g.slice(1)),g),nf=(g,S,A,E)=>{g.prototype=Object.create(S.prototype,E),g.prototype.constructor=g,Object.defineProperty(g,"super",{value:S.prototype}),A&&Object.assign(g.prototype,A)},sf=(g,S,A,E)=>{let V,W,T;const c={};if(S=S||{},g==null)return S;do{for(V=Object.getOwnPropertyNames(g),W=V.length;W-- >0;)T=V[W],(!E||E(T,g,S))&&!c[T]&&(S[T]=g[T],c[T]=!0);g=A!==!1&&xc(g)}while(g&&(!A||A(g,S))&&g!==Object.prototype);return S},of=(g,S,A)=>{g=String(g),(A===void 0||A>g.length)&&(A=g.length),A-=S.length;const E=g.indexOf(S,A);return E!==-1&&E===A},af=g=>{if(!g)return null;if(Os(g))return g;let S=g.length;if(!Jh(S))return null;const A=new Array(S);for(;S-- >0;)A[S]=g[S];return A},lf=(g=>S=>g&&S instanceof g)(typeof Uint8Array<"u"&&xc(Uint8Array)),cf=(g,S)=>{const E=(g&&g[Symbol.iterator]).call(g);let V;for(;(V=E.next())&&!V.done;){const W=V.value;S.call(g,W[0],W[1])}},hf=(g,S)=>{let A;const E=[];for(;(A=g.exec(S))!==null;)E.push(A);return E},uf=Tr("HTMLFormElement"),df=g=>g.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(A,E,V){return E.toUpperCase()+V}),Qh=(({hasOwnProperty:g})=>(S,A)=>g.call(S,A))(Object.prototype),pf=Tr("RegExp"),eu=(g,S)=>{const A=Object.getOwnPropertyDescriptors(g),E={};Fo(A,(V,W)=>{let T;(T=S(V,W,g))!==!1&&(E[W]=T||V)}),Object.defineProperties(g,E)},ff=g=>{eu(g,(S,A)=>{if(Ki(g)&&["arguments","caller","callee"].indexOf(A)!==-1)return!1;const E=g[A];if(Ki(E)){if(S.enumerable=!1,"writable"in S){S.writable=!1;return}S.set||(S.set=()=>{throw Error("Can not rewrite read-only method '"+A+"'")})}})},mf=(g,S)=>{const A={},E=V=>{V.forEach(W=>{A[W]=!0})};return Os(g)?E(g):E(String(g).split(S)),A},gf=()=>{},_f=(g,S)=>g!=null&&Number.isFinite(g=+g)?g:S,bc="abcdefghijklmnopqrstuvwxyz",tu="0123456789",iu={DIGIT:tu,ALPHA:bc,ALPHA_DIGIT:bc+bc.toUpperCase()+tu},yf=(g=16,S=iu.ALPHA_DIGIT)=>{let A="";const{length:E}=S;for(;g--;)A+=S[Math.random()*E|0];return A};function xf(g){return!!(g&&Ki(g.append)&&g[Symbol.toStringTag]==="FormData"&&g[Symbol.iterator])}const vf=g=>{const S=new Array(10),A=(E,V)=>{if(sl(E)){if(S.indexOf(E)>=0)return;if(!("toJSON"in E)){S[V]=E;const W=Os(E)?[]:{};return Fo(E,(T,c)=>{const ye=A(T,V+1);!Bo(ye)&&(W[c]=ye)}),S[V]=void 0,W}}return E};return A(g,0)},bf=Tr("AsyncFunction"),wf=g=>g&&(sl(g)||Ki(g))&&Ki(g.then)&&Ki(g.catch),ru=((g,S)=>g?setImmediate:S?((A,E)=>(es.addEventListener("message",({source:V,data:W})=>{V===es&&W===A&&E.length&&E.shift()()},!1),V=>{E.push(V),es.postMessage(A,"*")}))(`axios@${Math.random()}`,[]):A=>setTimeout(A))(typeof setImmediate=="function",Ki(es.postMessage)),Sf=typeof queueMicrotask<"u"?queueMicrotask.bind(es):typeof process<"u"&&process.nextTick||ru,fe={isArray:Os,isArrayBuffer:Wh,isBuffer:Vp,isFormData:Xp,isArrayBufferView:Np,isString:Up,isNumber:Jh,isBoolean:jp,isObject:sl,isPlainObject:ol,isReadableStream:Jp,isRequest:Kp,isResponse:Yp,isHeaders:Qp,isUndefined:Bo,isDate:$p,isFile:qp,isBlob:Zp,isRegExp:pf,isFunction:Ki,isStream:Hp,isURLSearchParams:Wp,isTypedArray:lf,isFileList:Gp,forEach:Fo,merge:vc,extend:tf,trim:ef,stripBOM:rf,inherits:nf,toFlatObject:sf,kindOf:rl,kindOfTest:Tr,endsWith:of,toArray:af,forEachEntry:cf,matchAll:hf,isHTMLForm:uf,hasOwnProperty:Qh,hasOwnProp:Qh,reduceDescriptors:eu,freezeMethods:ff,toObjectSet:mf,toCamelCase:df,noop:gf,toFiniteNumber:_f,findKey:Kh,global:es,isContextDefined:Yh,ALPHABET:iu,generateString:yf,isSpecCompliantForm:xf,toJSONObject:vf,isAsyncFn:bf,isThenable:wf,setImmediate:ru,asap:Sf};function lt(g,S,A,E,V){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=g,this.name="AxiosError",S&&(this.code=S),A&&(this.config=A),E&&(this.request=E),V&&(this.response=V)}fe.inherits(lt,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:fe.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const nu=lt.prototype,su={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(g=>{su[g]={value:g}}),Object.defineProperties(lt,su),Object.defineProperty(nu,"isAxiosError",{value:!0}),lt.from=(g,S,A,E,V,W)=>{const T=Object.create(nu);return fe.toFlatObject(g,T,function(ye){return ye!==Error.prototype},c=>c!=="isAxiosError"),lt.call(T,g.message,S,A,E,V),T.cause=g,T.name=g.name,W&&Object.assign(T,W),T};const Tf=null;function wc(g){return fe.isPlainObject(g)||fe.isArray(g)}function ou(g){return fe.endsWith(g,"[]")?g.slice(0,-2):g}function au(g,S,A){return g?g.concat(S).map(function(V,W){return V=ou(V),!A&&W?"["+V+"]":V}).join(A?".":""):S}function If(g){return fe.isArray(g)&&!g.some(wc)}const Pf=fe.toFlatObject(fe,{},null,function(S){return/^is[A-Z]/.test(S)});function al(g,S,A){if(!fe.isObject(g))throw new TypeError("target must be an object");S=S||new FormData,A=fe.toFlatObject(A,{metaTokens:!0,dots:!1,indexes:!1},!1,function(tt,Ue){return!fe.isUndefined(Ue[tt])});const E=A.metaTokens,V=A.visitor||be,W=A.dots,T=A.indexes,ye=(A.Blob||typeof Blob<"u"&&Blob)&&fe.isSpecCompliantForm(S);if(!fe.isFunction(V))throw new TypeError("visitor must be a function");function ve(Ze){if(Ze===null)return"";if(fe.isDate(Ze))return Ze.toISOString();if(!ye&&fe.isBlob(Ze))throw new lt("Blob is not supported. Use a Buffer instead.");return fe.isArrayBuffer(Ze)||fe.isTypedArray(Ze)?ye&&typeof Blob=="function"?new Blob([Ze]):Buffer.from(Ze):Ze}function be(Ze,tt,Ue){let dt=Ze;if(Ze&&!Ue&&typeof Ze=="object"){if(fe.endsWith(tt,"{}"))tt=E?tt:tt.slice(0,-2),Ze=JSON.stringify(Ze);else if(fe.isArray(Ze)&&If(Ze)||(fe.isFileList(Ze)||fe.endsWith(tt,"[]"))&&(dt=fe.toArray(Ze)))return tt=ou(tt),dt.forEach(function(Ee,Pt){!(fe.isUndefined(Ee)||Ee===null)&&S.append(T===!0?au([tt],Pt,W):T===null?tt:tt+"[]",ve(Ee))}),!1}return wc(Ze)?!0:(S.append(au(Ue,tt,W),ve(Ze)),!1)}const le=[],ae=Object.assign(Pf,{defaultVisitor:be,convertValue:ve,isVisitable:wc});function gt(Ze,tt){if(!fe.isUndefined(Ze)){if(le.indexOf(Ze)!==-1)throw Error("Circular reference detected in "+tt.join("."));le.push(Ze),fe.forEach(Ze,function(dt,Mt){(!(fe.isUndefined(dt)||dt===null)&&V.call(S,dt,fe.isString(Mt)?Mt.trim():Mt,tt,ae))===!0&>(dt,tt?tt.concat(Mt):[Mt])}),le.pop()}}if(!fe.isObject(g))throw new TypeError("data must be an object");return gt(g),S}function lu(g){const S={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(g).replace(/[!'()~]|%20|%00/g,function(E){return S[E]})}function Sc(g,S){this._pairs=[],g&&al(g,this,S)}const cu=Sc.prototype;cu.append=function(S,A){this._pairs.push([S,A])},cu.toString=function(S){const A=S?function(E){return S.call(this,E,lu)}:lu;return this._pairs.map(function(V){return A(V[0])+"="+A(V[1])},"").join("&")};function kf(g){return encodeURIComponent(g).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function hu(g,S,A){if(!S)return g;const E=A&&A.encode||kf,V=A&&A.serialize;let W;if(V?W=V(S,A):W=fe.isURLSearchParams(S)?S.toString():new Sc(S,A).toString(E),W){const T=g.indexOf("#");T!==-1&&(g=g.slice(0,T)),g+=(g.indexOf("?")===-1?"?":"&")+W}return g}class uu{constructor(){this.handlers=[]}use(S,A,E){return this.handlers.push({fulfilled:S,rejected:A,synchronous:E?E.synchronous:!1,runWhen:E?E.runWhen:null}),this.handlers.length-1}eject(S){this.handlers[S]&&(this.handlers[S]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(S){fe.forEach(this.handlers,function(E){E!==null&&S(E)})}}const du={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Af={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:Sc,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},Tc=typeof window<"u"&&typeof document<"u",Cf=(g=>Tc&&["ReactNative","NativeScript","NS"].indexOf(g)<0)(typeof navigator<"u"&&navigator.product),Ef=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Mf=Tc&&window.location.href||"http://localhost",Ir={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Tc,hasStandardBrowserEnv:Cf,hasStandardBrowserWebWorkerEnv:Ef,origin:Mf},Symbol.toStringTag,{value:"Module"})),...Af};function zf(g,S){return al(g,new Ir.classes.URLSearchParams,Object.assign({visitor:function(A,E,V,W){return Ir.isNode&&fe.isBuffer(A)?(this.append(E,A.toString("base64")),!1):W.defaultVisitor.apply(this,arguments)}},S))}function Df(g){return fe.matchAll(/\w+|\[(\w*)]/g,g).map(S=>S[0]==="[]"?"":S[1]||S[0])}function Lf(g){const S={},A=Object.keys(g);let E;const V=A.length;let W;for(E=0;E<V;E++)W=A[E],S[W]=g[W];return S}function pu(g){function S(A,E,V,W){let T=A[W++];if(T==="__proto__")return!0;const c=Number.isFinite(+T),ye=W>=A.length;return T=!T&&fe.isArray(V)?V.length:T,ye?(fe.hasOwnProp(V,T)?V[T]=[V[T],E]:V[T]=E,!c):((!V[T]||!fe.isObject(V[T]))&&(V[T]=[]),S(A,E,V[T],W)&&fe.isArray(V[T])&&(V[T]=Lf(V[T])),!c)}if(fe.isFormData(g)&&fe.isFunction(g.entries)){const A={};return fe.forEachEntry(g,(E,V)=>{S(Df(E),V,A,0)}),A}return null}function Rf(g,S,A){if(fe.isString(g))try{return(S||JSON.parse)(g),fe.trim(g)}catch(E){if(E.name!=="SyntaxError")throw E}return(A||JSON.stringify)(g)}const Oo={transitional:du,adapter:["xhr","http","fetch"],transformRequest:[function(S,A){const E=A.getContentType()||"",V=E.indexOf("application/json")>-1,W=fe.isObject(S);if(W&&fe.isHTMLForm(S)&&(S=new FormData(S)),fe.isFormData(S))return V?JSON.stringify(pu(S)):S;if(fe.isArrayBuffer(S)||fe.isBuffer(S)||fe.isStream(S)||fe.isFile(S)||fe.isBlob(S)||fe.isReadableStream(S))return S;if(fe.isArrayBufferView(S))return S.buffer;if(fe.isURLSearchParams(S))return A.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),S.toString();let c;if(W){if(E.indexOf("application/x-www-form-urlencoded")>-1)return zf(S,this.formSerializer).toString();if((c=fe.isFileList(S))||E.indexOf("multipart/form-data")>-1){const ye=this.env&&this.env.FormData;return al(c?{"files[]":S}:S,ye&&new ye,this.formSerializer)}}return W||V?(A.setContentType("application/json",!1),Rf(S)):S}],transformResponse:[function(S){const A=this.transitional||Oo.transitional,E=A&&A.forcedJSONParsing,V=this.responseType==="json";if(fe.isResponse(S)||fe.isReadableStream(S))return S;if(S&&fe.isString(S)&&(E&&!this.responseType||V)){const T=!(A&&A.silentJSONParsing)&&V;try{return JSON.parse(S)}catch(c){if(T)throw c.name==="SyntaxError"?lt.from(c,lt.ERR_BAD_RESPONSE,this,null,this.response):c}}return S}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ir.classes.FormData,Blob:Ir.classes.Blob},validateStatus:function(S){return S>=200&&S<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};fe.forEach(["delete","get","head","post","put","patch"],g=>{Oo.headers[g]={}});const Bf=fe.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Ff=g=>{const S={};let A,E,V;return g&&g.split(`
|
580
|
+
`),U=y.createShader(y.FRAGMENT_SHADER);if(y.isContextLost())return void(this.failedToCreate=!0);if(y.shaderSource(U,H),y.compileShader(U),!y.getShaderParameter(U,y.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${y.getShaderInfoLog(U)}`);y.attachShader(this.program,U);const te=y.createShader(y.VERTEX_SHADER);if(y.isContextLost())return void(this.failedToCreate=!0);if(y.shaderSource(te,Y),y.compileShader(te),!y.getShaderParameter(te,y.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${y.getShaderInfoLog(te)}`);y.attachShader(this.program,te),this.attributes={};const se={};this.numAttributes=P.length;for(let ce=0;ce<this.numAttributes;ce++)P[ce]&&(y.bindAttribLocation(this.program,ce,P[ce]),this.attributes[P[ce]]=ce);if(y.linkProgram(this.program),!y.getProgramParameter(this.program,y.LINK_STATUS))throw new Error(`Program failed to link: ${y.getProgramInfoLog(this.program)}`);y.deleteShader(te),y.deleteShader(U);for(let ce=0;ce<Z.length;ce++){const ge=Z[ce];if(ge&&!se[ge]){const we=y.getUniformLocation(this.program,ge);we&&(se[ge]=we)}}this.fixedUniforms=a(t,se),this.terrainUniforms=((ce,ge)=>({u_depth:new c.aI(ce,ge.u_depth),u_terrain:new c.aI(ce,ge.u_terrain),u_terrain_dim:new c.aJ(ce,ge.u_terrain_dim),u_terrain_matrix:new c.aK(ce,ge.u_terrain_matrix),u_terrain_unpack:new c.aL(ce,ge.u_terrain_unpack),u_terrain_exaggeration:new c.aJ(ce,ge.u_terrain_exaggeration)}))(t,se),this.binderUniforms=o?o.getUniforms(t,se):[]}draw(t,n,o,a,h,m,y,v,b,P,k,L,B,N,Z,j,H,Y){const U=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(o),t.setStencilMode(a),t.setColorMode(h),t.setCullFace(m),v){t.activeTexture.set(U.TEXTURE2),U.bindTexture(U.TEXTURE_2D,v.depthTexture),t.activeTexture.set(U.TEXTURE3),U.bindTexture(U.TEXTURE_2D,v.texture);for(const se in this.terrainUniforms)this.terrainUniforms[se].set(v[se])}for(const se in this.fixedUniforms)this.fixedUniforms[se].set(y[se]);Z&&Z.setUniforms(t,this.binderUniforms,B,{zoom:N});let te=0;switch(n){case U.LINES:te=2;break;case U.TRIANGLES:te=3;break;case U.LINE_STRIP:te=1}for(const se of L.get()){const ce=se.vaos||(se.vaos={});(ce[b]||(ce[b]=new qs)).bind(t,this,P,Z?Z.getPaintVertexBuffers():[],k,se.vertexOffset,j,H,Y),U.drawElements(n,se.primitiveLength*te,U.UNSIGNED_SHORT,se.primitiveOffset*te*2)}}}function Gs(u,t,n){const o=1/rt(n,1,t.transform.tileZoom),a=Math.pow(2,n.tileID.overscaledZ),h=n.tileSize*Math.pow(2,t.transform.tileZoom)/a,m=h*(n.tileID.canonical.x+n.tileID.wrap*a),y=h*n.tileID.canonical.y;return{u_image:0,u_texsize:n.imageAtlasTexture.size,u_scale:[o,u.fromScale,u.toScale],u_fade:u.t,u_pixel_coord_upper:[m>>16,y>>16],u_pixel_coord_lower:[65535&m,65535&y]}}const Hs=(u,t,n,o)=>{const a=t.style.light,h=a.properties.get("position"),m=[h.x,h.y,h.z],y=function(){var b=new c.A(9);return c.A!=Float32Array&&(b[1]=0,b[2]=0,b[3]=0,b[5]=0,b[6]=0,b[7]=0),b[0]=1,b[4]=1,b[8]=1,b}();a.properties.get("anchor")==="viewport"&&function(b,P){var k=Math.sin(P),L=Math.cos(P);b[0]=L,b[1]=k,b[2]=0,b[3]=-k,b[4]=L,b[5]=0,b[6]=0,b[7]=0,b[8]=1}(y,-t.transform.angle),function(b,P,k){var L=P[0],B=P[1],N=P[2];b[0]=L*k[0]+B*k[3]+N*k[6],b[1]=L*k[1]+B*k[4]+N*k[7],b[2]=L*k[2]+B*k[5]+N*k[8]}(m,m,y);const v=a.properties.get("color");return{u_matrix:u,u_lightpos:m,u_lightintensity:a.properties.get("intensity"),u_lightcolor:[v.r,v.g,v.b],u_vertical_gradient:+n,u_opacity:o}},Xs=(u,t,n,o,a,h,m)=>c.e(Hs(u,t,n,o),Gs(h,t,m),{u_height_factor:-Math.pow(2,a.overscaledZ)/m.tileSize/8}),ps=u=>({u_matrix:u}),zn=(u,t,n,o)=>c.e(ps(u),Gs(n,t,o)),Fc=(u,t)=>({u_matrix:u,u_world:t}),Oc=(u,t,n,o,a)=>c.e(zn(u,t,n,o),{u_world:a}),pl=(u,t,n,o)=>{const a=u.transform;let h,m;if(o.paint.get("circle-pitch-alignment")==="map"){const y=rt(n,1,a.zoom);h=!0,m=[y,y]}else h=!1,m=a.pixelsToGLUnits;return{u_camera_to_center_distance:a.cameraToCenterDistance,u_scale_with_map:+(o.paint.get("circle-pitch-scale")==="map"),u_matrix:u.translatePosMatrix(t.posMatrix,n,o.paint.get("circle-translate"),o.paint.get("circle-translate-anchor")),u_pitch_with_map:+h,u_device_pixel_ratio:u.pixelRatio,u_extrude_scale:m}},Vc=(u,t,n)=>({u_matrix:u,u_inv_matrix:t,u_camera_to_center_distance:n.cameraToCenterDistance,u_viewport_size:[n.width,n.height]}),Wr=(u,t,n=1)=>({u_matrix:u,u_color:t,u_overlay:0,u_overlay_scale:n}),fs=u=>({u_matrix:u}),Ui=(u,t,n,o)=>({u_matrix:u,u_extrude_scale:rt(t,1,n),u_intensity:o});function ji(u,t){const n=Math.pow(2,t.canonical.z),o=t.canonical.y;return[new c.Z(0,o/n).toLngLat().lat,new c.Z(0,(o+1)/n).toLngLat().lat]}const ms=(u,t,n,o)=>{const a=u.transform;return{u_matrix:gl(u,t,n,o),u_ratio:1/rt(t,1,a.zoom),u_device_pixel_ratio:u.pixelRatio,u_units_to_pixels:[1/a.pixelsToGLUnits[0],1/a.pixelsToGLUnits[1]]}},Ws=(u,t,n,o,a)=>c.e(ms(u,t,n,a),{u_image:0,u_image_height:o}),fl=(u,t,n,o,a)=>{const h=u.transform,m=un(t,h);return{u_matrix:gl(u,t,n,a),u_texsize:t.imageAtlasTexture.size,u_ratio:1/rt(t,1,h.zoom),u_device_pixel_ratio:u.pixelRatio,u_image:0,u_scale:[m,o.fromScale,o.toScale],u_fade:o.t,u_units_to_pixels:[1/h.pixelsToGLUnits[0],1/h.pixelsToGLUnits[1]]}},ml=(u,t,n,o,a,h)=>{const m=u.lineAtlas,y=un(t,u.transform),v=n.layout.get("line-cap")==="round",b=m.getDash(o.from,v),P=m.getDash(o.to,v),k=b.width*a.fromScale,L=P.width*a.toScale;return c.e(ms(u,t,n,h),{u_patternscale_a:[y/k,-b.height/2],u_patternscale_b:[y/L,-P.height/2],u_sdfgamma:m.width/(256*Math.min(k,L)*u.pixelRatio)/2,u_image:0,u_tex_y_a:b.y,u_tex_y_b:P.y,u_mix:a.t})};function un(u,t){return 1/rt(u,1,t.tileZoom)}function gl(u,t,n,o){return u.translatePosMatrix(o?o.posMatrix:t.tileID.posMatrix,t,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}const Nc=(u,t,n,o,a)=>{return{u_matrix:u,u_tl_parent:t,u_scale_parent:n,u_buffer_scale:1,u_fade_t:o.mix,u_opacity:o.opacity*a.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:a.paint.get("raster-brightness-min"),u_brightness_high:a.paint.get("raster-brightness-max"),u_saturation_factor:(m=a.paint.get("raster-saturation"),m>0?1-1/(1.001-m):-m),u_contrast_factor:(h=a.paint.get("raster-contrast"),h>0?1/(1-h):1+h),u_spin_weights:Uc(a.paint.get("raster-hue-rotate"))};var h,m};function Uc(u){u*=Math.PI/180;const t=Math.sin(u),n=Math.cos(u);return[(2*n+1)/3,(-Math.sqrt(3)*t-n+1)/3,(Math.sqrt(3)*t-n+1)/3]}const _l=(u,t,n,o,a,h,m,y,v,b,P,k,L,B)=>{const N=m.transform;return{u_is_size_zoom_constant:+(u==="constant"||u==="source"),u_is_size_feature_constant:+(u==="constant"||u==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:N.cameraToCenterDistance,u_pitch:N.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:N.width/N.height,u_fade_change:m.options.fadeDuration?m.symbolFadeChange:1,u_matrix:y,u_label_plane_matrix:v,u_coord_matrix:b,u_is_text:+k,u_pitch_with_map:+o,u_is_along_line:a,u_is_variable_anchor:h,u_texsize:L,u_texture:0,u_translation:P,u_pitched_scale:B}},yl=(u,t,n,o,a,h,m,y,v,b,P,k,L,B,N)=>{const Z=m.transform;return c.e(_l(u,t,n,o,a,h,m,y,v,b,P,k,L,N),{u_gamma_scale:o?Math.cos(Z._pitch)*Z.cameraToCenterDistance:1,u_device_pixel_ratio:m.pixelRatio,u_is_halo:+B})},jc=(u,t,n,o,a,h,m,y,v,b,P,k,L,B)=>c.e(yl(u,t,n,o,a,h,m,y,v,b,P,!0,k,!0,B),{u_texsize_icon:L,u_texture_icon:1}),Js=(u,t,n)=>({u_matrix:u,u_opacity:t,u_color:n}),qo=(u,t,n,o,a,h)=>c.e(function(m,y,v,b){const P=v.imageManager.getPattern(m.from.toString()),k=v.imageManager.getPattern(m.to.toString()),{width:L,height:B}=v.imageManager.getPixelSize(),N=Math.pow(2,b.tileID.overscaledZ),Z=b.tileSize*Math.pow(2,v.transform.tileZoom)/N,j=Z*(b.tileID.canonical.x+b.tileID.wrap*N),H=Z*b.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:P.tl,u_pattern_br_a:P.br,u_pattern_tl_b:k.tl,u_pattern_br_b:k.br,u_texsize:[L,B],u_mix:y.t,u_pattern_size_a:P.displaySize,u_pattern_size_b:k.displaySize,u_scale_a:y.fromScale,u_scale_b:y.toScale,u_tile_units_to_pixels:1/rt(b,1,v.transform.tileZoom),u_pixel_coord_upper:[j>>16,H>>16],u_pixel_coord_lower:[65535&j,65535&H]}}(o,h,n,a),{u_matrix:u,u_opacity:t}),Ks={fillExtrusion:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_lightpos:new c.aO(u,t.u_lightpos),u_lightintensity:new c.aJ(u,t.u_lightintensity),u_lightcolor:new c.aO(u,t.u_lightcolor),u_vertical_gradient:new c.aJ(u,t.u_vertical_gradient),u_opacity:new c.aJ(u,t.u_opacity)}),fillExtrusionPattern:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_lightpos:new c.aO(u,t.u_lightpos),u_lightintensity:new c.aJ(u,t.u_lightintensity),u_lightcolor:new c.aO(u,t.u_lightcolor),u_vertical_gradient:new c.aJ(u,t.u_vertical_gradient),u_height_factor:new c.aJ(u,t.u_height_factor),u_image:new c.aI(u,t.u_image),u_texsize:new c.aP(u,t.u_texsize),u_pixel_coord_upper:new c.aP(u,t.u_pixel_coord_upper),u_pixel_coord_lower:new c.aP(u,t.u_pixel_coord_lower),u_scale:new c.aO(u,t.u_scale),u_fade:new c.aJ(u,t.u_fade),u_opacity:new c.aJ(u,t.u_opacity)}),fill:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix)}),fillPattern:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_image:new c.aI(u,t.u_image),u_texsize:new c.aP(u,t.u_texsize),u_pixel_coord_upper:new c.aP(u,t.u_pixel_coord_upper),u_pixel_coord_lower:new c.aP(u,t.u_pixel_coord_lower),u_scale:new c.aO(u,t.u_scale),u_fade:new c.aJ(u,t.u_fade)}),fillOutline:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_world:new c.aP(u,t.u_world)}),fillOutlinePattern:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_world:new c.aP(u,t.u_world),u_image:new c.aI(u,t.u_image),u_texsize:new c.aP(u,t.u_texsize),u_pixel_coord_upper:new c.aP(u,t.u_pixel_coord_upper),u_pixel_coord_lower:new c.aP(u,t.u_pixel_coord_lower),u_scale:new c.aO(u,t.u_scale),u_fade:new c.aJ(u,t.u_fade)}),circle:(u,t)=>({u_camera_to_center_distance:new c.aJ(u,t.u_camera_to_center_distance),u_scale_with_map:new c.aI(u,t.u_scale_with_map),u_pitch_with_map:new c.aI(u,t.u_pitch_with_map),u_extrude_scale:new c.aP(u,t.u_extrude_scale),u_device_pixel_ratio:new c.aJ(u,t.u_device_pixel_ratio),u_matrix:new c.aK(u,t.u_matrix)}),collisionBox:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_pixel_extrude_scale:new c.aP(u,t.u_pixel_extrude_scale)}),collisionCircle:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_inv_matrix:new c.aK(u,t.u_inv_matrix),u_camera_to_center_distance:new c.aJ(u,t.u_camera_to_center_distance),u_viewport_size:new c.aP(u,t.u_viewport_size)}),debug:(u,t)=>({u_color:new c.aM(u,t.u_color),u_matrix:new c.aK(u,t.u_matrix),u_overlay:new c.aI(u,t.u_overlay),u_overlay_scale:new c.aJ(u,t.u_overlay_scale)}),clippingMask:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix)}),heatmap:(u,t)=>({u_extrude_scale:new c.aJ(u,t.u_extrude_scale),u_intensity:new c.aJ(u,t.u_intensity),u_matrix:new c.aK(u,t.u_matrix)}),heatmapTexture:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_world:new c.aP(u,t.u_world),u_image:new c.aI(u,t.u_image),u_color_ramp:new c.aI(u,t.u_color_ramp),u_opacity:new c.aJ(u,t.u_opacity)}),hillshade:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_image:new c.aI(u,t.u_image),u_latrange:new c.aP(u,t.u_latrange),u_light:new c.aP(u,t.u_light),u_shadow:new c.aM(u,t.u_shadow),u_highlight:new c.aM(u,t.u_highlight),u_accent:new c.aM(u,t.u_accent)}),hillshadePrepare:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_image:new c.aI(u,t.u_image),u_dimension:new c.aP(u,t.u_dimension),u_zoom:new c.aJ(u,t.u_zoom),u_unpack:new c.aL(u,t.u_unpack)}),line:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_ratio:new c.aJ(u,t.u_ratio),u_device_pixel_ratio:new c.aJ(u,t.u_device_pixel_ratio),u_units_to_pixels:new c.aP(u,t.u_units_to_pixels)}),lineGradient:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_ratio:new c.aJ(u,t.u_ratio),u_device_pixel_ratio:new c.aJ(u,t.u_device_pixel_ratio),u_units_to_pixels:new c.aP(u,t.u_units_to_pixels),u_image:new c.aI(u,t.u_image),u_image_height:new c.aJ(u,t.u_image_height)}),linePattern:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_texsize:new c.aP(u,t.u_texsize),u_ratio:new c.aJ(u,t.u_ratio),u_device_pixel_ratio:new c.aJ(u,t.u_device_pixel_ratio),u_image:new c.aI(u,t.u_image),u_units_to_pixels:new c.aP(u,t.u_units_to_pixels),u_scale:new c.aO(u,t.u_scale),u_fade:new c.aJ(u,t.u_fade)}),lineSDF:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_ratio:new c.aJ(u,t.u_ratio),u_device_pixel_ratio:new c.aJ(u,t.u_device_pixel_ratio),u_units_to_pixels:new c.aP(u,t.u_units_to_pixels),u_patternscale_a:new c.aP(u,t.u_patternscale_a),u_patternscale_b:new c.aP(u,t.u_patternscale_b),u_sdfgamma:new c.aJ(u,t.u_sdfgamma),u_image:new c.aI(u,t.u_image),u_tex_y_a:new c.aJ(u,t.u_tex_y_a),u_tex_y_b:new c.aJ(u,t.u_tex_y_b),u_mix:new c.aJ(u,t.u_mix)}),raster:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_tl_parent:new c.aP(u,t.u_tl_parent),u_scale_parent:new c.aJ(u,t.u_scale_parent),u_buffer_scale:new c.aJ(u,t.u_buffer_scale),u_fade_t:new c.aJ(u,t.u_fade_t),u_opacity:new c.aJ(u,t.u_opacity),u_image0:new c.aI(u,t.u_image0),u_image1:new c.aI(u,t.u_image1),u_brightness_low:new c.aJ(u,t.u_brightness_low),u_brightness_high:new c.aJ(u,t.u_brightness_high),u_saturation_factor:new c.aJ(u,t.u_saturation_factor),u_contrast_factor:new c.aJ(u,t.u_contrast_factor),u_spin_weights:new c.aO(u,t.u_spin_weights)}),symbolIcon:(u,t)=>({u_is_size_zoom_constant:new c.aI(u,t.u_is_size_zoom_constant),u_is_size_feature_constant:new c.aI(u,t.u_is_size_feature_constant),u_size_t:new c.aJ(u,t.u_size_t),u_size:new c.aJ(u,t.u_size),u_camera_to_center_distance:new c.aJ(u,t.u_camera_to_center_distance),u_pitch:new c.aJ(u,t.u_pitch),u_rotate_symbol:new c.aI(u,t.u_rotate_symbol),u_aspect_ratio:new c.aJ(u,t.u_aspect_ratio),u_fade_change:new c.aJ(u,t.u_fade_change),u_matrix:new c.aK(u,t.u_matrix),u_label_plane_matrix:new c.aK(u,t.u_label_plane_matrix),u_coord_matrix:new c.aK(u,t.u_coord_matrix),u_is_text:new c.aI(u,t.u_is_text),u_pitch_with_map:new c.aI(u,t.u_pitch_with_map),u_is_along_line:new c.aI(u,t.u_is_along_line),u_is_variable_anchor:new c.aI(u,t.u_is_variable_anchor),u_texsize:new c.aP(u,t.u_texsize),u_texture:new c.aI(u,t.u_texture),u_translation:new c.aP(u,t.u_translation),u_pitched_scale:new c.aJ(u,t.u_pitched_scale)}),symbolSDF:(u,t)=>({u_is_size_zoom_constant:new c.aI(u,t.u_is_size_zoom_constant),u_is_size_feature_constant:new c.aI(u,t.u_is_size_feature_constant),u_size_t:new c.aJ(u,t.u_size_t),u_size:new c.aJ(u,t.u_size),u_camera_to_center_distance:new c.aJ(u,t.u_camera_to_center_distance),u_pitch:new c.aJ(u,t.u_pitch),u_rotate_symbol:new c.aI(u,t.u_rotate_symbol),u_aspect_ratio:new c.aJ(u,t.u_aspect_ratio),u_fade_change:new c.aJ(u,t.u_fade_change),u_matrix:new c.aK(u,t.u_matrix),u_label_plane_matrix:new c.aK(u,t.u_label_plane_matrix),u_coord_matrix:new c.aK(u,t.u_coord_matrix),u_is_text:new c.aI(u,t.u_is_text),u_pitch_with_map:new c.aI(u,t.u_pitch_with_map),u_is_along_line:new c.aI(u,t.u_is_along_line),u_is_variable_anchor:new c.aI(u,t.u_is_variable_anchor),u_texsize:new c.aP(u,t.u_texsize),u_texture:new c.aI(u,t.u_texture),u_gamma_scale:new c.aJ(u,t.u_gamma_scale),u_device_pixel_ratio:new c.aJ(u,t.u_device_pixel_ratio),u_is_halo:new c.aI(u,t.u_is_halo),u_translation:new c.aP(u,t.u_translation),u_pitched_scale:new c.aJ(u,t.u_pitched_scale)}),symbolTextAndIcon:(u,t)=>({u_is_size_zoom_constant:new c.aI(u,t.u_is_size_zoom_constant),u_is_size_feature_constant:new c.aI(u,t.u_is_size_feature_constant),u_size_t:new c.aJ(u,t.u_size_t),u_size:new c.aJ(u,t.u_size),u_camera_to_center_distance:new c.aJ(u,t.u_camera_to_center_distance),u_pitch:new c.aJ(u,t.u_pitch),u_rotate_symbol:new c.aI(u,t.u_rotate_symbol),u_aspect_ratio:new c.aJ(u,t.u_aspect_ratio),u_fade_change:new c.aJ(u,t.u_fade_change),u_matrix:new c.aK(u,t.u_matrix),u_label_plane_matrix:new c.aK(u,t.u_label_plane_matrix),u_coord_matrix:new c.aK(u,t.u_coord_matrix),u_is_text:new c.aI(u,t.u_is_text),u_pitch_with_map:new c.aI(u,t.u_pitch_with_map),u_is_along_line:new c.aI(u,t.u_is_along_line),u_is_variable_anchor:new c.aI(u,t.u_is_variable_anchor),u_texsize:new c.aP(u,t.u_texsize),u_texsize_icon:new c.aP(u,t.u_texsize_icon),u_texture:new c.aI(u,t.u_texture),u_texture_icon:new c.aI(u,t.u_texture_icon),u_gamma_scale:new c.aJ(u,t.u_gamma_scale),u_device_pixel_ratio:new c.aJ(u,t.u_device_pixel_ratio),u_is_halo:new c.aI(u,t.u_is_halo),u_translation:new c.aP(u,t.u_translation),u_pitched_scale:new c.aJ(u,t.u_pitched_scale)}),background:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_opacity:new c.aJ(u,t.u_opacity),u_color:new c.aM(u,t.u_color)}),backgroundPattern:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_opacity:new c.aJ(u,t.u_opacity),u_image:new c.aI(u,t.u_image),u_pattern_tl_a:new c.aP(u,t.u_pattern_tl_a),u_pattern_br_a:new c.aP(u,t.u_pattern_br_a),u_pattern_tl_b:new c.aP(u,t.u_pattern_tl_b),u_pattern_br_b:new c.aP(u,t.u_pattern_br_b),u_texsize:new c.aP(u,t.u_texsize),u_mix:new c.aJ(u,t.u_mix),u_pattern_size_a:new c.aP(u,t.u_pattern_size_a),u_pattern_size_b:new c.aP(u,t.u_pattern_size_b),u_scale_a:new c.aJ(u,t.u_scale_a),u_scale_b:new c.aJ(u,t.u_scale_b),u_pixel_coord_upper:new c.aP(u,t.u_pixel_coord_upper),u_pixel_coord_lower:new c.aP(u,t.u_pixel_coord_lower),u_tile_units_to_pixels:new c.aJ(u,t.u_tile_units_to_pixels)}),terrain:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_texture:new c.aI(u,t.u_texture),u_ele_delta:new c.aJ(u,t.u_ele_delta),u_fog_matrix:new c.aK(u,t.u_fog_matrix),u_fog_color:new c.aM(u,t.u_fog_color),u_fog_ground_blend:new c.aJ(u,t.u_fog_ground_blend),u_fog_ground_blend_opacity:new c.aJ(u,t.u_fog_ground_blend_opacity),u_horizon_color:new c.aM(u,t.u_horizon_color),u_horizon_fog_blend:new c.aJ(u,t.u_horizon_fog_blend)}),terrainDepth:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_ele_delta:new c.aJ(u,t.u_ele_delta)}),terrainCoords:(u,t)=>({u_matrix:new c.aK(u,t.u_matrix),u_texture:new c.aI(u,t.u_texture),u_terrain_coords_id:new c.aJ(u,t.u_terrain_coords_id),u_ele_delta:new c.aJ(u,t.u_ele_delta)}),sky:(u,t)=>({u_sky_color:new c.aM(u,t.u_sky_color),u_horizon_color:new c.aM(u,t.u_horizon_color),u_horizon:new c.aJ(u,t.u_horizon),u_sky_horizon_blend:new c.aJ(u,t.u_sky_horizon_blend)})};class Zo{constructor(t,n,o){this.context=t;const a=t.gl;this.buffer=a.createBuffer(),this.dynamicDraw=!!o,this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),a.bufferData(a.ELEMENT_ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?a.DYNAMIC_DRAW:a.STATIC_DRAW),this.dynamicDraw||delete n.arrayBuffer}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 Go={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class _r{constructor(t,n,o,a){this.length=n.length,this.attributes=o,this.itemSize=n.bytesPerElement,this.dynamicDraw=a,this.context=t;const h=t.gl;this.buffer=h.createBuffer(),t.bindVertexBuffer.set(this.buffer),h.bufferData(h.ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?h.DYNAMIC_DRAW:h.STATIC_DRAW),this.dynamicDraw||delete n.arrayBuffer}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(let o=0;o<this.attributes.length;o++){const a=n.attributes[this.attributes[o].name];a!==void 0&&t.enableVertexAttribArray(a)}}setVertexAttribPointers(t,n,o){for(let a=0;a<this.attributes.length;a++){const h=this.attributes[a],m=n.attributes[h.name];m!==void 0&&t.vertexAttribPointer(m,h.components,t[Go[h.type]],!1,this.itemSize,h.offset+this.itemSize*(o||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Ho=new WeakMap;function Dn(u){var t;if(Ho.has(u))return Ho.get(u);{const n=(t=u.getParameter(u.VERSION))===null||t===void 0?void 0:t.startsWith("WebGL 2.0");return Ho.set(u,n),n}}class ut{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 gs extends ut{getDefault(){return c.aN.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 $c extends ut{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class Ys extends ut{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class qc extends ut{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 Ln extends ut{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class Zc extends ut{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class xl extends ut{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 Gc extends ut{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 vl extends ut{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 Xo extends ut{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 bl extends ut{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 wl extends ut{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class Sl extends ut{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 Tl extends ut{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 dn extends ut{getDefault(){return c.aN.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 Il extends ut{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}}class Hc extends ut{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 Xc extends ut{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class Pl extends ut{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}class _s extends ut{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}}class Wc extends ut{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class Qs extends ut{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 Jc extends ut{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 Kc extends ut{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 kl extends ut{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 Al extends ut{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 Cl extends ut{getDefault(){return null}set(t){const n=this.gl;n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Wo extends ut{getDefault(){return null}set(t){var n;if(t===this.current&&!this.dirty)return;const o=this.gl;Dn(o)?o.bindVertexArray(t):(n=o.getExtension("OES_vertex_array_object"))===null||n===void 0||n.bindVertexArrayOES(t),this.current=t,this.dirty=!1}}class El extends ut{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 eo extends ut{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 zr extends ut{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 ys extends ut{constructor(t,n){super(t),this.context=t,this.parent=n}getDefault(){return null}}class Jo extends ys{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 Ko extends ys{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 Ml extends ys{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}}class Yo{constructor(t,n,o,a,h){this.context=t,this.width=n,this.height=o;const m=t.gl,y=this.framebuffer=m.createFramebuffer();if(this.colorAttachment=new Jo(t,y),a)this.depthAttachment=h?new Ml(t,y):new Ko(t,y);else if(h)throw new Error("Stencil cannot be set without depth");if(m.checkFramebufferStatus(m.FRAMEBUFFER)!==m.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer is not complete")}destroy(){const t=this.context.gl,n=this.colorAttachment.get();if(n&&t.deleteTexture(n),this.depthAttachment){const o=this.depthAttachment.get();o&&t.deleteRenderbuffer(o)}t.deleteFramebuffer(this.framebuffer)}}class At{constructor(t,n,o){this.blendFunction=t,this.blendColor=n,this.mask=o}}At.Replace=[1,0],At.disabled=new At(At.Replace,c.aN.transparent,[!1,!1,!1,!1]),At.unblended=new At(At.Replace,c.aN.transparent,[!0,!0,!0,!0]),At.alphaBlended=new At([1,771],c.aN.transparent,[!0,!0,!0,!0]);class Qo{constructor(t){var n,o;if(this.gl=t,this.clearColor=new gs(this),this.clearDepth=new $c(this),this.clearStencil=new Ys(this),this.colorMask=new qc(this),this.depthMask=new Ln(this),this.stencilMask=new Zc(this),this.stencilFunc=new xl(this),this.stencilOp=new Gc(this),this.stencilTest=new vl(this),this.depthRange=new Xo(this),this.depthTest=new bl(this),this.depthFunc=new wl(this),this.blend=new Sl(this),this.blendFunc=new Tl(this),this.blendColor=new dn(this),this.blendEquation=new Il(this),this.cullFace=new Hc(this),this.cullFaceSide=new Xc(this),this.frontFace=new Pl(this),this.program=new _s(this),this.activeTexture=new Wc(this),this.viewport=new Qs(this),this.bindFramebuffer=new Jc(this),this.bindRenderbuffer=new Kc(this),this.bindTexture=new kl(this),this.bindVertexBuffer=new Al(this),this.bindElementBuffer=new Cl(this),this.bindVertexArray=new Wo(this),this.pixelStoreUnpack=new El(this),this.pixelStoreUnpackPremultiplyAlpha=new eo(this),this.pixelStoreUnpackFlipY=new zr(this),this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_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),Dn(t)){this.HALF_FLOAT=t.HALF_FLOAT;const a=t.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(n=t.RGBA16F)!==null&&n!==void 0?n:a==null?void 0:a.RGBA16F_EXT,this.RGB16F=(o=t.RGB16F)!==null&&o!==void 0?o:a==null?void 0:a.RGB16F_EXT,t.getExtension("EXT_color_buffer_float")}else{t.getExtension("EXT_color_buffer_half_float"),t.getExtension("OES_texture_half_float_linear");const a=t.getExtension("OES_texture_half_float");this.HALF_FLOAT=a==null?void 0:a.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 Zo(this,t,n)}createVertexBuffer(t,n,o){return new _r(this,t,n,o)}createRenderbuffer(t,n,o){const a=this.gl,h=a.createRenderbuffer();return this.bindRenderbuffer.set(h),a.renderbufferStorage(a.RENDERBUFFER,t,n,o),this.bindRenderbuffer.set(null),h}createFramebuffer(t,n,o,a){return new Yo(this,t,n,o,a)}clear({color:t,depth:n,stencil:o}){const a=this.gl;let h=0;t&&(h|=a.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),n!==void 0&&(h|=a.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(n),this.depthMask.set(!0)),o!==void 0&&(h|=a.STENCIL_BUFFER_BIT,this.clearStencil.set(o),this.stencilMask.set(255)),a.clear(h)}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){c.aF(t.blendFunction,At.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 Dn(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;return Dn(this.gl)?this.gl.deleteVertexArray(t):(n=this.gl.getExtension("OES_vertex_array_object"))===null||n===void 0?void 0:n.deleteVertexArrayOES(t)}unbindVAO(){this.bindVertexArray.set(null)}}class ct{constructor(t,n,o){this.func=t,this.mask=n,this.range=o}}ct.ReadOnly=!1,ct.ReadWrite=!0,ct.disabled=new ct(519,ct.ReadOnly,[0,1]);const ea=7680;class Vt{constructor(t,n,o,a,h,m){this.test=t,this.ref=n,this.mask=o,this.fail=a,this.depthFail=h,this.pass=m}}Vt.disabled=new Vt({func:519,mask:0},0,0,ea,ea,ea);class zt{constructor(t,n,o){this.enable=t,this.mode=n,this.frontFace=o}}let xs;function zl(u,t,n,o,a){const h=u.context,m=h.gl,y=u.useProgram("collisionBox"),v=[];let b=0,P=0;for(let H=0;H<o.length;H++){const Y=o[H],U=t.getTile(Y).getBucket(n);if(!U)continue;const te=a?U.textCollisionBox:U.iconCollisionBox,se=U.collisionCircleArray;if(se.length>0){const ce=c.H();c.aR(ce,U.placementInvProjMatrix,u.transform.glCoordMatrix),c.aR(ce,ce,U.placementViewportMatrix),v.push({circleArray:se,circleOffset:P,transform:Y.posMatrix,invTransform:ce,coord:Y}),b+=se.length/4,P=b}te&&y.draw(h,m.LINES,ct.disabled,Vt.disabled,u.colorModeForRenderPass(),zt.disabled,{u_matrix:Y.posMatrix,u_pixel_extrude_scale:[1/(k=u.transform).width,1/k.height]},u.style.map.terrain&&u.style.map.terrain.getTerrainData(Y),n.id,te.layoutVertexBuffer,te.indexBuffer,te.segments,null,u.transform.zoom,null,null,te.collisionVertexBuffer)}var k;if(!a||!v.length)return;const L=u.useProgram("collisionCircle"),B=new c.aS;B.resize(4*b),B._trim();let N=0;for(const H of v)for(let Y=0;Y<H.circleArray.length/4;Y++){const U=4*Y,te=H.circleArray[U+0],se=H.circleArray[U+1],ce=H.circleArray[U+2],ge=H.circleArray[U+3];B.emplace(N++,te,se,ce,ge,0),B.emplace(N++,te,se,ce,ge,1),B.emplace(N++,te,se,ce,ge,2),B.emplace(N++,te,se,ce,ge,3)}(!xs||xs.length<2*b)&&(xs=function(H){const Y=2*H,U=new c.aU;U.resize(Y),U._trim();for(let te=0;te<Y;te++){const se=6*te;U.uint16[se+0]=4*te+0,U.uint16[se+1]=4*te+1,U.uint16[se+2]=4*te+2,U.uint16[se+3]=4*te+2,U.uint16[se+4]=4*te+3,U.uint16[se+5]=4*te+0}return U}(b));const Z=h.createIndexBuffer(xs,!0),j=h.createVertexBuffer(B,c.aT.members,!0);for(const H of v){const Y=Vc(H.transform,H.invTransform,u.transform);L.draw(h,m.TRIANGLES,ct.disabled,Vt.disabled,u.colorModeForRenderPass(),zt.disabled,Y,u.style.map.terrain&&u.style.map.terrain.getTerrainData(H.coord),n.id,j,Z,c.a0.simpleSegment(0,2*H.circleOffset,H.circleArray.length,H.circleArray.length/2),null,u.transform.zoom,null,null,null)}j.destroy(),Z.destroy()}zt.disabled=new zt(!1,1029,2305),zt.backCCW=new zt(!0,1029,2305);const ta=c.ao(new Float32Array(16));function to(u,t,n,o,a,h){const{horizontalAlign:m,verticalAlign:y}=c.av(u);return new c.P((-(m-.5)*t/a+o[0])*h,(-(y-.5)*n/a+o[1])*h)}function io(u,t,n,o,a,h){const m=t.tileAnchorPoint.add(new c.P(t.translation[0],t.translation[1]));if(t.pitchWithMap){let y=o.mult(h);return n||(y=y.rotate(-a)),G(m.add(y),t.labelPlaneMatrix,t.getElevation).point}if(n){const y=pe(t.tileAnchorPoint.x+1,t.tileAnchorPoint.y,t).point.sub(u),v=Math.atan(y.y/y.x)+(y.x<0?Math.PI:0);return u.add(o.rotate(v))}return u.add(o)}function ro(u,t,n,o,a,h,m,y,v,b,P,k,L,B){const N=u.text.placedSymbolArray,Z=u.text.dynamicLayoutVertexArray,j=u.icon.dynamicLayoutVertexArray,H={};Z.clear();for(let Y=0;Y<N.length;Y++){const U=N.get(Y),te=U.hidden||!U.crossTileID||u.allowVerticalPlacement&&!U.placedOrientation?null:o[U.crossTileID];if(te){const se=new c.P(U.anchorX,U.anchorY),ce={getElevation:B,width:a.width,height:a.height,labelPlaneMatrix:h,lineVertexArray:null,pitchWithMap:n,projection:P,projectionCache:null,tileAnchorPoint:se,translation:k,unwrappedTileID:L},ge=n?G(se,m,B):pe(se.x,se.y,ce),we=z(a.cameraToCenterDistance,ge.signedDistanceFromCamera);let Le=c.aj(u.textSizeData,v,U)*we/c.aq;n&&(Le*=u.tilePixelRatio/y);const{width:Be,height:Se,anchor:Te,textOffset:Ne,textBoxScale:et}=te,ke=to(Te,Be,Se,Ne,et,Le),Me=P.getPitchedTextCorrection(a,se.add(new c.P(k[0],k[1])),L),Ye=io(ge.point,ce,t,ke,a.angle,Me),Lt=u.allowVerticalPlacement&&U.placedOrientation===c.ai.vertical?Math.PI/2:0;for(let st=0;st<U.numGlyphs;st++)c.ak(Z,Ye,Lt);b&&U.associatedIconIndex>=0&&(H[U.associatedIconIndex]={shiftedAnchor:Ye,angle:Lt})}else Xe(U.numGlyphs,Z)}if(b){j.clear();const Y=u.icon.placedSymbolArray;for(let U=0;U<Y.length;U++){const te=Y.get(U);if(te.hidden)Xe(te.numGlyphs,j);else{const se=H[U];if(se)for(let ce=0;ce<te.numGlyphs;ce++)c.ak(j,se.shiftedAnchor,se.angle);else Xe(te.numGlyphs,j)}}u.icon.dynamicLayoutVertexBuffer.updateData(j)}u.text.dynamicLayoutVertexBuffer.updateData(Z)}function ia(u,t,n){return n.iconsInText&&t?"symbolTextAndIcon":u?"symbolSDF":"symbolIcon"}function Jr(u,t,n,o,a,h,m,y,v,b,P,k){const L=u.context,B=L.gl,N=u.transform,Z=js(),j=y==="map",H=v==="map",Y=y!=="viewport"&&n.layout.get("symbol-placement")!=="point",U=j&&!H&&!Y,te=!H&&Y,se=!n.layout.get("symbol-sort-key").isConstant();let ce=!1;const ge=u.depthModeForSublayer(0,ct.ReadOnly),we=n._unevaluatedLayout.hasValue("text-variable-anchor")||n._unevaluatedLayout.hasValue("text-variable-anchor-offset"),Le=[],Be=Z.getCircleRadiusCorrection(N);for(const Se of o){const Te=t.getTile(Se),Ne=Te.getBucket(n);if(!Ne)continue;const et=a?Ne.text:Ne.icon;if(!et||!et.segments.get().length||!et.hasVisibleVertices)continue;const ke=et.programConfigurations.get(n.id),Me=a||Ne.sdfIcons,Ye=a?Ne.textSizeData:Ne.iconSizeData,Lt=H||N.pitch!==0,st=u.useProgram(ia(Me,a,Ne),ke),ht=c.ah(Ye,N.zoom),Rt=u.style.map.terrain&&u.style.map.terrain.getTerrainData(Se);let di,rr,Bt,Mi,Ii=[0,0],pi=null;if(a)rr=Te.glyphAtlasTexture,Bt=B.LINEAR,di=Te.glyphAtlasTexture.size,Ne.iconsInText&&(Ii=Te.imageAtlasTexture.size,pi=Te.imageAtlasTexture,Mi=Lt||u.options.rotating||u.options.zooming||Ye.kind==="composite"||Ye.kind==="camera"?B.LINEAR:B.NEAREST);else{const Nt=n.layout.get("icon-size").constantOr(0)!==1||Ne.iconsNeedLinear;rr=Te.imageAtlasTexture,Bt=Me||u.options.rotating||u.options.zooming||Nt||Lt?B.LINEAR:B.NEAREST,di=Te.imageAtlasTexture.size}const fi=rt(Te,1,u.transform.zoom),nr=te?Se.posMatrix:ta,vn=Gr(nr,H,j,u.transform,fi),xo=gr(nr,H,j,u.transform,fi),$n=gr(Se.posMatrix,H,j,u.transform,fi),bn=Z.translatePosition(u.transform,Te,h,m),vo=we&&Ne.hasTextData(),Da=n.layout.get("icon-text-fit")!=="none"&&vo&&Ne.hasIconData();if(Y){const Nt=u.style.map.terrain?(La,ti)=>u.style.map.terrain.getElevation(Se,La,ti):null,Zn=n.layout.get("text-rotation-alignment")==="map";O(Ne,Se.posMatrix,u,a,vn,$n,H,b,Zn,Z,Se.toUnwrapped(),N.width,N.height,bn,Nt)}const oi=Se.posMatrix,sr=a&&we||Da,Qr=Y||sr?ta:vn,qn=xo,mi=Me&&n.paint.get(a?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let gi;gi=Me?Ne.iconsInText?jc(Ye.kind,ht,U,H,Y,sr,u,oi,Qr,qn,bn,di,Ii,Be):yl(Ye.kind,ht,U,H,Y,sr,u,oi,Qr,qn,bn,a,di,!0,Be):_l(Ye.kind,ht,U,H,Y,sr,u,oi,Qr,qn,bn,a,di,Be);const ri={program:st,buffers:et,uniformValues:gi,atlasTexture:rr,atlasTextureIcon:pi,atlasInterpolation:Bt,atlasInterpolationIcon:Mi,isSDF:Me,hasHalo:mi};if(se&&Ne.canOverlap){ce=!0;const Nt=et.segments.get();for(const Zn of Nt)Le.push({segments:new c.a0([Zn]),sortKey:Zn.sortKey,state:ri,terrainData:Rt})}else Le.push({segments:et.segments,sortKey:0,state:ri,terrainData:Rt})}ce&&Le.sort((Se,Te)=>Se.sortKey-Te.sortKey);for(const Se of Le){const Te=Se.state;if(L.activeTexture.set(B.TEXTURE0),Te.atlasTexture.bind(Te.atlasInterpolation,B.CLAMP_TO_EDGE),Te.atlasTextureIcon&&(L.activeTexture.set(B.TEXTURE1),Te.atlasTextureIcon&&Te.atlasTextureIcon.bind(Te.atlasInterpolationIcon,B.CLAMP_TO_EDGE)),Te.isSDF){const Ne=Te.uniformValues;Te.hasHalo&&(Ne.u_is_halo=1,pn(Te.buffers,Se.segments,n,u,Te.program,ge,P,k,Ne,Se.terrainData)),Ne.u_is_halo=0}pn(Te.buffers,Se.segments,n,u,Te.program,ge,P,k,Te.uniformValues,Se.terrainData)}}function pn(u,t,n,o,a,h,m,y,v,b){const P=o.context;a.draw(P,P.gl.TRIANGLES,h,m,y,zt.disabled,v,b,n.id,u.layoutVertexBuffer,u.indexBuffer,t,n.paint,o.transform.zoom,u.programConfigurations.get(n.id),u.dynamicLayoutVertexBuffer,u.opacityVertexBuffer)}function $i(u,t,n,o,a){if(!n||!o||!o.imageAtlas)return;const h=o.imageAtlas.patternPositions;let m=h[n.to.toString()],y=h[n.from.toString()];if(!m&&y&&(m=y),!y&&m&&(y=m),!m||!y){const v=a.getPaintProperty(t);m=h[v],y=h[v]}m&&y&&u.setConstantPatternPositions(m,y)}function ra(u,t,n,o,a,h,m){const y=u.context.gl,v="fill-pattern",b=n.paint.get(v),P=b&&b.constantOr(1),k=n.getCrossfadeParameters();let L,B,N,Z,j;m?(B=P&&!n.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",L=y.LINES):(B=P?"fillPattern":"fill",L=y.TRIANGLES);const H=b.constantOr(null);for(const Y of o){const U=t.getTile(Y);if(P&&!U.patternsLoaded())continue;const te=U.getBucket(n);if(!te)continue;const se=te.programConfigurations.get(n.id),ce=u.useProgram(B,se),ge=u.style.map.terrain&&u.style.map.terrain.getTerrainData(Y);P&&(u.context.activeTexture.set(y.TEXTURE0),U.imageAtlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE),se.updatePaintBuffers(k)),$i(se,v,H,U,n);const we=ge?Y:null,Le=u.translatePosMatrix(we?we.posMatrix:Y.posMatrix,U,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));if(m){Z=te.indexBuffer2,j=te.segments2;const Be=[y.drawingBufferWidth,y.drawingBufferHeight];N=B==="fillOutlinePattern"&&P?Oc(Le,u,k,U,Be):Fc(Le,Be)}else Z=te.indexBuffer,j=te.segments,N=P?zn(Le,u,k,U):ps(Le);ce.draw(u.context,L,a,u.stencilModeForClipping(Y),h,zt.disabled,N,ge,n.id,te.layoutVertexBuffer,Z,j,n.paint,u.transform.zoom,se)}}function no(u,t,n,o,a,h,m){const y=u.context,v=y.gl,b="fill-extrusion-pattern",P=n.paint.get(b),k=P.constantOr(1),L=n.getCrossfadeParameters(),B=n.paint.get("fill-extrusion-opacity"),N=P.constantOr(null);for(const Z of o){const j=t.getTile(Z),H=j.getBucket(n);if(!H)continue;const Y=u.style.map.terrain&&u.style.map.terrain.getTerrainData(Z),U=H.programConfigurations.get(n.id),te=u.useProgram(k?"fillExtrusionPattern":"fillExtrusion",U);k&&(u.context.activeTexture.set(v.TEXTURE0),j.imageAtlasTexture.bind(v.LINEAR,v.CLAMP_TO_EDGE),U.updatePaintBuffers(L)),$i(U,b,N,j,n);const se=u.translatePosMatrix(Z.posMatrix,j,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),ce=n.paint.get("fill-extrusion-vertical-gradient"),ge=k?Xs(se,u,ce,B,Z,L,j):Hs(se,u,ce,B);te.draw(y,y.gl.TRIANGLES,a,h,m,zt.backCCW,ge,Y,n.id,H.layoutVertexBuffer,H.indexBuffer,H.segments,n.paint,u.transform.zoom,U,u.style.map.terrain&&H.centroidVertexBuffer)}}function na(u,t,n,o,a,h,m){const y=u.context,v=y.gl,b=n.fbo;if(!b)return;const P=u.useProgram("hillshade"),k=u.style.map.terrain&&u.style.map.terrain.getTerrainData(t);y.activeTexture.set(v.TEXTURE0),v.bindTexture(v.TEXTURE_2D,b.colorAttachment.get()),P.draw(y,v.TRIANGLES,a,h,m,zt.disabled,((L,B,N,Z)=>{const j=N.paint.get("hillshade-shadow-color"),H=N.paint.get("hillshade-highlight-color"),Y=N.paint.get("hillshade-accent-color");let U=N.paint.get("hillshade-illumination-direction")*(Math.PI/180);N.paint.get("hillshade-illumination-anchor")==="viewport"&&(U-=L.transform.angle);const te=!L.options.moving;return{u_matrix:Z?Z.posMatrix:L.transform.calculatePosMatrix(B.tileID.toUnwrapped(),te),u_image:0,u_latrange:ji(0,B.tileID),u_light:[N.paint.get("hillshade-exaggeration"),U],u_shadow:j,u_highlight:H,u_accent:Y}})(u,n,o,k?t:null),k,o.id,u.rasterBoundsBuffer,u.quadTriangleIndexBuffer,u.rasterBoundsSegments)}function fn(u,t,n,o,a,h){const m=u.context,y=m.gl,v=t.dem;if(v&&v.data){const b=v.dim,P=v.stride,k=v.getPixels();if(m.activeTexture.set(y.TEXTURE1),m.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||u.getTileTexture(P),t.demTexture){const B=t.demTexture;B.update(k,{premultiply:!1}),B.bind(y.NEAREST,y.CLAMP_TO_EDGE)}else t.demTexture=new bt(m,k,y.RGBA,{premultiply:!1}),t.demTexture.bind(y.NEAREST,y.CLAMP_TO_EDGE);m.activeTexture.set(y.TEXTURE0);let L=t.fbo;if(!L){const B=new bt(m,{width:b,height:b,data:null},y.RGBA);B.bind(y.LINEAR,y.CLAMP_TO_EDGE),L=t.fbo=m.createFramebuffer(b,b,!0,!1),L.colorAttachment.set(B.texture)}m.bindFramebuffer.set(L.framebuffer),m.viewport.set([0,0,b,b]),u.useProgram("hillshadePrepare").draw(m,y.TRIANGLES,o,a,h,zt.disabled,((B,N)=>{const Z=N.stride,j=c.H();return c.aQ(j,0,c.X,-c.X,0,0,1),c.J(j,j,[0,-c.X,0]),{u_matrix:j,u_image:1,u_dimension:[Z,Z],u_zoom:B.overscaledZ,u_unpack:N.getUnpackVector()}})(t.tileID,v),null,n.id,u.rasterBoundsBuffer,u.quadTriangleIndexBuffer,u.rasterBoundsSegments),t.needsHillshadePrepare=!1}}function so(u,t,n,o,a,h){const m=o.paint.get("raster-fade-duration");if(!h&&m>0){const y=le.now(),v=(y-u.timeAdded)/m,b=t?(y-t.timeAdded)/m:-1,P=n.getSource(),k=a.coveringZoomLevel({tileSize:P.tileSize,roundZoom:P.roundZoom}),L=!t||Math.abs(t.tileID.overscaledZ-k)>Math.abs(u.tileID.overscaledZ-k),B=L&&u.refreshedUponExpiration?1:c.ad(L?v:1-b,0,1);return u.refreshedUponExpiration&&v>=1&&(u.refreshedUponExpiration=!1),t?{opacity:1,mix:1-B}:{opacity:B,mix:0}}return{opacity:1,mix:0}}const oo=new c.aN(1,0,0,1),vs=new c.aN(0,1,0,1),ao=new c.aN(0,0,1,1),Dl=new c.aN(1,0,1,1),Rn=new c.aN(0,1,1,1);function mn(u,t,n,o){Bn(u,0,t+n/2,u.transform.width,n,o)}function sa(u,t,n,o){Bn(u,t-n/2,0,n,u.transform.height,o)}function Bn(u,t,n,o,a,h){const m=u.context,y=m.gl;y.enable(y.SCISSOR_TEST),y.scissor(t*u.pixelRatio,n*u.pixelRatio,o*u.pixelRatio,a*u.pixelRatio),m.clear({color:h}),y.disable(y.SCISSOR_TEST)}function ft(u,t,n){const o=u.context,a=o.gl,h=n.posMatrix,m=u.useProgram("debug"),y=ct.disabled,v=Vt.disabled,b=u.colorModeForRenderPass(),P="$debug",k=u.style.map.terrain&&u.style.map.terrain.getTerrainData(n);o.activeTexture.set(a.TEXTURE0);const L=t.getTileByID(n.key).latestRawTileData,B=Math.floor((L&&L.byteLength||0)/1024),N=t.getTile(n).tileSize,Z=512/Math.min(N,512)*(n.overscaledZ/u.transform.zoom)*.5;let j=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(j+=` => ${n.overscaledZ}`),function(H,Y){H.initDebugOverlayCanvas();const U=H.debugOverlayCanvas,te=H.context.gl,se=H.debugOverlayCanvas.getContext("2d");se.clearRect(0,0,U.width,U.height),se.shadowColor="white",se.shadowBlur=2,se.lineWidth=1.5,se.strokeStyle="white",se.textBaseline="top",se.font="bold 36px Open Sans, sans-serif",se.fillText(Y,5,5),se.strokeText(Y,5,5),H.debugOverlayTexture.update(U),H.debugOverlayTexture.bind(te.LINEAR,te.CLAMP_TO_EDGE)}(u,`${j} ${B}kB`),m.draw(o,a.TRIANGLES,y,v,At.alphaBlended,zt.disabled,Wr(h,c.aN.transparent,Z),null,P,u.debugBuffer,u.quadTriangleIndexBuffer,u.debugSegments),m.draw(o,a.LINE_STRIP,y,v,b,zt.disabled,Wr(h,c.aN.red),k,P,u.debugBuffer,u.tileBorderIndexBuffer,u.debugSegments)}function bs(u,t,n){const o=u.context,a=o.gl,h=u.colorModeForRenderPass(),m=new ct(a.LEQUAL,ct.ReadWrite,u.depthRangeFor3D),y=u.useProgram("terrain"),v=t.getTerrainMesh();o.bindFramebuffer.set(null),o.viewport.set([0,0,u.width,u.height]);for(const b of n){const P=u.renderToTexture.getTexture(b),k=t.getTerrainData(b.tileID);o.activeTexture.set(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,P.texture);const L=u.transform.calculatePosMatrix(b.tileID.toUnwrapped()),B=t.getMeshFrameDelta(u.transform.zoom),N=u.transform.calculateFogMatrix(b.tileID.toUnwrapped()),Z=$o(L,B,N,u.style.sky,u.transform.pitch);y.draw(o,a.TRIANGLES,m,Vt.disabled,h,zt.backCCW,Z,k,"terrain",v.vertexBuffer,v.indexBuffer,v.segments)}}class Ll{constructor(t,n,o){this.vertexBuffer=t,this.indexBuffer=n,this.segments=o}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}class Rl{constructor(t,n){this.context=new Qo(t),this.transform=n,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:c.ao(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Ke.maxUnderzooming+Ke.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Xi}resize(t,n,o){if(this.width=Math.floor(t*o),this.height=Math.floor(n*o),this.pixelRatio=o,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const a of this.style._order)this.style._layers[a].resize()}setup(){const t=this.context,n=new c.aX;n.emplaceBack(0,0),n.emplaceBack(c.X,0),n.emplaceBack(0,c.X),n.emplaceBack(c.X,c.X),this.tileExtentBuffer=t.createVertexBuffer(n,us.members),this.tileExtentSegments=c.a0.simpleSegment(0,0,4,2);const o=new c.aX;o.emplaceBack(0,0),o.emplaceBack(c.X,0),o.emplaceBack(0,c.X),o.emplaceBack(c.X,c.X),this.debugBuffer=t.createVertexBuffer(o,us.members),this.debugSegments=c.a0.simpleSegment(0,0,4,5);const a=new c.$;a.emplaceBack(0,0,0,0),a.emplaceBack(c.X,0,c.X,0),a.emplaceBack(0,c.X,0,c.X),a.emplaceBack(c.X,c.X,c.X,c.X),this.rasterBoundsBuffer=t.createVertexBuffer(a,qr.members),this.rasterBoundsSegments=c.a0.simpleSegment(0,0,4,2);const h=new c.aX;h.emplaceBack(0,0),h.emplaceBack(1,0),h.emplaceBack(0,1),h.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(h,us.members),this.viewportSegments=c.a0.simpleSegment(0,0,4,2);const m=new c.aZ;m.emplaceBack(0),m.emplaceBack(1),m.emplaceBack(3),m.emplaceBack(2),m.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(m);const y=new c.aY;y.emplaceBack(0,1,2),y.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(y);const v=this.context.gl;this.stencilClearMode=new Vt({func:v.ALWAYS,mask:0},0,255,v.ZERO,v.ZERO,v.ZERO)}clearStencil(){const t=this.context,n=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const o=c.H();c.aQ(o,0,this.width,this.height,0,0,1),c.K(o,o,[n.drawingBufferWidth,n.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(t,n.TRIANGLES,ct.disabled,this.stencilClearMode,At.disabled,zt.disabled,fs(o),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,n){if(this.currentStencilSource===t.source||!t.isTileClipped()||!n||!n.length)return;this.currentStencilSource=t.source;const o=this.context,a=o.gl;this.nextStencilID+n.length>256&&this.clearStencil(),o.setColorMode(At.disabled),o.setDepthMode(ct.disabled);const h=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const m of n){const y=this._tileClippingMaskIDs[m.key]=this.nextStencilID++,v=this.style.map.terrain&&this.style.map.terrain.getTerrainData(m);h.draw(o,a.TRIANGLES,ct.disabled,new Vt({func:a.ALWAYS,mask:0},y,255,a.KEEP,a.KEEP,a.REPLACE),At.disabled,zt.disabled,fs(m.posMatrix),v,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,n=this.context.gl;return new Vt({func:n.NOTEQUAL,mask:255},t,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(t){const n=this.context.gl;return new Vt({func:n.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,n.KEEP,n.KEEP,n.REPLACE)}stencilConfigForOverlap(t){const n=this.context.gl,o=t.sort((m,y)=>y.overscaledZ-m.overscaledZ),a=o[o.length-1].overscaledZ,h=o[0].overscaledZ-a+1;if(h>1){this.currentStencilSource=void 0,this.nextStencilID+h>256&&this.clearStencil();const m={};for(let y=0;y<h;y++)m[y+a]=new Vt({func:n.GEQUAL,mask:255},y+this.nextStencilID,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID+=h,[m,o]}return[{[a]:Vt.disabled},o]}colorModeForRenderPass(){const t=this.context.gl;return this._showOverdrawInspector?new At([t.CONSTANT_COLOR,t.ONE],new c.aN(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?At.unblended:At.alphaBlended}depthModeForSublayer(t,n,o){if(!this.opaquePassEnabledForLayer())return ct.disabled;const a=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new ct(o||this.context.gl.LEQUAL,n,[a,a])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(t,n){var o;this.style=t,this.options=n,this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(le.now()),this.imageManager.beginFrame();const a=this.style._order,h=this.style.sourceCaches,m={},y={},v={};for(const b in h){const P=h[b];P.used&&P.prepare(this.context),m[b]=P.getVisibleCoordinates(),y[b]=m[b].slice().reverse(),v[b]=P.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let b=0;b<a.length;b++)if(this.style._layers[a[b]].is3D()){this.opaquePassCutoff=b;break}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const b of a){const P=this.style._layers[b];if(!P.hasOffscreenPass()||P.isHidden(this.transform.zoom))continue;const k=y[P.source];(P.type==="custom"||k.length)&&this.renderLayer(this,h[P.source],P,k)}if(this.context.bindFramebuffer.set(null),this.context.clear({color:n.showOverdrawInspector?c.aN.black:c.aN.transparent,depth:1}),this.clearStencil(),!((o=this.style.stylesheet)===null||o===void 0)&&o.sky&&function(b,P){const k=b.context,L=k.gl,B=((Y,U,te)=>({u_sky_color:Y.properties.get("sky-color"),u_horizon_color:Y.properties.get("horizon-color"),u_horizon:(U.height/2+U.getHorizon())*te,u_sky_horizon_blend:Y.properties.get("sky-horizon-blend")*U.height/2*te}))(P,b.style.map.transform,b.pixelRatio),N=new ct(L.LEQUAL,ct.ReadWrite,[0,1]),Z=Vt.disabled,j=b.colorModeForRenderPass(),H=b.useProgram("sky");if(!P.mesh){const Y=new c.aX;Y.emplaceBack(-1,-1),Y.emplaceBack(1,-1),Y.emplaceBack(1,1),Y.emplaceBack(-1,1);const U=new c.aY;U.emplaceBack(0,1,2),U.emplaceBack(0,2,3),P.mesh=new Ll(k.createVertexBuffer(Y,us.members),k.createIndexBuffer(U),c.a0.simpleSegment(0,0,Y.length,U.length))}H.draw(k,L.TRIANGLES,N,Z,j,zt.disabled,B,void 0,"sky",P.mesh.vertexBuffer,P.mesh.indexBuffer,P.mesh.segments)}(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=a.length-1;this.currentLayer>=0;this.currentLayer--){const b=this.style._layers[a[this.currentLayer]],P=h[b.source],k=m[b.source];this._renderTileClippingMasks(b,k),this.renderLayer(this,P,b,k)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<a.length;this.currentLayer++){const b=this.style._layers[a[this.currentLayer]],P=h[b.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(b))continue;const k=(b.type==="symbol"?v:y)[b.source];this._renderTileClippingMasks(b,m[b.source]),this.renderLayer(this,P,b,k)}if(this.options.showTileBoundaries){const b=function(P,k){let L=null;const B=Object.values(P._layers).flatMap(H=>H.source&&!H.isHidden(k)?[P.sourceCaches[H.source]]:[]),N=B.filter(H=>H.getSource().type==="vector"),Z=B.filter(H=>H.getSource().type!=="vector"),j=H=>{(!L||L.getSource().maxzoom<H.getSource().maxzoom)&&(L=H)};return N.forEach(H=>j(H)),L||Z.forEach(H=>j(H)),L}(this.style,this.transform.zoom);b&&function(P,k,L){for(let B=0;B<L.length;B++)ft(P,k,L[B])}(this,b,b.getVisibleCoordinates())}this.options.showPadding&&function(b){const P=b.transform.padding;mn(b,b.transform.height-(P.top||0),3,oo),mn(b,P.bottom||0,3,vs),sa(b,P.left||0,3,ao),sa(b,b.transform.width-(P.right||0),3,Dl);const k=b.transform.centerPoint;(function(L,B,N,Z){Bn(L,B-1,N-10,2,20,Z),Bn(L,B-10,N-1,20,2,Z)})(b,k.x,b.transform.height-k.y,Rn)}(this),this.context.setDefault()}maybeDrawDepthAndCoords(t){if(!this.style||!this.style.map||!this.style.map.terrain)return;const n=this.terrainFacilitator.matrix,o=this.transform.modelViewProjectionMatrix;let a=this.terrainFacilitator.dirty;a||(a=t?!c.a_(n,o):!c.a$(n,o)),a||(a=this.style.map.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime).length>0),a&&(c.b0(n,o),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(h,m){const y=h.context,v=y.gl,b=At.unblended,P=new ct(v.LEQUAL,ct.ReadWrite,[0,1]),k=m.getTerrainMesh(),L=m.sourceCache.getRenderableTiles(),B=h.useProgram("terrainDepth");y.bindFramebuffer.set(m.getFramebuffer("depth").framebuffer),y.viewport.set([0,0,h.width/devicePixelRatio,h.height/devicePixelRatio]),y.clear({color:c.aN.transparent,depth:1});for(const N of L){const Z=m.getTerrainData(N.tileID),j={u_matrix:h.transform.calculatePosMatrix(N.tileID.toUnwrapped()),u_ele_delta:m.getMeshFrameDelta(h.transform.zoom)};B.draw(y,v.TRIANGLES,P,Vt.disabled,b,zt.backCCW,j,Z,"terrain",k.vertexBuffer,k.indexBuffer,k.segments)}y.bindFramebuffer.set(null),y.viewport.set([0,0,h.width,h.height])}(this,this.style.map.terrain),function(h,m){const y=h.context,v=y.gl,b=At.unblended,P=new ct(v.LEQUAL,ct.ReadWrite,[0,1]),k=m.getTerrainMesh(),L=m.getCoordsTexture(),B=m.sourceCache.getRenderableTiles(),N=h.useProgram("terrainCoords");y.bindFramebuffer.set(m.getFramebuffer("coords").framebuffer),y.viewport.set([0,0,h.width/devicePixelRatio,h.height/devicePixelRatio]),y.clear({color:c.aN.transparent,depth:1}),m.coordsIndex=[];for(const Z of B){const j=m.getTerrainData(Z.tileID);y.activeTexture.set(v.TEXTURE0),v.bindTexture(v.TEXTURE_2D,L.texture);const H={u_matrix:h.transform.calculatePosMatrix(Z.tileID.toUnwrapped()),u_terrain_coords_id:(255-m.coordsIndex.length)/255,u_texture:0,u_ele_delta:m.getMeshFrameDelta(h.transform.zoom)};N.draw(y,v.TRIANGLES,P,Vt.disabled,b,zt.backCCW,H,j,"terrain",k.vertexBuffer,k.indexBuffer,k.segments),m.coordsIndex.push(Z.tileID.key)}y.bindFramebuffer.set(null),y.viewport.set([0,0,h.width,h.height])}(this,this.style.map.terrain))}renderLayer(t,n,o,a){if(!o.isHidden(this.transform.zoom)&&(o.type==="background"||o.type==="custom"||(a||[]).length))switch(this.id=o.id,o.type){case"symbol":(function(h,m,y,v,b){if(h.renderPass!=="translucent")return;const P=Vt.disabled,k=h.colorModeForRenderPass();(y._unevaluatedLayout.hasValue("text-variable-anchor")||y._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(L,B,N,Z,j,H,Y,U,te){const se=B.transform,ce=js(),ge=j==="map",we=H==="map";for(const Le of L){const Be=Z.getTile(Le),Se=Be.getBucket(N);if(!Se||!Se.text||!Se.text.segments.get().length)continue;const Te=c.ah(Se.textSizeData,se.zoom),Ne=rt(Be,1,B.transform.zoom),et=Gr(Le.posMatrix,we,ge,B.transform,Ne),ke=N.layout.get("icon-text-fit")!=="none"&&Se.hasIconData();if(Te){const Me=Math.pow(2,se.zoom-Be.tileID.overscaledZ),Ye=B.style.map.terrain?(st,ht)=>B.style.map.terrain.getElevation(Le,st,ht):null,Lt=ce.translatePosition(se,Be,Y,U);ro(Se,ge,we,te,se,et,Le.posMatrix,Me,Te,ke,ce,Lt,Le.toUnwrapped(),Ye)}}}(v,h,y,m,y.layout.get("text-rotation-alignment"),y.layout.get("text-pitch-alignment"),y.paint.get("text-translate"),y.paint.get("text-translate-anchor"),b),y.paint.get("icon-opacity").constantOr(1)!==0&&Jr(h,m,y,v,!1,y.paint.get("icon-translate"),y.paint.get("icon-translate-anchor"),y.layout.get("icon-rotation-alignment"),y.layout.get("icon-pitch-alignment"),y.layout.get("icon-keep-upright"),P,k),y.paint.get("text-opacity").constantOr(1)!==0&&Jr(h,m,y,v,!0,y.paint.get("text-translate"),y.paint.get("text-translate-anchor"),y.layout.get("text-rotation-alignment"),y.layout.get("text-pitch-alignment"),y.layout.get("text-keep-upright"),P,k),m.map.showCollisionBoxes&&(zl(h,m,y,v,!0),zl(h,m,y,v,!1))})(t,n,o,a,this.style.placement.variableOffsets);break;case"circle":(function(h,m,y,v){if(h.renderPass!=="translucent")return;const b=y.paint.get("circle-opacity"),P=y.paint.get("circle-stroke-width"),k=y.paint.get("circle-stroke-opacity"),L=!y.layout.get("circle-sort-key").isConstant();if(b.constantOr(1)===0&&(P.constantOr(1)===0||k.constantOr(1)===0))return;const B=h.context,N=B.gl,Z=h.depthModeForSublayer(0,ct.ReadOnly),j=Vt.disabled,H=h.colorModeForRenderPass(),Y=[];for(let U=0;U<v.length;U++){const te=v[U],se=m.getTile(te),ce=se.getBucket(y);if(!ce)continue;const ge=ce.programConfigurations.get(y.id),we=h.useProgram("circle",ge),Le=ce.layoutVertexBuffer,Be=ce.indexBuffer,Se=h.style.map.terrain&&h.style.map.terrain.getTerrainData(te),Te={programConfiguration:ge,program:we,layoutVertexBuffer:Le,indexBuffer:Be,uniformValues:pl(h,te,se,y),terrainData:Se};if(L){const Ne=ce.segments.get();for(const et of Ne)Y.push({segments:new c.a0([et]),sortKey:et.sortKey,state:Te})}else Y.push({segments:ce.segments,sortKey:0,state:Te})}L&&Y.sort((U,te)=>U.sortKey-te.sortKey);for(const U of Y){const{programConfiguration:te,program:se,layoutVertexBuffer:ce,indexBuffer:ge,uniformValues:we,terrainData:Le}=U.state;se.draw(B,N.TRIANGLES,Z,j,H,zt.disabled,we,Le,y.id,ce,ge,U.segments,y.paint,h.transform.zoom,te)}})(t,n,o,a);break;case"heatmap":(function(h,m,y,v){if(y.paint.get("heatmap-opacity")!==0)if(h.renderPass==="offscreen"){const b=h.context,P=b.gl,k=Vt.disabled,L=new At([P.ONE,P.ONE],c.aN.transparent,[!0,!0,!0,!0]);(function(B,N,Z){const j=B.gl;B.activeTexture.set(j.TEXTURE1),B.viewport.set([0,0,N.width/4,N.height/4]);let H=Z.heatmapFbo;if(H)j.bindTexture(j.TEXTURE_2D,H.colorAttachment.get()),B.bindFramebuffer.set(H.framebuffer);else{const Y=j.createTexture();j.bindTexture(j.TEXTURE_2D,Y),j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE),j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE),j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MIN_FILTER,j.LINEAR),j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MAG_FILTER,j.LINEAR),H=Z.heatmapFbo=B.createFramebuffer(N.width/4,N.height/4,!1,!1),function(U,te,se,ce){var ge,we;const Le=U.gl,Be=(ge=U.HALF_FLOAT)!==null&&ge!==void 0?ge:Le.UNSIGNED_BYTE,Se=(we=U.RGBA16F)!==null&&we!==void 0?we:Le.RGBA;Le.texImage2D(Le.TEXTURE_2D,0,Se,te.width/4,te.height/4,0,Le.RGBA,Be,null),ce.colorAttachment.set(se)}(B,N,Y,H)}})(b,h,y),b.clear({color:c.aN.transparent});for(let B=0;B<v.length;B++){const N=v[B];if(m.hasRenderableParent(N))continue;const Z=m.getTile(N),j=Z.getBucket(y);if(!j)continue;const H=j.programConfigurations.get(y.id),Y=h.useProgram("heatmap",H),{zoom:U}=h.transform;Y.draw(b,P.TRIANGLES,ct.disabled,k,L,zt.disabled,Ui(N.posMatrix,Z,U,y.paint.get("heatmap-intensity")),null,y.id,j.layoutVertexBuffer,j.indexBuffer,j.segments,y.paint,h.transform.zoom,H)}b.viewport.set([0,0,h.width,h.height])}else h.renderPass==="translucent"&&(h.context.setColorMode(h.colorModeForRenderPass()),function(b,P){const k=b.context,L=k.gl,B=P.heatmapFbo;if(!B)return;k.activeTexture.set(L.TEXTURE0),L.bindTexture(L.TEXTURE_2D,B.colorAttachment.get()),k.activeTexture.set(L.TEXTURE1);let N=P.colorRampTexture;N||(N=P.colorRampTexture=new bt(k,P.colorRamp,L.RGBA)),N.bind(L.LINEAR,L.CLAMP_TO_EDGE),b.useProgram("heatmapTexture").draw(k,L.TRIANGLES,ct.disabled,Vt.disabled,b.colorModeForRenderPass(),zt.disabled,((Z,j,H,Y)=>{const U=c.H();c.aQ(U,0,Z.width,Z.height,0,0,1);const te=Z.context.gl;return{u_matrix:U,u_world:[te.drawingBufferWidth,te.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:j.paint.get("heatmap-opacity")}})(b,P),null,P.id,b.viewportBuffer,b.quadTriangleIndexBuffer,b.viewportSegments,P.paint,b.transform.zoom)}(h,y))})(t,n,o,a);break;case"line":(function(h,m,y,v){if(h.renderPass!=="translucent")return;const b=y.paint.get("line-opacity"),P=y.paint.get("line-width");if(b.constantOr(1)===0||P.constantOr(1)===0)return;const k=h.depthModeForSublayer(0,ct.ReadOnly),L=h.colorModeForRenderPass(),B=y.paint.get("line-dasharray"),N=y.paint.get("line-pattern"),Z=N.constantOr(1),j=y.paint.get("line-gradient"),H=y.getCrossfadeParameters(),Y=Z?"linePattern":B?"lineSDF":j?"lineGradient":"line",U=h.context,te=U.gl;let se=!0;for(const ce of v){const ge=m.getTile(ce);if(Z&&!ge.patternsLoaded())continue;const we=ge.getBucket(y);if(!we)continue;const Le=we.programConfigurations.get(y.id),Be=h.context.program.get(),Se=h.useProgram(Y,Le),Te=se||Se.program!==Be,Ne=h.style.map.terrain&&h.style.map.terrain.getTerrainData(ce),et=N.constantOr(null);if(et&&ge.imageAtlas){const Ye=ge.imageAtlas,Lt=Ye.patternPositions[et.to.toString()],st=Ye.patternPositions[et.from.toString()];Lt&&st&&Le.setConstantPatternPositions(Lt,st)}const ke=Ne?ce:null,Me=Z?fl(h,ge,y,H,ke):B?ml(h,ge,y,B,H,ke):j?Ws(h,ge,y,we.lineClipsArray.length,ke):ms(h,ge,y,ke);if(Z)U.activeTexture.set(te.TEXTURE0),ge.imageAtlasTexture.bind(te.LINEAR,te.CLAMP_TO_EDGE),Le.updatePaintBuffers(H);else if(B&&(Te||h.lineAtlas.dirty))U.activeTexture.set(te.TEXTURE0),h.lineAtlas.bind(U);else if(j){const Ye=we.gradients[y.id];let Lt=Ye.texture;if(y.gradientVersion!==Ye.version){let st=256;if(y.stepInterpolant){const ht=m.getSource().maxzoom,Rt=ce.canonical.z===ht?Math.ceil(1<<h.transform.maxZoom-ce.canonical.z):1;st=c.ad(c.aV(we.maxLineLength/c.X*1024*Rt),256,U.maxTextureSize)}Ye.gradient=c.aW({expression:y.gradientExpression(),evaluationKey:"lineProgress",resolution:st,image:Ye.gradient||void 0,clips:we.lineClipsArray}),Ye.texture?Ye.texture.update(Ye.gradient):Ye.texture=new bt(U,Ye.gradient,te.RGBA),Ye.version=y.gradientVersion,Lt=Ye.texture}U.activeTexture.set(te.TEXTURE0),Lt.bind(y.stepInterpolant?te.NEAREST:te.LINEAR,te.CLAMP_TO_EDGE)}Se.draw(U,te.TRIANGLES,k,h.stencilModeForClipping(ce),L,zt.disabled,Me,Ne,y.id,we.layoutVertexBuffer,we.indexBuffer,we.segments,y.paint,h.transform.zoom,Le,we.layoutVertexBuffer2),se=!1}})(t,n,o,a);break;case"fill":(function(h,m,y,v){const b=y.paint.get("fill-color"),P=y.paint.get("fill-opacity");if(P.constantOr(1)===0)return;const k=h.colorModeForRenderPass(),L=y.paint.get("fill-pattern"),B=h.opaquePassEnabledForLayer()&&!L.constantOr(1)&&b.constantOr(c.aN.transparent).a===1&&P.constantOr(0)===1?"opaque":"translucent";if(h.renderPass===B){const N=h.depthModeForSublayer(1,h.renderPass==="opaque"?ct.ReadWrite:ct.ReadOnly);ra(h,m,y,v,N,k,!1)}if(h.renderPass==="translucent"&&y.paint.get("fill-antialias")){const N=h.depthModeForSublayer(y.getPaintProperty("fill-outline-color")?2:0,ct.ReadOnly);ra(h,m,y,v,N,k,!0)}})(t,n,o,a);break;case"fill-extrusion":(function(h,m,y,v){const b=y.paint.get("fill-extrusion-opacity");if(b!==0&&h.renderPass==="translucent"){const P=new ct(h.context.gl.LEQUAL,ct.ReadWrite,h.depthRangeFor3D);if(b!==1||y.paint.get("fill-extrusion-pattern").constantOr(1))no(h,m,y,v,P,Vt.disabled,At.disabled),no(h,m,y,v,P,h.stencilModeFor3D(),h.colorModeForRenderPass());else{const k=h.colorModeForRenderPass();no(h,m,y,v,P,Vt.disabled,k)}}})(t,n,o,a);break;case"hillshade":(function(h,m,y,v){if(h.renderPass!=="offscreen"&&h.renderPass!=="translucent")return;const b=h.context,P=h.depthModeForSublayer(0,ct.ReadOnly),k=h.colorModeForRenderPass(),[L,B]=h.renderPass==="translucent"?h.stencilConfigForOverlap(v):[{},v];for(const N of B){const Z=m.getTile(N);Z.needsHillshadePrepare!==void 0&&Z.needsHillshadePrepare&&h.renderPass==="offscreen"?fn(h,Z,y,P,Vt.disabled,k):h.renderPass==="translucent"&&na(h,N,Z,y,P,L[N.overscaledZ],k)}b.viewport.set([0,0,h.width,h.height])})(t,n,o,a);break;case"raster":(function(h,m,y,v){if(h.renderPass!=="translucent"||y.paint.get("raster-opacity")===0||!v.length)return;const b=h.context,P=b.gl,k=m.getSource(),L=h.useProgram("raster"),B=h.colorModeForRenderPass(),[N,Z]=k instanceof Cr?[{},v]:h.stencilConfigForOverlap(v),j=Z[Z.length-1].overscaledZ,H=!h.options.moving;for(const Y of Z){const U=h.depthModeForSublayer(Y.overscaledZ-j,y.paint.get("raster-opacity")===1?ct.ReadWrite:ct.ReadOnly,P.LESS),te=m.getTile(Y);te.registerFadeDuration(y.paint.get("raster-fade-duration"));const se=m.findLoadedParent(Y,0),ce=m.findLoadedSibling(Y),ge=so(te,se||ce||null,m,y,h.transform,h.style.map.terrain);let we,Le;const Be=y.paint.get("raster-resampling")==="nearest"?P.NEAREST:P.LINEAR;b.activeTexture.set(P.TEXTURE0),te.texture.bind(Be,P.CLAMP_TO_EDGE,P.LINEAR_MIPMAP_NEAREST),b.activeTexture.set(P.TEXTURE1),se?(se.texture.bind(Be,P.CLAMP_TO_EDGE,P.LINEAR_MIPMAP_NEAREST),we=Math.pow(2,se.tileID.overscaledZ-te.tileID.overscaledZ),Le=[te.tileID.canonical.x*we%1,te.tileID.canonical.y*we%1]):te.texture.bind(Be,P.CLAMP_TO_EDGE,P.LINEAR_MIPMAP_NEAREST),te.texture.useMipmap&&b.extTextureFilterAnisotropic&&h.transform.pitch>20&&P.texParameterf(P.TEXTURE_2D,b.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,b.extTextureFilterAnisotropicMax);const Se=h.style.map.terrain&&h.style.map.terrain.getTerrainData(Y),Te=Se?Y:null,Ne=Te?Te.posMatrix:h.transform.calculatePosMatrix(Y.toUnwrapped(),H),et=Nc(Ne,Le||[0,0],we||1,ge,y);k instanceof Cr?L.draw(b,P.TRIANGLES,U,Vt.disabled,B,zt.disabled,et,Se,y.id,k.boundsBuffer,h.quadTriangleIndexBuffer,k.boundsSegments):L.draw(b,P.TRIANGLES,U,N[Y.overscaledZ],B,zt.disabled,et,Se,y.id,h.rasterBoundsBuffer,h.quadTriangleIndexBuffer,h.rasterBoundsSegments)}})(t,n,o,a);break;case"background":(function(h,m,y,v){const b=y.paint.get("background-color"),P=y.paint.get("background-opacity");if(P===0)return;const k=h.context,L=k.gl,B=h.transform,N=B.tileSize,Z=y.paint.get("background-pattern");if(h.isPatternMissing(Z))return;const j=!Z&&b.a===1&&P===1&&h.opaquePassEnabledForLayer()?"opaque":"translucent";if(h.renderPass!==j)return;const H=Vt.disabled,Y=h.depthModeForSublayer(0,j==="opaque"?ct.ReadWrite:ct.ReadOnly),U=h.colorModeForRenderPass(),te=h.useProgram(Z?"backgroundPattern":"background"),se=v||B.coveringTiles({tileSize:N,terrain:h.style.map.terrain});Z&&(k.activeTexture.set(L.TEXTURE0),h.imageManager.bind(h.context));const ce=y.getCrossfadeParameters();for(const ge of se){const we=v?ge.posMatrix:h.transform.calculatePosMatrix(ge.toUnwrapped()),Le=Z?qo(we,P,h,Z,{tileID:ge,tileSize:N},ce):Js(we,P,b),Be=h.style.map.terrain&&h.style.map.terrain.getTerrainData(ge);te.draw(k,L.TRIANGLES,Y,H,U,zt.disabled,Le,Be,y.id,h.tileExtentBuffer,h.quadTriangleIndexBuffer,h.tileExtentSegments)}})(t,0,o,a);break;case"custom":(function(h,m,y){const v=h.context,b=y.implementation;if(h.renderPass==="offscreen"){const P=b.prerender;P&&(h.setCustomLayerDefaults(),v.setColorMode(h.colorModeForRenderPass()),P.call(b,v.gl,h.transform.customLayerMatrix()),v.setDirty(),h.setBaseState())}else if(h.renderPass==="translucent"){h.setCustomLayerDefaults(),v.setColorMode(h.colorModeForRenderPass()),v.setStencilMode(Vt.disabled);const P=b.renderingMode==="3d"?new ct(h.context.gl.LEQUAL,ct.ReadWrite,h.depthRangeFor3D):h.depthModeForSublayer(0,ct.ReadOnly);v.setDepthMode(P),b.render(v.gl,h.transform.customLayerMatrix(),{farZ:h.transform.farZ,nearZ:h.transform.nearZ,fov:h.transform._fov,modelViewProjectionMatrix:h.transform.modelViewProjectionMatrix,projectionMatrix:h.transform.projectionMatrix}),v.setDirty(),h.setBaseState(),v.bindFramebuffer.set(null)}})(t,0,o)}}translatePosMatrix(t,n,o,a,h){if(!o[0]&&!o[1])return t;const m=h?a==="map"?this.transform.angle:0:a==="viewport"?-this.transform.angle:0;if(m){const b=Math.sin(m),P=Math.cos(m);o=[o[0]*P-o[1]*b,o[0]*b+o[1]*P]}const y=[h?o[0]:rt(n,o[0],this.transform.zoom),h?o[1]:rt(n,o[1],this.transform.zoom),0],v=new Float32Array(16);return c.J(v,t,y),v}saveTileTexture(t){const n=this._tileTextures[t.size[0]];n?n.push(t):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()),o=this.imageManager.getPattern(t.to.toString());return!n||!o}useProgram(t,n){this.cache=this.cache||{};const o=t+(n?n.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[o]||(this.cache[o]=new Zs(this.context,Xr[t],n,Ks[t],this._showOverdrawInspector,this.style.map.terrain)),this.cache[o]}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 bt(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:t,drawingBufferHeight:n}=this.context.gl;return this.width!==t||this.height!==n}}class gn{constructor(t,n){this.points=t,this.planes=n}static fromInvProjectionMatrix(t,n,o){const a=Math.pow(2,o),h=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(y=>{const v=1/(y=c.ag([],y,t))[3]/n*a;return c.b1(y,y,[v,v,1/y[3],v])}),m=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(y=>{const v=function(L,B){var N=B[0],Z=B[1],j=B[2],H=N*N+Z*Z+j*j;return H>0&&(H=1/Math.sqrt(H)),L[0]=B[0]*H,L[1]=B[1]*H,L[2]=B[2]*H,L}([],function(L,B,N){var Z=B[0],j=B[1],H=B[2],Y=N[0],U=N[1],te=N[2];return L[0]=j*te-H*U,L[1]=H*Y-Z*te,L[2]=Z*U-j*Y,L}([],jt([],h[y[0]],h[y[1]]),jt([],h[y[2]],h[y[1]]))),b=-((P=v)[0]*(k=h[y[1]])[0]+P[1]*k[1]+P[2]*k[2]);var P,k;return v.concat(b)});return new gn(h,m)}}class lo{constructor(t,n){this.min=t,this.max=n,this.center=function(o,a,h){return o[0]=.5*a[0],o[1]=.5*a[1],o[2]=.5*a[2],o}([],function(o,a,h){return o[0]=a[0]+h[0],o[1]=a[1]+h[1],o[2]=a[2]+h[2],o}([],this.min,this.max))}quadrant(t){const n=[t%2==0,t<2],o=Tt(this.min),a=Tt(this.max);for(let h=0;h<n.length;h++)o[h]=n[h]?this.min[h]:this.center[h],a[h]=n[h]?this.center[h]:this.max[h];return a[2]=this.max[2],new lo(o,a)}distanceX(t){return Math.max(Math.min(this.max[0],t[0]),this.min[0])-t[0]}distanceY(t){return Math.max(Math.min(this.max[1],t[1]),this.min[1])-t[1]}intersects(t){const n=[[this.min[0],this.min[1],this.min[2],1],[this.max[0],this.min[1],this.min[2],1],[this.max[0],this.max[1],this.min[2],1],[this.min[0],this.max[1],this.min[2],1],[this.min[0],this.min[1],this.max[2],1],[this.max[0],this.min[1],this.max[2],1],[this.max[0],this.max[1],this.max[2],1],[this.min[0],this.max[1],this.max[2],1]];let o=!0;for(let a=0;a<t.planes.length;a++){const h=t.planes[a];let m=0;for(let y=0;y<n.length;y++)c.b2(h,n[y])>=0&&m++;if(m===0)return 0;m!==n.length&&(o=!1)}if(o)return 2;for(let a=0;a<3;a++){let h=Number.MAX_VALUE,m=-Number.MAX_VALUE;for(let y=0;y<t.points.length;y++){const v=t.points[y][a]-this.min[a];h=Math.min(h,v),m=Math.max(m,v)}if(m<0||h>this.max[a]-this.min[a])return 0}return 1}}class co{constructor(t=0,n=0,o=0,a=0){if(isNaN(t)||t<0||isNaN(n)||n<0||isNaN(o)||o<0||isNaN(a)||a<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=n,this.left=o,this.right=a}interpolate(t,n,o){return n.top!=null&&t.top!=null&&(this.top=c.z.number(t.top,n.top,o)),n.bottom!=null&&t.bottom!=null&&(this.bottom=c.z.number(t.bottom,n.bottom,o)),n.left!=null&&t.left!=null&&(this.left=c.z.number(t.left,n.left,o)),n.right!=null&&t.right!=null&&(this.right=c.z.number(t.right,n.right,o)),this}getCenter(t,n){const o=c.ad((this.left+t-this.right)/2,0,t),a=c.ad((this.top+n-this.bottom)/2,0,n);return new c.P(o,a)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new co(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const oa=85.051129;class aa{constructor(t,n,o,a,h){this.tileSize=512,this._renderWorldCopies=h===void 0||!!h,this._minZoom=t||0,this._maxZoom=n||22,this._minPitch=o??0,this._maxPitch=a??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new c.N(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new co,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={},this.minElevationForCurrentTile=0}clone(){const t=new aa(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t.apply(this),t}apply(t){this.tileSize=t.tileSize,this.latRange=t.latRange,this.width=t.width,this.height=t.height,this._center=t._center,this._elevation=t._elevation,this.minElevationForCurrentTile=t.minElevationForCurrentTile,this.zoom=t.zoom,this.angle=t.angle,this._fov=t._fov,this._pitch=t._pitch,this._unmodified=t._unmodified,this._edgeInsets=t._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))}get maxZoom(){return this._maxZoom}set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))}get minPitch(){return this._minPitch}set minPitch(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))}get maxPitch(){return this._maxPitch}set maxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(t){t===void 0?t=!0:t===null&&(t=!1),this._renderWorldCopies=t}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new c.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(t){const n=-c.b3(t,-180,180)*Math.PI/180;this.angle!==n&&(this._unmodified=!1,this.angle=n,this._calcMatrices(),this.rotationMatrix=function(){var o=new c.A(4);return c.A!=Float32Array&&(o[1]=0,o[2]=0),o[0]=1,o[3]=1,o}(),function(o,a,h){var m=a[0],y=a[1],v=a[2],b=a[3],P=Math.sin(h),k=Math.cos(h);o[0]=m*k+v*P,o[1]=y*k+b*P,o[2]=m*-P+v*k,o[3]=y*-P+b*k}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const n=c.ad(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==n&&(this._unmodified=!1,this._pitch=n,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(t){const n=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==n&&(this._unmodified=!1,this._zoom=n,this.tileZoom=Math.max(0,Math.floor(n)),this.scale=this.zoomScale(n),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(t){t!==this._elevation&&(this._elevation=t,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,n,o){this._unmodified=!1,this._edgeInsets.interpolate(t,n,o),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){const n=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,n)}getVisibleUnwrappedCoordinates(t){const n=[new c.b4(0,t)];if(this._renderWorldCopies){const o=this.pointCoordinate(new c.P(0,0)),a=this.pointCoordinate(new c.P(this.width,0)),h=this.pointCoordinate(new c.P(this.width,this.height)),m=this.pointCoordinate(new c.P(0,this.height)),y=Math.floor(Math.min(o.x,a.x,h.x,m.x)),v=Math.floor(Math.max(o.x,a.x,h.x,m.x)),b=1;for(let P=y-b;P<=v+b;P++)P!==0&&n.push(new c.b4(P,t))}return n}coveringTiles(t){var n,o;let a=this.coveringZoomLevel(t);const h=a;if(t.minzoom!==void 0&&a<t.minzoom)return[];t.maxzoom!==void 0&&a>t.maxzoom&&(a=t.maxzoom);const m=this.pointCoordinate(this.getCameraPoint()),y=c.Z.fromLngLat(this.center),v=Math.pow(2,a),b=[v*m.x,v*m.y,0],P=[v*y.x,v*y.y,0],k=gn.fromInvProjectionMatrix(this.invModelViewProjectionMatrix,this.worldSize,a);let L=t.minzoom||0;!t.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(L=a);const B=t.terrain?2/Math.min(this.tileSize,t.tileSize)*this.tileSize:3,N=U=>({aabb:new lo([U*v,0,0],[(U+1)*v,v,0]),zoom:0,x:0,y:0,wrap:U,fullyVisible:!1}),Z=[],j=[],H=a,Y=t.reparseOverscaled?h:a;if(this._renderWorldCopies)for(let U=1;U<=3;U++)Z.push(N(-U)),Z.push(N(U));for(Z.push(N(0));Z.length>0;){const U=Z.pop(),te=U.x,se=U.y;let ce=U.fullyVisible;if(!ce){const Se=U.aabb.intersects(k);if(Se===0)continue;ce=Se===2}const ge=t.terrain?b:P,we=U.aabb.distanceX(ge),Le=U.aabb.distanceY(ge),Be=Math.max(Math.abs(we),Math.abs(Le));if(U.zoom===H||Be>B+(1<<H-U.zoom)-2&&U.zoom>=L){const Se=H-U.zoom,Te=b[0]-.5-(te<<Se),Ne=b[1]-.5-(se<<Se);j.push({tileID:new c.S(U.zoom===H?Y:U.zoom,U.wrap,U.zoom,te,se),distanceSq:Vr([P[0]-.5-te,P[1]-.5-se]),tileDistanceToCamera:Math.sqrt(Te*Te+Ne*Ne)})}else for(let Se=0;Se<4;Se++){const Te=(te<<1)+Se%2,Ne=(se<<1)+(Se>>1),et=U.zoom+1;let ke=U.aabb.quadrant(Se);if(t.terrain){const Me=new c.S(et,U.wrap,et,Te,Ne),Ye=t.terrain.getMinMaxElevation(Me),Lt=(n=Ye.minElevation)!==null&&n!==void 0?n:this.elevation,st=(o=Ye.maxElevation)!==null&&o!==void 0?o:this.elevation;ke=new lo([ke.min[0],ke.min[1],Lt],[ke.max[0],ke.max[1],st])}Z.push({aabb:ke,zoom:et,x:Te,y:Ne,wrap:U.wrap,fullyVisible:ce})}}return j.sort((U,te)=>U.distanceSq-te.distanceSq).map(U=>U.tileID)}resize(t,n){this.width=t,this.height=n,this.pixelsToGLUnits=[2/t,-2/n],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(t){return Math.pow(2,t)}scaleZoom(t){return Math.log(t)/Math.LN2}project(t){const n=c.ad(t.lat,-85.051129,oa);return new c.P(c.O(t.lng)*this.worldSize,c.Q(n)*this.worldSize)}unproject(t){return new c.Z(t.x/this.worldSize,t.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(t){const n=this.elevation,o=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,a=this.pointLocation(this.centerPoint,t),h=t.getElevationForLngLatZoom(a,this.tileZoom);if(!(this.elevation-h))return;const m=o+n-h,y=Math.cos(this._pitch)*this.cameraToCenterDistance/m/c.b5(1,a.lat),v=this.scaleZoom(y/this.tileSize);this._elevation=h,this._center=a,this.zoom=v}setLocationAtPoint(t,n){const o=this.pointCoordinate(n),a=this.pointCoordinate(this.centerPoint),h=this.locationCoordinate(t),m=new c.Z(h.x-(o.x-a.x),h.y-(o.y-a.y));this.center=this.coordinateLocation(m),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(t,n){return n?this.coordinatePoint(this.locationCoordinate(t),n.getElevationForLngLatZoom(t,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(t))}pointLocation(t,n){return this.coordinateLocation(this.pointCoordinate(t,n))}locationCoordinate(t){return c.Z.fromLngLat(t)}coordinateLocation(t){return t&&t.toLngLat()}pointCoordinate(t,n){if(n){const L=n.pointCoordinate(t);if(L!=null)return L}const o=[t.x,t.y,0,1],a=[t.x,t.y,1,1];c.ag(o,o,this.pixelMatrixInverse),c.ag(a,a,this.pixelMatrixInverse);const h=o[3],m=a[3],y=o[1]/h,v=a[1]/m,b=o[2]/h,P=a[2]/m,k=b===P?0:(0-b)/(P-b);return new c.Z(c.z.number(o[0]/h,a[0]/m,k)/this.worldSize,c.z.number(y,v,k)/this.worldSize)}coordinatePoint(t,n=0,o=this.pixelMatrix){const a=[t.x*this.worldSize,t.y*this.worldSize,n,1];return c.ag(a,a,o),new c.P(a[0]/a[3],a[1]/a[3])}getBounds(){const t=Math.max(0,this.height/2-this.getHorizon());return new ue().extend(this.pointLocation(new c.P(0,t))).extend(this.pointLocation(new c.P(this.width,t))).extend(this.pointLocation(new c.P(this.width,this.height))).extend(this.pointLocation(new c.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new ue([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(t){t?(this.lngRange=[t.getWest(),t.getEast()],this.latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-85.051129,oa])}calculateTileMatrix(t){const n=t.canonical,o=this.worldSize/this.zoomScale(n.z),a=n.x+Math.pow(2,n.z)*t.wrap,h=c.ao(new Float64Array(16));return c.J(h,h,[a*o,n.y*o,0]),c.K(h,h,[o/c.X,o/c.X,1]),h}calculatePosMatrix(t,n=!1){const o=t.key,a=n?this._alignedPosMatrixCache:this._posMatrixCache;if(a[o])return a[o];const h=this.calculateTileMatrix(t);return c.L(h,n?this.alignedModelViewProjectionMatrix:this.modelViewProjectionMatrix,h),a[o]=new Float32Array(h),a[o]}calculateFogMatrix(t){const n=t.key,o=this._fogMatrixCache;if(o[n])return o[n];const a=this.calculateTileMatrix(t);return c.L(a,this.fogMatrix,a),o[n]=new Float32Array(a),o[n]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(t,n){n=c.ad(+n,this.minZoom,this.maxZoom);const o={center:new c.N(t.lng,t.lat),zoom:n};let a=this.lngRange;if(!this._renderWorldCopies&&a===null){const U=179.9999999999;a=[-U,U]}const h=this.tileSize*this.zoomScale(o.zoom);let m=0,y=h,v=0,b=h,P=0,k=0;const{x:L,y:B}=this.size;if(this.latRange){const U=this.latRange;m=c.Q(U[1])*h,y=c.Q(U[0])*h,y-m<B&&(P=B/(y-m))}a&&(v=c.b3(c.O(a[0])*h,0,h),b=c.b3(c.O(a[1])*h,0,h),b<v&&(b+=h),b-v<L&&(k=L/(b-v)));const{x:N,y:Z}=this.project.call({worldSize:h},t);let j,H;const Y=Math.max(k||0,P||0);if(Y){const U=new c.P(k?(b+v)/2:N,P?(y+m)/2:Z);return o.center=this.unproject.call({worldSize:h},U).wrap(),o.zoom+=this.scaleZoom(Y),o}if(this.latRange){const U=B/2;Z-U<m&&(H=m+U),Z+U>y&&(H=y-U)}if(a){const U=(v+b)/2;let te=N;this._renderWorldCopies&&(te=c.b3(N,U-h/2,U+h/2));const se=L/2;te-se<v&&(j=v+se),te+se>b&&(j=b-se)}if(j!==void 0||H!==void 0){const U=new c.P(j??N,H??Z);o.center=this.unproject.call({worldSize:h},U).wrap()}return o}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const t=this._unmodified,{center:n,zoom:o}=this.getConstrained(this.center,this.zoom);this.center=n,this.zoom=o,this._unmodified=t,this._constraining=!1}_calcMatrices(){if(!this.height)return;const t=this.centerOffset,n=this.point.x,o=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=c.b5(1,this.center.lat)*this.worldSize;let a=c.ao(new Float64Array(16));c.K(a,a,[this.width/2,-this.height/2,1]),c.J(a,a,[1,-1,0]),this.labelPlaneMatrix=a,a=c.ao(new Float64Array(16)),c.K(a,a,[1,-1,1]),c.J(a,a,[-1,-1,0]),c.K(a,a,[2/this.width,2/this.height,1]),this.glCoordMatrix=a;const h=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),m=Math.min(this.elevation,this.minElevationForCurrentTile),y=h-m*this._pixelPerMeter/Math.cos(this._pitch),v=m<0?y:h,b=Math.PI/2+this._pitch,P=this._fov*(.5+t.y/this.height),k=Math.sin(P)*v/Math.sin(c.ad(Math.PI-b-P,.01,Math.PI-.01)),L=this.getHorizon(),B=2*Math.atan(L/this.cameraToCenterDistance)*(.5+t.y/(2*L)),N=Math.sin(B)*v/Math.sin(c.ad(Math.PI-b-B,.01,Math.PI-.01)),Z=Math.min(k,N);this.farZ=1.01*(Math.cos(Math.PI/2-this._pitch)*Z+v),this.nearZ=this.height/50,a=new Float64Array(16),c.b6(a,this._fov,this.width/this.height,this.nearZ,this.farZ),a[8]=2*-t.x/this.width,a[9]=2*t.y/this.height,this.projectionMatrix=c.af(a),c.K(a,a,[1,-1,1]),c.J(a,a,[0,0,-this.cameraToCenterDistance]),c.b7(a,a,this._pitch),c.ae(a,a,this.angle),c.J(a,a,[-n,-o,0]),this.mercatorMatrix=c.K([],a,[this.worldSize,this.worldSize,this.worldSize]),c.K(a,a,[1,1,this._pixelPerMeter]),this.pixelMatrix=c.L(new Float64Array(16),this.labelPlaneMatrix,a),c.J(a,a,[0,0,-this.elevation]),this.modelViewProjectionMatrix=a,this.invModelViewProjectionMatrix=c.at([],a),this.fogMatrix=new Float64Array(16),c.b6(this.fogMatrix,this._fov,this.width/this.height,h,this.farZ),this.fogMatrix[8]=2*-t.x/this.width,this.fogMatrix[9]=2*t.y/this.height,c.K(this.fogMatrix,this.fogMatrix,[1,-1,1]),c.J(this.fogMatrix,this.fogMatrix,[0,0,-this.cameraToCenterDistance]),c.b7(this.fogMatrix,this.fogMatrix,this._pitch),c.ae(this.fogMatrix,this.fogMatrix,this.angle),c.J(this.fogMatrix,this.fogMatrix,[-n,-o,0]),c.K(this.fogMatrix,this.fogMatrix,[1,1,this._pixelPerMeter]),c.J(this.fogMatrix,this.fogMatrix,[0,0,-this.elevation]),this.pixelMatrix3D=c.L(new Float64Array(16),this.labelPlaneMatrix,a);const j=this.width%2/2,H=this.height%2/2,Y=Math.cos(this.angle),U=Math.sin(this.angle),te=n-Math.round(n)+Y*j+U*H,se=o-Math.round(o)+Y*H+U*j,ce=new Float64Array(a);if(c.J(ce,ce,[te>.5?te-1:te,se>.5?se-1:se,0]),this.alignedModelViewProjectionMatrix=ce,a=c.at(new Float64Array(16),this.pixelMatrix),!a)throw new Error("failed to invert matrix");this.pixelMatrixInverse=a,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const t=this.pointCoordinate(new c.P(0,0)),n=[t.x*this.worldSize,t.y*this.worldSize,0,1];return c.ag(n,n,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new c.P(0,t))}getCameraQueryGeometry(t){const n=this.getCameraPoint();if(t.length===1)return[t[0],n];{let o=n.x,a=n.y,h=n.x,m=n.y;for(const y of t)o=Math.min(o,y.x),a=Math.min(a,y.y),h=Math.max(h,y.x),m=Math.max(m,y.y);return[new c.P(o,a),new c.P(h,a),new c.P(h,m),new c.P(o,m),new c.P(o,a)]}}lngLatToCameraDepth(t,n){const o=this.locationCoordinate(t),a=[o.x*this.worldSize,o.y*this.worldSize,n,1];return c.ag(a,a,this.modelViewProjectionMatrix),a[2]/a[3]}}function ho(u,t){let n,o=!1,a=null,h=null;const m=()=>{a=null,o&&(u.apply(h,n),a=setTimeout(m,t),o=!1)};return(...y)=>(o=!0,h=this,n=y,a||m(),a)}class ws{constructor(t){this._getCurrentHash=()=>{const n=window.location.hash.replace("#","");if(this._hashName){let o;return n.split("&").map(a=>a.split("=")).forEach(a=>{a[0]===this._hashName&&(o=a)}),(o&&o[1]||"").split("/")}return n.split("/")},this._onHashChange=()=>{const n=this._getCurrentHash();if(n.length>=3&&!n.some(o=>isNaN(o))){const o=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:o,pitch:+(n[4]||0)}),!0}return!1},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 o=n.join("/");let a=o;a.split("&").length>0&&(a=a.split("&")[0]),this._hashName&&(a=`${this._hashName}=${o}`);let h=window.location.hash.replace(a,"");h.startsWith("#&")?h=h.slice(0,1)+h.slice(2):h==="#"&&(h="");let m=window.location.href.replace(/(#.+)?$/,h);m=m.replace("&&","&"),window.history.replaceState(window.history.state,null,m)},this._updateHash=ho(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(),o=Math.round(100*this._map.getZoom())/100,a=Math.ceil((o*Math.LN2+Math.log(512/360/.5))/Math.LN10),h=Math.pow(10,a),m=Math.round(n.lng*h)/h,y=Math.round(n.lat*h)/h,v=this._map.getBearing(),b=this._map.getPitch();let P="";if(P+=t?`/${m}/${y}/${o}`:`${o}/${y}/${m}`,(v||b)&&(P+="/"+Math.round(10*v)/10),b&&(P+=`/${Math.round(b)}`),this._hashName){const k=this._hashName;let L=!1;const B=window.location.hash.slice(1).split("&").map(N=>{const Z=N.split("=")[0];return Z===k?(L=!0,`${Z}=${P}`):N}).filter(N=>N);return L||B.push(`${k}=${P}`),`#${B.join("&")}`}return`#${P}`}}const _n={linearity:.3,easing:c.b8(0,0,.3,1)},la=c.e({deceleration:2500,maxSpeed:1400},_n),ca=c.e({deceleration:20,maxSpeed:1400},_n),Bl=c.e({deceleration:1e3,maxSpeed:360},_n),uo=c.e({deceleration:1e3,maxSpeed:90},_n);class po{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:le.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,n=le.now();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,pan:new c.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:h}of this._inertiaBuffer)n.zoom+=h.zoomDelta||0,n.bearing+=h.bearingDelta||0,n.pitch+=h.pitchDelta||0,h.panDelta&&n.pan._add(h.panDelta),h.around&&(n.around=h.around),h.pinchAround&&(n.pinchAround=h.pinchAround);const o=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,a={};if(n.pan.mag()){const h=fo(n.pan.mag(),o,c.e({},la,t||{}));a.offset=n.pan.mult(h.amount/n.pan.mag()),a.center=this._map.transform.center,Fn(a,h)}if(n.zoom){const h=fo(n.zoom,o,ca);a.zoom=this._map.transform.zoom+h.amount,Fn(a,h)}if(n.bearing){const h=fo(n.bearing,o,Bl);a.bearing=this._map.transform.bearing+c.ad(h.amount,-179,179),Fn(a,h)}if(n.pitch){const h=fo(n.pitch,o,uo);a.pitch=this._map.transform.pitch+h.amount,Fn(a,h)}if(a.zoom||a.bearing){const h=n.pinchAround===void 0?n.around:n.pinchAround;a.around=h?this._map.unproject(h):this._map.getCenter()}return this.clear(),c.e(a,{noMoveStart:!0})}}function Fn(u,t){(!u.duration||u.duration<t.duration)&&(u.duration=t.duration,u.easing=t.easing)}function fo(u,t,n){const{maxSpeed:o,linearity:a,deceleration:h}=n,m=c.ad(u*a/(t/1e3),-o,o),y=Math.abs(m)/(h*a);return{easing:n.easing,duration:1e3*y,amount:m*(y/2)}}class Ti extends c.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,o,a={}){const h=ae.mousePos(n.getCanvas(),o),m=n.unproject(h);super(t,c.e({point:h,lngLat:m,originalEvent:o},a)),this._defaultPrevented=!1,this.target=n}}class Ss extends c.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,o){const a=t==="touchend"?o.changedTouches:o.touches,h=ae.touchPos(n.getCanvasContainer(),a),m=h.map(v=>n.unproject(v)),y=h.reduce((v,b,P,k)=>v.add(b.div(k.length)),new c.P(0,0));super(t,{points:h,point:y,lngLats:m,lngLat:n.unproject(y),originalEvent:o}),this._defaultPrevented=!1}}class ha extends c.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,o){super(t,{originalEvent:o}),this._defaultPrevented=!1}}class mo{constructor(t,n){this._map=t,this._clickTolerance=n.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new ha(t.type,this._map,t))}mousedown(t,n){return this._mousedownPos=n,this._firePreventable(new Ti(t.type,this._map,t))}mouseup(t){this._map.fire(new Ti(t.type,this._map,t))}click(t,n){this._mousedownPos&&this._mousedownPos.dist(n)>=this._clickTolerance||this._map.fire(new Ti(t.type,this._map,t))}dblclick(t){return this._firePreventable(new Ti(t.type,this._map,t))}mouseover(t){this._map.fire(new Ti(t.type,this._map,t))}mouseout(t){this._map.fire(new Ti(t.type,this._map,t))}touchstart(t){return this._firePreventable(new Ss(t.type,this._map,t))}touchmove(t){this._map.fire(new Ss(t.type,this._map,t))}touchend(t){this._map.fire(new Ss(t.type,this._map,t))}touchcancel(t){this._map.fire(new Ss(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class ua{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new Ti(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Ti("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new Ti(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class On{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.pointLocation(c.P.convert(t),this._map.terrain)}}class da{constructor(t,n){this._map=t,this._tr=new On(t),this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=n.clickTolerance||1}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&&(ae.disableDrag(),this._startPos=this._lastPos=n,this._active=!0)}mousemoveWindow(t,n){if(!this._active)return;const o=n;if(this._lastPos.equals(o)||!this._box&&o.dist(this._startPos)<this._clickTolerance)return;const a=this._startPos;this._lastPos=o,this._box||(this._box=ae.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",t));const h=Math.min(a.x,o.x),m=Math.max(a.x,o.x),y=Math.min(a.y,o.y),v=Math.max(a.y,o.y);ae.setTransform(this._box,`translate(${h}px,${y}px)`),this._box.style.width=m-h+"px",this._box.style.height=v-y+"px"}mouseupWindow(t,n){if(!this._active||t.button!==0)return;const o=this._startPos,a=n;if(this.reset(),ae.suppressClick(),o.x!==a.x||o.y!==a.y)return this._map.fire(new c.k("boxzoomend",{originalEvent:t})),{cameraAnimation:h=>h.fitScreenCoordinates(o,a,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&&(ae.remove(this._box),this._box=null),ae.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,n){return this._map.fire(new c.k(t,{originalEvent:n}))}}function Vn(u,t){if(u.length!==t.length)throw new Error(`The number of touches and points are not equal - touches ${u.length}, points ${t.length}`);const n={};for(let o=0;o<u.length;o++)n[u[o].identifier]=t[o];return n}class pa{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(t,n,o){(this.centroid||o.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=t.timeStamp),o.length===this.numTouches&&(this.centroid=function(a){const h=new c.P(0,0);for(const m of a)h._add(m);return h.div(a.length)}(n),this.touches=Vn(o,n)))}touchmove(t,n,o){if(this.aborted||!this.centroid)return;const a=Vn(o,n);for(const h in this.touches){const m=a[h];(!m||m.dist(this.touches[h])>30)&&(this.aborted=!0)}}touchend(t,n,o){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),o.length===0){const a=!this.aborted&&this.centroid;if(this.reset(),a)return a}}}class fa{constructor(t){this.singleTap=new pa(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,n,o){this.singleTap.touchstart(t,n,o)}touchmove(t,n,o){this.singleTap.touchmove(t,n,o)}touchend(t,n,o){const a=this.singleTap.touchend(t,n,o);if(a){const h=t.timeStamp-this.lastTime<500,m=!this.lastTap||this.lastTap.dist(a)<30;if(h&&m||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=a,this.count===this.numTaps)return this.reset(),a}}}class Fl{constructor(t){this._tr=new On(t),this._zoomIn=new fa({numTouches:1,numTaps:2}),this._zoomOut=new fa({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,n,o){this._zoomIn.touchstart(t,n,o),this._zoomOut.touchstart(t,n,o)}touchmove(t,n,o){this._zoomIn.touchmove(t,n,o),this._zoomOut.touchmove(t,n,o)}touchend(t,n,o){const a=this._zoomIn.touchend(t,n,o),h=this._zoomOut.touchend(t,n,o),m=this._tr;return a?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:y=>y.easeTo({duration:300,zoom:m.zoom+1,around:m.unproject(a)},{originalEvent:t})}):h?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:y=>y.easeTo({duration:300,zoom:m.zoom-1,around:m.unproject(h)},{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 Dt{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.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=n.length?n[0]:n,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(t,n){if(!this.isEnabled())return;const o=this._lastPoint;if(!o)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t))return void this.reset(t);const a=n.length?n[0]:n;return!this._moved&&a.dist(o)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=a,this._move(o,a))}dragEnd(t){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(t)&&(this._moved&&ae.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 yn={0:1,2:2};class Ei{constructor(t){this._correctEvent=t.checkCorrectEvent}startMove(t){const n=ae.mouseButton(t);this._eventButton=n}endMove(t){delete this._eventButton}isValidStartEvent(t){return this._correctEvent(t)}isValidMoveEvent(t){return!function(n,o){const a=yn[o];return n.buttons===void 0||(n.buttons&a)!==a}(t,this._eventButton)}isValidEndEvent(t){return ae.mouseButton(t)===this._eventButton}}class go{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)}}const Ts=u=>{u.mousedown=u.dragStart,u.mousemoveWindow=u.dragMove,u.mouseup=u.dragEnd,u.contextmenu=t=>{t.preventDefault()}},ma=({enable:u,clickTolerance:t,bearingDegreesPerPixelMoved:n=.8})=>{const o=new Ei({checkCorrectEvent:a=>ae.mouseButton(a)===0&&a.ctrlKey||ae.mouseButton(a)===2});return new Dt({clickTolerance:t,move:(a,h)=>({bearingDelta:(h.x-a.x)*n}),moveStateManager:o,enable:u,assignEvents:Ts})},xn=({enable:u,clickTolerance:t,pitchDegreesPerPixelMoved:n=-.5})=>{const o=new Ei({checkCorrectEvent:a=>ae.mouseButton(a)===0&&a.ctrlKey||ae.mouseButton(a)===2});return new Dt({clickTolerance:t,move:(a,h)=>({pitchDelta:(h.y-a.y)*n}),moveStateManager:o,enable:u,assignEvents:Ts})};class Is{constructor(t,n){this._clickTolerance=t.clickTolerance||1,this._map=n,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new c.P(0,0)}_shouldBePrevented(t){return t<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(t,n,o){return this._calculateTransform(t,n,o)}touchmove(t,n,o){if(this._active){if(!this._shouldBePrevented(o.length))return t.preventDefault(),this._calculateTransform(t,n,o);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",t)}}touchend(t,n,o){this._calculateTransform(t,n,o),this._active&&this._shouldBePrevented(o.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,n,o){o.length>0&&(this._active=!0);const a=Vn(o,n),h=new c.P(0,0),m=new c.P(0,0);let y=0;for(const b in a){const P=a[b],k=this._touches[b];k&&(h._add(P),m._add(P.sub(k)),y++,a[b]=P)}if(this._touches=a,this._shouldBePrevented(y)||!m.mag())return;const v=m.div(y);return this._sum._add(v),this._sum.mag()<this._clickTolerance?void 0:{around:h.div(y),panDelta:v}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ps{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(t,n,o){this._firstTwoTouches||o.length<2||(this._firstTwoTouches=[o[0].identifier,o[1].identifier],this._start([n[0],n[1]]))}touchmove(t,n,o){if(!this._firstTwoTouches)return;t.preventDefault();const[a,h]=this._firstTwoTouches,m=ks(o,n,a),y=ks(o,n,h);if(!m||!y)return;const v=this._aroundCenter?null:m.add(y).div(2);return this._move([m,y],v,t)}touchend(t,n,o){if(!this._firstTwoTouches)return;const[a,h]=this._firstTwoTouches,m=ks(o,n,a),y=ks(o,n,h);m&&y||(this._active&&ae.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 ks(u,t,n){for(let o=0;o<u.length;o++)if(u[o].identifier===n)return t[o]}function ga(u,t){return Math.log(u/t)/Math.LN2}class _a extends Ps{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,n){const o=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(ga(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:ga(this._distance,o),pinchAround:n}}}function ya(u,t){return 180*u.angleWith(t)/Math.PI}class xa extends Ps{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,o){const a=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:ya(this._vector,a),pinchAround:n}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const n=25/(Math.PI*this._minDiameter)*360,o=ya(t,this._startVector);return Math.abs(o)<n}}function Dr(u){return Math.abs(u.y)>Math.abs(u.x)}class va extends Ps{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,o){super.touchstart(t,n,o),this._currentTouchCount=o.length}_start(t){this._lastPoints=t,Dr(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,n,o){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const a=t[0].sub(this._lastPoints[0]),h=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(a,h,o.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(a.y+h.y)/2*-.5}):void 0}gestureBeginsVertically(t,n,o){if(this._valid!==void 0)return this._valid;const a=t.mag()>=2,h=n.mag()>=2;if(!a&&!h)return;if(!a||!h)return this._firstMove===void 0&&(this._firstMove=o),o-this._firstMove<100&&void 0;const m=t.y>0==n.y>0;return Dr(t)&&Dr(n)&&m}}const Ol={panStep:100,bearingStep:15,pitchStep:10};class ba{constructor(t){this._tr=new On(t);const n=Ol;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,o=0,a=0,h=0,m=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?o=-1:(t.preventDefault(),h=-1);break;case 39:t.shiftKey?o=1:(t.preventDefault(),h=1);break;case 38:t.shiftKey?a=1:(t.preventDefault(),m=-1);break;case 40:t.shiftKey?a=-1:(t.preventDefault(),m=1);break;default:return}return this._rotationDisabled&&(o=0,a=0),{cameraAnimation:y=>{const v=this._tr;y.easeTo({duration:300,easeId:"keyboardHandler",easing:Vl,zoom:n?Math.round(v.zoom)+n*(t.shiftKey?2:1):v.zoom,bearing:v.bearing+o*this._bearingStep,pitch:v.pitch+a*this._pitchStep,offset:[-h*this._panStep,-m*this._panStep],center:v.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 Vl(u){return u*(2-u)}const wa=4.000244140625;class Sa{constructor(t,n){this._onTimeout=o=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(o)},this._map=t,this._tr=new On(t),this._triggerRenderFrame=n,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}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 o=le.now(),a=o-(this._lastWheelEventTime||0);this._lastWheelEventTime=o,n!==0&&n%wa==0?this._type="wheel":n!==0&&Math.abs(n)<4?this._type="trackpad":a>400?(this._type=null,this._lastValue=n,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(a*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._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const n=ae.mousePos(this._map.getCanvas(),t),o=this._tr;this._around=n.y>o.transform.height/2-o.transform.getHorizon()?c.N.convert(this._aroundCenter?o.center:o.unproject(n)):c.N.convert(o.center),this._aroundPoint=o.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const t=this._tr.transform;if(this._delta!==0){const v=this._type==="wheel"&&Math.abs(this._delta)>wa?this._wheelZoomRate:this._defaultZoomRate;let b=2/(1+Math.exp(-Math.abs(this._delta*v)));this._delta<0&&b!==0&&(b=1/b);const P=typeof this._targetZoom=="number"?t.zoomScale(this._targetZoom):t.scale;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(P*b))),this._type==="wheel"&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const n=typeof this._targetZoom=="number"?this._targetZoom:t.zoom,o=this._startZoom,a=this._easing;let h,m=!1;const y=le.now()-this._lastWheelEventTime;if(this._type==="wheel"&&o&&a&&y){const v=Math.min(y/200,1),b=a(v);h=c.z.number(o,n,b),v<1?this._frameId||(this._frameId=!0):m=!0}else h=n,m=!0;return this._active=!0,m&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!m,zoomDelta:h-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let n=c.b9;if(this._prevEase){const o=this._prevEase,a=(le.now()-o.start)/o.duration,h=o.easing(a+.01)-o.easing(a),m=.27/Math.sqrt(h*h+1e-4)*.01,y=Math.sqrt(.0729-m*m);n=c.b8(m,y,.25,1)}return this._prevEase={start:le.now(),duration:t,easing:n},n}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class Ta{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 As{constructor(t){this._tr=new On(t),this.reset()}reset(){this._active=!1}dblclick(t,n){return t.preventDefault(),{cameraAnimation:o=>{o.easeTo({duration:300,zoom:this._tr.zoom+(t.shiftKey?-1:1),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 Nl{constructor(){this._tap=new fa({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(t,n,o){if(!this._swipePoint)if(this._tapTime){const a=n[0],h=t.timeStamp-this._tapTime<500,m=this._tapPoint.dist(a)<30;h&&m?o.length>0&&(this._swipePoint=a,this._swipeTouch=o[0].identifier):this.reset()}else this._tap.touchstart(t,n,o)}touchmove(t,n,o){if(this._tapTime){if(this._swipePoint){if(o[0].identifier!==this._swipeTouch)return;const a=n[0],h=a.y-this._swipePoint.y;return this._swipePoint=a,t.preventDefault(),this._active=!0,{zoomDelta:h/128}}}else this._tap.touchmove(t,n,o)}touchend(t,n,o){if(this._tapTime)this._swipePoint&&o.length===0&&this.reset();else{const a=this._tap.touchend(t,n,o);a&&(this._tapTime=t.timeStamp,this._tapPoint=a)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Wi{constructor(t,n,o){this._el=t,this._mousePan=n,this._touchPan=o}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 tr{constructor(t,n,o){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=n,this._mousePitch=o}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class Ia{constructor(t,n,o,a){this._el=t,this._touchZoom=n,this._touchRotate=o,this._tapDragZoom=a,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()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class ir{constructor(t,n){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"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=ae.create("div","maplibregl-cooperative-gesture-screen",t);let n=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(n=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const o=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),a=document.createElement("div");a.className="maplibregl-desktop-message",a.textContent=n,this._container.appendChild(a);const h=document.createElement("div");h.className="maplibregl-mobile-message",h.textContent=o,this._container.appendChild(h),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(ae.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(t){return t[this._bypassKey]}notifyGestureBlocked(t,n){this._enabled&&(this._map.fire(new c.k("cooperativegestureprevented",{gestureType:t,originalEvent:n})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const Lr=u=>u.zoom||u.drag||u.pitch||u.rotate;class Yc extends c.k{}function Pa(u){return u.panDelta&&u.panDelta.mag()||u.zoomDelta||u.bearingDelta||u.pitchDelta}class Qc{constructor(t,n){this.handleWindowEvent=a=>{this.handleEvent(a,`${a.type}Window`)},this.handleEvent=(a,h)=>{if(a.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const m=a.type==="renderFrame"?void 0:a,y={needsRenderFrame:!1},v={},b={},P=a.touches,k=P?this._getMapTouches(P):void 0,L=k?ae.touchPos(this._map.getCanvas(),k):ae.mousePos(this._map.getCanvas(),a);for(const{handlerName:Z,handler:j,allowed:H}of this._handlers){if(!j.isEnabled())continue;let Y;this._blockedByActive(b,H,Z)?j.reset():j[h||a.type]&&(Y=j[h||a.type](a,L,k),this.mergeHandlerResult(y,v,Y,Z,m),Y&&Y.needsRenderFrame&&this._triggerRenderFrame()),(Y||j.isActive())&&(b[Z]=j)}const B={};for(const Z in this._previousActiveHandlers)b[Z]||(B[Z]=m);this._previousActiveHandlers=b,(Object.keys(B).length||Pa(y))&&(this._changes.push([y,v,B]),this._triggerRenderFrame()),(Object.keys(b).length||Pa(y))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:N}=y;N&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],N(this._map))},this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new po(t),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(n);const o=this._el;this._listeners=[[o,"touchstart",{passive:!0}],[o,"touchmove",{passive:!1}],[o,"touchend",void 0],[o,"touchcancel",void 0],[o,"mousedown",void 0],[o,"mousemove",void 0],[o,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[o,"mouseover",void 0],[o,"mouseout",void 0],[o,"dblclick",void 0],[o,"click",void 0],[o,"keydown",{capture:!1}],[o,"keyup",void 0],[o,"wheel",{passive:!1}],[o,"contextmenu",void 0],[window,"blur",void 0]];for(const[a,h,m]of this._listeners)ae.addEventListener(a,h,a===document?this.handleWindowEvent:this.handleEvent,m)}destroy(){for(const[t,n,o]of this._listeners)ae.removeEventListener(t,n,t===document?this.handleWindowEvent:this.handleEvent,o)}_addDefaultHandlers(t){const n=this._map,o=n.getCanvasContainer();this._add("mapEvent",new mo(n,t));const a=n.boxZoom=new da(n,t);this._add("boxZoom",a),t.interactive&&t.boxZoom&&a.enable();const h=n.cooperativeGestures=new ir(n,t.cooperativeGestures);this._add("cooperativeGestures",h),t.cooperativeGestures&&h.enable();const m=new Fl(n),y=new As(n);n.doubleClickZoom=new Ta(y,m),this._add("tapZoom",m),this._add("clickZoom",y),t.interactive&&t.doubleClickZoom&&n.doubleClickZoom.enable();const v=new Nl;this._add("tapDragZoom",v);const b=n.touchPitch=new va(n);this._add("touchPitch",b),t.interactive&&t.touchPitch&&n.touchPitch.enable(t.touchPitch);const P=ma(t),k=xn(t);n.dragRotate=new tr(t,P,k),this._add("mouseRotate",P,["mousePitch"]),this._add("mousePitch",k,["mouseRotate"]),t.interactive&&t.dragRotate&&n.dragRotate.enable();const L=(({enable:Y,clickTolerance:U})=>{const te=new Ei({checkCorrectEvent:se=>ae.mouseButton(se)===0&&!se.ctrlKey});return new Dt({clickTolerance:U,move:(se,ce)=>({around:ce,panDelta:ce.sub(se)}),activateOnStart:!0,moveStateManager:te,enable:Y,assignEvents:Ts})})(t),B=new Is(t,n);n.dragPan=new Wi(o,L,B),this._add("mousePan",L),this._add("touchPan",B,["touchZoom","touchRotate"]),t.interactive&&t.dragPan&&n.dragPan.enable(t.dragPan);const N=new xa,Z=new _a;n.touchZoomRotate=new Ia(o,Z,N,v),this._add("touchRotate",N,["touchPan","touchZoom"]),this._add("touchZoom",Z,["touchPan","touchRotate"]),t.interactive&&t.touchZoomRotate&&n.touchZoomRotate.enable(t.touchZoomRotate);const j=n.scrollZoom=new Sa(n,()=>this._triggerRenderFrame());this._add("scrollZoom",j,["mousePan"]),t.interactive&&t.scrollZoom&&n.scrollZoom.enable(t.scrollZoom);const H=n.keyboard=new ba(n);this._add("keyboard",H),t.interactive&&t.keyboard&&n.keyboard.enable(),this._add("blockableMapEvent",new ua(n))}_add(t,n,o){this._handlers.push({handlerName:t,handler:n,allowed:o}),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!!Lr(this._eventsInProgress)||this.isZooming()}_blockedByActive(t,n,o){for(const a in t)if(a!==o&&(!n||n.indexOf(a)<0))return!0;return!1}_getMapTouches(t){const n=[];for(const o of t)this._el.contains(o.target)&&n.push(o);return n}mergeHandlerResult(t,n,o,a,h){if(!o)return;c.e(t,o);const m={handlerName:a,originalEvent:o.originalEvent||h};o.zoomDelta!==void 0&&(n.zoom=m),o.panDelta!==void 0&&(n.drag=m),o.pitchDelta!==void 0&&(n.pitch=m),o.bearingDelta!==void 0&&(n.rotate=m)}_applyChanges(){const t={},n={},o={};for(const[a,h,m]of this._changes)a.panDelta&&(t.panDelta=(t.panDelta||new c.P(0,0))._add(a.panDelta)),a.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+a.zoomDelta),a.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+a.bearingDelta),a.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+a.pitchDelta),a.around!==void 0&&(t.around=a.around),a.pinchAround!==void 0&&(t.pinchAround=a.pinchAround),a.noInertia&&(t.noInertia=a.noInertia),c.e(n,h),c.e(o,m);this._updateMapTransform(t,n,o),this._changes=[]}_updateMapTransform(t,n,o){const a=this._map,h=a._getTransformForUpdate(),m=a.terrain;if(!(Pa(t)||m&&this._terrainMovement))return this._fireEvents(n,o,!0);let{panDelta:y,zoomDelta:v,bearingDelta:b,pitchDelta:P,around:k,pinchAround:L}=t;L!==void 0&&(k=L),a._stop(!0),k=k||a.transform.centerPoint;const B=h.pointLocation(y?k.sub(y):k);b&&(h.bearing+=b),P&&(h.pitch+=P),v&&(h.zoom+=v),m?this._terrainMovement||!n.drag&&!n.zoom?n.drag&&this._terrainMovement?h.center=h.pointLocation(h.centerPoint.sub(y)):h.setLocationAtPoint(B,k):(this._terrainMovement=!0,this._map._elevationFreeze=!0,h.setLocationAtPoint(B,k)):h.setLocationAtPoint(B,k),a._applyUpdatedTransform(h),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(n,o,!0)}_fireEvents(t,n,o){const a=Lr(this._eventsInProgress),h=Lr(t),m={};for(const k in t){const{originalEvent:L}=t[k];this._eventsInProgress[k]||(m[`${k}start`]=L),this._eventsInProgress[k]=t[k]}!a&&h&&this._fireEvent("movestart",h.originalEvent);for(const k in m)this._fireEvent(k,m[k]);h&&this._fireEvent("move",h.originalEvent);for(const k in t){const{originalEvent:L}=t[k];this._fireEvent(k,L)}const y={};let v;for(const k in this._eventsInProgress){const{handlerName:L,originalEvent:B}=this._eventsInProgress[k];this._handlersById[L].isActive()||(delete this._eventsInProgress[k],v=n[L]||B,y[`${k}end`]=v)}for(const k in y)this._fireEvent(k,y[k]);const b=Lr(this._eventsInProgress),P=(a||h)&&!b;if(P&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const k=this._map._getTransformForUpdate();k.recalculateZoom(this._map.terrain),this._map._applyUpdatedTransform(k)}if(o&&P){this._updatingCamera=!0;const k=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),L=B=>B!==0&&-this._bearingSnap<B&&B<this._bearingSnap;!k||!k.essential&&le.prefersReducedMotion?(this._map.fire(new c.k("moveend",{originalEvent:v})),L(this._map.getBearing())&&this._map.resetNorth()):(L(k.bearing||this._map.getBearing())&&(k.bearing=0),k.freezeElevation=!0,this._map.easeTo(k,{originalEvent:v})),this._updatingCamera=!1}}_fireEvent(t,n){this._map.fire(new c.k(t,n?{originalEvent:n}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(t=>{delete this._frameId,this.handleEvent(new Yc("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class eh extends c.E{constructor(t,n){super(),this._renderFrameCallback=()=>{const o=Math.min((le.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(o)),o<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=n.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new c.N(this.transform.center.lng,this.transform.center.lat)}setCenter(t,n){return this.jumpTo({center:t},n)}panBy(t,n,o){return t=c.P.convert(t).mult(-1),this.panTo(this.transform.center,c.e({offset:t},n),o)}panTo(t,n,o){return this.easeTo(c.e({center:t},n),o)}getZoom(){return this.transform.zoom}setZoom(t,n){return this.jumpTo({zoom:t},n),this}zoomTo(t,n,o){return this.easeTo(c.e({zoom:t},n),o)}zoomIn(t,n){return this.zoomTo(this.getZoom()+1,t,n),this}zoomOut(t,n){return this.zoomTo(this.getZoom()-1,t,n),this}getBearing(){return this.transform.bearing}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,o){return this.easeTo(c.e({bearing:t},n),o)}resetNorth(t,n){return this.rotateTo(0,c.e({duration:1e3},t),n),this}resetNorthPitch(t,n){return this.easeTo(c.e({bearing:0,pitch: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}cameraForBounds(t,n){t=ue.convert(t);const o=n&&n.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),o,n)}_cameraForBoxAndBearing(t,n,o,a){const h={top:0,bottom:0,right:0,left:0};if(typeof(a=c.e({padding:h,offset:[0,0],maxZoom:this.transform.maxZoom},a)).padding=="number"){const Se=a.padding;a.padding={top:Se,bottom:Se,right:Se,left:Se}}a.padding=c.e(h,a.padding);const m=this.transform,y=m.padding,v=new ue(t,n),b=m.project(v.getNorthWest()),P=m.project(v.getNorthEast()),k=m.project(v.getSouthEast()),L=m.project(v.getSouthWest()),B=c.ba(-o),N=b.rotate(B),Z=P.rotate(B),j=k.rotate(B),H=L.rotate(B),Y=new c.P(Math.max(N.x,Z.x,H.x,j.x),Math.max(N.y,Z.y,H.y,j.y)),U=new c.P(Math.min(N.x,Z.x,H.x,j.x),Math.min(N.y,Z.y,H.y,j.y)),te=Y.sub(U),se=(m.width-(y.left+y.right+a.padding.left+a.padding.right))/te.x,ce=(m.height-(y.top+y.bottom+a.padding.top+a.padding.bottom))/te.y;if(ce<0||se<0)return void c.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");const ge=Math.min(m.scaleZoom(m.scale*Math.min(se,ce)),a.maxZoom),we=c.P.convert(a.offset),Le=new c.P((a.padding.left-a.padding.right)/2,(a.padding.top-a.padding.bottom)/2).rotate(c.ba(o)),Be=we.add(Le).mult(m.scale/m.zoomScale(ge));return{center:m.unproject(b.add(k).div(2).sub(Be)),zoom:ge,bearing:o}}fitBounds(t,n,o){return this._fitInternal(this.cameraForBounds(t,n),n,o)}fitScreenCoordinates(t,n,o,a,h){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(c.P.convert(t)),this.transform.pointLocation(c.P.convert(n)),o,a),a,h)}_fitInternal(t,n,o){return t?(delete(n=c.e(t,n)).padding,n.linear?this.easeTo(n,o):this.flyTo(n,o)):this}jumpTo(t,n){this.stop();const o=this._getTransformForUpdate();let a=!1,h=!1,m=!1;return"zoom"in t&&o.zoom!==+t.zoom&&(a=!0,o.zoom=+t.zoom),t.center!==void 0&&(o.center=c.N.convert(t.center)),"bearing"in t&&o.bearing!==+t.bearing&&(h=!0,o.bearing=+t.bearing),"pitch"in t&&o.pitch!==+t.pitch&&(m=!0,o.pitch=+t.pitch),t.padding==null||o.isPaddingEqual(t.padding)||(o.padding=t.padding),this._applyUpdatedTransform(o),this.fire(new c.k("movestart",n)).fire(new c.k("move",n)),a&&this.fire(new c.k("zoomstart",n)).fire(new c.k("zoom",n)).fire(new c.k("zoomend",n)),h&&this.fire(new c.k("rotatestart",n)).fire(new c.k("rotate",n)).fire(new c.k("rotateend",n)),m&&this.fire(new c.k("pitchstart",n)).fire(new c.k("pitch",n)).fire(new c.k("pitchend",n)),this.fire(new c.k("moveend",n))}calculateCameraOptionsFromTo(t,n,o,a=0){const h=c.Z.fromLngLat(t,n),m=c.Z.fromLngLat(o,a),y=m.x-h.x,v=m.y-h.y,b=m.z-h.z,P=Math.hypot(y,v,b);if(P===0)throw new Error("Can't calculate camera options with same From and To");const k=Math.hypot(y,v),L=this.transform.scaleZoom(this.transform.cameraToCenterDistance/P/this.transform.tileSize),B=180*Math.atan2(y,-v)/Math.PI;let N=180*Math.acos(k/P)/Math.PI;return N=b<0?90-N:90+N,{center:m.toLngLat(),zoom:L,pitch:N,bearing:B}}easeTo(t,n){var o;this._stop(!1,t.easeId),((t=c.e({offset:[0,0],duration:500,easing:c.b9},t)).animate===!1||!t.essential&&le.prefersReducedMotion)&&(t.duration=0);const a=this._getTransformForUpdate(),h=a.zoom,m=a.bearing,y=a.pitch,v=a.padding,b="bearing"in t?this._normalizeBearing(t.bearing,m):m,P="pitch"in t?+t.pitch:y,k="padding"in t?t.padding:a.padding,L=c.P.convert(t.offset);let B=a.centerPoint.add(L);const N=a.pointLocation(B),{center:Z,zoom:j}=a.getConstrained(c.N.convert(t.center||N),(o=t.zoom)!==null&&o!==void 0?o:h);this._normalizeCenter(Z,a);const H=a.project(N),Y=a.project(Z).sub(H),U=a.zoomScale(j-h);let te,se;t.around&&(te=c.N.convert(t.around),se=a.locationPoint(te));const ce={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||j!==h,this._rotating=this._rotating||m!==b,this._pitching=this._pitching||P!==y,this._padding=!a.isPaddingEqual(k),this._easeId=t.easeId,this._prepareEase(n,t.noMoveStart,ce),this.terrain&&this._prepareElevation(Z),this._ease(ge=>{if(this._zooming&&(a.zoom=c.z.number(h,j,ge)),this._rotating&&(a.bearing=c.z.number(m,b,ge)),this._pitching&&(a.pitch=c.z.number(y,P,ge)),this._padding&&(a.interpolatePadding(v,k,ge),B=a.centerPoint.add(L)),this.terrain&&!t.freezeElevation&&this._updateElevation(ge),te)a.setLocationAtPoint(te,se);else{const we=a.zoomScale(a.zoom-h),Le=j>h?Math.min(2,U):Math.max(.5,U),Be=Math.pow(Le,1-ge),Se=a.unproject(H.add(Y.mult(ge*Be)).mult(we));a.setLocationAtPoint(a.renderWorldCopies?Se.wrap():Se,B)}this._applyUpdatedTransform(a),this._fireMoveEvents(n)},ge=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(n,ge)},t),this}_prepareEase(t,n,o={}){this._moving=!0,n||o.moving||this.fire(new c.k("movestart",t)),this._zooming&&!o.zooming&&this.fire(new c.k("zoomstart",t)),this._rotating&&!o.rotating&&this.fire(new c.k("rotatestart",t)),this._pitching&&!o.pitching&&this.fire(new c.k("pitchstart",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.transform.minElevationForCurrentTile=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 o=this._elevationTarget-this._elevationStart;this._elevationStart+=t*(o-(n-(o*t+this._elevationStart))/(1-t)),this._elevationTarget=n}this.transform.elevation=c.z.number(this._elevationStart,this._elevationTarget,t)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(t){const n=t.getCameraPosition(),o=this.terrain.getElevationForLngLatZoom(n.lngLat,t.zoom);if(n.altitude<o){const a=this.calculateCameraOptionsFromTo(n.lngLat,o,t.center,t.elevation);return{pitch:a.pitch,zoom:a.zoom}}return{}}_applyUpdatedTransform(t){const n=[];if(this.terrain&&n.push(a=>this._elevateCameraIfInsideTerrain(a)),this.transformCameraUpdate&&n.push(a=>this.transformCameraUpdate(a)),!n.length)return;const o=t.clone();for(const a of n){const h=o.clone(),{center:m,zoom:y,pitch:v,bearing:b,elevation:P}=a(h);m&&(h.center=m),y!==void 0&&(h.zoom=y),v!==void 0&&(h.pitch=v),b!==void 0&&(h.bearing=b),P!==void 0&&(h.elevation=P),o.apply(h)}this.transform.apply(o)}_fireMoveEvents(t){this.fire(new c.k("move",t)),this._zooming&&this.fire(new c.k("zoom",t)),this._rotating&&this.fire(new c.k("rotate",t)),this._pitching&&this.fire(new c.k("pitch",t))}_afterEase(t,n){if(this._easeId&&n&&this._easeId===n)return;delete this._easeId;const o=this._zooming,a=this._rotating,h=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,o&&this.fire(new c.k("zoomend",t)),a&&this.fire(new c.k("rotateend",t)),h&&this.fire(new c.k("pitchend",t)),this.fire(new c.k("moveend",t))}flyTo(t,n){var o;if(!t.essential&&le.prefersReducedMotion){const Me=c.M(t,["center","zoom","bearing","pitch","around"]);return this.jumpTo(Me,n)}this.stop(),t=c.e({offset:[0,0],speed:1.2,curve:1.42,easing:c.b9},t);const a=this._getTransformForUpdate(),h=a.zoom,m=a.bearing,y=a.pitch,v=a.padding,b="bearing"in t?this._normalizeBearing(t.bearing,m):m,P="pitch"in t?+t.pitch:y,k="padding"in t?t.padding:a.padding,L=c.P.convert(t.offset);let B=a.centerPoint.add(L);const N=a.pointLocation(B),{center:Z,zoom:j}=a.getConstrained(c.N.convert(t.center||N),(o=t.zoom)!==null&&o!==void 0?o:h);this._normalizeCenter(Z,a);const H=a.zoomScale(j-h),Y=a.project(N),U=a.project(Z).sub(Y);let te=t.curve;const se=Math.max(a.width,a.height),ce=se/H,ge=U.mag();if("minZoom"in t){const Me=c.ad(Math.min(t.minZoom,h,j),a.minZoom,a.maxZoom),Ye=se/a.zoomScale(Me-h);te=Math.sqrt(Ye/ge*2)}const we=te*te;function Le(Me){const Ye=(ce*ce-se*se+(Me?-1:1)*we*we*ge*ge)/(2*(Me?ce:se)*we*ge);return Math.log(Math.sqrt(Ye*Ye+1)-Ye)}function Be(Me){return(Math.exp(Me)-Math.exp(-Me))/2}function Se(Me){return(Math.exp(Me)+Math.exp(-Me))/2}const Te=Le(!1);let Ne=function(Me){return Se(Te)/Se(Te+te*Me)},et=function(Me){return se*((Se(Te)*(Be(Ye=Te+te*Me)/Se(Ye))-Be(Te))/we)/ge;var Ye},ke=(Le(!0)-Te)/te;if(Math.abs(ge)<1e-6||!isFinite(ke)){if(Math.abs(se-ce)<1e-6)return this.easeTo(t,n);const Me=ce<se?-1:1;ke=Math.abs(Math.log(ce/se))/te,et=()=>0,Ne=Ye=>Math.exp(Me*te*Ye)}return t.duration="duration"in t?+t.duration:1e3*ke/("screenSpeed"in t?+t.screenSpeed/te:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=m!==b,this._pitching=P!==y,this._padding=!a.isPaddingEqual(k),this._prepareEase(n,!1),this.terrain&&this._prepareElevation(Z),this._ease(Me=>{const Ye=Me*ke,Lt=1/Ne(Ye);a.zoom=Me===1?j:h+a.scaleZoom(Lt),this._rotating&&(a.bearing=c.z.number(m,b,Me)),this._pitching&&(a.pitch=c.z.number(y,P,Me)),this._padding&&(a.interpolatePadding(v,k,Me),B=a.centerPoint.add(L)),this.terrain&&!t.freezeElevation&&this._updateElevation(Me);const st=Me===1?Z:a.unproject(Y.add(U.mult(et(Ye))).mult(Lt));a.setLocationAtPoint(a.renderWorldCopies?st.wrap():st,B),this._applyUpdatedTransform(a),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 o;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const a=this._onEaseEnd;delete this._onEaseEnd,a.call(this,n)}return t||(o=this.handlers)===null||o===void 0||o.stop(!1),this}_ease(t,n,o){o.animate===!1||o.duration===0?(t(1),n()):(this._easeStart=le.now(),this._easeOptions=o,this._onEaseFrame=t,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(t,n){t=c.b3(t,-180,180);const o=Math.abs(t-n);return Math.abs(t-360-n)<o&&(t-=360),Math.abs(t+360-n)<o&&(t+=360),t}_normalizeCenter(t,n){if(!n.renderWorldCopies||n.lngRange)return;const o=t.lng-n.center.lng;t.lng+=o>180?-360:o<-180?360:0}queryTerrainElevation(t){return this.terrain?this.terrain.getElevationForLngLatZoom(c.N.convert(t),this.transform.tileZoom)-this.transform.elevation:null}}const ka={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class Nn{constructor(t=ka){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=ae.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=ae.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=ae.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(){ae.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(t,n){const o=this._map._getUIString(`AttributionControl.${n}`);t.title=o,t.setAttribute("aria-label",o)}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map(a=>typeof a!="string"?"":a)):typeof this.options.customAttribution=="string"&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const a=this._map.style.stylesheet;this.styleOwner=a.owner,this.styleId=a.id}const n=this._map.style.sourceCaches;for(const a in n){const h=n[a];if(h.used||h.usedForTerrain){const m=h.getSource();m.attribution&&t.indexOf(m.attribution)<0&&t.push(m.attribution)}}t=t.filter(a=>String(a).trim()),t.sort((a,h)=>a.length-h.length),t=t.filter((a,h)=>{for(let m=h+1;m<t.length;m++)if(t[m].indexOf(a)>=0)return!1;return!0});const o=t.join(" | ");o!==this._attribHTML&&(this._attribHTML=o,t.length?(this._innerContainer.innerHTML=o,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class yr{constructor(t={}){this._updateCompact=()=>{const n=this._container.children;if(n.length){const o=n[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&o.classList.add("maplibregl-compact"):o.classList.remove("maplibregl-compact")}},this.options=t}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=ae.create("div","maplibregl-ctrl");const n=ae.create("a","maplibregl-ctrl-logo");return n.target="_blank",n.rel="noopener nofollow",n.href="https://maplibre.org/",n.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),n.setAttribute("rel","noopener nofollow"),this._container.appendChild(n),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){ae.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class Oe{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,o=n?this._queue.concat(n):this._queue;for(const a of o)if(a.id===t)return void(a.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 o of n)if(!o.cancelled&&(o.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var Ul=c.Y([{name:"a_pos3d",type:"Int16",components:3}]);class Aa extends c.E{constructor(t){super(),this.sourceCache=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,t.usedForTerrain=!0,t.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(t,n){this.sourceCache.update(t,n),this._renderableTilesKeys=[];const o={};for(const a of t.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:n}))o[a.key]=!0,this._renderableTilesKeys.push(a.key),this._tiles[a.key]||(a.posMatrix=new Float64Array(16),c.aQ(a.posMatrix,0,c.X,0,c.X,0,1),this._tiles[a.key]=new Zr(a,this.tileSize));for(const a in this._tiles)o[a]||delete this._tiles[a]}freeRtt(t){for(const n in this._tiles){const o=this._tiles[n];(!t||o.tileID.equals(t)||o.tileID.isChildOf(t)||t.isChildOf(o.tileID))&&(o.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(t=>this.getTileByID(t))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t){const n={};for(const o of this._renderableTilesKeys){const a=this._tiles[o].tileID;if(a.canonical.equals(t.canonical)){const h=t.clone();h.posMatrix=new Float64Array(16),c.aQ(h.posMatrix,0,c.X,0,c.X,0,1),n[o]=h}else if(a.canonical.isChildOf(t.canonical)){const h=t.clone();h.posMatrix=new Float64Array(16);const m=a.canonical.z-t.canonical.z,y=a.canonical.x-(a.canonical.x>>m<<m),v=a.canonical.y-(a.canonical.y>>m<<m),b=c.X>>m;c.aQ(h.posMatrix,0,b,0,b,0,1),c.J(h.posMatrix,h.posMatrix,[-y*b,-v*b,0]),n[o]=h}else if(t.canonical.isChildOf(a.canonical)){const h=t.clone();h.posMatrix=new Float64Array(16);const m=t.canonical.z-a.canonical.z,y=t.canonical.x-(t.canonical.x>>m<<m),v=t.canonical.y-(t.canonical.y>>m<<m),b=c.X>>m;c.aQ(h.posMatrix,0,c.X,0,c.X,0,1),c.J(h.posMatrix,h.posMatrix,[y*b,v*b,0]),c.K(h.posMatrix,h.posMatrix,[1/2**m,1/2**m,0]),n[o]=h}}return n}getSourceTile(t,n){const o=this.sourceCache._source;let a=t.overscaledZ-this.deltaZoom;if(a>o.maxzoom&&(a=o.maxzoom),a<o.minzoom)return null;this._sourceTileCache[t.key]||(this._sourceTileCache[t.key]=t.scaledTo(a).key);let h=this.sourceCache.getTileByID(this._sourceTileCache[t.key]);if((!h||!h.dem)&&n)for(;a>=o.minzoom&&(!h||!h.dem);)h=this.sourceCache.getTileByID(t.scaledTo(a--).key);return h}tilesAfterTime(t=Date.now()){return Object.values(this._tiles).filter(n=>n.timeAdded>=t)}}class jl{constructor(t,n,o){this.painter=t,this.sourceCache=new Aa(n),this.options=o,this.exaggeration=typeof o.exaggeration=="number"?o.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(t,n,o,a=c.X){var h;if(!(n>=0&&n<a&&o>=0&&o<a))return 0;const m=this.getTerrainData(t),y=(h=m.tile)===null||h===void 0?void 0:h.dem;if(!y)return 0;const v=function(N,Z,j){var H=Z[0],Y=Z[1];return N[0]=j[0]*H+j[4]*Y+j[12],N[1]=j[1]*H+j[5]*Y+j[13],N}([],[n/a*c.X,o/a*c.X],m.u_terrain_matrix),b=[v[0]*y.dim,v[1]*y.dim],P=Math.floor(b[0]),k=Math.floor(b[1]),L=b[0]-P,B=b[1]-k;return y.get(P,k)*(1-L)*(1-B)+y.get(P+1,k)*L*(1-B)+y.get(P,k+1)*(1-L)*B+y.get(P+1,k+1)*L*B}getElevationForLngLatZoom(t,n){const{tileID:o,mercatorX:a,mercatorY:h}=this._getOverscaledTileIDFromLngLatZoom(t,n);return this.getElevation(o,a%c.X,h%c.X,c.X)}getElevation(t,n,o,a=c.X){return this.getDEMElevation(t,n,o,a)*this.exaggeration}getTerrainData(t){if(!this._emptyDemTexture){const a=this.painter.context,h=new c.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new bt(a,h,a.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new bt(a,new c.R({width:1,height:1}),a.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(a.gl.NEAREST,a.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=c.ao([])}const n=this.sourceCache.getSourceTile(t,!0);if(n&&n.dem&&(!n.demTexture||n.needsTerrainPrepare)){const a=this.painter.context;n.demTexture=this.painter.getTileTexture(n.dem.stride),n.demTexture?n.demTexture.update(n.dem.getPixels(),{premultiply:!1}):n.demTexture=new bt(a,n.dem.getPixels(),a.gl.RGBA,{premultiply:!1}),n.demTexture.bind(a.gl.NEAREST,a.gl.CLAMP_TO_EDGE),n.needsTerrainPrepare=!1}const o=n&&n+n.tileID.key+t.key;if(o&&!this._demMatrixCache[o]){const a=this.sourceCache.sourceCache._source.maxzoom;let h=t.canonical.z-n.tileID.canonical.z;t.overscaledZ>t.canonical.z&&(t.canonical.z>=a?h=t.canonical.z-a:c.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const m=t.canonical.x-(t.canonical.x>>h<<h),y=t.canonical.y-(t.canonical.y>>h<<h),v=c.bb(new Float64Array(16),[1/(c.X<<h),1/(c.X<<h),0]);c.J(v,v,[m*c.X,y*c.X,0]),this._demMatrixCache[t.key]={matrix:v,coord:t}}return{u_depth:2,u_terrain:3,u_terrain_dim:n&&n.dem&&n.dem.dim||1,u_terrain_matrix:o?this._demMatrixCache[t.key].matrix:this._emptyDemMatrix,u_terrain_unpack:n&&n.dem&&n.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(n&&n.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:n}}getFramebuffer(t){const n=this.painter,o=n.width/devicePixelRatio,a=n.height/devicePixelRatio;return!this._fbo||this._fbo.width===o&&this._fbo.height===a||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new bt(n.context,{width:o,height:a,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 bt(n.context,{width:o,height:a,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(o,a,!0,!1),this._fbo.depthAttachment.set(n.context.createRenderbuffer(n.context.gl.DEPTH_COMPONENT16,o,a))),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 h=0,m=0;h<this._coordsTextureSize;h++)for(let y=0;y<this._coordsTextureSize;y++,m+=4)n[m+0]=255&y,n[m+1]=255&h,n[m+2]=y>>8<<4|h>>8,n[m+3]=0;const o=new c.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(n.buffer)),a=new bt(t,o,t.gl.RGBA,{premultiply:!1});return a.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=a,a}pointCoordinate(t){this.painter.maybeDrawDepthAndCoords(!0);const n=new Uint8Array(4),o=this.painter.context,a=o.gl,h=Math.round(t.x*this.painter.pixelRatio/devicePixelRatio),m=Math.round(t.y*this.painter.pixelRatio/devicePixelRatio),y=Math.round(this.painter.height/devicePixelRatio);o.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),a.readPixels(h,y-m-1,1,1,a.RGBA,a.UNSIGNED_BYTE,n),o.bindFramebuffer.set(null);const v=n[0]+(n[2]>>4<<8),b=n[1]+((15&n[2])<<8),P=this.coordsIndex[255-n[3]],k=P&&this.sourceCache.getTileByID(P);if(!k)return null;const L=this._coordsTextureSize,B=(1<<k.tileID.canonical.z)*L;return new c.Z((k.tileID.canonical.x*L+v)/B+k.tileID.wrap,(k.tileID.canonical.y*L+b)/B,this.getElevation(k.tileID,v,b,L))}depthAtPoint(t){const n=new Uint8Array(4),o=this.painter.context,a=o.gl;return o.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),a.readPixels(t.x,this.painter.height/devicePixelRatio-t.y-1,1,1,a.RGBA,a.UNSIGNED_BYTE,n),o.bindFramebuffer.set(null),(n[0]/16777216+n[1]/65536+n[2]/256+n[3])/256}getTerrainMesh(){if(this._mesh)return this._mesh;const t=this.painter.context,n=new c.bc,o=new c.aY,a=this.meshSize,h=c.X/a,m=a*a;for(let k=0;k<=a;k++)for(let L=0;L<=a;L++)n.emplaceBack(L*h,k*h,0);for(let k=0;k<m;k+=a+1)for(let L=0;L<a;L++)o.emplaceBack(L+k,a+L+k+1,a+L+k+2),o.emplaceBack(L+k,a+L+k+2,L+k+1);const y=n.length,v=y+2*(a+1);for(const k of[0,1])for(let L=0;L<=a;L++)for(const B of[0,1])n.emplaceBack(L*h,k*c.X,B);for(let k=0;k<2*a;k+=2)o.emplaceBack(v+k,v+k+1,v+k+3),o.emplaceBack(v+k,v+k+3,v+k+2),o.emplaceBack(y+k,y+k+3,y+k+1),o.emplaceBack(y+k,y+k+2,y+k+3);const b=n.length,P=b+2*(a+1);for(const k of[0,1])for(let L=0;L<=a;L++)for(const B of[0,1])n.emplaceBack(k*c.X,L*h,B);for(let k=0;k<2*a;k+=2)o.emplaceBack(b+k,b+k+1,b+k+3),o.emplaceBack(b+k,b+k+3,b+k+2),o.emplaceBack(P+k,P+k+3,P+k+1),o.emplaceBack(P+k,P+k+2,P+k+3);return this._mesh=new Ll(t.createVertexBuffer(n,Ul.members),t.createIndexBuffer(o),c.a0.simpleSegment(0,0,n.length,o.length)),this._mesh}getMeshFrameDelta(t){return 2*Math.PI*c.bd/Math.pow(2,t)/5}getMinTileElevationForLngLatZoom(t,n){var o;const{tileID:a}=this._getOverscaledTileIDFromLngLatZoom(t,n);return(o=this.getMinMaxElevation(a).minElevation)!==null&&o!==void 0?o:0}getMinMaxElevation(t){const n=this.getTerrainData(t).tile,o={minElevation:null,maxElevation:null};return n&&n.dem&&(o.minElevation=n.dem.min*this.exaggeration,o.maxElevation=n.dem.max*this.exaggeration),o}_getOverscaledTileIDFromLngLatZoom(t,n){const o=c.Z.fromLngLat(t.wrap()),a=(1<<n)*c.X,h=o.x*a,m=o.y*a,y=Math.floor(h/c.X),v=Math.floor(m/c.X);return{tileID:new c.S(n,0,n,y,v),mercatorX:h,mercatorY:m}}}class Cs{constructor(t,n,o){this._context=t,this._size=n,this._tileSize=o,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),o=new bt(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return o.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),n.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),n.colorAttachment.set(o.texture),{id:t,fbo:n,texture:o,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 xr={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class $l{constructor(t,n){this.painter=t,this.terrain=n,this.pool=new Cs(t.context,30,n.sourceCache.tileSize*n.qualityFactor)}destruct(){this.pool.destruct()}getTexture(t){return this.pool.getObjectForId(t.rtt[this._stacks.length-1].id).texture}prepareForRender(t,n){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=t._order.filter(o=>!t._layers[o].isHidden(n)),this._coordsDescendingInv={};for(const o in t.sourceCaches){this._coordsDescendingInv[o]={};const a=t.sourceCaches[o].getVisibleCoordinates();for(const h of a){const m=this.terrain.sourceCache.getTerrainCoords(h);for(const y in m)this._coordsDescendingInv[o][y]||(this._coordsDescendingInv[o][y]=[]),this._coordsDescendingInv[o][y].push(m[y])}}this._coordsDescendingInvStr={};for(const o of t._order){const a=t._layers[o],h=a.source;if(xr[a.type]&&!this._coordsDescendingInvStr[h]){this._coordsDescendingInvStr[h]={};for(const m in this._coordsDescendingInv[h])this._coordsDescendingInvStr[h][m]=this._coordsDescendingInv[h][m].map(y=>y.key).sort().join()}}for(const o of this._renderableTiles)for(const a in this._coordsDescendingInvStr){const h=this._coordsDescendingInvStr[a][o.tileID.key];h&&h!==o.rttCoords[a]&&(o.rtt=[])}}renderLayer(t){if(t.isHidden(this.painter.transform.zoom))return!1;const n=t.type,o=this.painter,a=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(xr[n]&&(this._prevType&&xr[this._prevType]||this._stacks.push([]),this._prevType=n,this._stacks[this._stacks.length-1].push(t.id),!a))return!0;if(xr[this._prevType]||xr[n]&&a){this._prevType=n;const h=this._stacks.length-1,m=this._stacks[h]||[];for(const y of this._renderableTiles){if(this.pool.isFull()&&(bs(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(y),y.rtt[h]){const b=this.pool.getObjectForId(y.rtt[h].id);if(b.stamp===y.rtt[h].stamp){this.pool.useObject(b);continue}}const v=this.pool.getOrCreateFreeObject();this.pool.useObject(v),this.pool.stampObject(v),y.rtt[h]={id:v.id,stamp:v.stamp},o.context.bindFramebuffer.set(v.fbo.framebuffer),o.context.clear({color:c.aN.transparent,stencil:0}),o.currentStencilSource=void 0;for(let b=0;b<m.length;b++){const P=o.style._layers[m[b]],k=P.source?this._coordsDescendingInv[P.source][y.tileID.key]:[y.tileID];o.context.viewport.set([0,0,v.fbo.width,v.fbo.height]),o._renderTileClippingMasks(P,k),o.renderLayer(o,o.style.sourceCaches[P.source],P,k),P.source&&(y.rttCoords[P.source]=this._coordsDescendingInvStr[P.source][y.tileID.key])}}return bs(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects(),xr[n]}return!1}}const De={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","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"},Ca=ye,th={hash:!1,interactive:!0,bearingSnap:7,attributionControl:ka,maplibreLogo:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,refreshExpiredTiles:!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],zoom:0,bearing:0,pitch:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:c.a.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0},ql=u=>{u.touchstart=u.dragStart,u.touchmoveWindow=u.dragMove,u.touchend=u.dragEnd},Ea={showCompass:!0,showZoom:!0,visualizePitch:!1};class Zl{constructor(t,n,o=!1){this.mousedown=m=>{this.startMouse(c.e({},m,{ctrlKey:!0,preventDefault:()=>m.preventDefault()}),ae.mousePos(this.element,m)),ae.addEventListener(window,"mousemove",this.mousemove),ae.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=m=>{this.moveMouse(m,ae.mousePos(this.element,m))},this.mouseup=m=>{this.mouseRotate.dragEnd(m),this.mousePitch&&this.mousePitch.dragEnd(m),this.offTemp()},this.touchstart=m=>{m.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=ae.touchPos(this.element,m.targetTouches)[0],this.startTouch(m,this._startPos),ae.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),ae.addEventListener(window,"touchend",this.touchend))},this.touchmove=m=>{m.targetTouches.length!==1?this.reset():(this._lastPos=ae.touchPos(this.element,m.targetTouches)[0],this.moveTouch(m,this._lastPos))},this.touchend=m=>{m.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.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10;const a=t.dragRotate._mouseRotate.getClickTolerance(),h=t.dragRotate._mousePitch.getClickTolerance();this.element=n,this.mouseRotate=ma({clickTolerance:a,enable:!0}),this.touchRotate=(({enable:m,clickTolerance:y,bearingDegreesPerPixelMoved:v=.8})=>{const b=new go;return new Dt({clickTolerance:y,move:(P,k)=>({bearingDelta:(k.x-P.x)*v}),moveStateManager:b,enable:m,assignEvents:ql})})({clickTolerance:a,enable:!0}),this.map=t,o&&(this.mousePitch=xn({clickTolerance:h,enable:!0}),this.touchPitch=(({enable:m,clickTolerance:y,pitchDegreesPerPixelMoved:v=-.5})=>{const b=new go;return new Dt({clickTolerance:y,move:(P,k)=>({pitchDelta:(k.y-P.y)*v}),moveStateManager:b,enable:m,assignEvents:ql})})({clickTolerance:h,enable:!0})),ae.addEventListener(n,"mousedown",this.mousedown),ae.addEventListener(n,"touchstart",this.touchstart,{passive:!1}),ae.addEventListener(n,"touchcancel",this.reset)}startMouse(t,n){this.mouseRotate.dragStart(t,n),this.mousePitch&&this.mousePitch.dragStart(t,n),ae.disableDrag()}startTouch(t,n){this.touchRotate.dragStart(t,n),this.touchPitch&&this.touchPitch.dragStart(t,n),ae.disableDrag()}moveMouse(t,n){const o=this.map,{bearingDelta:a}=this.mouseRotate.dragMove(t,n)||{};if(a&&o.setBearing(o.getBearing()+a),this.mousePitch){const{pitchDelta:h}=this.mousePitch.dragMove(t,n)||{};h&&o.setPitch(o.getPitch()+h)}}moveTouch(t,n){const o=this.map,{bearingDelta:a}=this.touchRotate.dragMove(t,n)||{};if(a&&o.setBearing(o.getBearing()+a),this.touchPitch){const{pitchDelta:h}=this.touchPitch.dragMove(t,n)||{};h&&o.setPitch(o.getPitch()+h)}}off(){const t=this.element;ae.removeEventListener(t,"mousedown",this.mousedown),ae.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),ae.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),ae.removeEventListener(window,"touchend",this.touchend),ae.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){ae.enableDrag(),ae.removeEventListener(window,"mousemove",this.mousemove),ae.removeEventListener(window,"mouseup",this.mouseup),ae.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),ae.removeEventListener(window,"touchend",this.touchend)}}let Kr;function Gl(u,t,n){const o=new c.N(u.lng,u.lat);if(u=new c.N(u.lng,u.lat),t){const a=new c.N(u.lng-360,u.lat),h=new c.N(u.lng+360,u.lat),m=n.locationPoint(u).distSqr(t);n.locationPoint(a).distSqr(t)<m?u=a:n.locationPoint(h).distSqr(t)<m&&(u=h)}for(;Math.abs(u.lng-n.center.lng)>180;){const a=n.locationPoint(u);if(a.x>=0&&a.y>=0&&a.x<=n.width&&a.y<=n.height)break;u.lng>n.center.lng?u.lng-=360:u.lng+=360}return u.lng!==o.lng&&n.locationPoint(u).y>n.height/2-n.getHorizon()?u:o}const Ma={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 Yr(u,t,n){const o=u.classList;for(const a in Ma)o.remove(`maplibregl-${n}-anchor-${a}`);o.add(`maplibregl-${n}-anchor-${t}`)}class Ct extends c.E{constructor(t){if(super(),this._onKeyPress=n=>{const o=n.code,a=n.charCode||n.keyCode;o!=="Space"&&o!=="Enter"&&a!==32&&a!==13||this.togglePopup()},this._onMapClick=n=>{const o=n.originalEvent.target,a=this._element;this._popup&&(o===a||a.contains(o))&&this.togglePopup()},this._update=n=>{var o;if(!this._map)return;const a=this._map.loaded()&&!this._map.isMoving();((n==null?void 0:n.type)==="terrain"||(n==null?void 0:n.type)==="render"&&!a)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?Gl(this._lngLat,this._flatPos,this._map.transform):(o=this._lngLat)===null||o===void 0?void 0:o.wrap(),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationPoint(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 m="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?m="rotateX(0deg)":this._pitchAlignment==="map"&&(m=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||n&&n.type!=="moveend"||(this._pos=this._pos.round()),ae.setTransform(this._element,`${Ma[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${m} ${h}`),le.frameAsync(new AbortController).then(()=>{this._updateOpacity(n&&n.type==="moveend")}).catch(()=>{})},this._onMove=n=>{if(!this._isDragging){const o=this._clickTolerance||this._map._clickTolerance;this._isDragging=n.point.dist(this._pointerdownPos)>=o}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 c.k("dragstart"))),this.fire(new c.k("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 c.k("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&&t.anchor||"center",this._color=t&&t.color||"#3FB1CE",this._scale=t&&t.scale||1,this._draggable=t&&t.draggable||!1,this._clickTolerance=t&&t.clickTolerance||0,this._subpixelPositioning=t&&t.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||"auto",this._pitchAlignment=t&&t.pitchAlignment&&t.pitchAlignment!=="auto"?t.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(t==null?void 0:t.opacity,t==null?void 0:t.opacityWhenCovered),t&&t.element)this._element=t.element,this._offset=c.P.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=ae.create("div");const n=ae.createNS("http://www.w3.org/2000/svg","svg"),o=41,a=27;n.setAttributeNS(null,"display","block"),n.setAttributeNS(null,"height",`${o}px`),n.setAttributeNS(null,"width",`${a}px`),n.setAttributeNS(null,"viewBox",`0 0 ${a} ${o}`);const h=ae.createNS("http://www.w3.org/2000/svg","g");h.setAttributeNS(null,"stroke","none"),h.setAttributeNS(null,"stroke-width","1"),h.setAttributeNS(null,"fill","none"),h.setAttributeNS(null,"fill-rule","evenodd");const m=ae.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"fill-rule","nonzero");const y=ae.createNS("http://www.w3.org/2000/svg","g");y.setAttributeNS(null,"transform","translate(3.0, 29.0)"),y.setAttributeNS(null,"fill","#000000");const v=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const H of v){const Y=ae.createNS("http://www.w3.org/2000/svg","ellipse");Y.setAttributeNS(null,"opacity","0.04"),Y.setAttributeNS(null,"cx","10.5"),Y.setAttributeNS(null,"cy","5.80029008"),Y.setAttributeNS(null,"rx",H.rx),Y.setAttributeNS(null,"ry",H.ry),y.appendChild(Y)}const b=ae.createNS("http://www.w3.org/2000/svg","g");b.setAttributeNS(null,"fill",this._color);const P=ae.createNS("http://www.w3.org/2000/svg","path");P.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),b.appendChild(P);const k=ae.createNS("http://www.w3.org/2000/svg","g");k.setAttributeNS(null,"opacity","0.25"),k.setAttributeNS(null,"fill","#000000");const L=ae.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"),k.appendChild(L);const B=ae.createNS("http://www.w3.org/2000/svg","g");B.setAttributeNS(null,"transform","translate(6.0, 7.0)"),B.setAttributeNS(null,"fill","#FFFFFF");const N=ae.createNS("http://www.w3.org/2000/svg","g");N.setAttributeNS(null,"transform","translate(8.0, 8.0)");const Z=ae.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 j=ae.createNS("http://www.w3.org/2000/svg","circle");j.setAttributeNS(null,"fill","#FFFFFF"),j.setAttributeNS(null,"cx","5.5"),j.setAttributeNS(null,"cy","5.5"),j.setAttributeNS(null,"r","5.4999962"),N.appendChild(Z),N.appendChild(j),m.appendChild(y),m.appendChild(b),m.appendChild(k),m.appendChild(B),m.appendChild(N),n.appendChild(m),n.setAttributeNS(null,"height",o*this._scale+"px"),n.setAttributeNS(null,"width",a*this._scale+"px"),this._element.appendChild(n),this._offset=c.P.convert(t&&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()}),Yr(this._element,this._anchor,"marker"),t&&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.setAttribute("aria-label",t._getUIString("Marker.Title")),t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),t.on("terrain",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",this._update),this._map.off("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),ae.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=c.N.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 a=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":[a,-1*(38.1-13.5+a)],"bottom-right":[-a,-1*(38.1-13.5+a)],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,o;if(!(!((n=this._map)===null||n===void 0)&&n.terrain))return void(this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity));if(t)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const a=this._map,h=a.terrain.depthAtPoint(this._pos),m=a.terrain.getElevationForLngLatZoom(this._lngLat,a.transform.tileZoom);if(a.transform.lngLatToCameraDepth(this._lngLat,m)-h<.006)return void(this._element.style.opacity=this._opacity);const y=-this._offset.y/a.transform._pixelPerMeter,v=Math.sin(a.getPitch()*Math.PI/180)*y,b=a.terrain.depthAtPoint(new c.P(this._pos.x,this._pos.y-this._offset.y)),P=a.transform.lngLatToCameraDepth(this._lngLat,m+v)-b>.006;!((o=this._popup)===null||o===void 0)&&o.isOpen()&&P&&this._popup.remove(),this._element.style.opacity=P?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(t){return this._offset=c.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 t===void 0&&n===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),t!==void 0&&(this._opacity=t),n!==void 0&&(this._opacityWhenCovered=n),this._map&&this._updateOpacity(!0),this}}const _o={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Un=0,jn=!1;const Hl={maxWidth:100,unit:"metric"};function za(u,t,n){const o=n&&n.maxWidth||100,a=u._container.clientHeight/2,h=u.unproject([0,a]),m=u.unproject([o,a]),y=h.distanceTo(m);if(n&&n.unit==="imperial"){const v=3.2808*y;v>5280?Es(t,o,v/5280,u._getUIString("ScaleControl.Miles")):Es(t,o,v,u._getUIString("ScaleControl.Feet"))}else n&&n.unit==="nautical"?Es(t,o,y/1852,u._getUIString("ScaleControl.NauticalMiles")):y>=1e3?Es(t,o,y/1e3,u._getUIString("ScaleControl.Kilometers")):Es(t,o,y,u._getUIString("ScaleControl.Meters"))}function Es(u,t,n,o){const a=function(h){const m=Math.pow(10,`${Math.floor(h)}`.length-1);let y=h/m;return y=y>=10?10:y>=5?5:y>=3?3:y>=2?2:y>=1?1:function(v){const b=Math.pow(10,Math.ceil(-Math.log(v)/Math.LN10));return Math.round(v*b)/b}(y),m*y}(n);u.style.width=t*(a/n)+"px",u.innerHTML=`${a} ${o}`}const vr={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},yo=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function qe(u){if(u){if(typeof u=="number"){const t=Math.round(Math.abs(u)/Math.SQRT2);return{center:new c.P(0,0),top:new c.P(0,u),"top-left":new c.P(t,t),"top-right":new c.P(-t,t),bottom:new c.P(0,-u),"bottom-left":new c.P(t,-t),"bottom-right":new c.P(-t,-t),left:new c.P(u,0),right:new c.P(-u,0)}}if(u instanceof c.P||Array.isArray(u)){const t=c.P.convert(u);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:c.P.convert(u.center||[0,0]),top:c.P.convert(u.top||[0,0]),"top-left":c.P.convert(u["top-left"]||[0,0]),"top-right":c.P.convert(u["top-right"]||[0,0]),bottom:c.P.convert(u.bottom||[0,0]),"bottom-left":c.P.convert(u["bottom-left"]||[0,0]),"bottom-right":c.P.convert(u["bottom-right"]||[0,0]),left:c.P.convert(u.left||[0,0]),right:c.P.convert(u.right||[0,0])}}return qe(new c.P(0,0))}const Je=ye;T.AJAXError=c.bg,T.Evented=c.E,T.LngLat=c.N,T.MercatorCoordinate=c.Z,T.Point=c.P,T.addProtocol=c.bh,T.config=c.a,T.removeProtocol=c.bi,T.AttributionControl=Nn,T.BoxZoomHandler=da,T.CanvasSource=Hi,T.CooperativeGesturesHandler=ir,T.DoubleClickZoomHandler=Ta,T.DragPanHandler=Wi,T.DragRotateHandler=tr,T.EdgeInsets=co,T.FullscreenControl=class extends c.E{constructor(u={}){super(),this._onFullscreenChange=()=>{var t;let n=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((t=n==null?void 0:n.shadowRoot)===null||t===void 0)&&t.fullscreenElement;)n=n.shadowRoot.fullscreenElement;n===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,u&&u.container&&(u.container instanceof HTMLElement?this._container=u.container:c.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(u){return this._map=u,this._container||(this._container=this._map.getContainer()),this._controlContainer=ae.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){ae.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const u=this._fullscreenButton=ae.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);ae.create("span","maplibregl-ctrl-icon",u).setAttribute("aria-hidden","true"),u.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const u=this._getTitle();this._fullscreenButton.setAttribute("aria-label",u),this._fullscreenButton.title=u}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new c.k("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new c.k("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},T.GeoJSONSource=ss,T.GeolocateControl=class extends c.E{constructor(u){super(),this._onSuccess=t=>{if(this._map){if(this._isOutOfMapMaxBounds(t))return this._setErrorState(),this.fire(new c.k("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 c.k("geolocate",t)),this._finish()}},this._updateCamera=t=>{const n=new c.N(t.coords.longitude,t.coords.latitude),o=t.coords.accuracy,a=this._map.getBearing(),h=c.e({bearing:a},this.options.fitBoundsOptions),m=ue.fromLngLat(n,o);this._map.fitBounds(m,h,{geolocateSource:!0})},this._updateMarker=t=>{if(t){const n=new c.N(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.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=t=>{if(this._map){if(this.options.trackUserLocation)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&&jn)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new c.k("error",t)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",t=>t.preventDefault()),this._geolocateButton=ae.create("button","maplibregl-ctrl-geolocate",this._container),ae.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){c.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=ae.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Ct({element:this._dotElement}),this._circleElement=ae.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Ct({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",n=>{n.geolocateSource||this._watchState!=="ACTIVE_LOCK"||n.originalEvent&&n.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new c.k("trackuserlocationend")),this.fire(new c.k("userlocationlostfocus")))})}},this.options=c.e({},_o,u)}onAdd(u){return this._map=u,this._container=ae.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return c._(this,arguments,void 0,function*(t=!1){if(Kr!==void 0&&!t)return Kr;if(window.navigator.permissions===void 0)return Kr=!!window.navigator.geolocation,Kr;try{Kr=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{Kr=!!window.navigator.geolocation}return Kr})}().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(),ae.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Un=0,jn=!1}_isOutOfMapMaxBounds(u){const t=this._map.getMaxBounds(),n=u.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":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){const u=this._map.getBounds(),t=u.getSouthEast(),n=u.getNorthEast(),o=t.distanceTo(n),a=Math.ceil(this._accuracy/(o/this._map._container.clientHeight)*2);this._circleElement.style.width=`${a}px`,this._circleElement.style.height=`${a}px`}trigger(){if(!this._setup)return c.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 c.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Un--,jn=!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 c.k("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 c.k("trackuserlocationstart")),this.fire(new c.k("userlocationfocus"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let u;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Un++,Un>1?(u={maximumAge:6e5,timeout:0},jn=!0):(u=this.options.positionOptions,jn=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,u)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},T.Hash=ws,T.ImageSource=Cr,T.KeyboardHandler=ba,T.LngLatBounds=ue,T.LogoControl=yr,T.Map=class extends eh{constructor(u){c.be.mark(c.bf.create);const t=Object.assign(Object.assign({},th),u);if(t.minZoom!=null&&t.maxZoom!=null&&t.minZoom>t.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(t.minPitch!=null&&t.maxPitch!=null&&t.minPitch>t.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(t.minPitch!=null&&t.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(t.maxPitch!=null&&t.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new aa(t.minZoom,t.maxZoom,t.minPitch,t.maxPitch,t.renderWorldCopies),{bearingSnap:t.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new Oe,this._controls=[],this._mapId=c.a4(),this._contextLost=n=>{n.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new c.k("webglcontextlost",{originalEvent:n}))},this._contextRestored=n=>{this._setupPainter(),this.resize(),this._update(),this.fire(new c.k("webglcontextrestored",{originalEvent:n}))},this._onMapScroll=n=>{if(n.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=t.interactive,this._maxTileCacheSize=t.maxTileCacheSize,this._maxTileCacheZoomLevels=t.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=t.failIfMajorPerformanceCaveat===!0,this._preserveDrawingBuffer=t.preserveDrawingBuffer===!0,this._antialias=t.antialias===!0,this._trackResize=t.trackResize===!0,this._bearingSnap=t.bearingSnap,this._refreshExpiredTiles=t.refreshExpiredTiles===!0,this._fadeDuration=t.fadeDuration,this._crossSourceCollisions=t.crossSourceCollisions===!0,this._collectResourceTiming=t.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},De),t.locale),this._clickTolerance=t.clickTolerance,this._overridePixelRatio=t.pixelRatio,this._maxCanvasSize=t.maxCanvasSize,this.transformCameraUpdate=t.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=t.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=Ee.addThrottleControl(()=>this.isMoving()),this._requestManager=new Pt(t.transformRequest),typeof t.container=="string"){if(this._container=document.getElementById(t.container),!this._container)throw new Error(`Container '${t.container}' not found.`)}else{if(!(t.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=t.container}if(t.maxBounds&&this.setMaxBounds(t.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)).on("moveend",()=>this._update(!1)).on("zoom",()=>this._update(!0)).on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}).once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let n=!1;const o=ho(a=>{this._trackResize&&!this._removed&&this.resize(a)._update()},50);this._resizeObserver=new ResizeObserver(a=>{n?o(a):n=!0}),this._resizeObserver.observe(this._container)}this.handlers=new Qc(this,t),this._hash=t.hash&&new ws(typeof t.hash=="string"&&t.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:t.center,zoom:t.zoom,bearing:t.bearing,pitch:t.pitch}),t.bounds&&(this.resize(),this.fitBounds(t.bounds,c.e({},t.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=t.localIdeographFontFamily,this._validateStyle=t.validateStyle,t.style&&this.setStyle(t.style,{localIdeographFontFamily:t.localIdeographFontFamily}),t.attributionControl&&this.addControl(new Nn(typeof t.attributionControl=="boolean"?void 0:t.attributionControl)),t.maplibreLogo&&this.addControl(new yr,t.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",n=>{this._update(n.dataType==="style"),this.fire(new c.k(`${n.dataType}data`,n))}),this.on("dataloading",n=>{this.fire(new c.k(`${n.dataType}dataloading`,n))}),this.on("dataabort",n=>{this.fire(new c.k("sourcedataabort",n))})}_getMapId(){return this._mapId}addControl(u,t){if(t===void 0&&(t=u.getDefaultPosition?u.getDefaultPosition():"top-right"),!u||!u.onAdd)return this.fire(new c.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const n=u.onAdd(this);this._controls.push(u);const o=this._controlPositions[t];return t.indexOf("bottom")!==-1?o.insertBefore(n,o.firstChild):o.appendChild(n),this}removeControl(u){if(!u||!u.onRemove)return this.fire(new c.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(u);return t>-1&&this._controls.splice(t,1),u.onRemove(this),this}hasControl(u){return this._controls.indexOf(u)>-1}calculateCameraOptionsFromTo(u,t,n,o){return o==null&&this.terrain&&(o=this.terrain.getElevationForLngLatZoom(n,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(u,t,n,o)}resize(u){var t;const n=this._containerDimensions(),o=n[0],a=n[1],h=this._getClampedPixelRatio(o,a);if(this._resizeCanvas(o,a,h),this.painter.resize(o,a,h),this.painter.overLimit()){const y=this.painter.context.gl;this._maxCanvasSize=[y.drawingBufferWidth,y.drawingBufferHeight];const v=this._getClampedPixelRatio(o,a);this._resizeCanvas(o,a,v),this.painter.resize(o,a,v)}this.transform.resize(o,a),(t=this._requestedCameraState)===null||t===void 0||t.resize(o,a);const m=!this._moving;return m&&(this.stop(),this.fire(new c.k("movestart",u)).fire(new c.k("move",u))),this.fire(new c.k("resize",u)),m&&this.fire(new c.k("moveend",u)),this}_getClampedPixelRatio(u,t){const{0:n,1:o}=this._maxCanvasSize,a=this.getPixelRatio(),h=u*a,m=t*a;return Math.min(h>n?n/h:1,m>o?o/m:1)*a}getPixelRatio(){var u;return(u=this._overridePixelRatio)!==null&&u!==void 0?u:devicePixelRatio}setPixelRatio(u){this._overridePixelRatio=u,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(u){return this.transform.setMaxBounds(ue.convert(u)),this._update()}setMinZoom(u){if((u=u??-2)>=-2&&u<=this.transform.maxZoom)return this.transform.minZoom=u,this._update(),this.getZoom()<u&&this.setZoom(u),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(u){if((u=u??22)>=this.transform.minZoom)return this.transform.maxZoom=u,this._update(),this.getZoom()>u&&this.setZoom(u),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(u){if((u=u??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(u>=0&&u<=this.transform.maxPitch)return this.transform.minPitch=u,this._update(),this.getPitch()<u&&this.setPitch(u),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(u){if((u=u??60)>85)throw new Error("maxPitch must be less than or equal to 85");if(u>=this.transform.minPitch)return this.transform.maxPitch=u,this._update(),this.getPitch()>u&&this.setPitch(u),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(u){return this.transform.renderWorldCopies=u,this._update()}project(u){return this.transform.locationPoint(c.N.convert(u),this.style&&this.terrain)}unproject(u){return this.transform.pointLocation(c.P.convert(u),this.terrain)}isMoving(){var u;return this._moving||((u=this.handlers)===null||u===void 0?void 0:u.isMoving())}isZooming(){var u;return this._zooming||((u=this.handlers)===null||u===void 0?void 0:u.isZooming())}isRotating(){var u;return this._rotating||((u=this.handlers)===null||u===void 0?void 0:u.isRotating())}_createDelegatedListener(u,t,n){if(u==="mouseenter"||u==="mouseover"){let o=!1;return{layer:t,listener:n,delegates:{mousemove:h=>{const m=this.getLayer(t)?this.queryRenderedFeatures(h.point,{layers:[t]}):[];m.length?o||(o=!0,n.call(this,new Ti(u,this,h.originalEvent,{features:m}))):o=!1},mouseout:()=>{o=!1}}}}if(u==="mouseleave"||u==="mouseout"){let o=!1;return{layer:t,listener:n,delegates:{mousemove:m=>{(this.getLayer(t)?this.queryRenderedFeatures(m.point,{layers:[t]}):[]).length?o=!0:o&&(o=!1,n.call(this,new Ti(u,this,m.originalEvent)))},mouseout:m=>{o&&(o=!1,n.call(this,new Ti(u,this,m.originalEvent)))}}}}{const o=a=>{const h=this.getLayer(t)?this.queryRenderedFeatures(a.point,{layers:[t]}):[];h.length&&(a.features=h,n.call(this,a),delete a.features)};return{layer:t,listener:n,delegates:{[u]:o}}}}on(u,t,n){if(n===void 0)return super.on(u,t);const o=this._createDelegatedListener(u,t,n);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[u]=this._delegatedListeners[u]||[],this._delegatedListeners[u].push(o);for(const a in o.delegates)this.on(a,o.delegates[a]);return this}once(u,t,n){if(n===void 0)return super.once(u,t);const o=this._createDelegatedListener(u,t,n);for(const a in o.delegates)this.once(a,o.delegates[a]);return this}off(u,t,n){return n===void 0?super.off(u,t):(this._delegatedListeners&&this._delegatedListeners[u]&&(o=>{const a=this._delegatedListeners[u];for(let h=0;h<a.length;h++){const m=a[h];if(m.layer===t&&m.listener===n){for(const y in m.delegates)this.off(y,m.delegates[y]);return a.splice(h,1),this}}})(),this)}queryRenderedFeatures(u,t){if(!this.style)return[];let n;const o=u instanceof c.P||Array.isArray(u),a=o?u:[[0,0],[this.transform.width,this.transform.height]];if(t=t||(o?{}:u)||{},a instanceof c.P||typeof a[0]=="number")n=[c.P.convert(a)];else{const h=c.P.convert(a[0]),m=c.P.convert(a[1]);n=[h,new c.P(m.x,h.y),m,new c.P(h.x,m.y),h]}return this.style.queryRenderedFeatures(n,t,this.transform)}querySourceFeatures(u,t){return this.style.querySourceFeatures(u,t)}setStyle(u,t){return(t=c.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},t)).diff!==!1&&t.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&u?(this._diffStyle(u,t),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._updateStyle(u,t))}setTransformRequest(u){return this._requestManager.setTransformRequest(u),this}_getUIString(u){const t=this._locale[u];if(t==null)throw new Error(`Missing UI string '${u}'`);return t}_updateStyle(u,t){if(t.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(u,t));const n=this.style&&t.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!u)),u?(this.style=new jo(this,t||{}),this.style.setEventedParent(this,{style:this.style}),typeof u=="string"?this.style.loadURL(u,t,n):this.style.loadJSON(u,t,n),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new jo(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(u,t){if(typeof u=="string"){const n=this._requestManager.transformRequest(u,"Style");c.h(n,new AbortController).then(o=>{this._updateDiff(o.data,t)}).catch(o=>{o&&this.fire(new c.j(o))})}else typeof u=="object"&&this._updateDiff(u,t)}_updateDiff(u,t){try{this.style.setState(u,t)&&this._update(!0)}catch(n){c.w(`Unable to perform style diff: ${n.message||n.error||n}. Rebuilding the style from scratch.`),this._updateStyle(u,t)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():c.w("There is no style added to the map.")}addSource(u,t){return this._lazyInitEmptyStyle(),this.style.addSource(u,t),this._update(!0)}isSourceLoaded(u){const t=this.style&&this.style.sourceCaches[u];if(t!==void 0)return t.loaded();this.fire(new c.j(new Error(`There is no source with ID '${u}'`)))}setTerrain(u){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),u){const t=this.style.sourceCaches[u.source];if(!t)throw new Error(`cannot load terrain, because there exists no source with ID: ${u.source}`);this.terrain===null&&t.reload();for(const n in this.style._layers){const o=this.style._layers[n];o.type==="hillshade"&&o.source===u.source&&c.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new jl(this.painter,t,u),this.painter.renderToTexture=new $l(this.painter,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=n=>{n.dataType==="style"?this.terrain.sourceCache.freeRtt():n.dataType==="source"&&n.tile&&(n.sourceId!==u.source||this._elevationFreeze||(this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(n.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.minElevationForCurrentTile=0,this.transform.elevation=0;return this.fire(new c.k("terrain",{terrain:u})),this}getTerrain(){var u,t;return(t=(u=this.terrain)===null||u===void 0?void 0:u.options)!==null&&t!==void 0?t:null}areTilesLoaded(){const u=this.style&&this.style.sourceCaches;for(const t in u){const n=u[t]._tiles;for(const o in n){const a=n[o];if(a.state!=="loaded"&&a.state!=="errored")return!1}}return!0}removeSource(u){return this.style.removeSource(u),this._update(!0)}getSource(u){return this.style.getSource(u)}addImage(u,t,n={}){const{pixelRatio:o=1,sdf:a=!1,stretchX:h,stretchY:m,content:y,textFitWidth:v,textFitHeight:b}=n;if(this._lazyInitEmptyStyle(),!(t instanceof HTMLImageElement||c.b(t))){if(t.width===void 0||t.height===void 0)return this.fire(new c.j(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:P,height:k,data:L}=t,B=t;return this.style.addImage(u,{data:new c.R({width:P,height:k},new Uint8Array(L)),pixelRatio:o,stretchX:h,stretchY:m,content:y,textFitWidth:v,textFitHeight:b,sdf:a,version:0,userImage:B}),B.onAdd&&B.onAdd(this,u),this}}{const{width:P,height:k,data:L}=le.getImageData(t);this.style.addImage(u,{data:new c.R({width:P,height:k},L),pixelRatio:o,stretchX:h,stretchY:m,content:y,textFitWidth:v,textFitHeight:b,sdf:a,version:0})}}updateImage(u,t){const n=this.style.getImage(u);if(!n)return this.fire(new c.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const o=t instanceof HTMLImageElement||c.b(t)?le.getImageData(t):t,{width:a,height:h,data:m}=o;if(a===void 0||h===void 0)return this.fire(new c.j(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(a!==n.data.width||h!==n.data.height)return this.fire(new c.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));const y=!(t instanceof HTMLImageElement||c.b(t));return n.data.replace(m,y),this.style.updateImage(u,n),this}getImage(u){return this.style.getImage(u)}hasImage(u){return u?!!this.style.getImage(u):(this.fire(new c.j(new Error("Missing required image id"))),!1)}removeImage(u){this.style.removeImage(u)}loadImage(u){return Ee.getImage(this._requestManager.transformRequest(u,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(u,t){return this._lazyInitEmptyStyle(),this.style.addLayer(u,t),this._update(!0)}moveLayer(u,t){return this.style.moveLayer(u,t),this._update(!0)}removeLayer(u){return this.style.removeLayer(u),this._update(!0)}getLayer(u){return this.style.getLayer(u)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(u,t,n){return this.style.setLayerZoomRange(u,t,n),this._update(!0)}setFilter(u,t,n={}){return this.style.setFilter(u,t,n),this._update(!0)}getFilter(u){return this.style.getFilter(u)}setPaintProperty(u,t,n,o={}){return this.style.setPaintProperty(u,t,n,o),this._update(!0)}getPaintProperty(u,t){return this.style.getPaintProperty(u,t)}setLayoutProperty(u,t,n,o={}){return this.style.setLayoutProperty(u,t,n,o),this._update(!0)}getLayoutProperty(u,t){return this.style.getLayoutProperty(u,t)}setGlyphs(u,t={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(u,t),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(u,t,n={}){return this._lazyInitEmptyStyle(),this.style.addSprite(u,t,n,o=>{o||this._update(!0)}),this}removeSprite(u){return this._lazyInitEmptyStyle(),this.style.removeSprite(u),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(u,t={}){return this._lazyInitEmptyStyle(),this.style.setSprite(u,t,n=>{n||this._update(!0)}),this}setLight(u,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(u,t),this._update(!0)}getLight(){return this.style.getLight()}setSky(u){return this._lazyInitEmptyStyle(),this.style.setSky(u),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(u,t){return this.style.setFeatureState(u,t),this._update()}removeFeatureState(u,t){return this.style.removeFeatureState(u,t),this._update()}getFeatureState(u){return this.style.getFeatureState(u)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let u=0,t=0;return this._container&&(u=this._container.clientWidth||400,t=this._container.clientHeight||300),[u,t]}_setupContainer(){const u=this._container;u.classList.add("maplibregl-map");const t=this._canvasContainer=ae.create("div","maplibregl-canvas-container",u);this._interactive&&t.classList.add("maplibregl-interactive"),this._canvas=ae.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(),o=this._getClampedPixelRatio(n[0],n[1]);this._resizeCanvas(n[0],n[1],o);const a=this._controlContainer=ae.create("div","maplibregl-control-container",u),h=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(m=>{h[m]=ae.create("div",`maplibregl-ctrl-${m} `,a)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(u,t,n){this._canvas.width=Math.floor(n*u),this._canvas.height=Math.floor(n*t),this._canvas.style.width=`${u}px`,this._canvas.style.height=`${t}px`}_setupPainter(){const u={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let t=null;this._canvas.addEventListener("webglcontextcreationerror",o=>{t={requestedAttributes:u},o&&(t.statusMessage=o.statusMessage,t.type=o.type)},{once:!0});const n=this._canvas.getContext("webgl2",u)||this._canvas.getContext("webgl",u);if(!n){const o="Failed to initialize WebGL";throw t?(t.message=o,new Error(JSON.stringify(t))):new Error(o)}this.painter=new Rl(n,this.transform),gt.testSupport(n)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(u){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||u,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(u){return this._update(),this._renderTaskQueue.add(u)}_cancelRenderFrame(u){this._renderTaskQueue.remove(u)}_render(u){const t=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(u),this._removed)return;let n=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const a=this.transform.zoom,h=le.now();this.style.zoomHistory.update(a,h);const m=new c.a9(a,{now:h,fadeDuration:t,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),y=m.crossFadingFactor();y===1&&y===this._crossFadingFactor||(n=!0,this._crossFadingFactor=y),this.style.update(m)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.minElevationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,t,this._crossSourceCollisions),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}),this.fire(new c.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,c.be.mark(c.bf.load),this.fire(new c.k("load"))),this.style&&(this.style.hasTransitions()||n)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const o=this._sourcesDirty||this._styleDirty||this._placementDirty;return o||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new c.k("idle")),!this._loaded||this._fullyLoaded||o||(this._fullyLoaded=!0,c.be.mark(c.bf.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var u;this._hash&&this._hash.remove();for(const n of this._controls)n.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),Ee.removeThrottleControl(this._imageQueueHandle),(u=this._resizeObserver)===null||u===void 0||u.disconnect();const t=this.painter.context.gl.getExtension("WEBGL_lose_context");t!=null&&t.loseContext&&t.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),ae.remove(this._canvasContainer),ae.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),c.be.clearMetrics(),this._removed=!0,this.fire(new c.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,le.frameAsync(this._frameRequest).then(u=>{c.be.frame(u),this._frameRequest=null,this._render(u)}).catch(()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(u){this._showTileBoundaries!==u&&(this._showTileBoundaries=u,this._update())}get showPadding(){return!!this._showPadding}set showPadding(u){this._showPadding!==u&&(this._showPadding=u,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(u){this._showCollisionBoxes!==u&&(this._showCollisionBoxes=u,u?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(u){this._showOverdrawInspector!==u&&(this._showOverdrawInspector=u,this._update())}get repaint(){return!!this._repaint}set repaint(u){this._repaint!==u&&(this._repaint=u,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(u){this._vertices=u,this._update()}get version(){return Ca}getCameraTargetElevation(){return this.transform.elevation}},T.MapMouseEvent=Ti,T.MapTouchEvent=Ss,T.MapWheelEvent=ha,T.Marker=Ct,T.NavigationControl=class{constructor(u){this._updateZoomButtons=()=>{const t=this._map.getZoom(),n=t===this._map.getMaxZoom(),o=t===this._map.getMinZoom();this._zoomInButton.disabled=n,this._zoomOutButton.disabled=o,this._zoomInButton.setAttribute("aria-disabled",n.toString()),this._zoomOutButton.setAttribute("aria-disabled",o.toString())},this._rotateCompassArrow=()=>{const t=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=t},this._setButtonTitle=(t,n)=>{const o=this._map._getUIString(`NavigationControl.${n}`);t.title=o,t.setAttribute("aria-label",o)},this.options=c.e({},Ea,u),this._container=ae.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})),ae.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})),ae.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=ae.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(u){return this._map=u,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Zl(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){ae.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(u,t){const n=ae.create("button",u,this._container);return n.type="button",n.addEventListener("click",t),n}},T.Popup=class extends c.E{constructor(u){super(),this.remove=()=>(this._content&&ae.remove(this._content),this._container&&(ae.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new c.k("close"))),this),this._onMouseUp=t=>{this._update(t.point)},this._onMouseMove=t=>{this._update(t.point)},this._onDrag=t=>{this._update(t.point)},this._update=t=>{var n;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=ae.create("div","maplibregl-popup",this._map.getContainer()),this._tip=ae.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const y of this.options.className.split(" "))this._container.classList.add(y);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=this._map.transform.renderWorldCopies&&!this._trackPointer?Gl(this._lngLat,this._flatPos,this._map.transform):(n=this._lngLat)===null||n===void 0?void 0:n.wrap(),this._trackPointer&&!t)return;const o=this._flatPos=this._pos=this._trackPointer&&t?t:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&t?t:this._map.transform.locationPoint(this._lngLat));let a=this.options.anchor;const h=qe(this.options.offset);if(!a){const y=this._container.offsetWidth,v=this._container.offsetHeight;let b;b=o.y+h.bottom.y<v?["top"]:o.y>this._map.transform.height-v?["bottom"]:[],o.x<y/2?b.push("left"):o.x>this._map.transform.width-y/2&&b.push("right"),a=b.length===0?"bottom":b.join("-")}let m=o.add(h[a]);this.options.subpixelPositioning||(m=m.round()),ae.setTransform(this._container,`${Ma[a]} translate(${m.x}px,${m.y}px)`),Yr(this._container,a,"popup")},this._onClose=()=>{this.remove()},this.options=c.e(Object.create(vr),u)}addTo(u){return this._map&&this.remove(),this._map=u,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new c.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(u){return this._lngLat=c.N.convert(u),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(u){return this.setDOMContent(document.createTextNode(u))}setHTML(u){const t=document.createDocumentFragment(),n=document.createElement("body");let o;for(n.innerHTML=u;o=n.firstChild,o;)t.appendChild(o);return this.setDOMContent(t)}getMaxWidth(){var u;return(u=this._container)===null||u===void 0?void 0:u.style.maxWidth}setMaxWidth(u){return this.options.maxWidth=u,this._update(),this}setDOMContent(u){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=ae.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(u),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(u){return this._container&&this._container.classList.add(u),this}removeClassName(u){return this._container&&this._container.classList.remove(u),this}setOffset(u){return this.options.offset=u,this._update(),this}toggleClassName(u){if(this._container)return this._container.classList.toggle(u)}setSubpixelPositioning(u){this.options.subpixelPositioning=u}_createCloseButton(){this.options.closeButton&&(this._closeButton=ae.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const u=this._container.querySelector(yo);u&&u.focus()}},T.RasterDEMTileSource=$t,T.RasterTileSource=_t,T.ScaleControl=class{constructor(u){this._onMove=()=>{za(this._map,this._container,this.options)},this.setUnit=t=>{this.options.unit=t,za(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Hl),u)}getDefaultPosition(){return"bottom-left"}onAdd(u){return this._map=u,this._container=ae.create("div","maplibregl-ctrl maplibregl-ctrl-scale",u.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){ae.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},T.ScrollZoomHandler=Sa,T.Style=jo,T.TerrainControl=class{constructor(u){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=u}onAdd(u){return this._map=u,this._container=ae.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=ae.create("button","maplibregl-ctrl-terrain",this._container),ae.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(){ae.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},T.TwoFingersTouchPitchHandler=va,T.TwoFingersTouchRotateHandler=xa,T.TwoFingersTouchZoomHandler=_a,T.TwoFingersTouchZoomRotateHandler=Ia,T.VectorTileSource=ns,T.VideoSource=Mn,T.addSourceType=(u,t)=>c._(void 0,void 0,void 0,function*(){if(as(u))throw new Error(`A source type called "${u}" already exists.`);((n,o)=>{os[n]=o})(u,t)}),T.clearPrewarmedResources=function(){const u=Fi;u&&(u.isPreloaded()&&u.numActive()===1?(u.release(Ur),Fi=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()"))},T.getMaxParallelImageRequests=function(){return c.a.MAX_PARALLEL_IMAGE_REQUESTS},T.getRTLTextPluginStatus=function(){return fr().getRTLTextPluginStatus()},T.getVersion=function(){return Je},T.getWorkerCount=function(){return dr.workerCount},T.getWorkerUrl=function(){return c.a.WORKER_URL},T.importScriptInWorkers=function(u){return rs().broadcast("IS",u)},T.prewarm=function(){an().acquire(Ur)},T.setMaxParallelImageRequests=function(u){c.a.MAX_PARALLEL_IMAGE_REQUESTS=u},T.setRTLTextPlugin=function(u,t){return fr().setRTLTextPlugin(u,t)},T.setWorkerCount=function(u){dr.workerCount=u},T.setWorkerUrl=function(u){c.a.WORKER_URL=u}});var W=A;return W})})(Gh);var Cp=Gh.exports;const il=Ap(Cp);function Ep(g){return[{type:"fill",paint:{"fill-color":g.color||"#ccc","fill-outline-color":g.color||"blue","fill-opacity":g.opacity||1}}]}function Mp(g){return[{type:"line",paint:{"line-color":g.color||"#ccc","line-opacity":g.opacity||1}}]}function zp(g){return[{type:"circle",paint:{"circle-radius":g.radius||6,"circle-stroke-color":g.stroke||"#ccc","circle-stroke-width":g.width||1,"circle-color":g.color||"blue"}}]}function Hh(g){if(!g)return null;const S=g.type||"point";return S==="polygon"?Ep(g):S==="line"?Mp(g):zp(g)}const yc={data(){return{layerList:[],activeLayer:""}},computed:{interactiveSources(){return this.layerList.filter(g=>g==null?void 0:g.interactive).map(g=>g.id)}},methods:{moveLayer(g,S=this.map){S.getStyle().layers.forEach(A=>{A.id.match(g)&&S.moveLayer(A.id)})},async setVisible(g,S=!0,A=this.map){if(!g)return;const E=(g==null?void 0:g.id)||g,V=this.layerList.find(T=>T.id===g)||g;if(!(V!=null&&V.id))throw new Error("MixinError: Layer has no id");const W=A.getStyle().layers.filter(T=>T.id.match(E));W.forEach(T=>{A.setLayoutProperty(T.id,"visibility",S?"visible":"none")}),!W.length&&S&&await this.addLayer(V)},async addLayer(g,S={},A=this==null?void 0:this.map){var W,T,c;const E=this.layerList.find(ye=>ye.id===g)||g;this.map.getStyle().layers.find(ye=>ye.id===E.id)||(this.layerList.find(ye=>ye.id===E.id)||this.layerList.push(E),(E.service==="vtile"||E.service==="vector"||(W=E.url)!=null&&W.includes(".vmt"))&&this.addVtileLayer(E,A),E.service==="geojson"&&this.addGeoJsonLayer(E,A),((T=E.url)!=null&&T.includes(".png")||["tms","raster"].includes((c=E.service)==null?void 0:c.toLowerCase()))&&await this.addRasterLayer(E,S,A))},async addRasterLayer(g,S,A=this==null?void 0:this.map){await A.addSource(g.id,{type:"raster",tiles:[g==null?void 0:g.url],tileSize:256,...g!=null&&g.scheme?{scheme:g==null?void 0:g.scheme}:{}});const E=S.order===0?this.getOrder(S.order):null;await A.addLayer({id:g.id,type:"raster",source:g.id,minzoom:0,maxzoom:(g==null?void 0:g.maxzoom)||22},E)},async addVtileLayer(g,S=this==null?void 0:this.map){var W;const A=["props","pointZoom"].filter(T=>g[T]).map(T=>`&${T}=${g[T]}`),E={type:"vector",tiles:[`${(W=g==null?void 0:g.url)!=null&&W.startsWith("http")?"":window.location.origin}${g==null?void 0:g.url}${A}`],minzoom:g.minzoom||5,maxzoom:g.maxzoom||24};S.addSource(g.id,E),(Hh(g.style)||g.layers||[]).forEach((T,c)=>{const ye={...T,id:`${g.id}-${c}`,source:g.id,"source-layer":T["source-layer"]||g.source||g.id,maxzoom:+T.maxzoom||24,minzoom:+T.minzoom||0};S.addLayer(ye)})},async addGeoJsonLayer(g,S=this.map){var V;const A=g.data||((V=g==null?void 0:g.url)!=null&&V.startsWith("http")?"":window.location.origin)+g.url;S.addSource(g.id,{type:"geojson",data:A}),(Hh(g.style)||g.layers||[]).forEach(W=>{const T={...W,source:g.id,id:W.id||g.id,maxzoom:+W.maxzoom||24,minzoom:+W.minzoom||0,type:W.type||"circle"};S.addLayer(T)})},setLayerData(g,S){this.layerList=this.layerList.map(A=>A.id===g?{...A,...S}:A)},async removeLayer(g,S=this.map){await S.getStyle().layers.forEach(async A=>{A.source===g&&await S.removeLayer(A.id)}),S.getSource(g)&&await S.removeSource(g)},async setFilter(g,S){const A=this.layerList.find(V=>V.id===g),E=await this.map.getSource(g);await(E==null?void 0:E.setTiles([`${window.location.origin}${A.url.split("&filter")[0]}${A.url.includes("?")?"&":"?"}filter=${S}${A.props?`&props=${A.props}`:""}`]))},getOrder(g){var S;return((S=this.map.getStyle().layers[g])==null?void 0:S.id)||null},async changeBaseLayer(g){g!==this.activeLayer&&(this.activeLayer&&this.map.setLayoutProperty(this.activeLayer,"visibility","none"),await this.addLayer(g,{order:0}),this.map.setLayoutProperty(g,"visibility","visible"),this.activeLayer=g)},async refreshLayer(g,S=this.map){await S.getStyle().layers.forEach(A=>{A.source===g&&S.removeLayer(A.id)}),await S.removeSource(g),this.setVisible(g)}}},Or=(g,S)=>{const A=g.__vccOpts||g;for(const[E,V]of S)A[E]=V;return A},Dp={},Lp={class:"w-48 mx-auto mb-4",width:"178",height:"90",viewBox:"0 0 178 90",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Rp=[K.createStaticVNode('<rect x="27" y="50.5" width="124" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="27" y="50.5" width="124" height="39" rx="7.5" stroke="currentColor" class="stroke-stone-50 dark:stroke-neutral-700/10"></rect><rect x="34.5" y="58" width="24" height="24" rx="4" fill="currentColor" class="fill-stone-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="61" width="60" height="6" rx="3" fill="currentColor" class="fill-stone-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="73" width="77" height="6" rx="3" fill="currentColor" class="fill-stone-50 dark:fill-neutral-700/30"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" stroke="currentColor" class="stroke-stone-100 dark:stroke-neutral-700/30"></rect><rect x="27" y="36" width="24" height="24" rx="4" fill="currentColor" class="fill-stone-100 dark:fill-neutral-700/70"></rect><rect x="59" y="39" width="60" height="6" rx="3" fill="currentColor" class="fill-stone-100 dark:fill-neutral-700/70"></rect><rect x="59" y="51" width="92" height="6" rx="3" fill="currentColor" class="fill-stone-100 dark:fill-neutral-700/70"></rect><g filter="url(#filter2)"><rect x="12" y="6" width="154" height="40" rx="8" fill="currentColor" class="fill-white dark:fill-neutral-800" shape-rendering="crispEdges"></rect><rect x="12.5" y="6.5" width="153" height="39" rx="7.5" stroke="currentColor" class="stroke-stone-100 dark:stroke-neutral-700/60" shape-rendering="crispEdges"></rect><rect x="20" y="14" width="24" height="24" rx="4" fill="currentColor" class="fill-stone-200 dark:fill-neutral-700"></rect><rect x="52" y="17" width="60" height="6" rx="3" fill="currentColor" class="fill-stone-200 dark:fill-neutral-700"></rect><rect x="52" y="29" width="106" height="6" rx="3" fill="currentColor" class="fill-stone-200 dark:fill-neutral-700"></rect></g><defs><filter id="filter2" x="0" y="0" width="178" height="64" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"></feColorMatrix><feOffset dy="6"></feOffset><feGaussianBlur stdDeviation="6"></feGaussianBlur><feComposite in2="hardAlpha" operator="out"></feComposite><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0"></feColorMatrix><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1187_14810"></feBlend><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_1187_14810" result="shape"></feBlend></filter></defs>',12)];function Bp(g,S){return K.openBlock(),K.createElementBlock("svg",Lp,Rp)}const Fp=Or(Dp,[["render",Bp]]);function Xh(g,S){return function(){return g.apply(S,arguments)}}const{toString:Op}=Object.prototype,{getPrototypeOf:xc}=Object,rl=(g=>S=>{const A=Op.call(S);return g[A]||(g[A]=A.slice(8,-1).toLowerCase())})(Object.create(null)),Tr=g=>(g=g.toLowerCase(),S=>rl(S)===g),nl=g=>S=>typeof S===g,{isArray:Os}=Array,Bo=nl("undefined");function Vp(g){return g!==null&&!Bo(g)&&g.constructor!==null&&!Bo(g.constructor)&&Ki(g.constructor.isBuffer)&&g.constructor.isBuffer(g)}const Wh=Tr("ArrayBuffer");function Np(g){let S;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?S=ArrayBuffer.isView(g):S=g&&g.buffer&&Wh(g.buffer),S}const Up=nl("string"),Ki=nl("function"),Jh=nl("number"),sl=g=>g!==null&&typeof g=="object",jp=g=>g===!0||g===!1,ol=g=>{if(rl(g)!=="object")return!1;const S=xc(g);return(S===null||S===Object.prototype||Object.getPrototypeOf(S)===null)&&!(Symbol.toStringTag in g)&&!(Symbol.iterator in g)},$p=Tr("Date"),qp=Tr("File"),Zp=Tr("Blob"),Gp=Tr("FileList"),Hp=g=>sl(g)&&Ki(g.pipe),Xp=g=>{let S;return g&&(typeof FormData=="function"&&g instanceof FormData||Ki(g.append)&&((S=rl(g))==="formdata"||S==="object"&&Ki(g.toString)&&g.toString()==="[object FormData]"))},Wp=Tr("URLSearchParams"),[Jp,Kp,Yp,Qp]=["ReadableStream","Request","Response","Headers"].map(Tr),ef=g=>g.trim?g.trim():g.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Fo(g,S,{allOwnKeys:A=!1}={}){if(g===null||typeof g>"u")return;let E,V;if(typeof g!="object"&&(g=[g]),Os(g))for(E=0,V=g.length;E<V;E++)S.call(null,g[E],E,g);else{const W=A?Object.getOwnPropertyNames(g):Object.keys(g),T=W.length;let c;for(E=0;E<T;E++)c=W[E],S.call(null,g[c],c,g)}}function Kh(g,S){S=S.toLowerCase();const A=Object.keys(g);let E=A.length,V;for(;E-- >0;)if(V=A[E],S===V.toLowerCase())return V;return null}const es=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Yh=g=>!Bo(g)&&g!==es;function vc(){const{caseless:g}=Yh(this)&&this||{},S={},A=(E,V)=>{const W=g&&Kh(S,V)||V;ol(S[W])&&ol(E)?S[W]=vc(S[W],E):ol(E)?S[W]=vc({},E):Os(E)?S[W]=E.slice():S[W]=E};for(let E=0,V=arguments.length;E<V;E++)arguments[E]&&Fo(arguments[E],A);return S}const tf=(g,S,A,{allOwnKeys:E}={})=>(Fo(S,(V,W)=>{A&&Ki(V)?g[W]=Xh(V,A):g[W]=V},{allOwnKeys:E}),g),rf=g=>(g.charCodeAt(0)===65279&&(g=g.slice(1)),g),nf=(g,S,A,E)=>{g.prototype=Object.create(S.prototype,E),g.prototype.constructor=g,Object.defineProperty(g,"super",{value:S.prototype}),A&&Object.assign(g.prototype,A)},sf=(g,S,A,E)=>{let V,W,T;const c={};if(S=S||{},g==null)return S;do{for(V=Object.getOwnPropertyNames(g),W=V.length;W-- >0;)T=V[W],(!E||E(T,g,S))&&!c[T]&&(S[T]=g[T],c[T]=!0);g=A!==!1&&xc(g)}while(g&&(!A||A(g,S))&&g!==Object.prototype);return S},of=(g,S,A)=>{g=String(g),(A===void 0||A>g.length)&&(A=g.length),A-=S.length;const E=g.indexOf(S,A);return E!==-1&&E===A},af=g=>{if(!g)return null;if(Os(g))return g;let S=g.length;if(!Jh(S))return null;const A=new Array(S);for(;S-- >0;)A[S]=g[S];return A},lf=(g=>S=>g&&S instanceof g)(typeof Uint8Array<"u"&&xc(Uint8Array)),cf=(g,S)=>{const E=(g&&g[Symbol.iterator]).call(g);let V;for(;(V=E.next())&&!V.done;){const W=V.value;S.call(g,W[0],W[1])}},hf=(g,S)=>{let A;const E=[];for(;(A=g.exec(S))!==null;)E.push(A);return E},uf=Tr("HTMLFormElement"),df=g=>g.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(A,E,V){return E.toUpperCase()+V}),Qh=(({hasOwnProperty:g})=>(S,A)=>g.call(S,A))(Object.prototype),pf=Tr("RegExp"),eu=(g,S)=>{const A=Object.getOwnPropertyDescriptors(g),E={};Fo(A,(V,W)=>{let T;(T=S(V,W,g))!==!1&&(E[W]=T||V)}),Object.defineProperties(g,E)},ff=g=>{eu(g,(S,A)=>{if(Ki(g)&&["arguments","caller","callee"].indexOf(A)!==-1)return!1;const E=g[A];if(Ki(E)){if(S.enumerable=!1,"writable"in S){S.writable=!1;return}S.set||(S.set=()=>{throw Error("Can not rewrite read-only method '"+A+"'")})}})},mf=(g,S)=>{const A={},E=V=>{V.forEach(W=>{A[W]=!0})};return Os(g)?E(g):E(String(g).split(S)),A},gf=()=>{},_f=(g,S)=>g!=null&&Number.isFinite(g=+g)?g:S,bc="abcdefghijklmnopqrstuvwxyz",tu="0123456789",iu={DIGIT:tu,ALPHA:bc,ALPHA_DIGIT:bc+bc.toUpperCase()+tu},yf=(g=16,S=iu.ALPHA_DIGIT)=>{let A="";const{length:E}=S;for(;g--;)A+=S[Math.random()*E|0];return A};function xf(g){return!!(g&&Ki(g.append)&&g[Symbol.toStringTag]==="FormData"&&g[Symbol.iterator])}const vf=g=>{const S=new Array(10),A=(E,V)=>{if(sl(E)){if(S.indexOf(E)>=0)return;if(!("toJSON"in E)){S[V]=E;const W=Os(E)?[]:{};return Fo(E,(T,c)=>{const ye=A(T,V+1);!Bo(ye)&&(W[c]=ye)}),S[V]=void 0,W}}return E};return A(g,0)},bf=Tr("AsyncFunction"),wf=g=>g&&(sl(g)||Ki(g))&&Ki(g.then)&&Ki(g.catch),ru=((g,S)=>g?setImmediate:S?((A,E)=>(es.addEventListener("message",({source:V,data:W})=>{V===es&&W===A&&E.length&&E.shift()()},!1),V=>{E.push(V),es.postMessage(A,"*")}))(`axios@${Math.random()}`,[]):A=>setTimeout(A))(typeof setImmediate=="function",Ki(es.postMessage)),Sf=typeof queueMicrotask<"u"?queueMicrotask.bind(es):typeof process<"u"&&process.nextTick||ru,fe={isArray:Os,isArrayBuffer:Wh,isBuffer:Vp,isFormData:Xp,isArrayBufferView:Np,isString:Up,isNumber:Jh,isBoolean:jp,isObject:sl,isPlainObject:ol,isReadableStream:Jp,isRequest:Kp,isResponse:Yp,isHeaders:Qp,isUndefined:Bo,isDate:$p,isFile:qp,isBlob:Zp,isRegExp:pf,isFunction:Ki,isStream:Hp,isURLSearchParams:Wp,isTypedArray:lf,isFileList:Gp,forEach:Fo,merge:vc,extend:tf,trim:ef,stripBOM:rf,inherits:nf,toFlatObject:sf,kindOf:rl,kindOfTest:Tr,endsWith:of,toArray:af,forEachEntry:cf,matchAll:hf,isHTMLForm:uf,hasOwnProperty:Qh,hasOwnProp:Qh,reduceDescriptors:eu,freezeMethods:ff,toObjectSet:mf,toCamelCase:df,noop:gf,toFiniteNumber:_f,findKey:Kh,global:es,isContextDefined:Yh,ALPHABET:iu,generateString:yf,isSpecCompliantForm:xf,toJSONObject:vf,isAsyncFn:bf,isThenable:wf,setImmediate:ru,asap:Sf};function lt(g,S,A,E,V){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=g,this.name="AxiosError",S&&(this.code=S),A&&(this.config=A),E&&(this.request=E),V&&(this.response=V)}fe.inherits(lt,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:fe.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const nu=lt.prototype,su={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(g=>{su[g]={value:g}}),Object.defineProperties(lt,su),Object.defineProperty(nu,"isAxiosError",{value:!0}),lt.from=(g,S,A,E,V,W)=>{const T=Object.create(nu);return fe.toFlatObject(g,T,function(ye){return ye!==Error.prototype},c=>c!=="isAxiosError"),lt.call(T,g.message,S,A,E,V),T.cause=g,T.name=g.name,W&&Object.assign(T,W),T};const Tf=null;function wc(g){return fe.isPlainObject(g)||fe.isArray(g)}function ou(g){return fe.endsWith(g,"[]")?g.slice(0,-2):g}function au(g,S,A){return g?g.concat(S).map(function(V,W){return V=ou(V),!A&&W?"["+V+"]":V}).join(A?".":""):S}function If(g){return fe.isArray(g)&&!g.some(wc)}const Pf=fe.toFlatObject(fe,{},null,function(S){return/^is[A-Z]/.test(S)});function al(g,S,A){if(!fe.isObject(g))throw new TypeError("target must be an object");S=S||new FormData,A=fe.toFlatObject(A,{metaTokens:!0,dots:!1,indexes:!1},!1,function(tt,Ue){return!fe.isUndefined(Ue[tt])});const E=A.metaTokens,V=A.visitor||be,W=A.dots,T=A.indexes,ye=(A.Blob||typeof Blob<"u"&&Blob)&&fe.isSpecCompliantForm(S);if(!fe.isFunction(V))throw new TypeError("visitor must be a function");function ve(Ze){if(Ze===null)return"";if(fe.isDate(Ze))return Ze.toISOString();if(!ye&&fe.isBlob(Ze))throw new lt("Blob is not supported. Use a Buffer instead.");return fe.isArrayBuffer(Ze)||fe.isTypedArray(Ze)?ye&&typeof Blob=="function"?new Blob([Ze]):Buffer.from(Ze):Ze}function be(Ze,tt,Ue){let dt=Ze;if(Ze&&!Ue&&typeof Ze=="object"){if(fe.endsWith(tt,"{}"))tt=E?tt:tt.slice(0,-2),Ze=JSON.stringify(Ze);else if(fe.isArray(Ze)&&If(Ze)||(fe.isFileList(Ze)||fe.endsWith(tt,"[]"))&&(dt=fe.toArray(Ze)))return tt=ou(tt),dt.forEach(function(Ee,Pt){!(fe.isUndefined(Ee)||Ee===null)&&S.append(T===!0?au([tt],Pt,W):T===null?tt:tt+"[]",ve(Ee))}),!1}return wc(Ze)?!0:(S.append(au(Ue,tt,W),ve(Ze)),!1)}const le=[],ae=Object.assign(Pf,{defaultVisitor:be,convertValue:ve,isVisitable:wc});function gt(Ze,tt){if(!fe.isUndefined(Ze)){if(le.indexOf(Ze)!==-1)throw Error("Circular reference detected in "+tt.join("."));le.push(Ze),fe.forEach(Ze,function(dt,Mt){(!(fe.isUndefined(dt)||dt===null)&&V.call(S,dt,fe.isString(Mt)?Mt.trim():Mt,tt,ae))===!0&>(dt,tt?tt.concat(Mt):[Mt])}),le.pop()}}if(!fe.isObject(g))throw new TypeError("data must be an object");return gt(g),S}function lu(g){const S={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(g).replace(/[!'()~]|%20|%00/g,function(E){return S[E]})}function Sc(g,S){this._pairs=[],g&&al(g,this,S)}const cu=Sc.prototype;cu.append=function(S,A){this._pairs.push([S,A])},cu.toString=function(S){const A=S?function(E){return S.call(this,E,lu)}:lu;return this._pairs.map(function(V){return A(V[0])+"="+A(V[1])},"").join("&")};function kf(g){return encodeURIComponent(g).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function hu(g,S,A){if(!S)return g;const E=A&&A.encode||kf,V=A&&A.serialize;let W;if(V?W=V(S,A):W=fe.isURLSearchParams(S)?S.toString():new Sc(S,A).toString(E),W){const T=g.indexOf("#");T!==-1&&(g=g.slice(0,T)),g+=(g.indexOf("?")===-1?"?":"&")+W}return g}class uu{constructor(){this.handlers=[]}use(S,A,E){return this.handlers.push({fulfilled:S,rejected:A,synchronous:E?E.synchronous:!1,runWhen:E?E.runWhen:null}),this.handlers.length-1}eject(S){this.handlers[S]&&(this.handlers[S]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(S){fe.forEach(this.handlers,function(E){E!==null&&S(E)})}}const du={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Af={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:Sc,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},Tc=typeof window<"u"&&typeof document<"u",Cf=(g=>Tc&&["ReactNative","NativeScript","NS"].indexOf(g)<0)(typeof navigator<"u"&&navigator.product),Ef=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Mf=Tc&&window.location.href||"http://localhost",Ir={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Tc,hasStandardBrowserEnv:Cf,hasStandardBrowserWebWorkerEnv:Ef,origin:Mf},Symbol.toStringTag,{value:"Module"})),...Af};function zf(g,S){return al(g,new Ir.classes.URLSearchParams,Object.assign({visitor:function(A,E,V,W){return Ir.isNode&&fe.isBuffer(A)?(this.append(E,A.toString("base64")),!1):W.defaultVisitor.apply(this,arguments)}},S))}function Df(g){return fe.matchAll(/\w+|\[(\w*)]/g,g).map(S=>S[0]==="[]"?"":S[1]||S[0])}function Lf(g){const S={},A=Object.keys(g);let E;const V=A.length;let W;for(E=0;E<V;E++)W=A[E],S[W]=g[W];return S}function pu(g){function S(A,E,V,W){let T=A[W++];if(T==="__proto__")return!0;const c=Number.isFinite(+T),ye=W>=A.length;return T=!T&&fe.isArray(V)?V.length:T,ye?(fe.hasOwnProp(V,T)?V[T]=[V[T],E]:V[T]=E,!c):((!V[T]||!fe.isObject(V[T]))&&(V[T]=[]),S(A,E,V[T],W)&&fe.isArray(V[T])&&(V[T]=Lf(V[T])),!c)}if(fe.isFormData(g)&&fe.isFunction(g.entries)){const A={};return fe.forEachEntry(g,(E,V)=>{S(Df(E),V,A,0)}),A}return null}function Rf(g,S,A){if(fe.isString(g))try{return(S||JSON.parse)(g),fe.trim(g)}catch(E){if(E.name!=="SyntaxError")throw E}return(A||JSON.stringify)(g)}const Oo={transitional:du,adapter:["xhr","http","fetch"],transformRequest:[function(S,A){const E=A.getContentType()||"",V=E.indexOf("application/json")>-1,W=fe.isObject(S);if(W&&fe.isHTMLForm(S)&&(S=new FormData(S)),fe.isFormData(S))return V?JSON.stringify(pu(S)):S;if(fe.isArrayBuffer(S)||fe.isBuffer(S)||fe.isStream(S)||fe.isFile(S)||fe.isBlob(S)||fe.isReadableStream(S))return S;if(fe.isArrayBufferView(S))return S.buffer;if(fe.isURLSearchParams(S))return A.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),S.toString();let c;if(W){if(E.indexOf("application/x-www-form-urlencoded")>-1)return zf(S,this.formSerializer).toString();if((c=fe.isFileList(S))||E.indexOf("multipart/form-data")>-1){const ye=this.env&&this.env.FormData;return al(c?{"files[]":S}:S,ye&&new ye,this.formSerializer)}}return W||V?(A.setContentType("application/json",!1),Rf(S)):S}],transformResponse:[function(S){const A=this.transitional||Oo.transitional,E=A&&A.forcedJSONParsing,V=this.responseType==="json";if(fe.isResponse(S)||fe.isReadableStream(S))return S;if(S&&fe.isString(S)&&(E&&!this.responseType||V)){const T=!(A&&A.silentJSONParsing)&&V;try{return JSON.parse(S)}catch(c){if(T)throw c.name==="SyntaxError"?lt.from(c,lt.ERR_BAD_RESPONSE,this,null,this.response):c}}return S}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ir.classes.FormData,Blob:Ir.classes.Blob},validateStatus:function(S){return S>=200&&S<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};fe.forEach(["delete","get","head","post","put","patch"],g=>{Oo.headers[g]={}});const Bf=fe.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Ff=g=>{const S={};let A,E,V;return g&&g.split(`
|
581
581
|
`).forEach(function(T){V=T.indexOf(":"),A=T.substring(0,V).trim().toLowerCase(),E=T.substring(V+1).trim(),!(!A||S[A]&&Bf[A])&&(A==="set-cookie"?S[A]?S[A].push(E):S[A]=[E]:S[A]=S[A]?S[A]+", "+E:E)}),S},fu=Symbol("internals");function Vo(g){return g&&String(g).trim().toLowerCase()}function ll(g){return g===!1||g==null?g:fe.isArray(g)?g.map(ll):String(g)}function Of(g){const S=Object.create(null),A=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let E;for(;E=A.exec(g);)S[E[1]]=E[2];return S}const Vf=g=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(g.trim());function Ic(g,S,A,E,V){if(fe.isFunction(E))return E.call(this,S,A);if(V&&(S=A),!!fe.isString(S)){if(fe.isString(E))return S.indexOf(E)!==-1;if(fe.isRegExp(E))return E.test(S)}}function Nf(g){return g.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(S,A,E)=>A.toUpperCase()+E)}function Uf(g,S){const A=fe.toCamelCase(" "+S);["get","set","has"].forEach(E=>{Object.defineProperty(g,E+A,{value:function(V,W,T){return this[E].call(this,S,V,W,T)},configurable:!0})})}class Gi{constructor(S){S&&this.set(S)}set(S,A,E){const V=this;function W(c,ye,ve){const be=Vo(ye);if(!be)throw new Error("header name must be a non-empty string");const le=fe.findKey(V,be);(!le||V[le]===void 0||ve===!0||ve===void 0&&V[le]!==!1)&&(V[le||ye]=ll(c))}const T=(c,ye)=>fe.forEach(c,(ve,be)=>W(ve,be,ye));if(fe.isPlainObject(S)||S instanceof this.constructor)T(S,A);else if(fe.isString(S)&&(S=S.trim())&&!Vf(S))T(Ff(S),A);else if(fe.isHeaders(S))for(const[c,ye]of S.entries())W(ye,c,E);else S!=null&&W(A,S,E);return this}get(S,A){if(S=Vo(S),S){const E=fe.findKey(this,S);if(E){const V=this[E];if(!A)return V;if(A===!0)return Of(V);if(fe.isFunction(A))return A.call(this,V,E);if(fe.isRegExp(A))return A.exec(V);throw new TypeError("parser must be boolean|regexp|function")}}}has(S,A){if(S=Vo(S),S){const E=fe.findKey(this,S);return!!(E&&this[E]!==void 0&&(!A||Ic(this,this[E],E,A)))}return!1}delete(S,A){const E=this;let V=!1;function W(T){if(T=Vo(T),T){const c=fe.findKey(E,T);c&&(!A||Ic(E,E[c],c,A))&&(delete E[c],V=!0)}}return fe.isArray(S)?S.forEach(W):W(S),V}clear(S){const A=Object.keys(this);let E=A.length,V=!1;for(;E--;){const W=A[E];(!S||Ic(this,this[W],W,S,!0))&&(delete this[W],V=!0)}return V}normalize(S){const A=this,E={};return fe.forEach(this,(V,W)=>{const T=fe.findKey(E,W);if(T){A[T]=ll(V),delete A[W];return}const c=S?Nf(W):String(W).trim();c!==W&&delete A[W],A[c]=ll(V),E[c]=!0}),this}concat(...S){return this.constructor.concat(this,...S)}toJSON(S){const A=Object.create(null);return fe.forEach(this,(E,V)=>{E!=null&&E!==!1&&(A[V]=S&&fe.isArray(E)?E.join(", "):E)}),A}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([S,A])=>S+": "+A).join(`
|
582
582
|
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(S){return S instanceof this?S:new this(S)}static concat(S,...A){const E=new this(S);return A.forEach(V=>E.set(V)),E}static accessor(S){const E=(this[fu]=this[fu]={accessors:{}}).accessors,V=this.prototype;function W(T){const c=Vo(T);E[c]||(Uf(V,T),E[c]=!0)}return fe.isArray(S)?S.forEach(W):W(S),this}}Gi.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),fe.reduceDescriptors(Gi.prototype,({value:g},S)=>{let A=S[0].toUpperCase()+S.slice(1);return{get:()=>g,set(E){this[A]=E}}}),fe.freezeMethods(Gi);function Pc(g,S){const A=this||Oo,E=S||A,V=Gi.from(E.headers);let W=E.data;return fe.forEach(g,function(c){W=c.call(A,W,V.normalize(),S?S.status:void 0)}),V.normalize(),W}function mu(g){return!!(g&&g.__CANCEL__)}function Vs(g,S,A){lt.call(this,g??"canceled",lt.ERR_CANCELED,S,A),this.name="CanceledError"}fe.inherits(Vs,lt,{__CANCEL__:!0});function gu(g,S,A){const E=A.config.validateStatus;!A.status||!E||E(A.status)?g(A):S(new lt("Request failed with status code "+A.status,[lt.ERR_BAD_REQUEST,lt.ERR_BAD_RESPONSE][Math.floor(A.status/100)-4],A.config,A.request,A))}function jf(g){const S=/^([-+\w]{1,25})(:?\/\/|:)/.exec(g);return S&&S[1]||""}function $f(g,S){g=g||10;const A=new Array(g),E=new Array(g);let V=0,W=0,T;return S=S!==void 0?S:1e3,function(ye){const ve=Date.now(),be=E[W];T||(T=ve),A[V]=ye,E[V]=ve;let le=W,ae=0;for(;le!==V;)ae+=A[le++],le=le%g;if(V=(V+1)%g,V===W&&(W=(W+1)%g),ve-T<S)return;const gt=be&&ve-be;return gt?Math.round(ae*1e3/gt):void 0}}function qf(g,S){let A=0,E=1e3/S,V,W;const T=(ve,be=Date.now())=>{A=be,V=null,W&&(clearTimeout(W),W=null),g.apply(null,ve)};return[(...ve)=>{const be=Date.now(),le=be-A;le>=E?T(ve,be):(V=ve,W||(W=setTimeout(()=>{W=null,T(V)},E-le)))},()=>V&&T(V)]}const cl=(g,S,A=3)=>{let E=0;const V=$f(50,250);return qf(W=>{const T=W.loaded,c=W.lengthComputable?W.total:void 0,ye=T-E,ve=V(ye),be=T<=c;E=T;const le={loaded:T,total:c,progress:c?T/c:void 0,bytes:ye,rate:ve||void 0,estimated:ve&&c&&be?(c-T)/ve:void 0,event:W,lengthComputable:c!=null,[S?"download":"upload"]:!0};g(le)},A)},_u=(g,S)=>{const A=g!=null;return[E=>S[0]({lengthComputable:A,total:g,loaded:E}),S[1]]},yu=g=>(...S)=>fe.asap(()=>g(...S)),Zf=Ir.hasStandardBrowserEnv?function(){const S=/(msie|trident)/i.test(navigator.userAgent),A=document.createElement("a");let E;function V(W){let T=W;return S&&(A.setAttribute("href",T),T=A.href),A.setAttribute("href",T),{href:A.href,protocol:A.protocol?A.protocol.replace(/:$/,""):"",host:A.host,search:A.search?A.search.replace(/^\?/,""):"",hash:A.hash?A.hash.replace(/^#/,""):"",hostname:A.hostname,port:A.port,pathname:A.pathname.charAt(0)==="/"?A.pathname:"/"+A.pathname}}return E=V(window.location.href),function(T){const c=fe.isString(T)?V(T):T;return c.protocol===E.protocol&&c.host===E.host}}():function(){return function(){return!0}}(),Gf=Ir.hasStandardBrowserEnv?{write(g,S,A,E,V,W){const T=[g+"="+encodeURIComponent(S)];fe.isNumber(A)&&T.push("expires="+new Date(A).toGMTString()),fe.isString(E)&&T.push("path="+E),fe.isString(V)&&T.push("domain="+V),W===!0&&T.push("secure"),document.cookie=T.join("; ")},read(g){const S=document.cookie.match(new RegExp("(^|;\\s*)("+g+")=([^;]*)"));return S?decodeURIComponent(S[3]):null},remove(g){this.write(g,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function Hf(g){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(g)}function Xf(g,S){return S?g.replace(/\/?\/$/,"")+"/"+S.replace(/^\/+/,""):g}function xu(g,S){return g&&!Hf(S)?Xf(g,S):S}const vu=g=>g instanceof Gi?{...g}:g;function ts(g,S){S=S||{};const A={};function E(ve,be,le){return fe.isPlainObject(ve)&&fe.isPlainObject(be)?fe.merge.call({caseless:le},ve,be):fe.isPlainObject(be)?fe.merge({},be):fe.isArray(be)?be.slice():be}function V(ve,be,le){if(fe.isUndefined(be)){if(!fe.isUndefined(ve))return E(void 0,ve,le)}else return E(ve,be,le)}function W(ve,be){if(!fe.isUndefined(be))return E(void 0,be)}function T(ve,be){if(fe.isUndefined(be)){if(!fe.isUndefined(ve))return E(void 0,ve)}else return E(void 0,be)}function c(ve,be,le){if(le in S)return E(ve,be);if(le in g)return E(void 0,ve)}const ye={url:W,method:W,data:W,baseURL:T,transformRequest:T,transformResponse:T,paramsSerializer:T,timeout:T,timeoutMessage:T,withCredentials:T,withXSRFToken:T,adapter:T,responseType:T,xsrfCookieName:T,xsrfHeaderName:T,onUploadProgress:T,onDownloadProgress:T,decompress:T,maxContentLength:T,maxBodyLength:T,beforeRedirect:T,transport:T,httpAgent:T,httpsAgent:T,cancelToken:T,socketPath:T,responseEncoding:T,validateStatus:c,headers:(ve,be)=>V(vu(ve),vu(be),!0)};return fe.forEach(Object.keys(Object.assign({},g,S)),function(be){const le=ye[be]||V,ae=le(g[be],S[be],be);fe.isUndefined(ae)&&le!==c||(A[be]=ae)}),A}const bu=g=>{const S=ts({},g);let{data:A,withXSRFToken:E,xsrfHeaderName:V,xsrfCookieName:W,headers:T,auth:c}=S;S.headers=T=Gi.from(T),S.url=hu(xu(S.baseURL,S.url),g.params,g.paramsSerializer),c&&T.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):"")));let ye;if(fe.isFormData(A)){if(Ir.hasStandardBrowserEnv||Ir.hasStandardBrowserWebWorkerEnv)T.setContentType(void 0);else if((ye=T.getContentType())!==!1){const[ve,...be]=ye?ye.split(";").map(le=>le.trim()).filter(Boolean):[];T.setContentType([ve||"multipart/form-data",...be].join("; "))}}if(Ir.hasStandardBrowserEnv&&(E&&fe.isFunction(E)&&(E=E(S)),E||E!==!1&&Zf(S.url))){const ve=V&&W&&Gf.read(W);ve&&T.set(V,ve)}return S},Wf=typeof XMLHttpRequest<"u"&&function(g){return new Promise(function(A,E){const V=bu(g);let W=V.data;const T=Gi.from(V.headers).normalize();let{responseType:c,onUploadProgress:ye,onDownloadProgress:ve}=V,be,le,ae,gt,Ze;function tt(){gt&>(),Ze&&Ze(),V.cancelToken&&V.cancelToken.unsubscribe(be),V.signal&&V.signal.removeEventListener("abort",be)}let Ue=new XMLHttpRequest;Ue.open(V.method.toUpperCase(),V.url,!0),Ue.timeout=V.timeout;function dt(){if(!Ue)return;const Ee=Gi.from("getAllResponseHeaders"in Ue&&Ue.getAllResponseHeaders()),Tt={data:!c||c==="text"||c==="json"?Ue.responseText:Ue.response,status:Ue.status,statusText:Ue.statusText,headers:Ee,config:g,request:Ue};gu(function(jt){A(jt),tt()},function(jt){E(jt),tt()},Tt),Ue=null}"onloadend"in Ue?Ue.onloadend=dt:Ue.onreadystatechange=function(){!Ue||Ue.readyState!==4||Ue.status===0&&!(Ue.responseURL&&Ue.responseURL.indexOf("file:")===0)||setTimeout(dt)},Ue.onabort=function(){Ue&&(E(new lt("Request aborted",lt.ECONNABORTED,g,Ue)),Ue=null)},Ue.onerror=function(){E(new lt("Network Error",lt.ERR_NETWORK,g,Ue)),Ue=null},Ue.ontimeout=function(){let Pt=V.timeout?"timeout of "+V.timeout+"ms exceeded":"timeout exceeded";const Tt=V.transitional||du;V.timeoutErrorMessage&&(Pt=V.timeoutErrorMessage),E(new lt(Pt,Tt.clarifyTimeoutError?lt.ETIMEDOUT:lt.ECONNABORTED,g,Ue)),Ue=null},W===void 0&&T.setContentType(null),"setRequestHeader"in Ue&&fe.forEach(T.toJSON(),function(Pt,Tt){Ue.setRequestHeader(Tt,Pt)}),fe.isUndefined(V.withCredentials)||(Ue.withCredentials=!!V.withCredentials),c&&c!=="json"&&(Ue.responseType=V.responseType),ve&&([ae,Ze]=cl(ve,!0),Ue.addEventListener("progress",ae)),ye&&Ue.upload&&([le,gt]=cl(ye),Ue.upload.addEventListener("progress",le),Ue.upload.addEventListener("loadend",gt)),(V.cancelToken||V.signal)&&(be=Ee=>{Ue&&(E(!Ee||Ee.type?new Vs(null,g,Ue):Ee),Ue.abort(),Ue=null)},V.cancelToken&&V.cancelToken.subscribe(be),V.signal&&(V.signal.aborted?be():V.signal.addEventListener("abort",be)));const Mt=jf(V.url);if(Mt&&Ir.protocols.indexOf(Mt)===-1){E(new lt("Unsupported protocol "+Mt+":",lt.ERR_BAD_REQUEST,g));return}Ue.send(W||null)})},Jf=(g,S)=>{let A=new AbortController,E;const V=function(ye){if(!E){E=!0,T();const ve=ye instanceof Error?ye:this.reason;A.abort(ve instanceof lt?ve:new Vs(ve instanceof Error?ve.message:ve))}};let W=S&&setTimeout(()=>{V(new lt(`timeout ${S} of ms exceeded`,lt.ETIMEDOUT))},S);const T=()=>{g&&(W&&clearTimeout(W),W=null,g.forEach(ye=>{ye&&(ye.removeEventListener?ye.removeEventListener("abort",V):ye.unsubscribe(V))}),g=null)};g.forEach(ye=>ye&&ye.addEventListener&&ye.addEventListener("abort",V));const{signal:c}=A;return c.unsubscribe=T,[c,()=>{W&&clearTimeout(W),W=null}]},Kf=function*(g,S){let A=g.byteLength;if(!S||A<S){yield g;return}let E=0,V;for(;E<A;)V=E+S,yield g.slice(E,V),E=V},Yf=async function*(g,S,A){for await(const E of g)yield*Kf(ArrayBuffer.isView(E)?E:await A(String(E)),S)},wu=(g,S,A,E,V)=>{const W=Yf(g,S,V);let T=0,c,ye=ve=>{c||(c=!0,E&&E(ve))};return new ReadableStream({async pull(ve){try{const{done:be,value:le}=await W.next();if(be){ye(),ve.close();return}let ae=le.byteLength;if(A){let gt=T+=ae;A(gt)}ve.enqueue(new Uint8Array(le))}catch(be){throw ye(be),be}},cancel(ve){return ye(ve),W.return()}},{highWaterMark:2})},hl=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",Su=hl&&typeof ReadableStream=="function",kc=hl&&(typeof TextEncoder=="function"?(g=>S=>g.encode(S))(new TextEncoder):async g=>new Uint8Array(await new Response(g).arrayBuffer())),Tu=(g,...S)=>{try{return!!g(...S)}catch{return!1}},Qf=Su&&Tu(()=>{let g=!1;const S=new Request(Ir.origin,{body:new ReadableStream,method:"POST",get duplex(){return g=!0,"half"}}).headers.has("Content-Type");return g&&!S}),Iu=64*1024,Ac=Su&&Tu(()=>fe.isReadableStream(new Response("").body)),ul={stream:Ac&&(g=>g.body)};hl&&(g=>{["text","arrayBuffer","blob","formData","stream"].forEach(S=>{!ul[S]&&(ul[S]=fe.isFunction(g[S])?A=>A[S]():(A,E)=>{throw new lt(`Response type '${S}' is not supported`,lt.ERR_NOT_SUPPORT,E)})})})(new Response);const em=async g=>{if(g==null)return 0;if(fe.isBlob(g))return g.size;if(fe.isSpecCompliantForm(g))return(await new Request(g).arrayBuffer()).byteLength;if(fe.isArrayBufferView(g)||fe.isArrayBuffer(g))return g.byteLength;if(fe.isURLSearchParams(g)&&(g=g+""),fe.isString(g))return(await kc(g)).byteLength},tm=async(g,S)=>{const A=fe.toFiniteNumber(g.getContentLength());return A??em(S)},Cc={http:Tf,xhr:Wf,fetch:hl&&(async g=>{let{url:S,method:A,data:E,signal:V,cancelToken:W,timeout:T,onDownloadProgress:c,onUploadProgress:ye,responseType:ve,headers:be,withCredentials:le="same-origin",fetchOptions:ae}=bu(g);ve=ve?(ve+"").toLowerCase():"text";let[gt,Ze]=V||W||T?Jf([V,W],T):[],tt,Ue;const dt=()=>{!tt&&setTimeout(()=>{gt&>.unsubscribe()}),tt=!0};let Mt;try{if(ye&&Qf&&A!=="get"&&A!=="head"&&(Mt=await tm(be,E))!==0){let Gt=new Request(S,{method:"POST",body:E,duplex:"half"}),jt;if(fe.isFormData(E)&&(jt=Gt.headers.get("content-type"))&&be.setContentType(jt),Gt.body){const[Vr,bi]=_u(Mt,cl(yu(ye)));E=wu(Gt.body,Iu,Vr,bi,kc)}}fe.isString(le)||(le=le?"include":"omit"),Ue=new Request(S,{...ae,signal:gt,method:A.toUpperCase(),headers:be.normalize().toJSON(),body:E,duplex:"half",credentials:le});let Ee=await fetch(Ue);const Pt=Ac&&(ve==="stream"||ve==="response");if(Ac&&(c||Pt)){const Gt={};["status","statusText","headers"].forEach(Nr=>{Gt[Nr]=Ee[Nr]});const jt=fe.toFiniteNumber(Ee.headers.get("content-length")),[Vr,bi]=c&&_u(jt,cl(yu(c),!0))||[];Ee=new Response(wu(Ee.body,Iu,Vr,()=>{bi&&bi(),Pt&&dt()},kc),Gt)}ve=ve||"text";let Tt=await ul[fe.findKey(ul,ve)||"text"](Ee,g);return!Pt&&dt(),Ze&&Ze(),await new Promise((Gt,jt)=>{gu(Gt,jt,{data:Tt,headers:Gi.from(Ee.headers),status:Ee.status,statusText:Ee.statusText,config:g,request:Ue})})}catch(Ee){throw dt(),Ee&&Ee.name==="TypeError"&&/fetch/i.test(Ee.message)?Object.assign(new lt("Network Error",lt.ERR_NETWORK,g,Ue),{cause:Ee.cause||Ee}):lt.from(Ee,Ee&&Ee.code,g,Ue)}})};fe.forEach(Cc,(g,S)=>{if(g){try{Object.defineProperty(g,"name",{value:S})}catch{}Object.defineProperty(g,"adapterName",{value:S})}});const Pu=g=>`- ${g}`,im=g=>fe.isFunction(g)||g===null||g===!1,ku={getAdapter:g=>{g=fe.isArray(g)?g:[g];const{length:S}=g;let A,E;const V={};for(let W=0;W<S;W++){A=g[W];let T;if(E=A,!im(A)&&(E=Cc[(T=String(A)).toLowerCase()],E===void 0))throw new lt(`Unknown adapter '${T}'`);if(E)break;V[T||"#"+W]=E}if(!E){const W=Object.entries(V).map(([c,ye])=>`adapter ${c} `+(ye===!1?"is not supported by the environment":"is not available in the build"));let T=S?W.length>1?`since :
|
583
583
|
`+W.map(Pu).join(`
|
584
584
|
`):" "+Pu(W[0]):"as no adapter specified";throw new lt("There is no suitable adapter to dispatch the request "+T,"ERR_NOT_SUPPORT")}return E},adapters:Cc};function Ec(g){if(g.cancelToken&&g.cancelToken.throwIfRequested(),g.signal&&g.signal.aborted)throw new Vs(null,g)}function Au(g){return Ec(g),g.headers=Gi.from(g.headers),g.data=Pc.call(g,g.transformRequest),["post","put","patch"].indexOf(g.method)!==-1&&g.headers.setContentType("application/x-www-form-urlencoded",!1),ku.getAdapter(g.adapter||Oo.adapter)(g).then(function(E){return Ec(g),E.data=Pc.call(g,g.transformResponse,E),E.headers=Gi.from(E.headers),E},function(E){return mu(E)||(Ec(g),E&&E.response&&(E.response.data=Pc.call(g,g.transformResponse,E.response),E.response.headers=Gi.from(E.response.headers))),Promise.reject(E)})}const Cu="1.7.4",Mc={};["object","boolean","number","function","string","symbol"].forEach((g,S)=>{Mc[g]=function(E){return typeof E===g||"a"+(S<1?"n ":" ")+g}});const Eu={};Mc.transitional=function(S,A,E){function V(W,T){return"[Axios v"+Cu+"] Transitional option '"+W+"'"+T+(E?". "+E:"")}return(W,T,c)=>{if(S===!1)throw new lt(V(T," has been removed"+(A?" in "+A:"")),lt.ERR_DEPRECATED);return A&&!Eu[T]&&(Eu[T]=!0,console.warn(V(T," has been deprecated since v"+A+" and will be removed in the near future"))),S?S(W,T,c):!0}};function rm(g,S,A){if(typeof g!="object")throw new lt("options must be an object",lt.ERR_BAD_OPTION_VALUE);const E=Object.keys(g);let V=E.length;for(;V-- >0;){const W=E[V],T=S[W];if(T){const c=g[W],ye=c===void 0||T(c,W,g);if(ye!==!0)throw new lt("option "+W+" must be "+ye,lt.ERR_BAD_OPTION_VALUE);continue}if(A!==!0)throw new lt("Unknown option "+W,lt.ERR_BAD_OPTION)}}const zc={assertOptions:rm,validators:Mc},Pn=zc.validators;class is{constructor(S){this.defaults=S,this.interceptors={request:new uu,response:new uu}}async request(S,A){try{return await this._request(S,A)}catch(E){if(E instanceof Error){let V;Error.captureStackTrace?Error.captureStackTrace(V={}):V=new Error;const W=V.stack?V.stack.replace(/^.+\n/,""):"";try{E.stack?W&&!String(E.stack).endsWith(W.replace(/^.+\n.+\n/,""))&&(E.stack+=`
|
585
|
-
`+W):E.stack=W}catch{}}throw E}}_request(S,A){typeof S=="string"?(A=A||{},A.url=S):A=S||{},A=ts(this.defaults,A);const{transitional:E,paramsSerializer:V,headers:W}=A;E!==void 0&&zc.assertOptions(E,{silentJSONParsing:Pn.transitional(Pn.boolean),forcedJSONParsing:Pn.transitional(Pn.boolean),clarifyTimeoutError:Pn.transitional(Pn.boolean)},!1),V!=null&&(fe.isFunction(V)?A.paramsSerializer={serialize:V}:zc.assertOptions(V,{encode:Pn.function,serialize:Pn.function},!0)),A.method=(A.method||this.defaults.method||"get").toLowerCase();let T=W&&fe.merge(W.common,W[A.method]);W&&fe.forEach(["delete","get","head","post","put","patch","common"],Ze=>{delete W[Ze]}),A.headers=Gi.concat(T,W);const c=[];let ye=!0;this.interceptors.request.forEach(function(tt){typeof tt.runWhen=="function"&&tt.runWhen(A)===!1||(ye=ye&&tt.synchronous,c.unshift(tt.fulfilled,tt.rejected))});const ve=[];this.interceptors.response.forEach(function(tt){ve.push(tt.fulfilled,tt.rejected)});let be,le=0,ae;if(!ye){const Ze=[Au.bind(this),void 0];for(Ze.unshift.apply(Ze,c),Ze.push.apply(Ze,ve),ae=Ze.length,be=Promise.resolve(A);le<ae;)be=be.then(Ze[le++],Ze[le++]);return be}ae=c.length;let gt=A;for(le=0;le<ae;){const Ze=c[le++],tt=c[le++];try{gt=Ze(gt)}catch(Ue){tt.call(this,Ue);break}}try{be=Au.call(this,gt)}catch(Ze){return Promise.reject(Ze)}for(le=0,ae=ve.length;le<ae;)be=be.then(ve[le++],ve[le++]);return be}getUri(S){S=ts(this.defaults,S);const A=xu(S.baseURL,S.url);return hu(A,S.params,S.paramsSerializer)}}fe.forEach(["delete","get","head","options"],function(S){is.prototype[S]=function(A,E){return this.request(ts(E||{},{method:S,url:A,data:(E||{}).data}))}}),fe.forEach(["post","put","patch"],function(S){function A(E){return function(W,T,c){return this.request(ts(c||{},{method:S,headers:E?{"Content-Type":"multipart/form-data"}:{},url:W,data:T}))}}is.prototype[S]=A(),is.prototype[S+"Form"]=A(!0)});class Dc{constructor(S){if(typeof S!="function")throw new TypeError("executor must be a function.");let A;this.promise=new Promise(function(W){A=W});const E=this;this.promise.then(V=>{if(!E._listeners)return;let W=E._listeners.length;for(;W-- >0;)E._listeners[W](V);E._listeners=null}),this.promise.then=V=>{let W;const T=new Promise(c=>{E.subscribe(c),W=c}).then(V);return T.cancel=function(){E.unsubscribe(W)},T},S(function(W,T,c){E.reason||(E.reason=new Vs(W,T,c),A(E.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(S){if(this.reason){S(this.reason);return}this._listeners?this._listeners.push(S):this._listeners=[S]}unsubscribe(S){if(!this._listeners)return;const A=this._listeners.indexOf(S);A!==-1&&this._listeners.splice(A,1)}static source(){let S;return{token:new Dc(function(V){S=V}),cancel:S}}}function nm(g){return function(A){return g.apply(null,A)}}function sm(g){return fe.isObject(g)&&g.isAxiosError===!0}const Lc={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Lc).forEach(([g,S])=>{Lc[S]=g});function Mu(g){const S=new is(g),A=Xh(is.prototype.request,S);return fe.extend(A,is.prototype,S,{allOwnKeys:!0}),fe.extend(A,S,null,{allOwnKeys:!0}),A.create=function(V){return Mu(ts(g,V))},A}const Ut=Mu(Oo);Ut.Axios=is,Ut.CanceledError=Vs,Ut.CancelToken=Dc,Ut.isCancel=mu,Ut.VERSION=Cu,Ut.toFormData=al,Ut.AxiosError=lt,Ut.Cancel=Ut.CanceledError,Ut.all=function(S){return Promise.all(S)},Ut.spread=nm,Ut.isAxiosError=sm,Ut.mergeConfig=ts,Ut.AxiosHeaders=Gi,Ut.formToJSON=g=>pu(fe.isHTMLForm(g)?new FormData(g):g),Ut.getAdapter=ku.getAdapter,Ut.HttpStatusCode=Lc,Ut.default=Ut;const Rc=(g,S=300)=>{let A;return function(...V){clearTimeout(A),A=setTimeout(()=>{g.apply(this,V)},S)}};function dl(g,S,A={}){const E={type:"Feature"};return(A.id===0||A.id)&&(E.id=A.id),A.bbox&&(E.bbox=A.bbox),E.properties=S||{},E.geometry=g,E}function om(g,S,A={}){if(!g)throw new Error("coordinates is required");if(!Array.isArray(g))throw new Error("coordinates must be an Array");if(g.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Ru(g[0])||!Ru(g[1]))throw new Error("coordinates must contain numbers");return dl({type:"Point",coordinates:g},S,A)}function zu(g,S,A={}){for(const V of g){if(V.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(V[V.length-1].length!==V[0].length)throw new Error("First and last Position are not equivalent.");for(let W=0;W<V[V.length-1].length;W++)if(V[V.length-1][W]!==V[0][W])throw new Error("First and last Position are not equivalent.")}return dl({type:"Polygon",coordinates:g},S,A)}function Du(g,S,A={}){return dl({type:"MultiPoint",coordinates:g},S,A)}function Lu(g,S,A={}){return dl({type:"MultiPolygon",coordinates:g},S,A)}function Ru(g){return!isNaN(g)&&g!==null&&!Array.isArray(g)}function Bu(g,S,A){if(g!==null)for(var E,V,W,T,c,ye,ve,be=0,le=0,ae,gt=g.type,Ze=gt==="FeatureCollection",tt=gt==="Feature",Ue=Ze?g.features.length:1,dt=0;dt<Ue;dt++){ve=Ze?g.features[dt].geometry:tt?g.geometry:g,ae=ve?ve.type==="GeometryCollection":!1,c=ae?ve.geometries.length:1;for(var Mt=0;Mt<c;Mt++){var Ee=0,Pt=0;if(T=ae?ve.geometries[Mt]:ve,T!==null){ye=T.coordinates;var Tt=T.type;switch(be=0,Tt){case null:break;case"Point":if(S(ye,le,dt,Ee,Pt)===!1)return!1;le++,Ee++;break;case"LineString":case"MultiPoint":for(E=0;E<ye.length;E++){if(S(ye[E],le,dt,Ee,Pt)===!1)return!1;le++,Tt==="MultiPoint"&&Ee++}Tt==="LineString"&&Ee++;break;case"Polygon":case"MultiLineString":for(E=0;E<ye.length;E++){for(V=0;V<ye[E].length-be;V++){if(S(ye[E][V],le,dt,Ee,Pt)===!1)return!1;le++}Tt==="MultiLineString"&&Ee++,Tt==="Polygon"&&Pt++}Tt==="Polygon"&&Ee++;break;case"MultiPolygon":for(E=0;E<ye.length;E++){for(Pt=0,V=0;V<ye[E].length;V++){for(W=0;W<ye[E][V].length-be;W++){if(S(ye[E][V][W],le,dt,Ee,Pt)===!1)return!1;le++}Pt++}Ee++}break;case"GeometryCollection":for(E=0;E<T.geometries.length;E++)if(Bu(T.geometries[E],S)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function Fu(g,S={}){if(g.bbox!=null&&S.recompute!==!0)return g.bbox;const A=[1/0,1/0,-1/0,-1/0];return Bu(g,E=>{A[0]>E[0]&&(A[0]=E[0]),A[1]>E[1]&&(A[1]=E[1]),A[2]<E[0]&&(A[2]=E[0]),A[3]<E[1]&&(A[3]=E[1])}),A}function Ou(g,S={}){const A=Fu(g),E=(A[0]+A[2])/2,V=(A[1]+A[3])/2;return om([E,V],S.properties,S)}const am={mixins:[yc],props:{map:{type:Object},baseLayers:{type:Array,default:[{id:"orto10",name:"Ortophoto 1:10К",url:"https://data.gki.com.ua/api-user/rtile/orto10/ua/{z}/{x}/{y}.png",service:"TMS",category:"Національна інфраструктура геопросторових даних",scale:1e4,year:2020,bounds:"ua",maxzoom:18,owner:"НДІГК (Інститут геодезії та картографії)",image:"https://data.gki.com.ua/api-user/rtile/orto10/ua/13/4954/2876.png",basemap:!0},{id:"graymap",name:"Сіра карта",url:"https://basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png",service:"TMS",category:"Базові карти",attribution:"© <a href='http://www.openstreetmap.org/copyright'>OpenStreetMap</a>, © <a href='https://carto.com/attributions'>CARTO</a>",bounds1:"ua",image:"https://basemaps.cartocdn.com/light_all/10/601/348.png",position:0,owner:"OSM",basemap:!0},{id:"darkmap_carto",name:"Темна карта України",image:"https://basemaps.cartocdn.com/dark_all/13/4791/2762.png?ver=2023-04-14",url:"https://basemaps.cartocdn.com/dark_all/{z}/{x}/{y}.png",service:"TMS",category:"Базові карти",active:!1}]}},data(){return{selectedLayer:null}},watch:{map(g){g&&g.on("load",this.handleMapLoad)}},methods:{handleMapLoad(){var g;this.baseLayers.forEach(S=>{this.layerList.push(S)}),this.toggleLayerVisibility((g=this.baseLayers[0])==null?void 0:g.id)},toggleLayerVisibility(g){this.selectedLayer=g,this.changeBaseLayer(this.selectedLayer)}}},lm={class:"vs-map-slot-layers"},cm=["onClick"],hm=["src"];function um(g,S,A,E,V,W){return K.openBlock(),K.createElementBlock("div",lm,[(K.openBlock(!0),K.createElementBlock(K.Fragment,null,K.renderList(A.baseLayers,(T,c)=>(K.openBlock(),K.createElementBlock("div",{key:T.id,class:K.normalizeClass(["vs-map-slot-layers__layer relative",{focused:T.id==V.selectedLayer}]),onClick:ye=>W.toggleLayerVisibility(T.id)},[K.createElementVNode("img",{src:T.image,class:"vs-map-slot-layers__image"},null,8,hm),K.createElementVNode("div",{class:K.normalizeClass(["absolute py-2 px-4 text-sm text-stone-800 bg-white shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-lg top-[-46px] text-nowrap p-2 hidden whitespace-nowrap",[c===0?"left-[-10px]":"left-[50%] translate-x-[-50%] "]])},K.toDisplayString(T==null?void 0:T.name),3)],10,cm))),128))])}const dm=Or(am,[["render",um],["__scopeId","data-v-d4fbd7d5"]]),pm={props:["colors","title"],methods:{capitalizeFirstLetter(g){return g?g.charAt(0).toUpperCase()+g.slice(1):""}}},fm={class:"absolute left-[20px] bottom-[74px] bg-white max-w-[250px] p-[10px] rounded-lg"},mm={key:0,class:"mb-[10px] text-[1rem]"},gm={class:"legend-item"},_m={key:0,class:"flex justify-start items-center gap-2"},ym={class:"ml-1 text-[0.875rem]"};function xm(g,S,A,E,V,W){return K.openBlock(),K.createElementBlock("div",fm,[A.title?(K.openBlock(),K.createElementBlock("div",mm,K.toDisplayString(A.title),1)):K.createCommentVNode("",!0),(K.openBlock(!0),K.createElementBlock(K.Fragment,null,K.renderList(A.colors,T=>(K.openBlock(),K.createElementBlock("div",gm,[T.id>0?(K.openBlock(),K.createElementBlock("div",_m,[K.createElementVNode("div",{class:"w-[15px] h-[15px] rounded-[50%] min-w-[15px]",style:K.normalizeStyle({backgroundColor:T.color})},null,4),K.createElementVNode("div",ym,K.toDisplayString(W.capitalizeFirstLetter(T.text)),1)])):K.createCommentVNode("",!0)]))),256))])}const vm={components:{MapSlotLayers:dm,MapLegend:Or(pm,[["render",xm]])},props:{colorAttr:null,defaultColor:{type:String,default:"blue"},legendname:{type:String,default:()=>""},height:{type:String,default:()=>"100vh"},width:{type:String,default:"100vw"},center:{type:Array,default:[32,49]},maxBounds:{type:Array,default:[[22,44],[40,52]]},table:{type:String,default:""},zoom:{type:[String,Number],default:13},basemap:Array,filtersParam:{type:String,default:""},row:{type:Object,default:{}},pointZoom:{type:String,default:"12"},legend:{type:Boolean,default:()=>!0}},mixins:[yc],data(){return{map:null,hoverObject:null,popup:null,colors:[]}},async mounted(){var g,S,A,E,V;if(await this.createMap(),(g=this.row)!=null&&g.geom){const{type:W,coordinates:T}=this.row.geom;let c;switch(W){case"Polygon":c=zu(T);break;case"MultiPolygon":c=Lu(T);break;case"MultiPoint":c=Du(T);break;default:(S=this.map)==null||S.fitBounds([T,T],{maxZoom:15,padding:30}),this.isSelectObj=!0;return}const ye=Ou(c).geometry.coordinates;(A=this.map)==null||A.fitBounds([ye,ye],{maxZoom:this.zoom,padding:30})}this.center?(E=this.map)==null||E.fitBounds(this.center,{maxZoom:this.zoom,padding:30}):(V=this.map)==null||V.fitBounds(this.maxBounds)},watch:{filtersParam(g){this.setFilter(this.table,g)}},methods:{async getColorStyle(){var g=[["#69D2E7","#A7DBD8","#E0E4CC","#F38630","#FA6900"],["#FE4365","#FC9D9A","#F9CDAD","#C8C8A9","#83AF9B"],["#ECD078","#D95B43","#C02942","#542437","#53777A"]];if(!this.colorAttr)return this.defaultColor;try{const{data:{rows:S}}=await Ut.get(`/api/data/${this.table}/${this.colorAttr}`),A=S.reduce((E,V,W)=>V!=null&&V.id?[...E,V.id.toString(),V.color||g[0][W%5]]:E,["match",["get",this.colorAttr]]);return this.colors=[...S],A.push("gray"),A}catch(S){console.log(S)}},async handleMapLoad(){var A,E;const g=await this.getColorStyle(),S=((E=(A=location.search.split("&").find(V=>V.includes("filter=")))==null?void 0:A.split("filter="))==null?void 0:E[1])||"";await this.addLayer({id:this.table,service:"vector",url:`/api/vtile/${this.table}/ua/{z}/{x}/{y}.vmt?pointZoom=${this.pointZoom}&dt=${new Date().toISOString()}&filter=${S}`,layers:[{type:"fill","source-layer":this.table,paint:{"fill-color":g,"fill-opacity":.3,"fill-outline-color":["case",["==",["feature-state","hover"],!0],"red","#000000"]},filter:["all",["==",["geometry-type"],"Polygon"]]},{type:"circle","source-layer":this.table,filter:["all",["==",["geometry-type"],"Point"]],paint:{"circle-radius":{base:1.75,stops:[[10,5],[12,6],[18,12]]},"circle-stroke-color":["case",["==",["feature-state","hover"],!0],"red","#ccc"],"circle-stroke-width":["case",["==",["feature-state","hover"],!0],2,1],"circle-color":g}}]})},async createMap(){const g={version:8,glyphs:"https://cdn.softpro.ua/data/fonts/{fontstack}/{range}.pbf",sources:{},layers:[]};this.map=await new il.Map({container:"maplibre-map",style:g,zoom:10,center:this.center,maxBounds:this.maxBounds}),this.$parent.map=this.map,this.map.addControl(new il.NavigationControl({visualizePitch:!0})),this.map.on("load",this.handleMapLoad)}}},bm={class:"vs-map-portal relative"};function wm(g,S,A,E,V,W){const T=K.resolveComponent("MapLegend"),c=K.resolveComponent("MapSlotLayers");return K.openBlock(),K.createElementBlock("div",bm,[K.createElementVNode("div",{id:"maplibre-map",ref:"maplibreMap",class:"w-full",style:K.normalizeStyle({height:A.height})},null,4),K.withDirectives(K.createVNode(T,{colors:V.colors,title:A.legendname},null,8,["colors","title"]),[[K.vShow,A.legend]]),K.createVNode(c,{map:V.map,baseLayers:A.basemap},null,8,["map","baseLayers"])])}const Sm=Or(vm,[["render",wm]]),Tm={},Im={class:"flex-shrink-0 size-3.5",xmlns:"http://www.w3.org/2000/svg",width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},Pm=[K.createStaticVNode('<line x1="21" x2="14" y1="4" y2="4"></line><line x1="10" x2="3" y1="4" y2="4"></line><line x1="21" x2="12" y1="12" y2="12"></line><line x1="8" x2="3" y1="12" y2="12"></line><line x1="21" x2="16" y1="20" y2="20"></line><line x1="12" x2="3" y1="20" y2="20"></line><line x1="14" x2="14" y1="2" y2="6"></line><line x1="8" x2="8" y1="10" y2="14"></line><line x1="16" x2="16" y1="18" y2="22"></line>',9)];function km(g,S){return K.openBlock(),K.createElementBlock("svg",Im,Pm)}const Am=Or(Tm,[["render",km]]),Cm={},Em={xmlns:"http://www.w3.org/2000/svg",width:"21",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-layout-sidebar-right-collapse"},Mm=[K.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),K.createElementVNode("path",{d:"M4 4m0 2a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2z"},null,-1),K.createElementVNode("path",{d:"M15 4v16"},null,-1),K.createElementVNode("path",{d:"M9 10l2 2l-2 2"},null,-1)];function zm(g,S){return K.openBlock(),K.createElementBlock("svg",Em,Mm)}const Dm=Or(Cm,[["render",zm]]),Lm={},Rm={xmlns:"http://www.w3.org/2000/svg",width:"21",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-layout-sidebar-right-expand"},Bm=[K.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),K.createElementVNode("path",{d:"M4 4m0 2a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2z"},null,-1),K.createElementVNode("path",{d:"M15 4v16"},null,-1),K.createElementVNode("path",{d:"M10 10l-2 2l2 2"},null,-1)];function Fm(g,S){return K.openBlock(),K.createElementBlock("svg",Rm,Bm)}const Om=Or(Lm,[["render",Fm]]),Vm={},Nm={class:"shrink-0 size-3",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},Um=[K.createElementVNode("path",{d:"M18 6 6 18"},null,-1),K.createElementVNode("path",{d:"m6 6 12 12"},null,-1)];function jm(g,S){return K.openBlock(),K.createElementBlock("svg",Nm,Um)}const $m=Or(Vm,[["render",jm]]),qm={props:{visible:{type:Boolean,default:()=>!1},title:{type:String,default:()=>""},size:{type:String,default:()=>""}},emits:["update:visible","onClose"],name:"vs-dialog",mounted(){window.addEventListener("keydown",this.checkKey)},unmounted(){window.removeEventListener("keydown",this.checkKey)},computed:{hasSlot(){var g;return!!((g=this.$slots)!=null&&g.footer)},checkSize(){return this.size==="small"?"w-5/12":this.size==="medium"?"w-6/12":"lg:w-7/12 w-11/12"}},methods:{checkKey({key:g}){g==="Escape"&&this.handleClose()},handleClose(){this.$emit("update:visible",!1),this.$emit("onClose")}}},Vu=g=>(K.pushScopeId("data-v-37405773"),g=g(),K.popScopeId(),g),Zm={class:"vsTailwind ui-dialog__wrapper"},Gm={class:"w-full h-full fixed top-0 start-0 z-[80] bg-black bg-opacity-50"},Hm={class:"py-2.5 px-4 flex justify-between items-center border-b"},Xm={class:"font-medium text-gray-800"},Wm=[Vu(()=>K.createElementVNode("span",{class:"sr-only"},"Close",-1)),Vu(()=>K.createElementVNode("svg",{class:"flex-shrink-0 w-4 h-4",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[K.createElementVNode("path",{d:"M18 6 6 18"}),K.createElementVNode("path",{d:"m6 6 12 12"})],-1))],Jm={class:"ui-dialog__content p-4"},Km={key:0,class:"flex justify-end gap-x-2"};function Ym(g,S,A,E,V,W){return K.openBlock(),K.createBlock(K.Teleport,{to:"#modal"},[K.createVNode(K.Transition,{name:"fade"},{default:K.withCtx(()=>[K.withDirectives(K.createElementVNode("div",Zm,[K.createElementVNode("div",Gm,[K.createVNode(K.Transition,{name:"content",appear:""},{default:K.withCtx(()=>[K.createElementVNode("div",{class:K.normalizeClass(["ui-dialog__modal opacity-1 transition-all flex flex-col bg-white border pointer-events-auto shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-xl",[W.checkSize]])},[K.createElementVNode("div",Hm,[K.createElementVNode("h3",Xm,K.toDisplayString(A.title),1),K.createElementVNode("button",{type:"button",class:"size-8 inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent bg-gray-100 text-gray-800 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:hover:bg-neutral-600 dark:text-neutral-400 dark:focus:bg-neutral-600",onClick:S[0]||(S[0]=(...T)=>W.handleClose&&W.handleClose(...T))},Wm)]),K.createElementVNode("div",Jm,[K.renderSlot(g.$slots,"default",{},void 0,!0)]),W.hasSlot?(K.openBlock(),K.createElementBlock("div",Km,[K.renderSlot(g.$slots,"footer",{},void 0,!0)])):K.createCommentVNode("",!0)],2)]),_:3})])],512),[[K.vShow,A.visible]])]),_:3})])}const Qm=Or(qm,[["render",Ym],["__scopeId","data-v-37405773"]]),eg=K.defineComponent({props:{title:{type:String,default:()=>""},table:{type:String,default:()=>""},rows:{type:Object,default:()=>null},initTotal:{type:[Number,String],default:()=>""},colorAttr:{type:String,default:()=>""},legendname:{type:String,default:()=>""},center:{type:Array,default:()=>[]},maxBounds:{type:Array,default:()=>[[22,44.4],[40,52.5]]},id:{type:String,default:()=>""},isAutocomplete:{type:Boolean,default:()=>!1},isAddressAutocomplete:{type:Boolean,default:()=>!1},zoom:{type:[Number,String],default:()=>"13"},maskForSearch:{type:String,default:()=>null},searchShow:{type:Boolean,default:()=>!0},basemap:{type:Array},pointZoom:{type:String,default:()=>"12"},legend:{type:Boolean,default:()=>!0},defaultColor:{type:String,default:()=>"blue"}},mixins:[yc],components:{MapPortal:Sm,NoData:Fp,FilterIcon:Am,VisibleMapIcon:Dm,HiddenMapIcon:Om,CloseIcon:$m,VsDialog:Qm},data(){return{filters:"",search:"",limit:20,polyline:null,filtersParam:"",isSelectObj:!1,selectedId:"",searchRegion:"",searchAddress:"",marker:null,handleSearchRegionDebounced:Rc(g=>this.updateSearchRegionValue(g),500),handleSearchAddressDebounced:Rc(g=>this.updateSearchAddressValue(g),500),searchRegionResult:[],searchAddressResult:[],selectedRow:null,activeFilters:"",isMapVisible:!0,tabsIsVisible:!1,filterUrl:"",currentPage:1,regionOptionGeneral:null,isFilterVisible:!1,tableData:null,hoverData:null,atuData:[],map:null,legendName:null,total:null,filtered:null,filterValues:"",activeFiltersCount:"",visibleTrue:!0,regionSelectValue:null,addressSelectValue:null,currentBbox:null,mountedFilter:{},optionRowsCount:[{value:10,label:"10"},{value:20,label:"20"},{value:30,label:"30"}],handleDebouncedUpdateValue:Rc(g=>{this.handleSearchValue(g)},10)}},watch:{map(){this.map.on("mousemove",this.handleMapHover),this.map.on("click",this.handleMapClick)},activeFiltersCount(){var g,S;return(S=(g=this.$refs)==null?void 0:g.filter)==null?void 0:S.filteredActiveFiltersLength},activeFilters(){var g,S;return this.isSelectObj&&this.moveToDefaultPage(),(S=(g=this.$refs)==null?void 0:g.filter)==null?void 0:S.activeFilters},isFilterVisible(g){g||this.getData()},async regionSelectValue(g,S){var V,W;if(!this.regionSelectValue){this.map.removeSource("region-search-id");return}g&&this.selectedId&&this.closeObjCard(),this.polyline=this.regionSelectValue.encoded_geom,this.getData();const A=((V=this.regionSelectValue)==null?void 0:V.geom)||Sr.toGeoJSON(this.regionSelectValue.encoded_geom),E=this.map.getSource("region-search-id");if(this.currentBbox=Fu(A),E)E.setData({type:"Feature",geometry:A});else{this.map.addSource("region-search-id",{type:"geojson",data:{type:"Feature",geometry:A}});const T={id:"region-search-id",type:"line",source:"region-search-id",paint:{"line-color":"blue","line-opacity":1}};await this.map.addLayer(T)}this.moveLayer("site.prc.parcel_object.table"),(W=this.map)==null||W.fitBounds(this.currentBbox,{zoom:this.setAtuZoom,padding:20}),this.getData()},async addressSelectValue(g,S){this.addressSelectValue&&(g&&this.selectedId&&this.closeObjCard(),this.getData())}},created(){this.legendName,this.tableData=this.rows,this.total=this.initTotal,this.id&&(this.selectedRow=this.rows[0],this.selectedId=this.id,this.isSelectObj=!0)},mounted(){var A;this.rows||this.getData();const g=(A=window.location.search)==null?void 0:A.split("?filter=")[1],S=g==null?void 0:g.split("|");S==null||S.forEach(E=>{const[V,W]=E.split("=");W!=null&&W.includes(",")?this.mountedFilter[V]=W==null?void 0:W.split(","):this.mountedFilter[V]=W}),this.getFilter()},updated(){this.checkFilterLength()},computed:{setAtuZoom(){var g,S,A;return((g=this.regionSelectValue)==null?void 0:g.id)==="UA80000000000093317"||((S=this.regionSelectValue)==null?void 0:S.id)==="UA85000000000065278"?10:((A=this.regionSelectValue)==null?void 0:A.region)===""?7.5:11}},methods:{async updateSearchRegionValue(g){this.searchRegion=g,await this.getReginOptions()},async updateSearchAddressValue(g){this.searchAddress=g,await this.getAddressOptions()},async getData(){var g,S;try{const A={search:this.search||null,limit:this.limit,page:this.currentPage,polyline:this.polyline};this.filtersParam!==""&&this.filtersParam!=="no-url"?A.filter=this.filtersParam:A.filter=decodeURIComponent(((S=(g=location.search.split("&").find(V=>V.includes("filter=")))==null?void 0:g.split("filter="))==null?void 0:S[1])||""),this.addressSelectValue&&(A.filter+=A.filter?`&address_id=${this.addressSelectValue.id}`:`address_id=${this.addressSelectValue.id}`);const{data:E}=await Ut.get(`/api/data/${this.table}`,{params:A});this.tableData=E==null?void 0:E.rows,this.total=E.total,this.filtered=E.filtered}catch(A){console.error(A.message)}},moveToDefaultPage(){var E;const g=new URLSearchParams(window.location.search);g.delete("id");const A=`${window.location.pathname}?${g.toString()}`;debugger;(E=this.map)==null||E.fitBounds(this.maxBounds,{}),window.history.pushState({},"",A),this.isSelectObj=!1},regionFullName(g){return g.region?`${g.text} / ${g.region}`:g.text},getLabelById(g){const S=this.filters.find(A=>A.id===g);return S?S.label:g},getOptionsLabelById(g,S){if(Array.isArray(S)){const A=this.filters.find(E=>E.id===g);return A!=null&&A.options?A==null?void 0:A.options.filter(E=>S.includes(E.id)).map(E=>E.text).join(", "):S==null?void 0:S.length}else return S},async clearFilter(g){var S,A;(A=(S=this.$refs)==null?void 0:S.filter)==null||A.clearFilter(g),await this.updateTableAndMap(),await this.getData()},async getReginOptions(){if(this.searchRegion===""&&this.regionOptionGeneral)this.searchRegionResult=this.regionOptionGeneral;else try{const{data:g}=await Ut.get(`https://data.softpro.ua/api-user/suggest/atu.codifier.type.polyline.select.region?key=${this.searchRegion}`);this.searchRegionResult=g,this.regionOptionGeneral||(this.regionOptionGeneral=g)}catch(g){console.error(g.message)}},async getAddressOptions(){if(this.searchAddress===""&&this.addressOptionGeneral)this.searchAddressResult=this.addressOptionGeneral;else try{const{data:g}=await Ut.get(`/api/suggest/itree.address_id?key=${this.searchAddress}`);this.searchAddressResult=g,this.addressOptionGeneral||(this.addressOptionGeneral=g)}catch(g){console.error(g.message)}},handlePageChange(g){this.currentPage=g,this.getData()},async getFilter(){try{const{data:g}=await Ut.get(`/api/filter/${this.table}`);this.filters=g.list}catch(g){console.error(g.message)}},async handleSearchValue(g){this.search=g,await this.getData()},closeObjCard(){var E;const g=new URLSearchParams(window.location.search);g.delete("id"),this.deletePulsePoint(),this.deleteHighlighPolygon();const A=`${window.location.pathname}?${g.toString()}`;(E=this.map)==null||E.fitBounds(this.currentBbox||this.maxBounds,{}),window.history.pushState({},"",A),this.isSelectObj=!1,this.getData()},async handleSearchRegionValue(g){var A;const S=this.map.getLayer("region-search-id");this.searchRegion=g,g===""&&S?((A=this.map)==null||A.fitBounds(this.maxBounds,{}),this.currentBbox=null,this.polyline=null,this.map.removeLayer("region-search-id"),this.getData()):g===""&&this.getData()},async handleSearchAddressValue(g){var A;const S=this.map.getLayer("address-search-id");this.searchAddress=g,g===""&&S?((A=this.map)==null||A.fitBounds(this.maxBounds,{}),this.currentBbox=null,this.polyline=null,this.map.removeLayer("address-search-id"),this.getData()):g===""&&this.getData()},handleFilterChange(g){this.currentPage=g.state.page||1,this.filterUrl=g.url.split("|").filter(S=>!S.includes("page=")).join("|")},async updateTableAndMap(){var g,S;this.selectedRow||(this.filtersParam=this.filterUrl,this.activeFilters=(S=(g=this.$refs)==null?void 0:g.filter)==null?void 0:S.activeFilters,this.isFilterVisible=!1,this.getData())},handleFilterSubmit(){var g;this.isSelectObj="",this.selectedId="",this.selectedId=!1,(g=this.map)==null||g.fitBounds(this.maxBounds,{}),this.isFilterVisible=!1},toggleMapVisible(){this.isMapVisible=!this.isMapVisible},checkUrl(){const g=new URLSearchParams(window.location.search);g.has("id")?(this.isSelectObj=!0,this.isMapVisible=!0,this.selectedId=g.get("id")):(this.isSelectObj=!1,this.selectedId="")},changeLimit(g){this.limit=g,this.currentPage=1,this.getData()},filterModalClose(){this.isFilterVisible=!1},resetFilters(){this.$refs.filter&&(this.$refs.filter.clearAll(),this.search="",this.isFilterVisible=!1,this.filtersParam="",this.polyline=null,this.regionSelectValue=null,this.addressSelectValue=null,this.currentBbox=null,this.activeFilters=null,this.tabsIsVisible=!1,this.handleSearchRegionValue(""),this.handleSearchAddressValue(""))},checkFilterLength(){var S,A;const g=(A=(S=this.$refs)==null?void 0:S.filter)==null?void 0:A.filteredActiveFiltersLength;g!==this.previousLength&&(this.previousLength=g,this.activeFiltersCount=g)},async handleMapClick(g){var W,T,c,ye,ve,be,le,ae;const S=this.map.queryRenderedFeatures(g.point);if((S==null?void 0:S.length)<1)return;const A=window.location.pathname,E=new URLSearchParams(window.location.search);E.set("id",`${(W=S[0])==null?void 0:W.properties.id}`),this.getObjectData((c=(T=S[0])==null?void 0:T.properties)==null?void 0:c.id);const V=`${A}?${E.toString()}`;window.history.pushState({},"",V),this.isSelectObj=!0,g.lngLat&&((ae=this.map)==null||ae.fitBounds([[(ye=g.lngLat)==null?void 0:ye.lng,(ve=g.lngLat)==null?void 0:ve.lat],[(be=g.lngLat)==null?void 0:be.lng,(le=g.lngLat)==null?void 0:le.lat]],{maxZoom:this.zoom,padding:30})),this.checkUrl()},async getObjectData(g){var S,A;try{const{data:E}=await Ut.get(`/api/data/${this.table}/${g}`);this.selectRow((S=E==null?void 0:E.rows)==null?void 0:S[0]),((A=E==null?void 0:E.rows)==null?void 0:A.lenght)<1&&this.deletePulsePoint()}catch(E){console.error(E.message)}},async selectRow(g){var T,c,ye;this.isMapVisible=!0;const A=await(await fetch(`/api/data/${this.table}/${g.id}`)).json();this.selectedRow=((T=A==null?void 0:A.rows)==null?void 0:T[0])||g;const E=window.location.pathname,V=new URLSearchParams(window.location.search);V.set("id",`${g.id}`);const W=`${E}?${V.toString()}`;if(window.history.pushState({},"",W),this.checkUrl(),g!=null&&g.geom){const{type:ve,coordinates:be}=g.geom;let le;switch(ve){case"Polygon":le=zu(be);break;case"MultiPolygon":le=Lu(be);break;case"MultiPoint":le=Du(be);break;default:(c=this.map)==null||c.fitBounds([be,be],{maxZoom:15,padding:30}),this.isSelectObj=!0;return}const ae=Ou(le).geometry.coordinates;(ye=this.map)==null||ye.fitBounds([ae,ae],{maxZoom:this.zoom,padding:30})}this.isSelectObj=!0},deletePulsePoint(){this.marker&&this.marker.remove()},addPulsePoint(g){this.deletePulsePoint();const S=document.createElement("div");S.className="gps-marker",S.style.width="10px",S.style.height="10px",S.style.position="relative";const A=document.createElement("div");A.className="gps-wave",S.appendChild(A),this.marker=new il.Marker({element:S,anchor:"center"}).setLngLat(g).addTo(this.map)},deleteHighlighPolygon(){var g,S,A;(g=this.map)!=null&&g.getLayer("highlighted-polygon")&&((S=this.map)==null||S.removeLayer("highlighted-polygon"),(A=this.map)==null||A.removeSource("highlighted-polygon"))},highlightPolygon(g){var S,A,E,V,W,T;this.deletePulsePoint(),this.deleteHighlighPolygon(),(V=this.map)==null||V.addSource("highlighted-polygon",{type:"geojson",data:{geometry:{type:(S=g==null?void 0:g.geom)==null?void 0:S.type,coordinates:(A=g==null?void 0:g.geom)==null?void 0:A.coordinates},type:"Feature",properties:{id:g==null?void 0:g.id,name:g==null?void 0:g.name,category:g==null?void 0:g.id},id:g==null?void 0:g.id,layer:{id:"site.rest_zone.table-0",type:"fill",source:"site.rest_zone.table",sourceLayer:"site.rest_zone.table",filter:["all",["==",["geometry-type"],(E=g==null?void 0:g.geom)==null?void 0:E.type]],paint:{"fill-color":"orange","fill-opacity":.5},layout:{}},source:"site.rest_zone.table",sourceLayer:"site.rest_zone.table",state:{hover:!0},table:"site.rest_zone.table"}}),(W=this.map)==null||W.addLayer({id:"highlighted-polygon",type:"fill",source:"highlighted-polygon",layout:{},minzoom:12,maxzoom:0,paint:{"fill-color":"orange","fill-opacity":.6}}),(T=this.map)==null||T.moveLayer("highlighted-polygon")},async handleMapHover(g){var V,W,T;this.hoverObject&&(this.map.setFeatureState(this.hoverObject,{hover:!1}),this.hoverObject=null),this.popup||(this.popup=new il.Popup({maxWidth:"400px",closeButton:!1,closeOnClick:!1}));const S=this.map.queryRenderedFeatures(g.point);if(this.map.getCanvas().style.cursor="pointer",!(S!=null&&S.length)||((V=S==null?void 0:S[0])==null?void 0:V.source)==="region-search-id"){this.map.getCanvas().style.cursor="",this.popup.remove();return}const A=S[0].geometry.coordinates.slice();S[0].source==="highlighted-polygon"&&S[1]?this.hoverData=(W=S[1])==null?void 0:W.properties:this.hoverData=(T=S[0])==null?void 0:T.properties;const E={source:S[0].source,sourceLayer:S[0].sourceLayer,id:S[0].id};if(E.source!=="region-search-id"){for(this.map.setFeatureState(E,{hover:!0}),this.hoverObject=E;Math.abs(g.lngLat.lng-A[0])>180;)A[0]+=g.lngLat.lng>A[0]?360:-360;this.popup.setLngLat(g.lngLat).setHTML(this.$refs.popup.innerHTML).addTo(this.map)}}}}),tg={class:"ml-3 pt-[20px]"},ig={class:"w-full gap-5 flex justify-between mb-[6px] pr-3"},rg={class:"flex gap-2 pt-[4px]"},ng={class:"inline max-h-[38px] w-[1100px]"},sg={key:0,class:"font-medium text-[10px] min-w-[16px] py-0.5 px-[5px] bg-gray-800 text-white leading-3 rounded-full"},og=["title"],ag=K.createElementVNode("span",{class:"sr-only"},"Відкрити мапу",-1),lg={class:"flex"},cg={class:"py-[15px] pb-[24px] pl-2"},hg={class:"font-bold text-2xl mr-[10px]"},ug={class:"text-sm text-stone-500 font-medium"},dg=K.createElementVNode("span",{class:"text-sm text-stone-500 font-medium"}," об'єктів",-1),pg={class:"wrapperTable flex flex-col",style:{height:"calc(100vh - 302px)"}},fg={key:0,class:"flex gap-x-2 flex-wrap"},mg={class:"font-medium"},gg=K.createElementVNode("span",{class:"h-3 mx-2 border-s border-gray-200"},null,-1),_g={class:"text-gray-500"},yg=["onClick"],xg={key:0,class:"mb-[10px] py-1 ps-3 pe-1 inline-flex items-center bg-white border border-gray-200 text-gray-800 text-xs rounded-full"},vg=K.createElementVNode("span",{class:"font-medium"}," Очистити ",-1),bg={key:2,class:"text-center py-28"},wg=K.createElementVNode("h2",{class:"font-medium text-base text-gray-500 rounded-xl"}," За вашим запитом даних не знайдено! ",-1),Sg=K.createElementVNode("p",{class:"font-normal text-sm text-gray-500 rounded-xl"}," Введіть, будь ласка, інші значення для пошуку. ",-1),Tg={key:0},Ig={key:1,class:"my-5 pr-2"},Pg={class:"flex justify-between"},kg={class:"w-2/4"},Ag={class:"map-section"},Cg={ref:"popup",style:{display:"none"}};function Eg(g,S,A,E,V,W){var Mt;const T=K.resolveComponent("VsAutocompleteOption"),c=K.resolveComponent("vs-autocomplete"),ye=K.resolveComponent("VsTextMask"),ve=K.resolveComponent("vs-text"),be=K.resolveComponent("FilterIcon"),le=K.resolveComponent("VsFilterList"),ae=K.resolveComponent("VisibleMapIcon"),gt=K.resolveComponent("HiddenMapIcon"),Ze=K.resolveComponent("CloseIcon"),tt=K.resolveComponent("NoData"),Ue=K.resolveComponent("VsPagination"),dt=K.resolveComponent("MapPortal");return K.openBlock(),K.createElementBlock("section",tg,[K.createElementVNode("div",null,[K.createElementVNode("div",ig,[K.createElementVNode("div",rg,[g.isAutocomplete?(K.openBlock(),K.createBlock(c,{key:0,modelValue:g.regionSelectValue,"onUpdate:modelValue":[S[0]||(S[0]=Ee=>g.regionSelectValue=Ee),g.handleSearchRegionValue],searchable:"",clearable:"",searchPlaceholder:"Введіть назву громади",placeholder:"Обрати область чи громаду",onOnSearch:g.handleSearchRegionDebounced,onClick:g.getReginOptions,class:"w-[500px]"},{default:K.withCtx(()=>[(K.openBlock(!0),K.createElementBlock(K.Fragment,null,K.renderList(g.searchRegionResult,Ee=>(K.openBlock(),K.createBlock(T,{class:"cursor-pointer dark:hs-selected:bg-neutral-800 py-2 px-4 w-full text-sm text-gray-800 hover:bg-gray-100 rounded-lg focus:outline-none focus:bg-gray-100 dark:text-neutral-300 dark:hover:bg-neutral-800 dark:focus:bg-neutral-800",key:Ee==null?void 0:Ee.id,value:Ee,label:g.regionFullName(Ee)},null,8,["value","label"]))),128))]),_:1},8,["modelValue","onOnSearch","onUpdate:modelValue","onClick"])):K.createCommentVNode("",!0),g.isAddressAutocomplete?(K.openBlock(),K.createBlock(c,{key:1,modelValue:g.addressSelectValue,"onUpdate:modelValue":[S[1]||(S[1]=Ee=>g.addressSelectValue=Ee),g.handleSearchAddressValue],searchable:"",clearable:"",searchPlaceholder:"Введіть адресу",placeholder:"Обрати адресу",onOnSearch:g.handleSearchAddressDebounced,onClick:g.getAddressOptions,class:"w-[350px]"},{default:K.withCtx(()=>[(K.openBlock(!0),K.createElementBlock(K.Fragment,null,K.renderList(g.searchAddressResult,Ee=>(K.openBlock(),K.createBlock(T,{class:"cursor-pointer dark:hs-selected:bg-neutral-800 py-2 px-4 w-full text-sm text-gray-800 hover:bg-gray-100 rounded-lg focus:outline-none focus:bg-gray-100 dark:text-neutral-300 dark:hover:bg-neutral-800 dark:focus:bg-neutral-800",key:Ee==null?void 0:Ee.id,value:Ee,label:Ee.text},null,8,["value","label"]))),128))]),_:1},8,["modelValue","onOnSearch","onUpdate:modelValue","onClick"])):K.createCommentVNode("",!0),g.maskForSearch?(K.openBlock(),K.createBlock(ye,{key:2,"model-value":g.search,"onUpdate:modelValue":g.handleDebouncedUpdateValue,class:"w-full table-interface-search",placeholder:"Пошук",mask:g.maskForSearch,icon:"search",iconPosition:"left",clearable:"",style:{height:"38px","min-width":"300px","max-width":"300px"},ref:"searchInput"},null,8,["model-value","onUpdate:modelValue","mask"])):g.searchShow?(K.openBlock(),K.createBlock(ve,{key:3,"model-value":g.search,"onUpdate:modelValue":g.handleDebouncedUpdateValue,class:"w-full table-interface-search max-w-[300px] h-[38px]",placeholder:"Пошук",icon:"search","icon-position":"left",clearable:"",style:{height:"38px"},ref:"searchInput"},null,8,["model-value","onUpdate:modelValue"])):K.createCommentVNode("",!0),K.createElementVNode("div",ng,[g.filters?(K.openBlock(),K.createBlock(le,{key:0,modelValue:g.mountedFilter,ref:"filter",scheme:g.filters,urlSeparator:"true",history:!0,closeFilterBtn:!0,view:"plain",clearable:!1,name:"filter",onFilterChange:S[2]||(S[2]=Ee=>{g.handleFilterChange(Ee),g.updateTableAndMap()})},{button:K.withCtx(({visible:Ee})=>[K.createElementVNode("button",{type:"button",class:K.normalizeClass(["py-2 px-2.5 h-[40px] inline-flex items-center gap-x-1.5 text-sm font-medium rounded-lg bg-white text-gray-800 hover:bg-gray-50 focus:outline-none focus:bg-gray-50",[Ee?"border border-blue-600 border-2":"border border-gray-200"]])},[K.createVNode(be),K.createTextVNode(" Фільтри "),g.activeFiltersCount>=1?(K.openBlock(),K.createElementBlock("span",sg,K.toDisplayString(g.activeFiltersCount),1)):K.createCommentVNode("",!0)],2)]),_:1},8,["modelValue","scheme"])):K.createCommentVNode("",!0)])]),K.createElementVNode("button",{type:"button",class:"py-2 px-2 inline-flex items-center gap-x-1.5 text-sm rounded-lg border border-gray-200 bg-white text-gray-600 shadow-sm hover:bg-stone-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-100",title:g.isMapVisible?"Приховати карту":"Показати карту",onClick:S[3]||(S[3]=(...Ee)=>g.toggleMapVisible&&g.toggleMapVisible(...Ee))},[g.isMapVisible?(K.openBlock(),K.createBlock(ae,{key:0})):(K.openBlock(),K.createBlock(gt,{key:1})),ag],8,og)]),K.createElementVNode("div",lg,[K.createElementVNode("div",{class:K.normalizeClass(["relative overflow-hidden",g.isMapVisible?"w-2/4 mr-0":"w-full mr-3",g.isSelectObj?"hidden":""])},[K.createElementVNode("h1",cg,[K.createElementVNode("span",hg,K.toDisplayString(g.title),1),K.createElementVNode("span",ug,K.toDisplayString(g.filtered),1),dg]),K.createElementVNode("div",pg,[g.activeFilters?(K.openBlock(),K.createElementBlock("div",fg,[(K.openBlock(!0),K.createElementBlock(K.Fragment,null,K.renderList(g.activeFilters,(Ee,Pt,Tt)=>(K.openBlock(),K.createElementBlock("span",{class:"mb-[10px] py-1 ps-3 pe-1 inline-flex items-center bg-white border border-gray-200 text-gray-800 text-xs rounded-full",key:Tt},[K.createElementVNode("span",mg,K.toDisplayString(g.getLabelById(Pt)),1),gg,K.createElementVNode("span",_g,K.toDisplayString(g.getOptionsLabelById(Pt,Ee)),1),K.createElementVNode("button",{type:"button",class:"inline-flex shrink-0 justify-center items-center size-5 ms-1 rounded-full text-gray-600 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 text-sm",onClick:Gt=>g.clearFilter(Pt)},[K.createVNode(Ze)],8,yg)]))),128)),((Mt=Object.keys(g.activeFilters))==null?void 0:Mt.length)>=2?(K.openBlock(),K.createElementBlock("span",xg,[vg,K.createElementVNode("button",{type:"button",class:"inline-flex shrink-0 justify-center items-center size-5 ms-1 rounded-full text-gray-600 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 text-sm",onClick:S[4]||(S[4]=Ee=>g.mountedFilter={})},[K.createVNode(Ze)])])):K.createCommentVNode("",!0)])):K.createCommentVNode("",!0),g.total>=1?K.renderSlot(g.$slots,"table",{key:1,rows:g.tableData,map:g.map,selectRow:g.selectRow,getData:g.getData,isMapVisible:g.isMapVisible}):(K.openBlock(),K.createElementBlock("div",bg,[K.createVNode(tt),wg,Sg,K.createElementVNode("button",{type:"button",class:"mt-[10px] py-2 px-2.5 inline-flex items-center gap-x-1.5 text-xs rounded-lg border border-stone-200 bg-white text-stone-800 shadow-sm hover:bg-stone-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-stone-100",onClick:S[5]||(S[5]=(...Ee)=>g.resetFilters&&g.resetFilters(...Ee))}," Очистити дані пошуку ")]))]),g.total>=1?(K.openBlock(),K.createElementBlock("hr",Tg)):K.createCommentVNode("",!0),g.total>=1?(K.openBlock(),K.createElementBlock("div",Ig,[K.createElementVNode("div",Pg,[K.createVNode(Ue,{total:g.total,maxPages:7,defaultPage:g.currentPage,pageSize:g.limit,goTo:!1,size:"medium",onPageChange:g.handlePageChange,backgroundColor:"#e5e7eb",borderedCellSelected:!0,pageSizes:[10,20,30],onPageSizeChange:g.changeLimit},null,8,["total","defaultPage","pageSize","onPageChange","onPageSizeChange"])])])):K.createCommentVNode("",!0)],2),g.isSelectObj?(K.openBlock(),K.createElementBlock("div",{key:0,class:K.normalizeClass(g.isMapVisible?"w-2/4 mr-0 pb-5":"w-full pb-5 mr-3"),style:{height:"calc(100vh - 152px)"}},[K.renderSlot(g.$slots,"details",{table:g.table,selectedId:g.selectedId,selectedRow:g.selectedRow,map:g.map,closeObjCard:g.closeObjCard,isMapVisible:g.isMapVisible})],2)):K.createCommentVNode("",!0),K.withDirectives(K.createElementVNode("div",kg,[K.createElementVNode("section",Ag,[K.createVNode(dt,{height:"calc(100vh - 152px)",width:"w-2/4",table:g.table,filtersParam:g.filtersParam,row:g.selectedRow,legendname:g.legendname,legend:g.legend,colorAttr:g.colorAttr,maxBounds:g.maxBounds,center:g.center,zoom:g.zoom,basemap:g.basemap,pointZoom:g.pointZoom,defaultColor:g.defaultColor},null,8,["table","filtersParam","row","legendname","legend","colorAttr","maxBounds","center","zoom","basemap","pointZoom","defaultColor"])])],512),[[K.vShow,g.isMapVisible]])]),K.createElementVNode("div",Cg,[K.renderSlot(g.$slots,"popup",{data:g.hoverData})],512)])])}const Nu=Or(eg,[["render",Eg]]),Uu={install:g=>{g.component("VsPartsMap",Nu)},components:{VsPartsMap:Nu}};return typeof window<"u"&&(window.PartsMap=Uu),Uu});
|
585
|
+
`+W):E.stack=W}catch{}}throw E}}_request(S,A){typeof S=="string"?(A=A||{},A.url=S):A=S||{},A=ts(this.defaults,A);const{transitional:E,paramsSerializer:V,headers:W}=A;E!==void 0&&zc.assertOptions(E,{silentJSONParsing:Pn.transitional(Pn.boolean),forcedJSONParsing:Pn.transitional(Pn.boolean),clarifyTimeoutError:Pn.transitional(Pn.boolean)},!1),V!=null&&(fe.isFunction(V)?A.paramsSerializer={serialize:V}:zc.assertOptions(V,{encode:Pn.function,serialize:Pn.function},!0)),A.method=(A.method||this.defaults.method||"get").toLowerCase();let T=W&&fe.merge(W.common,W[A.method]);W&&fe.forEach(["delete","get","head","post","put","patch","common"],Ze=>{delete W[Ze]}),A.headers=Gi.concat(T,W);const c=[];let ye=!0;this.interceptors.request.forEach(function(tt){typeof tt.runWhen=="function"&&tt.runWhen(A)===!1||(ye=ye&&tt.synchronous,c.unshift(tt.fulfilled,tt.rejected))});const ve=[];this.interceptors.response.forEach(function(tt){ve.push(tt.fulfilled,tt.rejected)});let be,le=0,ae;if(!ye){const Ze=[Au.bind(this),void 0];for(Ze.unshift.apply(Ze,c),Ze.push.apply(Ze,ve),ae=Ze.length,be=Promise.resolve(A);le<ae;)be=be.then(Ze[le++],Ze[le++]);return be}ae=c.length;let gt=A;for(le=0;le<ae;){const Ze=c[le++],tt=c[le++];try{gt=Ze(gt)}catch(Ue){tt.call(this,Ue);break}}try{be=Au.call(this,gt)}catch(Ze){return Promise.reject(Ze)}for(le=0,ae=ve.length;le<ae;)be=be.then(ve[le++],ve[le++]);return be}getUri(S){S=ts(this.defaults,S);const A=xu(S.baseURL,S.url);return hu(A,S.params,S.paramsSerializer)}}fe.forEach(["delete","get","head","options"],function(S){is.prototype[S]=function(A,E){return this.request(ts(E||{},{method:S,url:A,data:(E||{}).data}))}}),fe.forEach(["post","put","patch"],function(S){function A(E){return function(W,T,c){return this.request(ts(c||{},{method:S,headers:E?{"Content-Type":"multipart/form-data"}:{},url:W,data:T}))}}is.prototype[S]=A(),is.prototype[S+"Form"]=A(!0)});class Dc{constructor(S){if(typeof S!="function")throw new TypeError("executor must be a function.");let A;this.promise=new Promise(function(W){A=W});const E=this;this.promise.then(V=>{if(!E._listeners)return;let W=E._listeners.length;for(;W-- >0;)E._listeners[W](V);E._listeners=null}),this.promise.then=V=>{let W;const T=new Promise(c=>{E.subscribe(c),W=c}).then(V);return T.cancel=function(){E.unsubscribe(W)},T},S(function(W,T,c){E.reason||(E.reason=new Vs(W,T,c),A(E.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(S){if(this.reason){S(this.reason);return}this._listeners?this._listeners.push(S):this._listeners=[S]}unsubscribe(S){if(!this._listeners)return;const A=this._listeners.indexOf(S);A!==-1&&this._listeners.splice(A,1)}static source(){let S;return{token:new Dc(function(V){S=V}),cancel:S}}}function nm(g){return function(A){return g.apply(null,A)}}function sm(g){return fe.isObject(g)&&g.isAxiosError===!0}const Lc={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Lc).forEach(([g,S])=>{Lc[S]=g});function Mu(g){const S=new is(g),A=Xh(is.prototype.request,S);return fe.extend(A,is.prototype,S,{allOwnKeys:!0}),fe.extend(A,S,null,{allOwnKeys:!0}),A.create=function(V){return Mu(ts(g,V))},A}const Ut=Mu(Oo);Ut.Axios=is,Ut.CanceledError=Vs,Ut.CancelToken=Dc,Ut.isCancel=mu,Ut.VERSION=Cu,Ut.toFormData=al,Ut.AxiosError=lt,Ut.Cancel=Ut.CanceledError,Ut.all=function(S){return Promise.all(S)},Ut.spread=nm,Ut.isAxiosError=sm,Ut.mergeConfig=ts,Ut.AxiosHeaders=Gi,Ut.formToJSON=g=>pu(fe.isHTMLForm(g)?new FormData(g):g),Ut.getAdapter=ku.getAdapter,Ut.HttpStatusCode=Lc,Ut.default=Ut;const Rc=(g,S=300)=>{let A;return function(...V){clearTimeout(A),A=setTimeout(()=>{g.apply(this,V)},S)}};function dl(g,S,A={}){const E={type:"Feature"};return(A.id===0||A.id)&&(E.id=A.id),A.bbox&&(E.bbox=A.bbox),E.properties=S||{},E.geometry=g,E}function om(g,S,A={}){if(!g)throw new Error("coordinates is required");if(!Array.isArray(g))throw new Error("coordinates must be an Array");if(g.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Ru(g[0])||!Ru(g[1]))throw new Error("coordinates must contain numbers");return dl({type:"Point",coordinates:g},S,A)}function zu(g,S,A={}){for(const V of g){if(V.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(V[V.length-1].length!==V[0].length)throw new Error("First and last Position are not equivalent.");for(let W=0;W<V[V.length-1].length;W++)if(V[V.length-1][W]!==V[0][W])throw new Error("First and last Position are not equivalent.")}return dl({type:"Polygon",coordinates:g},S,A)}function Du(g,S,A={}){return dl({type:"MultiPoint",coordinates:g},S,A)}function Lu(g,S,A={}){return dl({type:"MultiPolygon",coordinates:g},S,A)}function Ru(g){return!isNaN(g)&&g!==null&&!Array.isArray(g)}function Bu(g,S,A){if(g!==null)for(var E,V,W,T,c,ye,ve,be=0,le=0,ae,gt=g.type,Ze=gt==="FeatureCollection",tt=gt==="Feature",Ue=Ze?g.features.length:1,dt=0;dt<Ue;dt++){ve=Ze?g.features[dt].geometry:tt?g.geometry:g,ae=ve?ve.type==="GeometryCollection":!1,c=ae?ve.geometries.length:1;for(var Mt=0;Mt<c;Mt++){var Ee=0,Pt=0;if(T=ae?ve.geometries[Mt]:ve,T!==null){ye=T.coordinates;var Tt=T.type;switch(be=0,Tt){case null:break;case"Point":if(S(ye,le,dt,Ee,Pt)===!1)return!1;le++,Ee++;break;case"LineString":case"MultiPoint":for(E=0;E<ye.length;E++){if(S(ye[E],le,dt,Ee,Pt)===!1)return!1;le++,Tt==="MultiPoint"&&Ee++}Tt==="LineString"&&Ee++;break;case"Polygon":case"MultiLineString":for(E=0;E<ye.length;E++){for(V=0;V<ye[E].length-be;V++){if(S(ye[E][V],le,dt,Ee,Pt)===!1)return!1;le++}Tt==="MultiLineString"&&Ee++,Tt==="Polygon"&&Pt++}Tt==="Polygon"&&Ee++;break;case"MultiPolygon":for(E=0;E<ye.length;E++){for(Pt=0,V=0;V<ye[E].length;V++){for(W=0;W<ye[E][V].length-be;W++){if(S(ye[E][V][W],le,dt,Ee,Pt)===!1)return!1;le++}Pt++}Ee++}break;case"GeometryCollection":for(E=0;E<T.geometries.length;E++)if(Bu(T.geometries[E],S)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function Fu(g,S={}){if(g.bbox!=null&&S.recompute!==!0)return g.bbox;const A=[1/0,1/0,-1/0,-1/0];return Bu(g,E=>{A[0]>E[0]&&(A[0]=E[0]),A[1]>E[1]&&(A[1]=E[1]),A[2]<E[0]&&(A[2]=E[0]),A[3]<E[1]&&(A[3]=E[1])}),A}function Ou(g,S={}){const A=Fu(g),E=(A[0]+A[2])/2,V=(A[1]+A[3])/2;return om([E,V],S.properties,S)}const am={mixins:[yc],props:{map:{type:Object},baseLayers:{type:Array,default:[{id:"orto10",name:"Ortophoto 1:10К",url:"https://data.gki.com.ua/api-user/rtile/orto10/ua/{z}/{x}/{y}.png",service:"TMS",category:"Національна інфраструктура геопросторових даних",scale:1e4,year:2020,bounds:"ua",maxzoom:18,owner:"НДІГК (Інститут геодезії та картографії)",image:"https://data.gki.com.ua/api-user/rtile/orto10/ua/13/4954/2876.png",basemap:!0},{id:"graymap",name:"Сіра карта",url:"https://basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png",service:"TMS",category:"Базові карти",attribution:"© <a href='http://www.openstreetmap.org/copyright'>OpenStreetMap</a>, © <a href='https://carto.com/attributions'>CARTO</a>",bounds1:"ua",image:"https://basemaps.cartocdn.com/light_all/10/601/348.png",position:0,owner:"OSM",basemap:!0},{id:"darkmap_carto",name:"Темна карта України",image:"https://basemaps.cartocdn.com/dark_all/13/4791/2762.png?ver=2023-04-14",url:"https://basemaps.cartocdn.com/dark_all/{z}/{x}/{y}.png",service:"TMS",category:"Базові карти",active:!1}]}},data(){return{selectedLayer:null}},watch:{map(g){g&&g.on("load",this.handleMapLoad)}},methods:{handleMapLoad(){var g;this.baseLayers.forEach(S=>{this.layerList.push(S)}),this.toggleLayerVisibility((g=this.baseLayers[0])==null?void 0:g.id)},toggleLayerVisibility(g){this.selectedLayer=g,this.changeBaseLayer(this.selectedLayer)}}},lm={class:"vs-map-slot-layers"},cm=["onClick"],hm=["src"];function um(g,S,A,E,V,W){return K.openBlock(),K.createElementBlock("div",lm,[(K.openBlock(!0),K.createElementBlock(K.Fragment,null,K.renderList(A.baseLayers,(T,c)=>(K.openBlock(),K.createElementBlock("div",{key:T.id,class:K.normalizeClass(["vs-map-slot-layers__layer relative",{focused:T.id==V.selectedLayer}]),onClick:ye=>W.toggleLayerVisibility(T.id)},[K.createElementVNode("img",{src:T.image,class:"vs-map-slot-layers__image"},null,8,hm),K.createElementVNode("div",{class:K.normalizeClass(["absolute py-2 px-4 text-sm text-stone-800 bg-white shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-lg top-[-46px] text-nowrap p-2 hidden whitespace-nowrap",[c===0?"left-[-10px]":"left-[50%] translate-x-[-50%] "]])},K.toDisplayString(T==null?void 0:T.name),3)],10,cm))),128))])}const dm=Or(am,[["render",um],["__scopeId","data-v-d4fbd7d5"]]),pm={props:["colors","title"],methods:{capitalizeFirstLetter(g){return g?g.charAt(0).toUpperCase()+g.slice(1):""}}},fm={class:"absolute left-[20px] bottom-[74px] bg-white max-w-[250px] p-[10px] rounded-lg"},mm={key:0,class:"mb-[10px] text-[1rem]"},gm={class:"legend-item"},_m={key:0,class:"flex justify-start items-center gap-2"},ym={class:"ml-1 text-[0.875rem]"};function xm(g,S,A,E,V,W){return K.openBlock(),K.createElementBlock("div",fm,[A.title?(K.openBlock(),K.createElementBlock("div",mm,K.toDisplayString(A.title),1)):K.createCommentVNode("",!0),(K.openBlock(!0),K.createElementBlock(K.Fragment,null,K.renderList(A.colors,T=>(K.openBlock(),K.createElementBlock("div",gm,[T.id>0?(K.openBlock(),K.createElementBlock("div",_m,[K.createElementVNode("div",{class:"w-[15px] h-[15px] rounded-[50%] min-w-[15px]",style:K.normalizeStyle({backgroundColor:T.color})},null,4),K.createElementVNode("div",ym,K.toDisplayString(W.capitalizeFirstLetter(T.text)),1)])):K.createCommentVNode("",!0)]))),256))])}const vm={components:{MapSlotLayers:dm,MapLegend:Or(pm,[["render",xm]])},props:{colorAttr:null,defaultColor:{type:String,default:"blue"},legendname:{type:String,default:()=>""},height:{type:String,default:()=>"100vh"},width:{type:String,default:"100vw"},center:{type:Array,default:[32,49]},maxBounds:{type:Array,default:[[22,44],[40,52]]},table:{type:String,default:""},zoom:{type:[String,Number],default:13},basemap:Array,filtersParam:{type:String,default:""},row:{type:Object,default:{}},pointZoom:{type:String,default:"12"},legend:{type:Boolean,default:()=>!0}},mixins:[yc],data(){return{map:null,hoverObject:null,popup:null,colors:[]}},async mounted(){var g,S,A,E,V;if(await this.createMap(),(g=this.row)!=null&&g.geom){const{type:W,coordinates:T}=this.row.geom;let c;switch(W){case"Polygon":c=zu(T);break;case"MultiPolygon":c=Lu(T);break;case"MultiPoint":c=Du(T);break;default:(S=this.map)==null||S.fitBounds([T,T],{maxZoom:15,padding:30}),this.isSelectObj=!0;return}const ye=Ou(c).geometry.coordinates;(A=this.map)==null||A.fitBounds([ye,ye],{maxZoom:this.zoom,padding:30})}this.center?(E=this.map)==null||E.fitBounds(this.center,{maxZoom:this.zoom,padding:30}):(V=this.map)==null||V.fitBounds(this.maxBounds)},watch:{filtersParam(g){this.setFilter(this.table,g)}},methods:{async getColorStyle(){var g=[["#69D2E7","#A7DBD8","#E0E4CC","#F38630","#FA6900"],["#FE4365","#FC9D9A","#F9CDAD","#C8C8A9","#83AF9B"],["#ECD078","#D95B43","#C02942","#542437","#53777A"]];if(!this.colorAttr)return this.defaultColor;try{const{data:{rows:S}}=await Ut.get(`/api/data/${this.table}/${this.colorAttr}`),A=S.reduce((E,V,W)=>V!=null&&V.id?[...E,V.id.toString(),V.color||g[0][W%5]]:E,["match",["get",this.colorAttr]]);return this.colors=[...S],A.push("gray"),A}catch(S){console.log(S)}},async handleMapLoad(){var A,E;const g=await this.getColorStyle(),S=((E=(A=location.search.split("&").find(V=>V.includes("filter=")))==null?void 0:A.split("filter="))==null?void 0:E[1])||"";await this.addLayer({id:this.table,service:"vector",url:`/api/vtile/${this.table}/ua/{z}/{x}/{y}.vmt?pointZoom=${this.pointZoom}&dt=${new Date().toISOString()}&filter=${S}`,layers:[{type:"fill","source-layer":this.table,paint:{"fill-color":g,"fill-opacity":.3,"fill-outline-color":["case",["==",["feature-state","hover"],!0],"red","#000000"]},filter:["all",["==",["geometry-type"],"Polygon"]]},{type:"circle","source-layer":this.table,filter:["all",["==",["geometry-type"],"Point"]],paint:{"circle-radius":{base:1.75,stops:[[10,5],[12,6],[18,12]]},"circle-stroke-color":["case",["==",["feature-state","hover"],!0],"red","#ccc"],"circle-stroke-width":["case",["==",["feature-state","hover"],!0],2,1],"circle-color":g}}]})},async createMap(){const g={version:8,glyphs:"https://cdn.softpro.ua/data/fonts/{fontstack}/{range}.pbf",sources:{},layers:[]};this.map=await new il.Map({container:"maplibre-map",style:g,zoom:10,center:this.center,maxBounds:this.maxBounds}),this.$parent.map=this.map,this.map.addControl(new il.NavigationControl({visualizePitch:!0})),this.map.on("load",this.handleMapLoad)}}},bm={class:"vs-map-portal relative"};function wm(g,S,A,E,V,W){const T=K.resolveComponent("MapLegend"),c=K.resolveComponent("MapSlotLayers");return K.openBlock(),K.createElementBlock("div",bm,[K.createElementVNode("div",{id:"maplibre-map",ref:"maplibreMap",class:"w-full",style:K.normalizeStyle({height:A.height})},null,4),K.withDirectives(K.createVNode(T,{colors:V.colors,title:A.legendname},null,8,["colors","title"]),[[K.vShow,A.legend]]),K.createVNode(c,{map:V.map,baseLayers:A.basemap},null,8,["map","baseLayers"])])}const Sm=Or(vm,[["render",wm]]),Tm={},Im={class:"flex-shrink-0 size-3.5",xmlns:"http://www.w3.org/2000/svg",width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},Pm=[K.createStaticVNode('<line x1="21" x2="14" y1="4" y2="4"></line><line x1="10" x2="3" y1="4" y2="4"></line><line x1="21" x2="12" y1="12" y2="12"></line><line x1="8" x2="3" y1="12" y2="12"></line><line x1="21" x2="16" y1="20" y2="20"></line><line x1="12" x2="3" y1="20" y2="20"></line><line x1="14" x2="14" y1="2" y2="6"></line><line x1="8" x2="8" y1="10" y2="14"></line><line x1="16" x2="16" y1="18" y2="22"></line>',9)];function km(g,S){return K.openBlock(),K.createElementBlock("svg",Im,Pm)}const Am=Or(Tm,[["render",km]]),Cm={},Em={xmlns:"http://www.w3.org/2000/svg",width:"21",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-layout-sidebar-right-collapse"},Mm=[K.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),K.createElementVNode("path",{d:"M4 4m0 2a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2z"},null,-1),K.createElementVNode("path",{d:"M15 4v16"},null,-1),K.createElementVNode("path",{d:"M9 10l2 2l-2 2"},null,-1)];function zm(g,S){return K.openBlock(),K.createElementBlock("svg",Em,Mm)}const Dm=Or(Cm,[["render",zm]]),Lm={},Rm={xmlns:"http://www.w3.org/2000/svg",width:"21",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-layout-sidebar-right-expand"},Bm=[K.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),K.createElementVNode("path",{d:"M4 4m0 2a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2z"},null,-1),K.createElementVNode("path",{d:"M15 4v16"},null,-1),K.createElementVNode("path",{d:"M10 10l-2 2l2 2"},null,-1)];function Fm(g,S){return K.openBlock(),K.createElementBlock("svg",Rm,Bm)}const Om=Or(Lm,[["render",Fm]]),Vm={},Nm={class:"shrink-0 size-3",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},Um=[K.createElementVNode("path",{d:"M18 6 6 18"},null,-1),K.createElementVNode("path",{d:"m6 6 12 12"},null,-1)];function jm(g,S){return K.openBlock(),K.createElementBlock("svg",Nm,Um)}const $m=Or(Vm,[["render",jm]]),qm={props:{visible:{type:Boolean,default:()=>!1},title:{type:String,default:()=>""},size:{type:String,default:()=>""}},emits:["update:visible","onClose"],name:"vs-dialog",mounted(){window.addEventListener("keydown",this.checkKey)},unmounted(){window.removeEventListener("keydown",this.checkKey)},computed:{hasSlot(){var g;return!!((g=this.$slots)!=null&&g.footer)},checkSize(){return this.size==="small"?"w-5/12":this.size==="medium"?"w-6/12":"lg:w-7/12 w-11/12"}},methods:{checkKey({key:g}){g==="Escape"&&this.handleClose()},handleClose(){this.$emit("update:visible",!1),this.$emit("onClose")}}},Vu=g=>(K.pushScopeId("data-v-37405773"),g=g(),K.popScopeId(),g),Zm={class:"vsTailwind ui-dialog__wrapper"},Gm={class:"w-full h-full fixed top-0 start-0 z-[80] bg-black bg-opacity-50"},Hm={class:"py-2.5 px-4 flex justify-between items-center border-b"},Xm={class:"font-medium text-gray-800"},Wm=[Vu(()=>K.createElementVNode("span",{class:"sr-only"},"Close",-1)),Vu(()=>K.createElementVNode("svg",{class:"flex-shrink-0 w-4 h-4",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[K.createElementVNode("path",{d:"M18 6 6 18"}),K.createElementVNode("path",{d:"m6 6 12 12"})],-1))],Jm={class:"ui-dialog__content p-4"},Km={key:0,class:"flex justify-end gap-x-2"};function Ym(g,S,A,E,V,W){return K.openBlock(),K.createBlock(K.Teleport,{to:"#modal"},[K.createVNode(K.Transition,{name:"fade"},{default:K.withCtx(()=>[K.withDirectives(K.createElementVNode("div",Zm,[K.createElementVNode("div",Gm,[K.createVNode(K.Transition,{name:"content",appear:""},{default:K.withCtx(()=>[K.createElementVNode("div",{class:K.normalizeClass(["ui-dialog__modal opacity-1 transition-all flex flex-col bg-white border pointer-events-auto shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-xl",[W.checkSize]])},[K.createElementVNode("div",Hm,[K.createElementVNode("h3",Xm,K.toDisplayString(A.title),1),K.createElementVNode("button",{type:"button",class:"size-8 inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent bg-gray-100 text-gray-800 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:hover:bg-neutral-600 dark:text-neutral-400 dark:focus:bg-neutral-600",onClick:S[0]||(S[0]=(...T)=>W.handleClose&&W.handleClose(...T))},Wm)]),K.createElementVNode("div",Jm,[K.renderSlot(g.$slots,"default",{},void 0,!0)]),W.hasSlot?(K.openBlock(),K.createElementBlock("div",Km,[K.renderSlot(g.$slots,"footer",{},void 0,!0)])):K.createCommentVNode("",!0)],2)]),_:3})])],512),[[K.vShow,A.visible]])]),_:3})])}const Qm=Or(qm,[["render",Ym],["__scopeId","data-v-37405773"]]),eg=K.defineComponent({props:{title:{type:String,default:()=>""},table:{type:String,default:()=>""},rows:{type:Object,default:()=>null},initTotal:{type:[Number,String],default:()=>""},colorAttr:{type:String,default:()=>""},legendname:{type:String,default:()=>""},center:{type:Array},maxBounds:{type:Array,default:()=>[[22,44.4],[40,52.5]]},id:{type:String,default:()=>""},isAutocomplete:{type:Boolean,default:()=>!1},isAddressAutocomplete:{type:Boolean,default:()=>!1},zoom:{type:[Number,String],default:()=>"13"},maskForSearch:{type:String,default:()=>null},searchShow:{type:Boolean,default:()=>!0},basemap:{type:Array},pointZoom:{type:String,default:()=>"12"},legend:{type:Boolean,default:()=>!0},defaultColor:{type:String,default:()=>"blue"}},mixins:[yc],components:{MapPortal:Sm,NoData:Fp,FilterIcon:Am,VisibleMapIcon:Dm,HiddenMapIcon:Om,CloseIcon:$m,VsDialog:Qm},data(){return{filters:"",search:"",limit:20,polyline:null,filtersParam:"",isSelectObj:!1,selectedId:"",searchRegion:"",searchAddress:"",marker:null,handleSearchRegionDebounced:Rc(g=>this.updateSearchRegionValue(g),500),handleSearchAddressDebounced:Rc(g=>this.updateSearchAddressValue(g),500),searchRegionResult:[],searchAddressResult:[],selectedRow:null,activeFilters:"",isMapVisible:!0,tabsIsVisible:!1,filterUrl:"",currentPage:1,regionOptionGeneral:null,isFilterVisible:!1,tableData:null,hoverData:null,atuData:[],map:null,legendName:null,total:null,filtered:null,filterValues:"",activeFiltersCount:"",visibleTrue:!0,regionSelectValue:null,addressSelectValue:null,currentBbox:null,mountedFilter:{},optionRowsCount:[{value:10,label:"10"},{value:20,label:"20"},{value:30,label:"30"}],handleDebouncedUpdateValue:Rc(g=>{this.handleSearchValue(g)},10)}},watch:{map(){this.map.on("mousemove",this.handleMapHover),this.map.on("click",this.handleMapClick)},activeFiltersCount(){var g,S;return(S=(g=this.$refs)==null?void 0:g.filter)==null?void 0:S.filteredActiveFiltersLength},activeFilters(){var g,S;return this.isSelectObj&&this.moveToDefaultPage(),(S=(g=this.$refs)==null?void 0:g.filter)==null?void 0:S.activeFilters},isFilterVisible(g){g||this.getData()},async regionSelectValue(g,S){var V,W;if(!this.regionSelectValue){this.map.removeSource("region-search-id");return}g&&this.selectedId&&this.closeObjCard(),this.polyline=this.regionSelectValue.encoded_geom,this.getData();const A=((V=this.regionSelectValue)==null?void 0:V.geom)||Sr.toGeoJSON(this.regionSelectValue.encoded_geom),E=this.map.getSource("region-search-id");if(this.currentBbox=Fu(A),E)E.setData({type:"Feature",geometry:A});else{this.map.addSource("region-search-id",{type:"geojson",data:{type:"Feature",geometry:A}});const T={id:"region-search-id",type:"line",source:"region-search-id",paint:{"line-color":"blue","line-opacity":1}};await this.map.addLayer(T)}this.moveLayer("site.prc.parcel_object.table"),(W=this.map)==null||W.fitBounds(this.currentBbox,{zoom:this.setAtuZoom,padding:20}),this.getData()},async addressSelectValue(g,S){this.addressSelectValue&&(g&&this.selectedId&&this.closeObjCard(),this.getData())}},created(){this.legendName,this.tableData=this.rows,this.total=this.initTotal,this.id&&(this.selectedRow=this.rows[0],this.selectedId=this.id,this.isSelectObj=!0)},mounted(){var A;this.rows||this.getData();const g=(A=window.location.search)==null?void 0:A.split("?filter=")[1],S=g==null?void 0:g.split("|");S==null||S.forEach(E=>{const[V,W]=E.split("=");W!=null&&W.includes(",")?this.mountedFilter[V]=W==null?void 0:W.split(","):this.mountedFilter[V]=W}),this.getFilter()},updated(){this.checkFilterLength()},computed:{setAtuZoom(){var g,S,A;return((g=this.regionSelectValue)==null?void 0:g.id)==="UA80000000000093317"||((S=this.regionSelectValue)==null?void 0:S.id)==="UA85000000000065278"?10:((A=this.regionSelectValue)==null?void 0:A.region)===""?7.5:11}},methods:{async updateSearchRegionValue(g){this.searchRegion=g,await this.getReginOptions()},async updateSearchAddressValue(g){this.searchAddress=g,await this.getAddressOptions()},async getData(){var g,S;try{const A={search:this.search||null,limit:this.limit,page:this.currentPage,polyline:this.polyline};this.filtersParam!==""&&this.filtersParam!=="no-url"?A.filter=this.filtersParam:A.filter=decodeURIComponent(((S=(g=location.search.split("&").find(V=>V.includes("filter=")))==null?void 0:g.split("filter="))==null?void 0:S[1])||""),this.addressSelectValue&&(A.filter+=A.filter?`&address_id=${this.addressSelectValue.id}`:`address_id=${this.addressSelectValue.id}`);const{data:E}=await Ut.get(`/api/data/${this.table}`,{params:A});this.tableData=E==null?void 0:E.rows,this.total=E.total,this.filtered=E.filtered}catch(A){console.error(A.message)}},moveToDefaultPage(){var E;const g=new URLSearchParams(window.location.search);g.delete("id");const A=`${window.location.pathname}?${g.toString()}`;debugger;(E=this.map)==null||E.fitBounds(this.maxBounds,{}),window.history.pushState({},"",A),this.isSelectObj=!1},regionFullName(g){return g.region?`${g.text} / ${g.region}`:g.text},getLabelById(g){const S=this.filters.find(A=>A.id===g);return S?S.label:g},getOptionsLabelById(g,S){if(Array.isArray(S)){const A=this.filters.find(E=>E.id===g);return A!=null&&A.options?A==null?void 0:A.options.filter(E=>S.includes(E.id)).map(E=>E.text).join(", "):S==null?void 0:S.length}else return S},async clearFilter(g){var S,A;(A=(S=this.$refs)==null?void 0:S.filter)==null||A.clearFilter(g),await this.updateTableAndMap(),await this.getData()},async getReginOptions(){if(this.searchRegion===""&&this.regionOptionGeneral)this.searchRegionResult=this.regionOptionGeneral;else try{const{data:g}=await Ut.get(`https://data.softpro.ua/api-user/suggest/atu.codifier.type.polyline.select.region?key=${this.searchRegion}`);this.searchRegionResult=g,this.regionOptionGeneral||(this.regionOptionGeneral=g)}catch(g){console.error(g.message)}},async getAddressOptions(){if(this.searchAddress===""&&this.addressOptionGeneral)this.searchAddressResult=this.addressOptionGeneral;else try{const{data:g}=await Ut.get(`/api/suggest/itree.address_id?key=${this.searchAddress}`);this.searchAddressResult=g,this.addressOptionGeneral||(this.addressOptionGeneral=g)}catch(g){console.error(g.message)}},handlePageChange(g){this.currentPage=g,this.getData()},async getFilter(){try{const{data:g}=await Ut.get(`/api/filter/${this.table}`);this.filters=g.list}catch(g){console.error(g.message)}},async handleSearchValue(g){this.search=g,await this.getData()},closeObjCard(){var E;const g=new URLSearchParams(window.location.search);g.delete("id"),this.deletePulsePoint(),this.deleteHighlighPolygon();const A=`${window.location.pathname}?${g.toString()}`;(E=this.map)==null||E.fitBounds(this.currentBbox||this.maxBounds,{}),window.history.pushState({},"",A),this.isSelectObj=!1,this.getData()},async handleSearchRegionValue(g){var A;const S=this.map.getLayer("region-search-id");this.searchRegion=g,g===""&&S?((A=this.map)==null||A.fitBounds(this.maxBounds,{}),this.currentBbox=null,this.polyline=null,this.map.removeLayer("region-search-id"),this.getData()):g===""&&this.getData()},async handleSearchAddressValue(g){var A;const S=this.map.getLayer("address-search-id");this.searchAddress=g,g===""&&S?((A=this.map)==null||A.fitBounds(this.maxBounds,{}),this.currentBbox=null,this.polyline=null,this.map.removeLayer("address-search-id"),this.getData()):g===""&&this.getData()},handleFilterChange(g){this.currentPage=g.state.page||1,this.filterUrl=g.url.split("|").filter(S=>!S.includes("page=")).join("|")},async updateTableAndMap(){var g,S;this.selectedRow||(this.filtersParam=this.filterUrl,this.activeFilters=(S=(g=this.$refs)==null?void 0:g.filter)==null?void 0:S.activeFilters,this.isFilterVisible=!1,this.getData())},handleFilterSubmit(){var g;this.isSelectObj="",this.selectedId="",this.selectedId=!1,(g=this.map)==null||g.fitBounds(this.maxBounds,{}),this.isFilterVisible=!1},toggleMapVisible(){this.isMapVisible=!this.isMapVisible},checkUrl(){const g=new URLSearchParams(window.location.search);g.has("id")?(this.isSelectObj=!0,this.isMapVisible=!0,this.selectedId=g.get("id")):(this.isSelectObj=!1,this.selectedId="")},changeLimit(g){this.limit=g,this.currentPage=1,this.getData()},filterModalClose(){this.isFilterVisible=!1},resetFilters(){this.$refs.filter&&(this.$refs.filter.clearAll(),this.search="",this.isFilterVisible=!1,this.filtersParam="",this.polyline=null,this.regionSelectValue=null,this.addressSelectValue=null,this.currentBbox=null,this.activeFilters=null,this.tabsIsVisible=!1,this.handleSearchRegionValue(""),this.handleSearchAddressValue(""))},checkFilterLength(){var S,A;const g=(A=(S=this.$refs)==null?void 0:S.filter)==null?void 0:A.filteredActiveFiltersLength;g!==this.previousLength&&(this.previousLength=g,this.activeFiltersCount=g)},async handleMapClick(g){var W,T,c,ye,ve,be,le,ae;const S=this.map.queryRenderedFeatures(g.point);if((S==null?void 0:S.length)<1)return;const A=window.location.pathname,E=new URLSearchParams(window.location.search);E.set("id",`${(W=S[0])==null?void 0:W.properties.id}`),this.getObjectData((c=(T=S[0])==null?void 0:T.properties)==null?void 0:c.id);const V=`${A}?${E.toString()}`;window.history.pushState({},"",V),this.isSelectObj=!0,g.lngLat&&((ae=this.map)==null||ae.fitBounds([[(ye=g.lngLat)==null?void 0:ye.lng,(ve=g.lngLat)==null?void 0:ve.lat],[(be=g.lngLat)==null?void 0:be.lng,(le=g.lngLat)==null?void 0:le.lat]],{maxZoom:this.zoom,padding:30})),this.checkUrl()},async getObjectData(g){var S,A;try{const{data:E}=await Ut.get(`/api/data/${this.table}/${g}`);this.selectRow((S=E==null?void 0:E.rows)==null?void 0:S[0]),((A=E==null?void 0:E.rows)==null?void 0:A.lenght)<1&&this.deletePulsePoint()}catch(E){console.error(E.message)}},async selectRow(g){var T,c,ye;this.isMapVisible=!0;const A=await(await fetch(`/api/data/${this.table}/${g.id}`)).json();this.selectedRow=((T=A==null?void 0:A.rows)==null?void 0:T[0])||g;const E=window.location.pathname,V=new URLSearchParams(window.location.search);V.set("id",`${g.id}`);const W=`${E}?${V.toString()}`;if(window.history.pushState({},"",W),this.checkUrl(),g!=null&&g.geom){const{type:ve,coordinates:be}=g.geom;let le;switch(ve){case"Polygon":le=zu(be);break;case"MultiPolygon":le=Lu(be);break;case"MultiPoint":le=Du(be);break;default:(c=this.map)==null||c.fitBounds([be,be],{maxZoom:15,padding:30}),this.isSelectObj=!0;return}const ae=Ou(le).geometry.coordinates;(ye=this.map)==null||ye.fitBounds([ae,ae],{maxZoom:this.zoom,padding:30})}this.isSelectObj=!0},deletePulsePoint(){this.marker&&this.marker.remove()},addPulsePoint(g){this.deletePulsePoint();const S=document.createElement("div");S.className="gps-marker",S.style.width="10px",S.style.height="10px",S.style.position="relative";const A=document.createElement("div");A.className="gps-wave",S.appendChild(A),this.marker=new il.Marker({element:S,anchor:"center"}).setLngLat(g).addTo(this.map)},deleteHighlighPolygon(){var g,S,A;(g=this.map)!=null&&g.getLayer("highlighted-polygon")&&((S=this.map)==null||S.removeLayer("highlighted-polygon"),(A=this.map)==null||A.removeSource("highlighted-polygon"))},highlightPolygon(g){var S,A,E,V,W,T;this.deletePulsePoint(),this.deleteHighlighPolygon(),(V=this.map)==null||V.addSource("highlighted-polygon",{type:"geojson",data:{geometry:{type:(S=g==null?void 0:g.geom)==null?void 0:S.type,coordinates:(A=g==null?void 0:g.geom)==null?void 0:A.coordinates},type:"Feature",properties:{id:g==null?void 0:g.id,name:g==null?void 0:g.name,category:g==null?void 0:g.id},id:g==null?void 0:g.id,layer:{id:"site.rest_zone.table-0",type:"fill",source:"site.rest_zone.table",sourceLayer:"site.rest_zone.table",filter:["all",["==",["geometry-type"],(E=g==null?void 0:g.geom)==null?void 0:E.type]],paint:{"fill-color":"orange","fill-opacity":.5},layout:{}},source:"site.rest_zone.table",sourceLayer:"site.rest_zone.table",state:{hover:!0},table:"site.rest_zone.table"}}),(W=this.map)==null||W.addLayer({id:"highlighted-polygon",type:"fill",source:"highlighted-polygon",layout:{},minzoom:12,maxzoom:0,paint:{"fill-color":"orange","fill-opacity":.6}}),(T=this.map)==null||T.moveLayer("highlighted-polygon")},async handleMapHover(g){var V,W,T;this.hoverObject&&(this.map.setFeatureState(this.hoverObject,{hover:!1}),this.hoverObject=null),this.popup||(this.popup=new il.Popup({maxWidth:"400px",closeButton:!1,closeOnClick:!1}));const S=this.map.queryRenderedFeatures(g.point);if(this.map.getCanvas().style.cursor="pointer",!(S!=null&&S.length)||((V=S==null?void 0:S[0])==null?void 0:V.source)==="region-search-id"){this.map.getCanvas().style.cursor="",this.popup.remove();return}const A=S[0].geometry.coordinates.slice();S[0].source==="highlighted-polygon"&&S[1]?this.hoverData=(W=S[1])==null?void 0:W.properties:this.hoverData=(T=S[0])==null?void 0:T.properties;const E={source:S[0].source,sourceLayer:S[0].sourceLayer,id:S[0].id};if(E.source!=="region-search-id"){for(this.map.setFeatureState(E,{hover:!0}),this.hoverObject=E;Math.abs(g.lngLat.lng-A[0])>180;)A[0]+=g.lngLat.lng>A[0]?360:-360;this.popup.setLngLat(g.lngLat).setHTML(this.$refs.popup.innerHTML).addTo(this.map)}}}}),tg={class:"ml-3 pt-[20px]"},ig={class:"w-full gap-5 flex justify-between mb-[6px] pr-3"},rg={class:"flex gap-2 pt-[4px]"},ng={class:"inline max-h-[38px] w-[1100px]"},sg={key:0,class:"font-medium text-[10px] min-w-[16px] py-0.5 px-[5px] bg-gray-800 text-white leading-3 rounded-full"},og=["title"],ag=K.createElementVNode("span",{class:"sr-only"},"Відкрити мапу",-1),lg={class:"flex"},cg={class:"py-[15px] pb-[24px] pl-2"},hg={class:"font-bold text-2xl mr-[10px]"},ug={class:"text-sm text-stone-500 font-medium"},dg=K.createElementVNode("span",{class:"text-sm text-stone-500 font-medium"}," об'єктів",-1),pg={class:"wrapperTable flex flex-col",style:{height:"calc(100vh - 302px)"}},fg={key:0,class:"flex gap-x-2 flex-wrap"},mg={class:"font-medium"},gg=K.createElementVNode("span",{class:"h-3 mx-2 border-s border-gray-200"},null,-1),_g={class:"text-gray-500"},yg=["onClick"],xg={key:0,class:"mb-[10px] py-1 ps-3 pe-1 inline-flex items-center bg-white border border-gray-200 text-gray-800 text-xs rounded-full"},vg=K.createElementVNode("span",{class:"font-medium"}," Очистити ",-1),bg={key:2,class:"text-center py-28"},wg=K.createElementVNode("h2",{class:"font-medium text-base text-gray-500 rounded-xl"}," За вашим запитом даних не знайдено! ",-1),Sg=K.createElementVNode("p",{class:"font-normal text-sm text-gray-500 rounded-xl"}," Введіть, будь ласка, інші значення для пошуку. ",-1),Tg={key:0},Ig={key:1,class:"my-5 pr-2"},Pg={class:"flex justify-between"},kg={class:"w-2/4"},Ag={class:"map-section"},Cg={ref:"popup",style:{display:"none"}};function Eg(g,S,A,E,V,W){var Mt;const T=K.resolveComponent("VsAutocompleteOption"),c=K.resolveComponent("vs-autocomplete"),ye=K.resolveComponent("VsTextMask"),ve=K.resolveComponent("vs-text"),be=K.resolveComponent("FilterIcon"),le=K.resolveComponent("VsFilterList"),ae=K.resolveComponent("VisibleMapIcon"),gt=K.resolveComponent("HiddenMapIcon"),Ze=K.resolveComponent("CloseIcon"),tt=K.resolveComponent("NoData"),Ue=K.resolveComponent("VsPagination"),dt=K.resolveComponent("MapPortal");return K.openBlock(),K.createElementBlock("section",tg,[K.createElementVNode("div",null,[K.createElementVNode("div",ig,[K.createElementVNode("div",rg,[g.isAutocomplete?(K.openBlock(),K.createBlock(c,{key:0,modelValue:g.regionSelectValue,"onUpdate:modelValue":[S[0]||(S[0]=Ee=>g.regionSelectValue=Ee),g.handleSearchRegionValue],searchable:"",clearable:"",searchPlaceholder:"Введіть назву громади",placeholder:"Обрати область чи громаду",onOnSearch:g.handleSearchRegionDebounced,onClick:g.getReginOptions,class:"w-[500px]"},{default:K.withCtx(()=>[(K.openBlock(!0),K.createElementBlock(K.Fragment,null,K.renderList(g.searchRegionResult,Ee=>(K.openBlock(),K.createBlock(T,{class:"cursor-pointer dark:hs-selected:bg-neutral-800 py-2 px-4 w-full text-sm text-gray-800 hover:bg-gray-100 rounded-lg focus:outline-none focus:bg-gray-100 dark:text-neutral-300 dark:hover:bg-neutral-800 dark:focus:bg-neutral-800",key:Ee==null?void 0:Ee.id,value:Ee,label:g.regionFullName(Ee)},null,8,["value","label"]))),128))]),_:1},8,["modelValue","onOnSearch","onUpdate:modelValue","onClick"])):K.createCommentVNode("",!0),g.isAddressAutocomplete?(K.openBlock(),K.createBlock(c,{key:1,modelValue:g.addressSelectValue,"onUpdate:modelValue":[S[1]||(S[1]=Ee=>g.addressSelectValue=Ee),g.handleSearchAddressValue],searchable:"",clearable:"",searchPlaceholder:"Введіть адресу",placeholder:"Обрати адресу",onOnSearch:g.handleSearchAddressDebounced,onClick:g.getAddressOptions,class:"w-[350px]"},{default:K.withCtx(()=>[(K.openBlock(!0),K.createElementBlock(K.Fragment,null,K.renderList(g.searchAddressResult,Ee=>(K.openBlock(),K.createBlock(T,{class:"cursor-pointer dark:hs-selected:bg-neutral-800 py-2 px-4 w-full text-sm text-gray-800 hover:bg-gray-100 rounded-lg focus:outline-none focus:bg-gray-100 dark:text-neutral-300 dark:hover:bg-neutral-800 dark:focus:bg-neutral-800",key:Ee==null?void 0:Ee.id,value:Ee,label:Ee.text},null,8,["value","label"]))),128))]),_:1},8,["modelValue","onOnSearch","onUpdate:modelValue","onClick"])):K.createCommentVNode("",!0),g.maskForSearch?(K.openBlock(),K.createBlock(ye,{key:2,"model-value":g.search,"onUpdate:modelValue":g.handleDebouncedUpdateValue,class:"w-full table-interface-search",placeholder:"Пошук",mask:g.maskForSearch,icon:"search",iconPosition:"left",clearable:"",style:{height:"38px","min-width":"300px","max-width":"300px"},ref:"searchInput"},null,8,["model-value","onUpdate:modelValue","mask"])):g.searchShow?(K.openBlock(),K.createBlock(ve,{key:3,"model-value":g.search,"onUpdate:modelValue":g.handleDebouncedUpdateValue,class:"w-full table-interface-search max-w-[300px] h-[38px]",placeholder:"Пошук",icon:"search","icon-position":"left",clearable:"",style:{height:"38px"},ref:"searchInput"},null,8,["model-value","onUpdate:modelValue"])):K.createCommentVNode("",!0),K.createElementVNode("div",ng,[g.filters?(K.openBlock(),K.createBlock(le,{key:0,modelValue:g.mountedFilter,ref:"filter",scheme:g.filters,urlSeparator:"true",history:!0,closeFilterBtn:!0,view:"plain",clearable:!1,name:"filter",onFilterChange:S[2]||(S[2]=Ee=>{g.handleFilterChange(Ee),g.updateTableAndMap()})},{button:K.withCtx(({visible:Ee})=>[K.createElementVNode("button",{type:"button",class:K.normalizeClass(["py-2 px-2.5 h-[40px] inline-flex items-center gap-x-1.5 text-sm font-medium rounded-lg bg-white text-gray-800 hover:bg-gray-50 focus:outline-none focus:bg-gray-50",[Ee?"border border-blue-600 border-2":"border border-gray-200"]])},[K.createVNode(be),K.createTextVNode(" Фільтри "),g.activeFiltersCount>=1?(K.openBlock(),K.createElementBlock("span",sg,K.toDisplayString(g.activeFiltersCount),1)):K.createCommentVNode("",!0)],2)]),_:1},8,["modelValue","scheme"])):K.createCommentVNode("",!0)])]),K.createElementVNode("button",{type:"button",class:"py-2 px-2 inline-flex items-center gap-x-1.5 text-sm rounded-lg border border-gray-200 bg-white text-gray-600 shadow-sm hover:bg-stone-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-100",title:g.isMapVisible?"Приховати карту":"Показати карту",onClick:S[3]||(S[3]=(...Ee)=>g.toggleMapVisible&&g.toggleMapVisible(...Ee))},[g.isMapVisible?(K.openBlock(),K.createBlock(ae,{key:0})):(K.openBlock(),K.createBlock(gt,{key:1})),ag],8,og)]),K.createElementVNode("div",lg,[K.createElementVNode("div",{class:K.normalizeClass(["relative overflow-hidden",g.isMapVisible?"w-2/4 mr-0":"w-full mr-3",g.isSelectObj?"hidden":""])},[K.createElementVNode("h1",cg,[K.createElementVNode("span",hg,K.toDisplayString(g.title),1),K.createElementVNode("span",ug,K.toDisplayString(g.filtered),1),dg]),K.createElementVNode("div",pg,[g.activeFilters?(K.openBlock(),K.createElementBlock("div",fg,[(K.openBlock(!0),K.createElementBlock(K.Fragment,null,K.renderList(g.activeFilters,(Ee,Pt,Tt)=>(K.openBlock(),K.createElementBlock("span",{class:"mb-[10px] py-1 ps-3 pe-1 inline-flex items-center bg-white border border-gray-200 text-gray-800 text-xs rounded-full",key:Tt},[K.createElementVNode("span",mg,K.toDisplayString(g.getLabelById(Pt)),1),gg,K.createElementVNode("span",_g,K.toDisplayString(g.getOptionsLabelById(Pt,Ee)),1),K.createElementVNode("button",{type:"button",class:"inline-flex shrink-0 justify-center items-center size-5 ms-1 rounded-full text-gray-600 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 text-sm",onClick:Gt=>g.clearFilter(Pt)},[K.createVNode(Ze)],8,yg)]))),128)),((Mt=Object.keys(g.activeFilters))==null?void 0:Mt.length)>=2?(K.openBlock(),K.createElementBlock("span",xg,[vg,K.createElementVNode("button",{type:"button",class:"inline-flex shrink-0 justify-center items-center size-5 ms-1 rounded-full text-gray-600 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 text-sm",onClick:S[4]||(S[4]=Ee=>g.mountedFilter={})},[K.createVNode(Ze)])])):K.createCommentVNode("",!0)])):K.createCommentVNode("",!0),g.total>=1?K.renderSlot(g.$slots,"table",{key:1,rows:g.tableData,map:g.map,selectRow:g.selectRow,getData:g.getData,isMapVisible:g.isMapVisible}):(K.openBlock(),K.createElementBlock("div",bg,[K.createVNode(tt),wg,Sg,K.createElementVNode("button",{type:"button",class:"mt-[10px] py-2 px-2.5 inline-flex items-center gap-x-1.5 text-xs rounded-lg border border-stone-200 bg-white text-stone-800 shadow-sm hover:bg-stone-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-stone-100",onClick:S[5]||(S[5]=(...Ee)=>g.resetFilters&&g.resetFilters(...Ee))}," Очистити дані пошуку ")]))]),g.total>=1?(K.openBlock(),K.createElementBlock("hr",Tg)):K.createCommentVNode("",!0),g.total>=1?(K.openBlock(),K.createElementBlock("div",Ig,[K.createElementVNode("div",Pg,[K.createVNode(Ue,{total:g.total,maxPages:7,defaultPage:g.currentPage,pageSize:g.limit,goTo:!1,size:"medium",onPageChange:g.handlePageChange,backgroundColor:"#e5e7eb",borderedCellSelected:!0,pageSizes:[10,20,30],onPageSizeChange:g.changeLimit},null,8,["total","defaultPage","pageSize","onPageChange","onPageSizeChange"])])])):K.createCommentVNode("",!0)],2),g.isSelectObj?(K.openBlock(),K.createElementBlock("div",{key:0,class:K.normalizeClass(g.isMapVisible?"w-2/4 mr-0 pb-5":"w-full pb-5 mr-3"),style:{height:"calc(100vh - 152px)"}},[K.renderSlot(g.$slots,"details",{table:g.table,selectedId:g.selectedId,selectedRow:g.selectedRow,map:g.map,closeObjCard:g.closeObjCard,isMapVisible:g.isMapVisible})],2)):K.createCommentVNode("",!0),K.withDirectives(K.createElementVNode("div",kg,[K.createElementVNode("section",Ag,[K.createVNode(dt,{height:"calc(100vh - 152px)",width:"w-2/4",table:g.table,filtersParam:g.filtersParam,row:g.selectedRow,legendname:g.legendname,legend:g.legend,colorAttr:g.colorAttr,maxBounds:g.maxBounds,center:g.center,zoom:g.zoom,basemap:g.basemap,pointZoom:g.pointZoom,defaultColor:g.defaultColor},null,8,["table","filtersParam","row","legendname","legend","colorAttr","maxBounds","center","zoom","basemap","pointZoom","defaultColor"])])],512),[[K.vShow,g.isMapVisible]])]),K.createElementVNode("div",Cg,[K.renderSlot(g.$slots,"popup",{data:g.hoverData})],512)])])}const Nu=Or(eg,[["render",Eg]]),Uu={install:g=>{g.component("VsPartsMap",Nu)},components:{VsPartsMap:Nu}};return typeof window<"u"&&(window.PartsMap=Uu),Uu});
|