@opengis/partsmap 0.0.15 → 0.0.16
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 +638 -637
- package/dist/PartsMap.umd.cjs +2 -2
- package/dist/style.css +1 -1
- 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,_,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!==_||this.boundDynamicVertexBuffer2!==v||this.boundDynamicVertexBuffer3!==b?this.freshBind(n,o,a,h,m,_,v,b):(t.bindVertexArray.set(this.vao),_&&_.bind(),h&&h.dynamicDraw&&h.bind(),v&&v.bind(),b&&b.bind())}freshBind(t,n,o,a,h,m,_,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=_,this.boundDynamicVertexBuffer3=v,n.enableAttributes(k,t);for(const L of o)L.enableAttributes(k,t);m&&m.enableAttributes(k,t),_&&_.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(),_&&(_.bind(),_.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 _=t.gl;this.program=_.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():[],V=k.concat(L).concat(B),Z=[];for(const le of V)Z.indexOf(le)<0&&Z.push(le);const U=o?o.defines():[];h&&U.push("#define OVERDRAW_INSPECTOR;"),m&&U.push("#define TERRAIN3D;");const H=U.concat(Xr.prelude.fragmentSource,n.fragmentSource).join(`
|
579
579
|
`),K=U.concat(Xr.prelude.vertexSource,n.vertexSource).join(`
|
580
|
-
`),j=_.createShader(_.FRAGMENT_SHADER);if(_.isContextLost())return void(this.failedToCreate=!0);if(_.shaderSource(j,H),_.compileShader(j),!_.getShaderParameter(j,_.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${_.getShaderInfoLog(j)}`);_.attachShader(this.program,j);const te=_.createShader(_.VERTEX_SHADER);if(_.isContextLost())return void(this.failedToCreate=!0);if(_.shaderSource(te,K),_.compileShader(te),!_.getShaderParameter(te,_.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${_.getShaderInfoLog(te)}`);_.attachShader(this.program,te),this.attributes={};const se={};this.numAttributes=P.length;for(let le=0;le<this.numAttributes;le++)P[le]&&(_.bindAttribLocation(this.program,le,P[le]),this.attributes[P[le]]=le);if(_.linkProgram(this.program),!_.getProgramParameter(this.program,_.LINK_STATUS))throw new Error(`Program failed to link: ${_.getProgramInfoLog(this.program)}`);_.deleteShader(te),_.deleteShader(j);for(let le=0;le<Z.length;le++){const ge=Z[le];if(ge&&!se[ge]){const be=_.getUniformLocation(this.program,ge);be&&(se[ge]=be)}}this.fixedUniforms=a(t,se),this.terrainUniforms=((le,ge)=>({u_depth:new c.aI(le,ge.u_depth),u_terrain:new c.aI(le,ge.u_terrain),u_terrain_dim:new c.aJ(le,ge.u_terrain_dim),u_terrain_matrix:new c.aK(le,ge.u_terrain_matrix),u_terrain_unpack:new c.aL(le,ge.u_terrain_unpack),u_terrain_exaggeration:new c.aJ(le,ge.u_terrain_exaggeration)}))(t,se),this.binderUniforms=o?o.getUniforms(t,se):[]}draw(t,n,o,a,h,m,_,v,b,P,k,L,B,V,Z,U,H,K){const j=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(j.TEXTURE2),j.bindTexture(j.TEXTURE_2D,v.depthTexture),t.activeTexture.set(j.TEXTURE3),j.bindTexture(j.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(_[se]);Z&&Z.setUniforms(t,this.binderUniforms,B,{zoom:V});let te=0;switch(n){case j.LINES:te=2;break;case j.TRIANGLES:te=3;break;case j.LINE_STRIP:te=1}for(const se of L.get()){const le=se.vaos||(se.vaos={});(le[b]||(le[b]=new qs)).bind(t,this,P,Z?Z.getPaintVertexBuffers():[],k,se.vertexOffset,U,H,K),j.drawElements(n,se.primitiveLength*te,j.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),_=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,_>>16],u_pixel_coord_lower:[65535&m,65535&_]}}const Hs=(u,t,n,o)=>{const a=t.style.light,h=a.properties.get("position"),m=[h.x,h.y,h.z],_=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}(_,-t.transform.angle),function(b,P,k){var L=P[0],B=P[1],V=P[2];b[0]=L*k[0]+B*k[3]+V*k[6],b[1]=L*k[1]+B*k[4]+V*k[7],b[2]=L*k[2]+B*k[5]+V*k[8]}(m,m,_);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)),Bc=(u,t)=>({u_matrix:u,u_world:t}),Fc=(u,t,n,o,a)=>c.e(zn(u,t,n,o),{u_world:a}),dl=(u,t,n,o)=>{const a=u.transform;let h,m;if(o.paint.get("circle-pitch-alignment")==="map"){const _=rt(n,1,a.zoom);h=!0,m=[_,_]}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}},Oc=(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}),ji=(u,t,n,o)=>({u_matrix:u,u_extrude_scale:rt(t,1,n),u_intensity:o});function Ui(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:ml(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}),pl=(u,t,n,o,a)=>{const h=u.transform,m=un(t,h);return{u_matrix:ml(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]]}},fl=(u,t,n,o,a,h)=>{const m=u.lineAtlas,_=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:[_/k,-b.height/2],u_patternscale_b:[_/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 ml(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 Vc=(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:Nc(a.paint.get("raster-hue-rotate"))};var h,m};function Nc(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 gl=(u,t,n,o,a,h,m,_,v,b,P,k,L,B)=>{const V=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:V.cameraToCenterDistance,u_pitch:V.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:V.width/V.height,u_fade_change:m.options.fadeDuration?m.symbolFadeChange:1,u_matrix:_,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}},_l=(u,t,n,o,a,h,m,_,v,b,P,k,L,B,V)=>{const Z=m.transform;return c.e(gl(u,t,n,o,a,h,m,_,v,b,P,k,L,V),{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,_,v,b,P,k,L,B)=>c.e(_l(u,t,n,o,a,h,m,_,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,_,v,b){const P=v.imageManager.getPattern(m.from.toString()),k=v.imageManager.getPattern(m.to.toString()),{width:L,height:B}=v.imageManager.getPixelSize(),V=Math.pow(2,b.tileID.overscaledZ),Z=b.tileSize*Math.pow(2,v.transform.tileZoom)/V,U=Z*(b.tileID.canonical.x+b.tileID.wrap*V),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:_.t,u_pattern_size_a:P.displaySize,u_pattern_size_b:k.displaySize,u_scale_a:_.fromScale,u_scale_b:_.toScale,u_tile_units_to_pixels:1/rt(b,1,v.transform.tileZoom),u_pixel_coord_upper:[U>>16,H>>16],u_pixel_coord_lower:[65535&U,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 Uc 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 $c 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 qc extends ut{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class yl 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 Zc 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 xl 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 vl 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 bl 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 wl 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 Sl 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 Tl 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 Gc 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 Hc 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 Il 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 Xc 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 Wc 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 Jc 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 Pl 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 kl 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 El 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 Cl 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 Al 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,_=this.framebuffer=m.createFramebuffer();if(this.colorAttachment=new Jo(t,_),a)this.depthAttachment=h?new Al(t,_):new Ko(t,_);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 Et{constructor(t,n,o){this.blendFunction=t,this.blendColor=n,this.mask=o}}Et.Replace=[1,0],Et.disabled=new Et(Et.Replace,c.aN.transparent,[!1,!1,!1,!1]),Et.unblended=new Et(Et.Replace,c.aN.transparent,[!0,!0,!0,!0]),Et.alphaBlended=new Et([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 Uc(this),this.clearStencil=new Ys(this),this.colorMask=new $c(this),this.depthMask=new Ln(this),this.stencilMask=new qc(this),this.stencilFunc=new yl(this),this.stencilOp=new Zc(this),this.stencilTest=new xl(this),this.depthRange=new Xo(this),this.depthTest=new vl(this),this.depthFunc=new bl(this),this.blend=new wl(this),this.blendFunc=new Sl(this),this.blendColor=new dn(this),this.blendEquation=new Tl(this),this.cullFace=new Gc(this),this.cullFaceSide=new Hc(this),this.frontFace=new Il(this),this.program=new _s(this),this.activeTexture=new Xc(this),this.viewport=new Qs(this),this.bindFramebuffer=new Wc(this),this.bindRenderbuffer=new Jc(this),this.bindTexture=new Pl(this),this.bindVertexBuffer=new kl(this),this.bindElementBuffer=new El(this),this.bindVertexArray=new Wo(this),this.pixelStoreUnpack=new Cl(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,Et.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 Mt{constructor(t,n,o){this.enable=t,this.mode=n,this.frontFace=o}}let xs;function Ml(u,t,n,o,a){const h=u.context,m=h.gl,_=u.useProgram("collisionBox"),v=[];let b=0,P=0;for(let H=0;H<o.length;H++){const K=o[H],j=t.getTile(K).getBucket(n);if(!j)continue;const te=a?j.textCollisionBox:j.iconCollisionBox,se=j.collisionCircleArray;if(se.length>0){const le=c.H();c.aR(le,j.placementInvProjMatrix,u.transform.glCoordMatrix),c.aR(le,le,j.placementViewportMatrix),v.push({circleArray:se,circleOffset:P,transform:K.posMatrix,invTransform:le,coord:K}),b+=se.length/4,P=b}te&&_.draw(h,m.LINES,ct.disabled,Vt.disabled,u.colorModeForRenderPass(),Mt.disabled,{u_matrix:K.posMatrix,u_pixel_extrude_scale:[1/(k=u.transform).width,1/k.height]},u.style.map.terrain&&u.style.map.terrain.getTerrainData(K),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 V=0;for(const H of v)for(let K=0;K<H.circleArray.length/4;K++){const j=4*K,te=H.circleArray[j+0],se=H.circleArray[j+1],le=H.circleArray[j+2],ge=H.circleArray[j+3];B.emplace(V++,te,se,le,ge,0),B.emplace(V++,te,se,le,ge,1),B.emplace(V++,te,se,le,ge,2),B.emplace(V++,te,se,le,ge,3)}(!xs||xs.length<2*b)&&(xs=function(H){const K=2*H,j=new c.aU;j.resize(K),j._trim();for(let te=0;te<K;te++){const se=6*te;j.uint16[se+0]=4*te+0,j.uint16[se+1]=4*te+1,j.uint16[se+2]=4*te+2,j.uint16[se+3]=4*te+2,j.uint16[se+4]=4*te+3,j.uint16[se+5]=4*te+0}return j}(b));const Z=h.createIndexBuffer(xs,!0),U=h.createVertexBuffer(B,c.aT.members,!0);for(const H of v){const K=Oc(H.transform,H.invTransform,u.transform);L.draw(h,m.TRIANGLES,ct.disabled,Vt.disabled,u.colorModeForRenderPass(),Mt.disabled,K,u.style.map.terrain&&u.style.map.terrain.getTerrainData(H.coord),n.id,U,Z,c.a0.simpleSegment(0,2*H.circleOffset,H.circleArray.length,H.circleArray.length/2),null,u.transform.zoom,null,null,null)}U.destroy(),Z.destroy()}Mt.disabled=new Mt(!1,1029,2305),Mt.backCCW=new Mt(!0,1029,2305);const ta=c.ao(new Float32Array(16));function to(u,t,n,o,a,h){const{horizontalAlign:m,verticalAlign:_}=c.av(u);return new c.P((-(m-.5)*t/a+o[0])*h,(-(_-.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 _=o.mult(h);return n||(_=_.rotate(-a)),G(m.add(_),t.labelPlaneMatrix,t.getElevation).point}if(n){const _=pe(t.tileAnchorPoint.x+1,t.tileAnchorPoint.y,t).point.sub(u),v=Math.atan(_.y/_.x)+(_.x<0?Math.PI:0);return u.add(o.rotate(v))}return u.add(o)}function ro(u,t,n,o,a,h,m,_,v,b,P,k,L,B){const V=u.text.placedSymbolArray,Z=u.text.dynamicLayoutVertexArray,U=u.icon.dynamicLayoutVertexArray,H={};Z.clear();for(let K=0;K<V.length;K++){const j=V.get(K),te=j.hidden||!j.crossTileID||u.allowVerticalPlacement&&!j.placedOrientation?null:o[j.crossTileID];if(te){const se=new c.P(j.anchorX,j.anchorY),le={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,le),be=M(a.cameraToCenterDistance,ge.signedDistanceFromCamera);let Le=c.aj(u.textSizeData,v,j)*be/c.aq;n&&(Le*=u.tilePixelRatio/_);const{width:Be,height:we,anchor:Te,textOffset:Ne,textBoxScale:tt}=te,ke=to(Te,Be,we,Ne,tt,Le),Me=P.getPitchedTextCorrection(a,se.add(new c.P(k[0],k[1])),L),Ye=io(ge.point,le,t,ke,a.angle,Me),Dt=u.allowVerticalPlacement&&j.placedOrientation===c.ai.vertical?Math.PI/2:0;for(let st=0;st<j.numGlyphs;st++)c.ak(Z,Ye,Dt);b&&j.associatedIconIndex>=0&&(H[j.associatedIconIndex]={shiftedAnchor:Ye,angle:Dt})}else Xe(j.numGlyphs,Z)}if(b){U.clear();const K=u.icon.placedSymbolArray;for(let j=0;j<K.length;j++){const te=K.get(j);if(te.hidden)Xe(te.numGlyphs,U);else{const se=H[j];if(se)for(let le=0;le<te.numGlyphs;le++)c.ak(U,se.shiftedAnchor,se.angle);else Xe(te.numGlyphs,U)}}u.icon.dynamicLayoutVertexBuffer.updateData(U)}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,_,v,b,P,k){const L=u.context,B=L.gl,V=u.transform,Z=Us(),U=_==="map",H=v==="map",K=_!=="viewport"&&n.layout.get("symbol-placement")!=="point",j=U&&!H&&!K,te=!H&&K,se=!n.layout.get("symbol-sort-key").isConstant();let le=!1;const ge=u.depthModeForSublayer(0,ct.ReadOnly),be=n._unevaluatedLayout.hasValue("text-variable-anchor")||n._unevaluatedLayout.hasValue("text-variable-anchor-offset"),Le=[],Be=Z.getCircleRadiusCorrection(V);for(const we of o){const Te=t.getTile(we),Ne=Te.getBucket(n);if(!Ne)continue;const tt=a?Ne.text:Ne.icon;if(!tt||!tt.segments.get().length||!tt.hasVisibleVertices)continue;const ke=tt.programConfigurations.get(n.id),Me=a||Ne.sdfIcons,Ye=a?Ne.textSizeData:Ne.iconSizeData,Dt=H||V.pitch!==0,st=u.useProgram(ia(Me,a,Ne),ke),ht=c.ah(Ye,V.zoom),Lt=u.style.map.terrain&&u.style.map.terrain.getTerrainData(we);let di,rr,Rt,Mi,Ii=[0,0],pi=null;if(a)rr=Te.glyphAtlasTexture,Rt=B.LINEAR,di=Te.glyphAtlasTexture.size,Ne.iconsInText&&(Ii=Te.imageAtlasTexture.size,pi=Te.imageAtlasTexture,Mi=Dt||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,Rt=Me||u.options.rotating||u.options.zooming||Nt||Dt?B.LINEAR:B.NEAREST,di=Te.imageAtlasTexture.size}const fi=rt(Te,1,u.transform.zoom),nr=te?we.posMatrix:ta,vn=Gr(nr,H,U,u.transform,fi),xo=gr(nr,H,U,u.transform,fi),$n=gr(we.posMatrix,H,U,u.transform,fi),bn=Z.translatePosition(u.transform,Te,h,m),vo=be&&Ne.hasTextData(),Da=n.layout.get("icon-text-fit")!=="none"&&vo&&Ne.hasIconData();if(K){const Nt=u.style.map.terrain?(La,ti)=>u.style.map.terrain.getElevation(we,La,ti):null,Zn=n.layout.get("text-rotation-alignment")==="map";O(Ne,we.posMatrix,u,a,vn,$n,H,b,Zn,Z,we.toUnwrapped(),V.width,V.height,bn,Nt)}const oi=we.posMatrix,sr=a&&be||Da,Qr=K||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,j,H,K,sr,u,oi,Qr,qn,bn,di,Ii,Be):_l(Ye.kind,ht,j,H,K,sr,u,oi,Qr,qn,bn,a,di,!0,Be):gl(Ye.kind,ht,j,H,K,sr,u,oi,Qr,qn,bn,a,di,Be);const ri={program:st,buffers:tt,uniformValues:gi,atlasTexture:rr,atlasTextureIcon:pi,atlasInterpolation:Rt,atlasInterpolationIcon:Mi,isSDF:Me,hasHalo:mi};if(se&&Ne.canOverlap){le=!0;const Nt=tt.segments.get();for(const Zn of Nt)Le.push({segments:new c.a0([Zn]),sortKey:Zn.sortKey,state:ri,terrainData:Lt})}else Le.push({segments:tt.segments,sortKey:0,state:ri,terrainData:Lt})}le&&Le.sort((we,Te)=>we.sortKey-Te.sortKey);for(const we of Le){const Te=we.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,we.segments,n,u,Te.program,ge,P,k,Ne,we.terrainData)),Ne.u_is_halo=0}pn(Te.buffers,we.segments,n,u,Te.program,ge,P,k,Te.uniformValues,we.terrainData)}}function pn(u,t,n,o,a,h,m,_,v,b){const P=o.context;a.draw(P,P.gl.TRIANGLES,h,m,_,Mt.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()],_=h[n.from.toString()];if(!m&&_&&(m=_),!_&&m&&(_=m),!m||!_){const v=a.getPaintProperty(t);m=h[v],_=h[v]}m&&_&&u.setConstantPatternPositions(m,_)}function ra(u,t,n,o,a,h,m){const _=u.context.gl,v="fill-pattern",b=n.paint.get(v),P=b&&b.constantOr(1),k=n.getCrossfadeParameters();let L,B,V,Z,U;m?(B=P&&!n.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",L=_.LINES):(B=P?"fillPattern":"fill",L=_.TRIANGLES);const H=b.constantOr(null);for(const K of o){const j=t.getTile(K);if(P&&!j.patternsLoaded())continue;const te=j.getBucket(n);if(!te)continue;const se=te.programConfigurations.get(n.id),le=u.useProgram(B,se),ge=u.style.map.terrain&&u.style.map.terrain.getTerrainData(K);P&&(u.context.activeTexture.set(_.TEXTURE0),j.imageAtlasTexture.bind(_.LINEAR,_.CLAMP_TO_EDGE),se.updatePaintBuffers(k)),$i(se,v,H,j,n);const be=ge?K:null,Le=u.translatePosMatrix(be?be.posMatrix:K.posMatrix,j,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));if(m){Z=te.indexBuffer2,U=te.segments2;const Be=[_.drawingBufferWidth,_.drawingBufferHeight];V=B==="fillOutlinePattern"&&P?Fc(Le,u,k,j,Be):Bc(Le,Be)}else Z=te.indexBuffer,U=te.segments,V=P?zn(Le,u,k,j):ps(Le);le.draw(u.context,L,a,u.stencilModeForClipping(K),h,Mt.disabled,V,ge,n.id,te.layoutVertexBuffer,Z,U,n.paint,u.transform.zoom,se)}}function no(u,t,n,o,a,h,m){const _=u.context,v=_.gl,b="fill-extrusion-pattern",P=n.paint.get(b),k=P.constantOr(1),L=n.getCrossfadeParameters(),B=n.paint.get("fill-extrusion-opacity"),V=P.constantOr(null);for(const Z of o){const U=t.getTile(Z),H=U.getBucket(n);if(!H)continue;const K=u.style.map.terrain&&u.style.map.terrain.getTerrainData(Z),j=H.programConfigurations.get(n.id),te=u.useProgram(k?"fillExtrusionPattern":"fillExtrusion",j);k&&(u.context.activeTexture.set(v.TEXTURE0),U.imageAtlasTexture.bind(v.LINEAR,v.CLAMP_TO_EDGE),j.updatePaintBuffers(L)),$i(j,b,V,U,n);const se=u.translatePosMatrix(Z.posMatrix,U,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),le=n.paint.get("fill-extrusion-vertical-gradient"),ge=k?Xs(se,u,le,B,Z,L,U):Hs(se,u,le,B);te.draw(_,_.gl.TRIANGLES,a,h,m,Mt.backCCW,ge,K,n.id,H.layoutVertexBuffer,H.indexBuffer,H.segments,n.paint,u.transform.zoom,j,u.style.map.terrain&&H.centroidVertexBuffer)}}function na(u,t,n,o,a,h,m){const _=u.context,v=_.gl,b=n.fbo;if(!b)return;const P=u.useProgram("hillshade"),k=u.style.map.terrain&&u.style.map.terrain.getTerrainData(t);_.activeTexture.set(v.TEXTURE0),v.bindTexture(v.TEXTURE_2D,b.colorAttachment.get()),P.draw(_,v.TRIANGLES,a,h,m,Mt.disabled,((L,B,V,Z)=>{const U=V.paint.get("hillshade-shadow-color"),H=V.paint.get("hillshade-highlight-color"),K=V.paint.get("hillshade-accent-color");let j=V.paint.get("hillshade-illumination-direction")*(Math.PI/180);V.paint.get("hillshade-illumination-anchor")==="viewport"&&(j-=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:Ui(0,B.tileID),u_light:[V.paint.get("hillshade-exaggeration"),j],u_shadow:U,u_highlight:H,u_accent:K}})(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,_=m.gl,v=t.dem;if(v&&v.data){const b=v.dim,P=v.stride,k=v.getPixels();if(m.activeTexture.set(_.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(_.NEAREST,_.CLAMP_TO_EDGE)}else t.demTexture=new bt(m,k,_.RGBA,{premultiply:!1}),t.demTexture.bind(_.NEAREST,_.CLAMP_TO_EDGE);m.activeTexture.set(_.TEXTURE0);let L=t.fbo;if(!L){const B=new bt(m,{width:b,height:b,data:null},_.RGBA);B.bind(_.LINEAR,_.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,_.TRIANGLES,o,a,h,Mt.disabled,((B,V)=>{const Z=V.stride,U=c.H();return c.aQ(U,0,c.X,-c.X,0,0,1),c.J(U,U,[0,-c.X,0]),{u_matrix:U,u_image:1,u_dimension:[Z,Z],u_zoom:B.overscaledZ,u_unpack:V.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 _=ce.now(),v=(_-u.timeAdded)/m,b=t?(_-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),zl=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,_=m.gl;_.enable(_.SCISSOR_TEST),_.scissor(t*u.pixelRatio,n*u.pixelRatio,o*u.pixelRatio,a*u.pixelRatio),m.clear({color:h}),_.disable(_.SCISSOR_TEST)}function ft(u,t,n){const o=u.context,a=o.gl,h=n.posMatrix,m=u.useProgram("debug"),_=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),V=t.getTile(n).tileSize,Z=512/Math.min(V,512)*(n.overscaledZ/u.transform.zoom)*.5;let U=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(U+=` => ${n.overscaledZ}`),function(H,K){H.initDebugOverlayCanvas();const j=H.debugOverlayCanvas,te=H.context.gl,se=H.debugOverlayCanvas.getContext("2d");se.clearRect(0,0,j.width,j.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(K,5,5),se.strokeText(K,5,5),H.debugOverlayTexture.update(j),H.debugOverlayTexture.bind(te.LINEAR,te.CLAMP_TO_EDGE)}(u,`${U} ${B}kB`),m.draw(o,a.TRIANGLES,_,v,Et.alphaBlended,Mt.disabled,Wr(h,c.aN.transparent,Z),null,P,u.debugBuffer,u.quadTriangleIndexBuffer,u.debugSegments),m.draw(o,a.LINE_STRIP,_,v,b,Mt.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),_=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),V=u.transform.calculateFogMatrix(b.tileID.toUnwrapped()),Z=$o(L,B,V,u.style.sky,u.transform.pitch);_.draw(o,a.TRIANGLES,m,Vt.disabled,h,Mt.backCCW,Z,k,"terrain",v.vertexBuffer,v.indexBuffer,v.segments)}}class Dl{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 Ll{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 _=new c.aY;_.emplaceBack(0,1,2),_.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(_);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,Et.disabled,Mt.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(Et.disabled),o.setDepthMode(ct.disabled);const h=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const m of n){const _=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},_,255,a.KEEP,a.KEEP,a.REPLACE),Et.disabled,Mt.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,_)=>_.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 _=0;_<h;_++)m[_+a]=new Vt({func:n.GEQUAL,mask:255},_+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 Et([t.CONSTANT_COLOR,t.ONE],new c.aN(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Et.unblended:Et.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(ce.now()),this.imageManager.beginFrame();const a=this.style._order,h=this.style.sourceCaches,m={},_={},v={};for(const b in h){const P=h[b];P.used&&P.prepare(this.context),m[b]=P.getVisibleCoordinates(),_[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=_[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=((K,j,te)=>({u_sky_color:K.properties.get("sky-color"),u_horizon_color:K.properties.get("horizon-color"),u_horizon:(j.height/2+j.getHorizon())*te,u_sky_horizon_blend:K.properties.get("sky-horizon-blend")*j.height/2*te}))(P,b.style.map.transform,b.pixelRatio),V=new ct(L.LEQUAL,ct.ReadWrite,[0,1]),Z=Vt.disabled,U=b.colorModeForRenderPass(),H=b.useProgram("sky");if(!P.mesh){const K=new c.aX;K.emplaceBack(-1,-1),K.emplaceBack(1,-1),K.emplaceBack(1,1),K.emplaceBack(-1,1);const j=new c.aY;j.emplaceBack(0,1,2),j.emplaceBack(0,2,3),P.mesh=new Dl(k.createVertexBuffer(K,us.members),k.createIndexBuffer(j),c.a0.simpleSegment(0,0,K.length,j.length))}H.draw(k,L.TRIANGLES,V,Z,U,Mt.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:_)[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]]:[]),V=B.filter(H=>H.getSource().type==="vector"),Z=B.filter(H=>H.getSource().type!=="vector"),U=H=>{(!L||L.getSource().maxzoom<H.getSource().maxzoom)&&(L=H)};return V.forEach(H=>U(H)),L||Z.forEach(H=>U(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,zl);const k=b.transform.centerPoint;(function(L,B,V,Z){Bn(L,B-1,V-10,2,20,Z),Bn(L,B-10,V-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 _=h.context,v=_.gl,b=Et.unblended,P=new ct(v.LEQUAL,ct.ReadWrite,[0,1]),k=m.getTerrainMesh(),L=m.sourceCache.getRenderableTiles(),B=h.useProgram("terrainDepth");_.bindFramebuffer.set(m.getFramebuffer("depth").framebuffer),_.viewport.set([0,0,h.width/devicePixelRatio,h.height/devicePixelRatio]),_.clear({color:c.aN.transparent,depth:1});for(const V of L){const Z=m.getTerrainData(V.tileID),U={u_matrix:h.transform.calculatePosMatrix(V.tileID.toUnwrapped()),u_ele_delta:m.getMeshFrameDelta(h.transform.zoom)};B.draw(_,v.TRIANGLES,P,Vt.disabled,b,Mt.backCCW,U,Z,"terrain",k.vertexBuffer,k.indexBuffer,k.segments)}_.bindFramebuffer.set(null),_.viewport.set([0,0,h.width,h.height])}(this,this.style.map.terrain),function(h,m){const _=h.context,v=_.gl,b=Et.unblended,P=new ct(v.LEQUAL,ct.ReadWrite,[0,1]),k=m.getTerrainMesh(),L=m.getCoordsTexture(),B=m.sourceCache.getRenderableTiles(),V=h.useProgram("terrainCoords");_.bindFramebuffer.set(m.getFramebuffer("coords").framebuffer),_.viewport.set([0,0,h.width/devicePixelRatio,h.height/devicePixelRatio]),_.clear({color:c.aN.transparent,depth:1}),m.coordsIndex=[];for(const Z of B){const U=m.getTerrainData(Z.tileID);_.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)};V.draw(_,v.TRIANGLES,P,Vt.disabled,b,Mt.backCCW,H,U,"terrain",k.vertexBuffer,k.indexBuffer,k.segments),m.coordsIndex.push(Z.tileID.key)}_.bindFramebuffer.set(null),_.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,_,v,b){if(h.renderPass!=="translucent")return;const P=Vt.disabled,k=h.colorModeForRenderPass();(_._unevaluatedLayout.hasValue("text-variable-anchor")||_._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(L,B,V,Z,U,H,K,j,te){const se=B.transform,le=Us(),ge=U==="map",be=H==="map";for(const Le of L){const Be=Z.getTile(Le),we=Be.getBucket(V);if(!we||!we.text||!we.text.segments.get().length)continue;const Te=c.ah(we.textSizeData,se.zoom),Ne=rt(Be,1,B.transform.zoom),tt=Gr(Le.posMatrix,be,ge,B.transform,Ne),ke=V.layout.get("icon-text-fit")!=="none"&&we.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,Dt=le.translatePosition(se,Be,K,j);ro(we,ge,be,te,se,tt,Le.posMatrix,Me,Te,ke,le,Dt,Le.toUnwrapped(),Ye)}}}(v,h,_,m,_.layout.get("text-rotation-alignment"),_.layout.get("text-pitch-alignment"),_.paint.get("text-translate"),_.paint.get("text-translate-anchor"),b),_.paint.get("icon-opacity").constantOr(1)!==0&&Jr(h,m,_,v,!1,_.paint.get("icon-translate"),_.paint.get("icon-translate-anchor"),_.layout.get("icon-rotation-alignment"),_.layout.get("icon-pitch-alignment"),_.layout.get("icon-keep-upright"),P,k),_.paint.get("text-opacity").constantOr(1)!==0&&Jr(h,m,_,v,!0,_.paint.get("text-translate"),_.paint.get("text-translate-anchor"),_.layout.get("text-rotation-alignment"),_.layout.get("text-pitch-alignment"),_.layout.get("text-keep-upright"),P,k),m.map.showCollisionBoxes&&(Ml(h,m,_,v,!0),Ml(h,m,_,v,!1))})(t,n,o,a,this.style.placement.variableOffsets);break;case"circle":(function(h,m,_,v){if(h.renderPass!=="translucent")return;const b=_.paint.get("circle-opacity"),P=_.paint.get("circle-stroke-width"),k=_.paint.get("circle-stroke-opacity"),L=!_.layout.get("circle-sort-key").isConstant();if(b.constantOr(1)===0&&(P.constantOr(1)===0||k.constantOr(1)===0))return;const B=h.context,V=B.gl,Z=h.depthModeForSublayer(0,ct.ReadOnly),U=Vt.disabled,H=h.colorModeForRenderPass(),K=[];for(let j=0;j<v.length;j++){const te=v[j],se=m.getTile(te),le=se.getBucket(_);if(!le)continue;const ge=le.programConfigurations.get(_.id),be=h.useProgram("circle",ge),Le=le.layoutVertexBuffer,Be=le.indexBuffer,we=h.style.map.terrain&&h.style.map.terrain.getTerrainData(te),Te={programConfiguration:ge,program:be,layoutVertexBuffer:Le,indexBuffer:Be,uniformValues:dl(h,te,se,_),terrainData:we};if(L){const Ne=le.segments.get();for(const tt of Ne)K.push({segments:new c.a0([tt]),sortKey:tt.sortKey,state:Te})}else K.push({segments:le.segments,sortKey:0,state:Te})}L&&K.sort((j,te)=>j.sortKey-te.sortKey);for(const j of K){const{programConfiguration:te,program:se,layoutVertexBuffer:le,indexBuffer:ge,uniformValues:be,terrainData:Le}=j.state;se.draw(B,V.TRIANGLES,Z,U,H,Mt.disabled,be,Le,_.id,le,ge,j.segments,_.paint,h.transform.zoom,te)}})(t,n,o,a);break;case"heatmap":(function(h,m,_,v){if(_.paint.get("heatmap-opacity")!==0)if(h.renderPass==="offscreen"){const b=h.context,P=b.gl,k=Vt.disabled,L=new Et([P.ONE,P.ONE],c.aN.transparent,[!0,!0,!0,!0]);(function(B,V,Z){const U=B.gl;B.activeTexture.set(U.TEXTURE1),B.viewport.set([0,0,V.width/4,V.height/4]);let H=Z.heatmapFbo;if(H)U.bindTexture(U.TEXTURE_2D,H.colorAttachment.get()),B.bindFramebuffer.set(H.framebuffer);else{const K=U.createTexture();U.bindTexture(U.TEXTURE_2D,K),U.texParameteri(U.TEXTURE_2D,U.TEXTURE_WRAP_S,U.CLAMP_TO_EDGE),U.texParameteri(U.TEXTURE_2D,U.TEXTURE_WRAP_T,U.CLAMP_TO_EDGE),U.texParameteri(U.TEXTURE_2D,U.TEXTURE_MIN_FILTER,U.LINEAR),U.texParameteri(U.TEXTURE_2D,U.TEXTURE_MAG_FILTER,U.LINEAR),H=Z.heatmapFbo=B.createFramebuffer(V.width/4,V.height/4,!1,!1),function(j,te,se,le){var ge,be;const Le=j.gl,Be=(ge=j.HALF_FLOAT)!==null&&ge!==void 0?ge:Le.UNSIGNED_BYTE,we=(be=j.RGBA16F)!==null&&be!==void 0?be:Le.RGBA;Le.texImage2D(Le.TEXTURE_2D,0,we,te.width/4,te.height/4,0,Le.RGBA,Be,null),le.colorAttachment.set(se)}(B,V,K,H)}})(b,h,_),b.clear({color:c.aN.transparent});for(let B=0;B<v.length;B++){const V=v[B];if(m.hasRenderableParent(V))continue;const Z=m.getTile(V),U=Z.getBucket(_);if(!U)continue;const H=U.programConfigurations.get(_.id),K=h.useProgram("heatmap",H),{zoom:j}=h.transform;K.draw(b,P.TRIANGLES,ct.disabled,k,L,Mt.disabled,ji(V.posMatrix,Z,j,_.paint.get("heatmap-intensity")),null,_.id,U.layoutVertexBuffer,U.indexBuffer,U.segments,_.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 V=P.colorRampTexture;V||(V=P.colorRampTexture=new bt(k,P.colorRamp,L.RGBA)),V.bind(L.LINEAR,L.CLAMP_TO_EDGE),b.useProgram("heatmapTexture").draw(k,L.TRIANGLES,ct.disabled,Vt.disabled,b.colorModeForRenderPass(),Mt.disabled,((Z,U,H,K)=>{const j=c.H();c.aQ(j,0,Z.width,Z.height,0,0,1);const te=Z.context.gl;return{u_matrix:j,u_world:[te.drawingBufferWidth,te.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:U.paint.get("heatmap-opacity")}})(b,P),null,P.id,b.viewportBuffer,b.quadTriangleIndexBuffer,b.viewportSegments,P.paint,b.transform.zoom)}(h,_))})(t,n,o,a);break;case"line":(function(h,m,_,v){if(h.renderPass!=="translucent")return;const b=_.paint.get("line-opacity"),P=_.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=_.paint.get("line-dasharray"),V=_.paint.get("line-pattern"),Z=V.constantOr(1),U=_.paint.get("line-gradient"),H=_.getCrossfadeParameters(),K=Z?"linePattern":B?"lineSDF":U?"lineGradient":"line",j=h.context,te=j.gl;let se=!0;for(const le of v){const ge=m.getTile(le);if(Z&&!ge.patternsLoaded())continue;const be=ge.getBucket(_);if(!be)continue;const Le=be.programConfigurations.get(_.id),Be=h.context.program.get(),we=h.useProgram(K,Le),Te=se||we.program!==Be,Ne=h.style.map.terrain&&h.style.map.terrain.getTerrainData(le),tt=V.constantOr(null);if(tt&&ge.imageAtlas){const Ye=ge.imageAtlas,Dt=Ye.patternPositions[tt.to.toString()],st=Ye.patternPositions[tt.from.toString()];Dt&&st&&Le.setConstantPatternPositions(Dt,st)}const ke=Ne?le:null,Me=Z?pl(h,ge,_,H,ke):B?fl(h,ge,_,B,H,ke):U?Ws(h,ge,_,be.lineClipsArray.length,ke):ms(h,ge,_,ke);if(Z)j.activeTexture.set(te.TEXTURE0),ge.imageAtlasTexture.bind(te.LINEAR,te.CLAMP_TO_EDGE),Le.updatePaintBuffers(H);else if(B&&(Te||h.lineAtlas.dirty))j.activeTexture.set(te.TEXTURE0),h.lineAtlas.bind(j);else if(U){const Ye=be.gradients[_.id];let Dt=Ye.texture;if(_.gradientVersion!==Ye.version){let st=256;if(_.stepInterpolant){const ht=m.getSource().maxzoom,Lt=le.canonical.z===ht?Math.ceil(1<<h.transform.maxZoom-le.canonical.z):1;st=c.ad(c.aV(be.maxLineLength/c.X*1024*Lt),256,j.maxTextureSize)}Ye.gradient=c.aW({expression:_.gradientExpression(),evaluationKey:"lineProgress",resolution:st,image:Ye.gradient||void 0,clips:be.lineClipsArray}),Ye.texture?Ye.texture.update(Ye.gradient):Ye.texture=new bt(j,Ye.gradient,te.RGBA),Ye.version=_.gradientVersion,Dt=Ye.texture}j.activeTexture.set(te.TEXTURE0),Dt.bind(_.stepInterpolant?te.NEAREST:te.LINEAR,te.CLAMP_TO_EDGE)}we.draw(j,te.TRIANGLES,k,h.stencilModeForClipping(le),L,Mt.disabled,Me,Ne,_.id,be.layoutVertexBuffer,be.indexBuffer,be.segments,_.paint,h.transform.zoom,Le,be.layoutVertexBuffer2),se=!1}})(t,n,o,a);break;case"fill":(function(h,m,_,v){const b=_.paint.get("fill-color"),P=_.paint.get("fill-opacity");if(P.constantOr(1)===0)return;const k=h.colorModeForRenderPass(),L=_.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 V=h.depthModeForSublayer(1,h.renderPass==="opaque"?ct.ReadWrite:ct.ReadOnly);ra(h,m,_,v,V,k,!1)}if(h.renderPass==="translucent"&&_.paint.get("fill-antialias")){const V=h.depthModeForSublayer(_.getPaintProperty("fill-outline-color")?2:0,ct.ReadOnly);ra(h,m,_,v,V,k,!0)}})(t,n,o,a);break;case"fill-extrusion":(function(h,m,_,v){const b=_.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||_.paint.get("fill-extrusion-pattern").constantOr(1))no(h,m,_,v,P,Vt.disabled,Et.disabled),no(h,m,_,v,P,h.stencilModeFor3D(),h.colorModeForRenderPass());else{const k=h.colorModeForRenderPass();no(h,m,_,v,P,Vt.disabled,k)}}})(t,n,o,a);break;case"hillshade":(function(h,m,_,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 V of B){const Z=m.getTile(V);Z.needsHillshadePrepare!==void 0&&Z.needsHillshadePrepare&&h.renderPass==="offscreen"?fn(h,Z,_,P,Vt.disabled,k):h.renderPass==="translucent"&&na(h,V,Z,_,P,L[V.overscaledZ],k)}b.viewport.set([0,0,h.width,h.height])})(t,n,o,a);break;case"raster":(function(h,m,_,v){if(h.renderPass!=="translucent"||_.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(),[V,Z]=k instanceof Cr?[{},v]:h.stencilConfigForOverlap(v),U=Z[Z.length-1].overscaledZ,H=!h.options.moving;for(const K of Z){const j=h.depthModeForSublayer(K.overscaledZ-U,_.paint.get("raster-opacity")===1?ct.ReadWrite:ct.ReadOnly,P.LESS),te=m.getTile(K);te.registerFadeDuration(_.paint.get("raster-fade-duration"));const se=m.findLoadedParent(K,0),le=m.findLoadedSibling(K),ge=so(te,se||le||null,m,_,h.transform,h.style.map.terrain);let be,Le;const Be=_.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),be=Math.pow(2,se.tileID.overscaledZ-te.tileID.overscaledZ),Le=[te.tileID.canonical.x*be%1,te.tileID.canonical.y*be%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 we=h.style.map.terrain&&h.style.map.terrain.getTerrainData(K),Te=we?K:null,Ne=Te?Te.posMatrix:h.transform.calculatePosMatrix(K.toUnwrapped(),H),tt=Vc(Ne,Le||[0,0],be||1,ge,_);k instanceof Cr?L.draw(b,P.TRIANGLES,j,Vt.disabled,B,Mt.disabled,tt,we,_.id,k.boundsBuffer,h.quadTriangleIndexBuffer,k.boundsSegments):L.draw(b,P.TRIANGLES,j,V[K.overscaledZ],B,Mt.disabled,tt,we,_.id,h.rasterBoundsBuffer,h.quadTriangleIndexBuffer,h.rasterBoundsSegments)}})(t,n,o,a);break;case"background":(function(h,m,_,v){const b=_.paint.get("background-color"),P=_.paint.get("background-opacity");if(P===0)return;const k=h.context,L=k.gl,B=h.transform,V=B.tileSize,Z=_.paint.get("background-pattern");if(h.isPatternMissing(Z))return;const U=!Z&&b.a===1&&P===1&&h.opaquePassEnabledForLayer()?"opaque":"translucent";if(h.renderPass!==U)return;const H=Vt.disabled,K=h.depthModeForSublayer(0,U==="opaque"?ct.ReadWrite:ct.ReadOnly),j=h.colorModeForRenderPass(),te=h.useProgram(Z?"backgroundPattern":"background"),se=v||B.coveringTiles({tileSize:V,terrain:h.style.map.terrain});Z&&(k.activeTexture.set(L.TEXTURE0),h.imageManager.bind(h.context));const le=_.getCrossfadeParameters();for(const ge of se){const be=v?ge.posMatrix:h.transform.calculatePosMatrix(ge.toUnwrapped()),Le=Z?qo(be,P,h,Z,{tileID:ge,tileSize:V},le):Js(be,P,b),Be=h.style.map.terrain&&h.style.map.terrain.getTerrainData(ge);te.draw(k,L.TRIANGLES,K,H,j,Mt.disabled,Le,Be,_.id,h.tileExtentBuffer,h.quadTriangleIndexBuffer,h.tileExtentSegments)}})(t,0,o,a);break;case"custom":(function(h,m,_){const v=h.context,b=_.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 _=[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,_),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(_=>{const v=1/(_=c.ag([],_,t))[3]/n*a;return c.b1(_,_,[v,v,1/_[3],v])}),m=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(_=>{const v=function(L,B){var V=B[0],Z=B[1],U=B[2],H=V*V+Z*Z+U*U;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,V){var Z=B[0],U=B[1],H=B[2],K=V[0],j=V[1],te=V[2];return L[0]=U*te-H*j,L[1]=H*K-Z*te,L[2]=Z*j-U*K,L}([],jt([],h[_[0]],h[_[1]]),jt([],h[_[2]],h[_[1]]))),b=-((P=v)[0]*(k=h[_[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 _=0;_<n.length;_++)c.b2(h,n[_])>=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 _=0;_<t.points.length;_++){const v=t.points[_][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],_=a[1],v=a[2],b=a[3],P=Math.sin(h),k=Math.cos(h);o[0]=m*k+v*P,o[1]=_*k+b*P,o[2]=m*-P+v*k,o[3]=_*-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)),_=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=_-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()),_=c.Z.fromLngLat(this.center),v=Math.pow(2,a),b=[v*m.x,v*m.y,0],P=[v*_.x,v*_.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,V=j=>({aabb:new lo([j*v,0,0],[(j+1)*v,v,0]),zoom:0,x:0,y:0,wrap:j,fullyVisible:!1}),Z=[],U=[],H=a,K=t.reparseOverscaled?h:a;if(this._renderWorldCopies)for(let j=1;j<=3;j++)Z.push(V(-j)),Z.push(V(j));for(Z.push(V(0));Z.length>0;){const j=Z.pop(),te=j.x,se=j.y;let le=j.fullyVisible;if(!le){const we=j.aabb.intersects(k);if(we===0)continue;le=we===2}const ge=t.terrain?b:P,be=j.aabb.distanceX(ge),Le=j.aabb.distanceY(ge),Be=Math.max(Math.abs(be),Math.abs(Le));if(j.zoom===H||Be>B+(1<<H-j.zoom)-2&&j.zoom>=L){const we=H-j.zoom,Te=b[0]-.5-(te<<we),Ne=b[1]-.5-(se<<we);U.push({tileID:new c.S(j.zoom===H?K:j.zoom,j.wrap,j.zoom,te,se),distanceSq:Vr([P[0]-.5-te,P[1]-.5-se]),tileDistanceToCamera:Math.sqrt(Te*Te+Ne*Ne)})}else for(let we=0;we<4;we++){const Te=(te<<1)+we%2,Ne=(se<<1)+(we>>1),tt=j.zoom+1;let ke=j.aabb.quadrant(we);if(t.terrain){const Me=new c.S(tt,j.wrap,tt,Te,Ne),Ye=t.terrain.getMinMaxElevation(Me),Dt=(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],Dt],[ke.max[0],ke.max[1],st])}Z.push({aabb:ke,zoom:tt,x:Te,y:Ne,wrap:j.wrap,fullyVisible:le})}}return U.sort((j,te)=>j.distanceSq-te.distanceSq).map(j=>j.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,_=Math.cos(this._pitch)*this.cameraToCenterDistance/m/c.b5(1,a.lat),v=this.scaleZoom(_/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],_=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(_,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 j=179.9999999999;a=[-j,j]}const h=this.tileSize*this.zoomScale(o.zoom);let m=0,_=h,v=0,b=h,P=0,k=0;const{x:L,y:B}=this.size;if(this.latRange){const j=this.latRange;m=c.Q(j[1])*h,_=c.Q(j[0])*h,_-m<B&&(P=B/(_-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:V,y:Z}=this.project.call({worldSize:h},t);let U,H;const K=Math.max(k||0,P||0);if(K){const j=new c.P(k?(b+v)/2:V,P?(_+m)/2:Z);return o.center=this.unproject.call({worldSize:h},j).wrap(),o.zoom+=this.scaleZoom(K),o}if(this.latRange){const j=B/2;Z-j<m&&(H=m+j),Z+j>_&&(H=_-j)}if(a){const j=(v+b)/2;let te=V;this._renderWorldCopies&&(te=c.b3(V,j-h/2,j+h/2));const se=L/2;te-se<v&&(U=v+se),te+se>b&&(U=b-se)}if(U!==void 0||H!==void 0){const j=new c.P(U??V,H??Z);o.center=this.unproject.call({worldSize:h},j).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),_=h-m*this._pixelPerMeter/Math.cos(this._pitch),v=m<0?_: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)),V=Math.sin(B)*v/Math.sin(c.ad(Math.PI-b-B,.01,Math.PI-.01)),Z=Math.min(k,V);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 U=this.width%2/2,H=this.height%2/2,K=Math.cos(this.angle),j=Math.sin(this.angle),te=n-Math.round(n)+K*U+j*H,se=o-Math.round(o)+K*H+j*U,le=new Float64Array(a);if(c.J(le,le,[te>.5?te-1:te,se>.5?se-1:se,0]),this.alignedModelViewProjectionMatrix=le,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 _ of t)o=Math.min(o,_.x),a=Math.min(a,_.y),h=Math.max(h,_.x),m=Math.max(m,_.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(..._)=>(o=!0,h=this,n=_,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,_=Math.round(n.lat*h)/h,v=this._map.getBearing(),b=this._map.getPitch();let P="";if(P+=t?`/${m}/${_}/${o}`:`${o}/${_}/${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(V=>{const Z=V.split("=")[0];return Z===k?(L=!0,`${Z}=${P}`):V}).filter(V=>V);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),Rl=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:ce.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,n=ce.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,Rl);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),_=Math.abs(m)/(h*a);return{easing:n.easing,duration:1e3*_,amount:m*(_/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)),_=h.reduce((v,b,P,k)=>v.add(b.div(k.length)),new c.P(0,0));super(t,{points:h,point:_,lngLats:m,lngLat:n.unproject(_),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),_=Math.min(a.y,o.y),v=Math.max(a.y,o.y);ae.setTransform(this._box,`translate(${h}px,${_}px)`),this._box.style.width=m-h+"px",this._box.style.height=v-_+"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 Bl{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:_=>_.easeTo({duration:300,zoom:m.zoom+1,around:m.unproject(a)},{originalEvent:t})}):h?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:_=>_.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 zt{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 Ai{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 Ai({checkCorrectEvent:a=>ae.mouseButton(a)===0&&a.ctrlKey||ae.mouseButton(a)===2});return new zt({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 Ai({checkCorrectEvent:a=>ae.mouseButton(a)===0&&a.ctrlKey||ae.mouseButton(a)===2});return new zt({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 _=0;for(const b in a){const P=a[b],k=this._touches[b];k&&(h._add(P),m._add(P.sub(k)),_++,a[b]=P)}if(this._touches=a,this._shouldBePrevented(_)||!m.mag())return;const v=m.div(_);return this._sum._add(v),this._sum.mag()<this._clickTolerance?void 0:{around:h.div(_),panDelta:v}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class 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),_=ks(o,n,h);if(!m||!_)return;const v=this._aroundCenter?null:m.add(_).div(2);return this._move([m,_],v,t)}touchend(t,n,o){if(!this._firstTwoTouches)return;const[a,h]=this._firstTwoTouches,m=ks(o,n,a),_=ks(o,n,h);m&&_||(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 Fl={panStep:100,bearingStep:15,pitchStep:10};class ba{constructor(t){this._tr=new On(t);const n=Fl;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:_=>{const v=this._tr;_.easeTo({duration:300,easeId:"keyboardHandler",easing:Ol,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 Ol(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=ce.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 _=ce.now()-this._lastWheelEventTime;if(this._type==="wheel"&&o&&a&&_){const v=Math.min(_/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=(ce.now()-o.start)/o.duration,h=o.easing(a+.01)-o.easing(a),m=.27/Math.sqrt(h*h+1e-4)*.01,_=Math.sqrt(.0729-m*m);n=c.b8(m,_,.25,1)}return this._prevEase={start:ce.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 Es{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 Vl{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 Kc extends c.k{}function Pa(u){return u.panDelta&&u.panDelta.mag()||u.zoomDelta||u.bearingDelta||u.pitchDelta}class Yc{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,_={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:U,allowed:H}of this._handlers){if(!U.isEnabled())continue;let K;this._blockedByActive(b,H,Z)?U.reset():U[h||a.type]&&(K=U[h||a.type](a,L,k),this.mergeHandlerResult(_,v,K,Z,m),K&&K.needsRenderFrame&&this._triggerRenderFrame()),(K||U.isActive())&&(b[Z]=U)}const B={};for(const Z in this._previousActiveHandlers)b[Z]||(B[Z]=m);this._previousActiveHandlers=b,(Object.keys(B).length||Pa(_))&&(this._changes.push([_,v,B]),this._triggerRenderFrame()),(Object.keys(b).length||Pa(_))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:V}=_;V&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],V(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 Bl(n),_=new Es(n);n.doubleClickZoom=new Ta(_,m),this._add("tapZoom",m),this._add("clickZoom",_),t.interactive&&t.doubleClickZoom&&n.doubleClickZoom.enable();const v=new Vl;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:K,clickTolerance:j})=>{const te=new Ai({checkCorrectEvent:se=>ae.mouseButton(se)===0&&!se.ctrlKey});return new zt({clickTolerance:j,move:(se,le)=>({around:le,panDelta:le.sub(se)}),activateOnStart:!0,moveStateManager:te,enable:K,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 V=new xa,Z=new _a;n.touchZoomRotate=new Ia(o,Z,V,v),this._add("touchRotate",V,["touchPan","touchZoom"]),this._add("touchZoom",Z,["touchPan","touchRotate"]),t.interactive&&t.touchZoomRotate&&n.touchZoomRotate.enable(t.touchZoomRotate);const U=n.scrollZoom=new Sa(n,()=>this._triggerRenderFrame());this._add("scrollZoom",U,["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:_,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(_?k.sub(_):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(_)):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 _={};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,_[`${k}end`]=v)}for(const k in _)this._fireEvent(k,_[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&&ce.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 Kc("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class Qc extends c.E{constructor(t,n){super(),this._renderFrameCallback=()=>{const o=Math.min((ce.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 we=a.padding;a.padding={top:we,bottom:we,right:we,left:we}}a.padding=c.e(h,a.padding);const m=this.transform,_=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),V=b.rotate(B),Z=P.rotate(B),U=k.rotate(B),H=L.rotate(B),K=new c.P(Math.max(V.x,Z.x,H.x,U.x),Math.max(V.y,Z.y,H.y,U.y)),j=new c.P(Math.min(V.x,Z.x,H.x,U.x),Math.min(V.y,Z.y,H.y,U.y)),te=K.sub(j),se=(m.width-(_.left+_.right+a.padding.left+a.padding.right))/te.x,le=(m.height-(_.top+_.bottom+a.padding.top+a.padding.bottom))/te.y;if(le<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,le)),a.maxZoom),be=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=be.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),_=m.x-h.x,v=m.y-h.y,b=m.z-h.z,P=Math.hypot(_,v,b);if(P===0)throw new Error("Can't calculate camera options with same From and To");const k=Math.hypot(_,v),L=this.transform.scaleZoom(this.transform.cameraToCenterDistance/P/this.transform.tileSize),B=180*Math.atan2(_,-v)/Math.PI;let V=180*Math.acos(k/P)/Math.PI;return V=b<0?90-V:90+V,{center:m.toLngLat(),zoom:L,pitch:V,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&&ce.prefersReducedMotion)&&(t.duration=0);const a=this._getTransformForUpdate(),h=a.zoom,m=a.bearing,_=a.pitch,v=a.padding,b="bearing"in t?this._normalizeBearing(t.bearing,m):m,P="pitch"in t?+t.pitch:_,k="padding"in t?t.padding:a.padding,L=c.P.convert(t.offset);let B=a.centerPoint.add(L);const V=a.pointLocation(B),{center:Z,zoom:U}=a.getConstrained(c.N.convert(t.center||V),(o=t.zoom)!==null&&o!==void 0?o:h);this._normalizeCenter(Z,a);const H=a.project(V),K=a.project(Z).sub(H),j=a.zoomScale(U-h);let te,se;t.around&&(te=c.N.convert(t.around),se=a.locationPoint(te));const le={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||U!==h,this._rotating=this._rotating||m!==b,this._pitching=this._pitching||P!==_,this._padding=!a.isPaddingEqual(k),this._easeId=t.easeId,this._prepareEase(n,t.noMoveStart,le),this.terrain&&this._prepareElevation(Z),this._ease(ge=>{if(this._zooming&&(a.zoom=c.z.number(h,U,ge)),this._rotating&&(a.bearing=c.z.number(m,b,ge)),this._pitching&&(a.pitch=c.z.number(_,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 be=a.zoomScale(a.zoom-h),Le=U>h?Math.min(2,j):Math.max(.5,j),Be=Math.pow(Le,1-ge),we=a.unproject(H.add(K.mult(ge*Be)).mult(be));a.setLocationAtPoint(a.renderWorldCopies?we.wrap():we,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:_,pitch:v,bearing:b,elevation:P}=a(h);m&&(h.center=m),_!==void 0&&(h.zoom=_),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&&ce.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,_=a.pitch,v=a.padding,b="bearing"in t?this._normalizeBearing(t.bearing,m):m,P="pitch"in t?+t.pitch:_,k="padding"in t?t.padding:a.padding,L=c.P.convert(t.offset);let B=a.centerPoint.add(L);const V=a.pointLocation(B),{center:Z,zoom:U}=a.getConstrained(c.N.convert(t.center||V),(o=t.zoom)!==null&&o!==void 0?o:h);this._normalizeCenter(Z,a);const H=a.zoomScale(U-h),K=a.project(V),j=a.project(Z).sub(K);let te=t.curve;const se=Math.max(a.width,a.height),le=se/H,ge=j.mag();if("minZoom"in t){const Me=c.ad(Math.min(t.minZoom,h,U),a.minZoom,a.maxZoom),Ye=se/a.zoomScale(Me-h);te=Math.sqrt(Ye/ge*2)}const be=te*te;function Le(Me){const Ye=(le*le-se*se+(Me?-1:1)*be*be*ge*ge)/(2*(Me?le:se)*be*ge);return Math.log(Math.sqrt(Ye*Ye+1)-Ye)}function Be(Me){return(Math.exp(Me)-Math.exp(-Me))/2}function we(Me){return(Math.exp(Me)+Math.exp(-Me))/2}const Te=Le(!1);let Ne=function(Me){return we(Te)/we(Te+te*Me)},tt=function(Me){return se*((we(Te)*(Be(Ye=Te+te*Me)/we(Ye))-Be(Te))/be)/ge;var Ye},ke=(Le(!0)-Te)/te;if(Math.abs(ge)<1e-6||!isFinite(ke)){if(Math.abs(se-le)<1e-6)return this.easeTo(t,n);const Me=le<se?-1:1;ke=Math.abs(Math.log(le/se))/te,tt=()=>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!==_,this._padding=!a.isPaddingEqual(k),this._prepareEase(n,!1),this.terrain&&this._prepareElevation(Z),this._ease(Me=>{const Ye=Me*ke,Dt=1/Ne(Ye);a.zoom=Me===1?U:h+a.scaleZoom(Dt),this._rotating&&(a.bearing=c.z.number(m,b,Me)),this._pitching&&(a.pitch=c.z.number(_,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(K.add(j.mult(tt(Ye))).mult(Dt));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=ce.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 Nl=c.Y([{name:"a_pos3d",type:"Int16",components:3}]);class Ea 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,_=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,[-_*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,_=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,[_*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 Ea(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),_=(h=m.tile)===null||h===void 0?void 0:h.dem;if(!_)return 0;const v=function(V,Z,U){var H=Z[0],K=Z[1];return V[0]=U[0]*H+U[4]*K+U[12],V[1]=U[1]*H+U[5]*K+U[13],V}([],[n/a*c.X,o/a*c.X],m.u_terrain_matrix),b=[v[0]*_.dim,v[1]*_.dim],P=Math.floor(b[0]),k=Math.floor(b[1]),L=b[0]-P,B=b[1]-k;return _.get(P,k)*(1-L)*(1-B)+_.get(P+1,k)*L*(1-B)+_.get(P,k+1)*(1-L)*B+_.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),_=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,_*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 _=0;_<this._coordsTextureSize;_++,m+=4)n[m+0]=255&_,n[m+1]=255&h,n[m+2]=_>>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),_=Math.round(this.painter.height/devicePixelRatio);o.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),a.readPixels(h,_-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 _=n.length,v=_+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(_+k,_+k+3,_+k+1),o.emplaceBack(_+k,_+k+2,_+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 Dl(t.createVertexBuffer(n,Nl.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,_=Math.floor(h/c.X),v=Math.floor(m/c.X);return{tileID:new c.S(n,0,n,_,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 Ul{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 _ in m)this._coordsDescendingInv[o][_]||(this._coordsDescendingInv[o][_]=[]),this._coordsDescendingInv[o][_].push(m[_])}}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(_=>_.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 _ of this._renderableTiles){if(this.pool.isFull()&&(bs(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(_),_.rtt[h]){const b=this.pool.getObjectForId(_.rtt[h].id);if(b.stamp===_.rtt[h].stamp){this.pool.useObject(b);continue}}const v=this.pool.getOrCreateFreeObject();this.pool.useObject(v),this.pool.stampObject(v),_.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][_.tileID.key]:[_.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&&(_.rttCoords[P.source]=this._coordsDescendingInvStr[P.source][_.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,eh={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},$l=u=>{u.touchstart=u.dragStart,u.touchmoveWindow=u.dragMove,u.touchend=u.dragEnd},Aa={showCompass:!0,showZoom:!0,visualizePitch:!1};class ql{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:_,bearingDegreesPerPixelMoved:v=.8})=>{const b=new go;return new zt({clickTolerance:_,move:(P,k)=>({bearingDelta:(k.x-P.x)*v}),moveStateManager:b,enable:m,assignEvents:$l})})({clickTolerance:a,enable:!0}),this.map=t,o&&(this.mousePitch=xn({clickTolerance:h,enable:!0}),this.touchPitch=(({enable:m,clickTolerance:_,pitchDegreesPerPixelMoved:v=-.5})=>{const b=new go;return new zt({clickTolerance:_,move:(P,k)=>({pitchDelta:(k.y-P.y)*v}),moveStateManager:b,enable:m,assignEvents:$l})})({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 Zl(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?Zl(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}`),ce.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 _=ae.createNS("http://www.w3.org/2000/svg","g");_.setAttributeNS(null,"transform","translate(3.0, 29.0)"),_.setAttributeNS(null,"fill","#000000");const v=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const H of v){const K=ae.createNS("http://www.w3.org/2000/svg","ellipse");K.setAttributeNS(null,"opacity","0.04"),K.setAttributeNS(null,"cx","10.5"),K.setAttributeNS(null,"cy","5.80029008"),K.setAttributeNS(null,"rx",H.rx),K.setAttributeNS(null,"ry",H.ry),_.appendChild(K)}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 V=ae.createNS("http://www.w3.org/2000/svg","g");V.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 U=ae.createNS("http://www.w3.org/2000/svg","circle");U.setAttributeNS(null,"fill","#FFFFFF"),U.setAttributeNS(null,"cx","5.5"),U.setAttributeNS(null,"cy","5.5"),U.setAttributeNS(null,"r","5.4999962"),V.appendChild(Z),V.appendChild(U),m.appendChild(_),m.appendChild(b),m.appendChild(k),m.appendChild(B),m.appendChild(V),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 _=-this._offset.y/a.transform._pixelPerMeter,v=Math.sin(a.getPitch()*Math.PI/180)*_,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 jn=0,Un=!1;const Gl={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]),_=h.distanceTo(m);if(n&&n.unit==="imperial"){const v=3.2808*_;v>5280?As(t,o,v/5280,u._getUIString("ScaleControl.Miles")):As(t,o,v,u._getUIString("ScaleControl.Feet"))}else n&&n.unit==="nautical"?As(t,o,_/1852,u._getUIString("ScaleControl.NauticalMiles")):_>=1e3?As(t,o,_/1e3,u._getUIString("ScaleControl.Kilometers")):As(t,o,_,u._getUIString("ScaleControl.Meters"))}function As(u,t,n,o){const a=function(h){const m=Math.pow(10,`${Math.floor(h)}`.length-1);let _=h/m;return _=_>=10?10:_>=5?5:_>=3?3:_>=2?2:_>=1?1:function(v){const b=Math.pow(10,Math.ceil(-Math.log(v)/Math.LN10));return Math.round(v*b)/b}(_),m*_}(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&&Un)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,jn=0,Un=!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":jn--,Un=!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"),jn++,jn>1?(u={maximumAge:6e5,timeout:0},Un=!0):(u=this.options.positionOptions,Un=!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 Qc{constructor(u){c.be.mark(c.bf.create);const t=Object.assign(Object.assign({},eh),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=Ae.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 Yc(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 _=this.painter.context.gl;this._maxCanvasSize=[_.drawingBufferWidth,_.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 _ in m.delegates)this.off(_,m.delegates[_]);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 Uo(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 Uo(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 Ul(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:_,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:_,textFitWidth:v,textFitHeight:b,sdf:a,version:0,userImage:B}),B.onAdd&&B.onAdd(this,u),this}}{const{width:P,height:k,data:L}=ce.getImageData(t);this.style.addImage(u,{data:new c.R({width:P,height:k},L),pixelRatio:o,stretchX:h,stretchY:m,content:_,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)?ce.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 _=!(t instanceof HTMLImageElement||c.b(t));return n.data.replace(m,_),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 Ae.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 Ll(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=ce.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()}),_=m.crossFadingFactor();_===1&&_===this._crossFadingFactor||(n=!0,this._crossFadingFactor=_),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),Ae.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,ce.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({},Aa,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 ql(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 _ of this.options.className.split(" "))this._container.classList.add(_);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=this._map.transform.renderWorldCopies&&!this._trackPointer?Zl(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 _=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<_/2?b.push("left"):o.x>this._map.transform.width-_/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=Ut,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({},Gl),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=Uo,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(jr),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(jr)},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=C;return W})})(Zh);var Cp=Zh.exports;const _c=Ep(Cp);function Ap(y){return[{type:"fill",paint:{"fill-color":y.color||"#ccc","fill-outline-color":y.color||"blue","fill-opacity":y.opacity||1}}]}function Mp(y){return[{type:"line",paint:{"line-color":y.color||"#ccc","line-opacity":y.opacity||1}}]}function zp(y){return[{type:"circle",paint:{"circle-radius":y.radius||6,"circle-stroke-color":y.stroke||"#ccc","circle-stroke-width":y.width||1,"circle-color":y.color||"blue"}}]}function Gh(y){if(!y)return null;const S=y.type||"point";return S==="polygon"?Ap(y):S==="line"?Mp(y):zp(y)}const yc={data(){return{layerList:[],activeLayer:""}},computed:{interactiveSources(){return this.layerList.filter(y=>y==null?void 0:y.interactive).map(y=>y.id)}},methods:{moveLayer(y,S=this.map){S.getStyle().layers.forEach(C=>{C.id.match(y)&&S.moveLayer(C.id)})},async setVisible(y,S=!0,C=this.map){if(!y)return;const z=(y==null?void 0:y.id)||y,N=this.layerList.find(T=>T.id===y)||y;if(!(N!=null&&N.id))throw new Error("MixinError: Layer has no id");const W=C.getStyle().layers.filter(T=>T.id.match(z));W.forEach(T=>{C.setLayoutProperty(T.id,"visibility",S?"visible":"none")}),!W.length&&S&&await this.addLayer(N)},async addLayer(y,S={},C=this==null?void 0:this.map){var W,T;const z=this.layerList.find(c=>c.id===y)||y;this.map.getStyle().layers.find(c=>c.id===z.id)||(this.layerList.find(c=>c.id===z.id)||this.layerList.push(z),(z.service==="vtile"||z.service==="vector"||(W=z.url)!=null&&W.includes(".vmt"))&&this.addVtileLayer(z,C),z.service==="geojson"&&this.addGeoJsonLayer(z,C),((T=z.url)!=null&&T.includes(".png")||["tms","raster"].includes(z.service))&&await this.addRasterLayer(z,S,C))},async addRasterLayer(y,S,C=this==null?void 0:this.map){await C.addSource(y.id,{type:"raster",tiles:[y==null?void 0:y.url],tileSize:256,...y!=null&&y.scheme?{scheme:y==null?void 0:y.scheme}:{}});const z=S.order===0?this.getOrder(S.order):null;await C.addLayer({id:y.id,type:"raster",source:y.id,minzoom:0,maxzoom:(y==null?void 0:y.maxzoom)||22},z)},async addVtileLayer(y,S=this==null?void 0:this.map){var W;const C=["props","pointZoom"].filter(T=>y[T]).map(T=>`&${T}=${y[T]}`),z={type:"vector",tiles:[`${(W=y==null?void 0:y.url)!=null&&W.startsWith("http")?"":window.location.origin}${y==null?void 0:y.url}${C}`],minzoom:y.minzoom||5,maxzoom:y.maxzoom||24};S.addSource(y.id,z),(Gh(y.style)||y.layers||[]).forEach((T,c)=>{const ye={...T,id:`${y.id}-${c}`,source:y.id,"source-layer":T["source-layer"]||y.source||y.id,maxzoom:+T.maxzoom||24,minzoom:+T.minzoom||0};S.addLayer(ye)})},async addGeoJsonLayer(y,S=this.map){var N;const C=y.data||((N=y==null?void 0:y.url)!=null&&N.startsWith("http")?"":window.location.origin)+y.url;S.addSource(y.id,{type:"geojson",data:C}),(Gh(y.style)||y.layers||[]).forEach(W=>{const T={...W,source:y.id,id:W.id||y.id,maxzoom:+W.maxzoom||24,minzoom:+W.minzoom||0,type:W.type||"circle"};S.addLayer(T)})},setLayerData(y,S){this.layerList=this.layerList.map(C=>C.id===y?{...C,...S}:C)},async removeLayer(y,S=this.map){await S.getStyle().layers.forEach(async C=>{C.source===y&&await S.removeLayer(C.id)}),S.getSource(y)&&await S.removeSource(y)},async setFilter(y,S){const C=this.layerList.find(N=>N.id===y);await(await this.map.getSource(y)).setTiles([`${window.location.origin}${C.url}${C.url.includes("?")?"&":"?"}filter=${S}${C.props?`&props=${C.props}`:""}`])},getOrder(y){var S;return((S=this.map.getStyle().layers[y])==null?void 0:S.id)||null},async changeBaseLayer(y){y!==this.activeLayer&&(this.activeLayer&&this.map.setLayoutProperty(this.activeLayer,"visibility","none"),await this.addLayer(y,{order:0}),this.map.setLayoutProperty(y,"visibility","visible"),this.activeLayer=y)},async refreshLayer(y,S=this.map){await S.getStyle().layers.forEach(C=>{C.source===y&&S.removeLayer(C.id)}),await S.removeSource(y),this.setVisible(y)}}},Or=(y,S)=>{const C=y.__vccOpts||y;for(const[z,N]of S)C[z]=N;return C},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=[ee.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(y,S){return ee.openBlock(),ee.createElementBlock("svg",Lp,Rp)}const Fp=Or(Dp,[["render",Bp]]);function Hh(y,S){return function(){return y.apply(S,arguments)}}const{toString:Op}=Object.prototype,{getPrototypeOf:xc}=Object,il=(y=>S=>{const C=Op.call(S);return y[C]||(y[C]=C.slice(8,-1).toLowerCase())})(Object.create(null)),Tr=y=>(y=y.toLowerCase(),S=>il(S)===y),rl=y=>S=>typeof S===y,{isArray:Os}=Array,Bo=rl("undefined");function Vp(y){return y!==null&&!Bo(y)&&y.constructor!==null&&!Bo(y.constructor)&&Ki(y.constructor.isBuffer)&&y.constructor.isBuffer(y)}const Xh=Tr("ArrayBuffer");function Np(y){let S;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?S=ArrayBuffer.isView(y):S=y&&y.buffer&&Xh(y.buffer),S}const jp=rl("string"),Ki=rl("function"),Wh=rl("number"),nl=y=>y!==null&&typeof y=="object",Up=y=>y===!0||y===!1,sl=y=>{if(il(y)!=="object")return!1;const S=xc(y);return(S===null||S===Object.prototype||Object.getPrototypeOf(S)===null)&&!(Symbol.toStringTag in y)&&!(Symbol.iterator in y)},$p=Tr("Date"),qp=Tr("File"),Zp=Tr("Blob"),Gp=Tr("FileList"),Hp=y=>nl(y)&&Ki(y.pipe),Xp=y=>{let S;return y&&(typeof FormData=="function"&&y instanceof FormData||Ki(y.append)&&((S=il(y))==="formdata"||S==="object"&&Ki(y.toString)&&y.toString()==="[object FormData]"))},Wp=Tr("URLSearchParams"),[Jp,Kp,Yp,Qp]=["ReadableStream","Request","Response","Headers"].map(Tr),ef=y=>y.trim?y.trim():y.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Fo(y,S,{allOwnKeys:C=!1}={}){if(y===null||typeof y>"u")return;let z,N;if(typeof y!="object"&&(y=[y]),Os(y))for(z=0,N=y.length;z<N;z++)S.call(null,y[z],z,y);else{const W=C?Object.getOwnPropertyNames(y):Object.keys(y),T=W.length;let c;for(z=0;z<T;z++)c=W[z],S.call(null,y[c],c,y)}}function Jh(y,S){S=S.toLowerCase();const C=Object.keys(y);let z=C.length,N;for(;z-- >0;)if(N=C[z],S===N.toLowerCase())return N;return null}const es=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Kh=y=>!Bo(y)&&y!==es;function vc(){const{caseless:y}=Kh(this)&&this||{},S={},C=(z,N)=>{const W=y&&Jh(S,N)||N;sl(S[W])&&sl(z)?S[W]=vc(S[W],z):sl(z)?S[W]=vc({},z):Os(z)?S[W]=z.slice():S[W]=z};for(let z=0,N=arguments.length;z<N;z++)arguments[z]&&Fo(arguments[z],C);return S}const tf=(y,S,C,{allOwnKeys:z}={})=>(Fo(S,(N,W)=>{C&&Ki(N)?y[W]=Hh(N,C):y[W]=N},{allOwnKeys:z}),y),rf=y=>(y.charCodeAt(0)===65279&&(y=y.slice(1)),y),nf=(y,S,C,z)=>{y.prototype=Object.create(S.prototype,z),y.prototype.constructor=y,Object.defineProperty(y,"super",{value:S.prototype}),C&&Object.assign(y.prototype,C)},sf=(y,S,C,z)=>{let N,W,T;const c={};if(S=S||{},y==null)return S;do{for(N=Object.getOwnPropertyNames(y),W=N.length;W-- >0;)T=N[W],(!z||z(T,y,S))&&!c[T]&&(S[T]=y[T],c[T]=!0);y=C!==!1&&xc(y)}while(y&&(!C||C(y,S))&&y!==Object.prototype);return S},of=(y,S,C)=>{y=String(y),(C===void 0||C>y.length)&&(C=y.length),C-=S.length;const z=y.indexOf(S,C);return z!==-1&&z===C},af=y=>{if(!y)return null;if(Os(y))return y;let S=y.length;if(!Wh(S))return null;const C=new Array(S);for(;S-- >0;)C[S]=y[S];return C},lf=(y=>S=>y&&S instanceof y)(typeof Uint8Array<"u"&&xc(Uint8Array)),cf=(y,S)=>{const z=(y&&y[Symbol.iterator]).call(y);let N;for(;(N=z.next())&&!N.done;){const W=N.value;S.call(y,W[0],W[1])}},hf=(y,S)=>{let C;const z=[];for(;(C=y.exec(S))!==null;)z.push(C);return z},uf=Tr("HTMLFormElement"),df=y=>y.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(C,z,N){return z.toUpperCase()+N}),Yh=(({hasOwnProperty:y})=>(S,C)=>y.call(S,C))(Object.prototype),pf=Tr("RegExp"),Qh=(y,S)=>{const C=Object.getOwnPropertyDescriptors(y),z={};Fo(C,(N,W)=>{let T;(T=S(N,W,y))!==!1&&(z[W]=T||N)}),Object.defineProperties(y,z)},ff=y=>{Qh(y,(S,C)=>{if(Ki(y)&&["arguments","caller","callee"].indexOf(C)!==-1)return!1;const z=y[C];if(Ki(z)){if(S.enumerable=!1,"writable"in S){S.writable=!1;return}S.set||(S.set=()=>{throw Error("Can not rewrite read-only method '"+C+"'")})}})},mf=(y,S)=>{const C={},z=N=>{N.forEach(W=>{C[W]=!0})};return Os(y)?z(y):z(String(y).split(S)),C},gf=()=>{},_f=(y,S)=>y!=null&&Number.isFinite(y=+y)?y:S,bc="abcdefghijklmnopqrstuvwxyz",eu="0123456789",tu={DIGIT:eu,ALPHA:bc,ALPHA_DIGIT:bc+bc.toUpperCase()+eu},yf=(y=16,S=tu.ALPHA_DIGIT)=>{let C="";const{length:z}=S;for(;y--;)C+=S[Math.random()*z|0];return C};function xf(y){return!!(y&&Ki(y.append)&&y[Symbol.toStringTag]==="FormData"&&y[Symbol.iterator])}const vf=y=>{const S=new Array(10),C=(z,N)=>{if(nl(z)){if(S.indexOf(z)>=0)return;if(!("toJSON"in z)){S[N]=z;const W=Os(z)?[]:{};return Fo(z,(T,c)=>{const ye=C(T,N+1);!Bo(ye)&&(W[c]=ye)}),S[N]=void 0,W}}return z};return C(y,0)},bf=Tr("AsyncFunction"),wf=y=>y&&(nl(y)||Ki(y))&&Ki(y.then)&&Ki(y.catch),iu=((y,S)=>y?setImmediate:S?((C,z)=>(es.addEventListener("message",({source:N,data:W})=>{N===es&&W===C&&z.length&&z.shift()()},!1),N=>{z.push(N),es.postMessage(C,"*")}))(`axios@${Math.random()}`,[]):C=>setTimeout(C))(typeof setImmediate=="function",Ki(es.postMessage)),Sf=typeof queueMicrotask<"u"?queueMicrotask.bind(es):typeof process<"u"&&process.nextTick||iu,fe={isArray:Os,isArrayBuffer:Xh,isBuffer:Vp,isFormData:Xp,isArrayBufferView:Np,isString:jp,isNumber:Wh,isBoolean:Up,isObject:nl,isPlainObject:sl,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:il,kindOfTest:Tr,endsWith:of,toArray:af,forEachEntry:cf,matchAll:hf,isHTMLForm:uf,hasOwnProperty:Yh,hasOwnProp:Yh,reduceDescriptors:Qh,freezeMethods:ff,toObjectSet:mf,toCamelCase:df,noop:gf,toFiniteNumber:_f,findKey:Jh,global:es,isContextDefined:Kh,ALPHABET:tu,generateString:yf,isSpecCompliantForm:xf,toJSONObject:vf,isAsyncFn:bf,isThenable:wf,setImmediate:iu,asap:Sf};function lt(y,S,C,z,N){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=y,this.name="AxiosError",S&&(this.code=S),C&&(this.config=C),z&&(this.request=z),N&&(this.response=N)}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 ru=lt.prototype,nu={};["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(y=>{nu[y]={value:y}}),Object.defineProperties(lt,nu),Object.defineProperty(ru,"isAxiosError",{value:!0}),lt.from=(y,S,C,z,N,W)=>{const T=Object.create(ru);return fe.toFlatObject(y,T,function(ye){return ye!==Error.prototype},c=>c!=="isAxiosError"),lt.call(T,y.message,S,C,z,N),T.cause=y,T.name=y.name,W&&Object.assign(T,W),T};const Tf=null;function wc(y){return fe.isPlainObject(y)||fe.isArray(y)}function su(y){return fe.endsWith(y,"[]")?y.slice(0,-2):y}function ou(y,S,C){return y?y.concat(S).map(function(N,W){return N=su(N),!C&&W?"["+N+"]":N}).join(C?".":""):S}function If(y){return fe.isArray(y)&&!y.some(wc)}const Pf=fe.toFlatObject(fe,{},null,function(S){return/^is[A-Z]/.test(S)});function ol(y,S,C){if(!fe.isObject(y))throw new TypeError("target must be an object");S=S||new FormData,C=fe.toFlatObject(C,{metaTokens:!0,dots:!1,indexes:!1},!1,function(et,je){return!fe.isUndefined(je[et])});const z=C.metaTokens,N=C.visitor||Se,W=C.dots,T=C.indexes,ye=(C.Blob||typeof Blob<"u"&&Blob)&&fe.isSpecCompliantForm(S);if(!fe.isFunction(N))throw new TypeError("visitor must be a function");function xe(Ge){if(Ge===null)return"";if(fe.isDate(Ge))return Ge.toISOString();if(!ye&&fe.isBlob(Ge))throw new lt("Blob is not supported. Use a Buffer instead.");return fe.isArrayBuffer(Ge)||fe.isTypedArray(Ge)?ye&&typeof Blob=="function"?new Blob([Ge]):Buffer.from(Ge):Ge}function Se(Ge,et,je){let dt=Ge;if(Ge&&!je&&typeof Ge=="object"){if(fe.endsWith(et,"{}"))et=z?et:et.slice(0,-2),Ge=JSON.stringify(Ge);else if(fe.isArray(Ge)&&If(Ge)||(fe.isFileList(Ge)||fe.endsWith(et,"[]"))&&(dt=fe.toArray(Ge)))return et=su(et),dt.forEach(function(Ae,Pt){!(fe.isUndefined(Ae)||Ae===null)&&S.append(T===!0?ou([et],Pt,W):T===null?et:et+"[]",xe(Ae))}),!1}return wc(Ge)?!0:(S.append(ou(je,et,W),xe(Ge)),!1)}const ce=[],ae=Object.assign(Pf,{defaultVisitor:Se,convertValue:xe,isVisitable:wc});function gt(Ge,et){if(!fe.isUndefined(Ge)){if(ce.indexOf(Ge)!==-1)throw Error("Circular reference detected in "+et.join("."));ce.push(Ge),fe.forEach(Ge,function(dt,Ft){(!(fe.isUndefined(dt)||dt===null)&&N.call(S,dt,fe.isString(Ft)?Ft.trim():Ft,et,ae))===!0&>(dt,et?et.concat(Ft):[Ft])}),ce.pop()}}if(!fe.isObject(y))throw new TypeError("data must be an object");return gt(y),S}function au(y){const S={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(y).replace(/[!'()~]|%20|%00/g,function(z){return S[z]})}function Sc(y,S){this._pairs=[],y&&ol(y,this,S)}const lu=Sc.prototype;lu.append=function(S,C){this._pairs.push([S,C])},lu.toString=function(S){const C=S?function(z){return S.call(this,z,au)}:au;return this._pairs.map(function(N){return C(N[0])+"="+C(N[1])},"").join("&")};function kf(y){return encodeURIComponent(y).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function cu(y,S,C){if(!S)return y;const z=C&&C.encode||kf,N=C&&C.serialize;let W;if(N?W=N(S,C):W=fe.isURLSearchParams(S)?S.toString():new Sc(S,C).toString(z),W){const T=y.indexOf("#");T!==-1&&(y=y.slice(0,T)),y+=(y.indexOf("?")===-1?"?":"&")+W}return y}class hu{constructor(){this.handlers=[]}use(S,C,z){return this.handlers.push({fulfilled:S,rejected:C,synchronous:z?z.synchronous:!1,runWhen:z?z.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(z){z!==null&&S(z)})}}const uu={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Ef={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=(y=>Tc&&["ReactNative","NativeScript","NS"].indexOf(y)<0)(typeof navigator<"u"&&navigator.product),Af=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:Af,origin:Mf},Symbol.toStringTag,{value:"Module"})),...Ef};function zf(y,S){return ol(y,new Ir.classes.URLSearchParams,Object.assign({visitor:function(C,z,N,W){return Ir.isNode&&fe.isBuffer(C)?(this.append(z,C.toString("base64")),!1):W.defaultVisitor.apply(this,arguments)}},S))}function Df(y){return fe.matchAll(/\w+|\[(\w*)]/g,y).map(S=>S[0]==="[]"?"":S[1]||S[0])}function Lf(y){const S={},C=Object.keys(y);let z;const N=C.length;let W;for(z=0;z<N;z++)W=C[z],S[W]=y[W];return S}function du(y){function S(C,z,N,W){let T=C[W++];if(T==="__proto__")return!0;const c=Number.isFinite(+T),ye=W>=C.length;return T=!T&&fe.isArray(N)?N.length:T,ye?(fe.hasOwnProp(N,T)?N[T]=[N[T],z]:N[T]=z,!c):((!N[T]||!fe.isObject(N[T]))&&(N[T]=[]),S(C,z,N[T],W)&&fe.isArray(N[T])&&(N[T]=Lf(N[T])),!c)}if(fe.isFormData(y)&&fe.isFunction(y.entries)){const C={};return fe.forEachEntry(y,(z,N)=>{S(Df(z),N,C,0)}),C}return null}function Rf(y,S,C){if(fe.isString(y))try{return(S||JSON.parse)(y),fe.trim(y)}catch(z){if(z.name!=="SyntaxError")throw z}return(C||JSON.stringify)(y)}const Oo={transitional:uu,adapter:["xhr","http","fetch"],transformRequest:[function(S,C){const z=C.getContentType()||"",N=z.indexOf("application/json")>-1,W=fe.isObject(S);if(W&&fe.isHTMLForm(S)&&(S=new FormData(S)),fe.isFormData(S))return N?JSON.stringify(du(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 C.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),S.toString();let c;if(W){if(z.indexOf("application/x-www-form-urlencoded")>-1)return zf(S,this.formSerializer).toString();if((c=fe.isFileList(S))||z.indexOf("multipart/form-data")>-1){const ye=this.env&&this.env.FormData;return ol(c?{"files[]":S}:S,ye&&new ye,this.formSerializer)}}return W||N?(C.setContentType("application/json",!1),Rf(S)):S}],transformResponse:[function(S){const C=this.transitional||Oo.transitional,z=C&&C.forcedJSONParsing,N=this.responseType==="json";if(fe.isResponse(S)||fe.isReadableStream(S))return S;if(S&&fe.isString(S)&&(z&&!this.responseType||N)){const T=!(C&&C.silentJSONParsing)&&N;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"],y=>{Oo.headers[y]={}});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=y=>{const S={};let C,z,N;return y&&y.split(`
|
580
|
+
`),j=_.createShader(_.FRAGMENT_SHADER);if(_.isContextLost())return void(this.failedToCreate=!0);if(_.shaderSource(j,H),_.compileShader(j),!_.getShaderParameter(j,_.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${_.getShaderInfoLog(j)}`);_.attachShader(this.program,j);const te=_.createShader(_.VERTEX_SHADER);if(_.isContextLost())return void(this.failedToCreate=!0);if(_.shaderSource(te,K),_.compileShader(te),!_.getShaderParameter(te,_.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${_.getShaderInfoLog(te)}`);_.attachShader(this.program,te),this.attributes={};const se={};this.numAttributes=P.length;for(let le=0;le<this.numAttributes;le++)P[le]&&(_.bindAttribLocation(this.program,le,P[le]),this.attributes[P[le]]=le);if(_.linkProgram(this.program),!_.getProgramParameter(this.program,_.LINK_STATUS))throw new Error(`Program failed to link: ${_.getProgramInfoLog(this.program)}`);_.deleteShader(te),_.deleteShader(j);for(let le=0;le<Z.length;le++){const ge=Z[le];if(ge&&!se[ge]){const be=_.getUniformLocation(this.program,ge);be&&(se[ge]=be)}}this.fixedUniforms=a(t,se),this.terrainUniforms=((le,ge)=>({u_depth:new c.aI(le,ge.u_depth),u_terrain:new c.aI(le,ge.u_terrain),u_terrain_dim:new c.aJ(le,ge.u_terrain_dim),u_terrain_matrix:new c.aK(le,ge.u_terrain_matrix),u_terrain_unpack:new c.aL(le,ge.u_terrain_unpack),u_terrain_exaggeration:new c.aJ(le,ge.u_terrain_exaggeration)}))(t,se),this.binderUniforms=o?o.getUniforms(t,se):[]}draw(t,n,o,a,h,m,_,v,b,P,k,L,B,V,Z,U,H,K){const j=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(j.TEXTURE2),j.bindTexture(j.TEXTURE_2D,v.depthTexture),t.activeTexture.set(j.TEXTURE3),j.bindTexture(j.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(_[se]);Z&&Z.setUniforms(t,this.binderUniforms,B,{zoom:V});let te=0;switch(n){case j.LINES:te=2;break;case j.TRIANGLES:te=3;break;case j.LINE_STRIP:te=1}for(const se of L.get()){const le=se.vaos||(se.vaos={});(le[b]||(le[b]=new qs)).bind(t,this,P,Z?Z.getPaintVertexBuffers():[],k,se.vertexOffset,U,H,K),j.drawElements(n,se.primitiveLength*te,j.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),_=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,_>>16],u_pixel_coord_lower:[65535&m,65535&_]}}const Hs=(u,t,n,o)=>{const a=t.style.light,h=a.properties.get("position"),m=[h.x,h.y,h.z],_=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}(_,-t.transform.angle),function(b,P,k){var L=P[0],B=P[1],V=P[2];b[0]=L*k[0]+B*k[3]+V*k[6],b[1]=L*k[1]+B*k[4]+V*k[7],b[2]=L*k[2]+B*k[5]+V*k[8]}(m,m,_);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)),Bc=(u,t)=>({u_matrix:u,u_world:t}),Fc=(u,t,n,o,a)=>c.e(zn(u,t,n,o),{u_world:a}),dl=(u,t,n,o)=>{const a=u.transform;let h,m;if(o.paint.get("circle-pitch-alignment")==="map"){const _=rt(n,1,a.zoom);h=!0,m=[_,_]}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}},Oc=(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}),ji=(u,t,n,o)=>({u_matrix:u,u_extrude_scale:rt(t,1,n),u_intensity:o});function Ui(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:ml(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}),pl=(u,t,n,o,a)=>{const h=u.transform,m=un(t,h);return{u_matrix:ml(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]]}},fl=(u,t,n,o,a,h)=>{const m=u.lineAtlas,_=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:[_/k,-b.height/2],u_patternscale_b:[_/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 ml(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 Vc=(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:Nc(a.paint.get("raster-hue-rotate"))};var h,m};function Nc(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 gl=(u,t,n,o,a,h,m,_,v,b,P,k,L,B)=>{const V=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:V.cameraToCenterDistance,u_pitch:V.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:V.width/V.height,u_fade_change:m.options.fadeDuration?m.symbolFadeChange:1,u_matrix:_,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}},_l=(u,t,n,o,a,h,m,_,v,b,P,k,L,B,V)=>{const Z=m.transform;return c.e(gl(u,t,n,o,a,h,m,_,v,b,P,k,L,V),{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,_,v,b,P,k,L,B)=>c.e(_l(u,t,n,o,a,h,m,_,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,_,v,b){const P=v.imageManager.getPattern(m.from.toString()),k=v.imageManager.getPattern(m.to.toString()),{width:L,height:B}=v.imageManager.getPixelSize(),V=Math.pow(2,b.tileID.overscaledZ),Z=b.tileSize*Math.pow(2,v.transform.tileZoom)/V,U=Z*(b.tileID.canonical.x+b.tileID.wrap*V),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:_.t,u_pattern_size_a:P.displaySize,u_pattern_size_b:k.displaySize,u_scale_a:_.fromScale,u_scale_b:_.toScale,u_tile_units_to_pixels:1/rt(b,1,v.transform.tileZoom),u_pixel_coord_upper:[U>>16,H>>16],u_pixel_coord_lower:[65535&U,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 Uc 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 $c 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 qc extends ut{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class yl 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 Zc 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 xl 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 vl 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 bl 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 wl 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 Sl 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 Tl 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 Gc 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 Hc 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 Il 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 Xc 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 Wc 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 Jc 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 Pl 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 kl 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 El 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 Cl 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 Al 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,_=this.framebuffer=m.createFramebuffer();if(this.colorAttachment=new Jo(t,_),a)this.depthAttachment=h?new Al(t,_):new Ko(t,_);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 Et{constructor(t,n,o){this.blendFunction=t,this.blendColor=n,this.mask=o}}Et.Replace=[1,0],Et.disabled=new Et(Et.Replace,c.aN.transparent,[!1,!1,!1,!1]),Et.unblended=new Et(Et.Replace,c.aN.transparent,[!0,!0,!0,!0]),Et.alphaBlended=new Et([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 Uc(this),this.clearStencil=new Ys(this),this.colorMask=new $c(this),this.depthMask=new Ln(this),this.stencilMask=new qc(this),this.stencilFunc=new yl(this),this.stencilOp=new Zc(this),this.stencilTest=new xl(this),this.depthRange=new Xo(this),this.depthTest=new vl(this),this.depthFunc=new bl(this),this.blend=new wl(this),this.blendFunc=new Sl(this),this.blendColor=new dn(this),this.blendEquation=new Tl(this),this.cullFace=new Gc(this),this.cullFaceSide=new Hc(this),this.frontFace=new Il(this),this.program=new _s(this),this.activeTexture=new Xc(this),this.viewport=new Qs(this),this.bindFramebuffer=new Wc(this),this.bindRenderbuffer=new Jc(this),this.bindTexture=new Pl(this),this.bindVertexBuffer=new kl(this),this.bindElementBuffer=new El(this),this.bindVertexArray=new Wo(this),this.pixelStoreUnpack=new Cl(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,Et.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 Mt{constructor(t,n,o){this.enable=t,this.mode=n,this.frontFace=o}}let xs;function Ml(u,t,n,o,a){const h=u.context,m=h.gl,_=u.useProgram("collisionBox"),v=[];let b=0,P=0;for(let H=0;H<o.length;H++){const K=o[H],j=t.getTile(K).getBucket(n);if(!j)continue;const te=a?j.textCollisionBox:j.iconCollisionBox,se=j.collisionCircleArray;if(se.length>0){const le=c.H();c.aR(le,j.placementInvProjMatrix,u.transform.glCoordMatrix),c.aR(le,le,j.placementViewportMatrix),v.push({circleArray:se,circleOffset:P,transform:K.posMatrix,invTransform:le,coord:K}),b+=se.length/4,P=b}te&&_.draw(h,m.LINES,ct.disabled,Vt.disabled,u.colorModeForRenderPass(),Mt.disabled,{u_matrix:K.posMatrix,u_pixel_extrude_scale:[1/(k=u.transform).width,1/k.height]},u.style.map.terrain&&u.style.map.terrain.getTerrainData(K),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 V=0;for(const H of v)for(let K=0;K<H.circleArray.length/4;K++){const j=4*K,te=H.circleArray[j+0],se=H.circleArray[j+1],le=H.circleArray[j+2],ge=H.circleArray[j+3];B.emplace(V++,te,se,le,ge,0),B.emplace(V++,te,se,le,ge,1),B.emplace(V++,te,se,le,ge,2),B.emplace(V++,te,se,le,ge,3)}(!xs||xs.length<2*b)&&(xs=function(H){const K=2*H,j=new c.aU;j.resize(K),j._trim();for(let te=0;te<K;te++){const se=6*te;j.uint16[se+0]=4*te+0,j.uint16[se+1]=4*te+1,j.uint16[se+2]=4*te+2,j.uint16[se+3]=4*te+2,j.uint16[se+4]=4*te+3,j.uint16[se+5]=4*te+0}return j}(b));const Z=h.createIndexBuffer(xs,!0),U=h.createVertexBuffer(B,c.aT.members,!0);for(const H of v){const K=Oc(H.transform,H.invTransform,u.transform);L.draw(h,m.TRIANGLES,ct.disabled,Vt.disabled,u.colorModeForRenderPass(),Mt.disabled,K,u.style.map.terrain&&u.style.map.terrain.getTerrainData(H.coord),n.id,U,Z,c.a0.simpleSegment(0,2*H.circleOffset,H.circleArray.length,H.circleArray.length/2),null,u.transform.zoom,null,null,null)}U.destroy(),Z.destroy()}Mt.disabled=new Mt(!1,1029,2305),Mt.backCCW=new Mt(!0,1029,2305);const ta=c.ao(new Float32Array(16));function to(u,t,n,o,a,h){const{horizontalAlign:m,verticalAlign:_}=c.av(u);return new c.P((-(m-.5)*t/a+o[0])*h,(-(_-.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 _=o.mult(h);return n||(_=_.rotate(-a)),G(m.add(_),t.labelPlaneMatrix,t.getElevation).point}if(n){const _=pe(t.tileAnchorPoint.x+1,t.tileAnchorPoint.y,t).point.sub(u),v=Math.atan(_.y/_.x)+(_.x<0?Math.PI:0);return u.add(o.rotate(v))}return u.add(o)}function ro(u,t,n,o,a,h,m,_,v,b,P,k,L,B){const V=u.text.placedSymbolArray,Z=u.text.dynamicLayoutVertexArray,U=u.icon.dynamicLayoutVertexArray,H={};Z.clear();for(let K=0;K<V.length;K++){const j=V.get(K),te=j.hidden||!j.crossTileID||u.allowVerticalPlacement&&!j.placedOrientation?null:o[j.crossTileID];if(te){const se=new c.P(j.anchorX,j.anchorY),le={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,le),be=M(a.cameraToCenterDistance,ge.signedDistanceFromCamera);let Le=c.aj(u.textSizeData,v,j)*be/c.aq;n&&(Le*=u.tilePixelRatio/_);const{width:Be,height:we,anchor:Te,textOffset:Ne,textBoxScale:tt}=te,ke=to(Te,Be,we,Ne,tt,Le),Me=P.getPitchedTextCorrection(a,se.add(new c.P(k[0],k[1])),L),Ye=io(ge.point,le,t,ke,a.angle,Me),Dt=u.allowVerticalPlacement&&j.placedOrientation===c.ai.vertical?Math.PI/2:0;for(let st=0;st<j.numGlyphs;st++)c.ak(Z,Ye,Dt);b&&j.associatedIconIndex>=0&&(H[j.associatedIconIndex]={shiftedAnchor:Ye,angle:Dt})}else Xe(j.numGlyphs,Z)}if(b){U.clear();const K=u.icon.placedSymbolArray;for(let j=0;j<K.length;j++){const te=K.get(j);if(te.hidden)Xe(te.numGlyphs,U);else{const se=H[j];if(se)for(let le=0;le<te.numGlyphs;le++)c.ak(U,se.shiftedAnchor,se.angle);else Xe(te.numGlyphs,U)}}u.icon.dynamicLayoutVertexBuffer.updateData(U)}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,_,v,b,P,k){const L=u.context,B=L.gl,V=u.transform,Z=Us(),U=_==="map",H=v==="map",K=_!=="viewport"&&n.layout.get("symbol-placement")!=="point",j=U&&!H&&!K,te=!H&&K,se=!n.layout.get("symbol-sort-key").isConstant();let le=!1;const ge=u.depthModeForSublayer(0,ct.ReadOnly),be=n._unevaluatedLayout.hasValue("text-variable-anchor")||n._unevaluatedLayout.hasValue("text-variable-anchor-offset"),Le=[],Be=Z.getCircleRadiusCorrection(V);for(const we of o){const Te=t.getTile(we),Ne=Te.getBucket(n);if(!Ne)continue;const tt=a?Ne.text:Ne.icon;if(!tt||!tt.segments.get().length||!tt.hasVisibleVertices)continue;const ke=tt.programConfigurations.get(n.id),Me=a||Ne.sdfIcons,Ye=a?Ne.textSizeData:Ne.iconSizeData,Dt=H||V.pitch!==0,st=u.useProgram(ia(Me,a,Ne),ke),ht=c.ah(Ye,V.zoom),Lt=u.style.map.terrain&&u.style.map.terrain.getTerrainData(we);let di,rr,Rt,Mi,Ii=[0,0],pi=null;if(a)rr=Te.glyphAtlasTexture,Rt=B.LINEAR,di=Te.glyphAtlasTexture.size,Ne.iconsInText&&(Ii=Te.imageAtlasTexture.size,pi=Te.imageAtlasTexture,Mi=Dt||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,Rt=Me||u.options.rotating||u.options.zooming||Nt||Dt?B.LINEAR:B.NEAREST,di=Te.imageAtlasTexture.size}const fi=rt(Te,1,u.transform.zoom),nr=te?we.posMatrix:ta,vn=Gr(nr,H,U,u.transform,fi),xo=gr(nr,H,U,u.transform,fi),$n=gr(we.posMatrix,H,U,u.transform,fi),bn=Z.translatePosition(u.transform,Te,h,m),vo=be&&Ne.hasTextData(),Da=n.layout.get("icon-text-fit")!=="none"&&vo&&Ne.hasIconData();if(K){const Nt=u.style.map.terrain?(La,ti)=>u.style.map.terrain.getElevation(we,La,ti):null,Zn=n.layout.get("text-rotation-alignment")==="map";O(Ne,we.posMatrix,u,a,vn,$n,H,b,Zn,Z,we.toUnwrapped(),V.width,V.height,bn,Nt)}const oi=we.posMatrix,sr=a&&be||Da,Qr=K||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,j,H,K,sr,u,oi,Qr,qn,bn,di,Ii,Be):_l(Ye.kind,ht,j,H,K,sr,u,oi,Qr,qn,bn,a,di,!0,Be):gl(Ye.kind,ht,j,H,K,sr,u,oi,Qr,qn,bn,a,di,Be);const ri={program:st,buffers:tt,uniformValues:gi,atlasTexture:rr,atlasTextureIcon:pi,atlasInterpolation:Rt,atlasInterpolationIcon:Mi,isSDF:Me,hasHalo:mi};if(se&&Ne.canOverlap){le=!0;const Nt=tt.segments.get();for(const Zn of Nt)Le.push({segments:new c.a0([Zn]),sortKey:Zn.sortKey,state:ri,terrainData:Lt})}else Le.push({segments:tt.segments,sortKey:0,state:ri,terrainData:Lt})}le&&Le.sort((we,Te)=>we.sortKey-Te.sortKey);for(const we of Le){const Te=we.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,we.segments,n,u,Te.program,ge,P,k,Ne,we.terrainData)),Ne.u_is_halo=0}pn(Te.buffers,we.segments,n,u,Te.program,ge,P,k,Te.uniformValues,we.terrainData)}}function pn(u,t,n,o,a,h,m,_,v,b){const P=o.context;a.draw(P,P.gl.TRIANGLES,h,m,_,Mt.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()],_=h[n.from.toString()];if(!m&&_&&(m=_),!_&&m&&(_=m),!m||!_){const v=a.getPaintProperty(t);m=h[v],_=h[v]}m&&_&&u.setConstantPatternPositions(m,_)}function ra(u,t,n,o,a,h,m){const _=u.context.gl,v="fill-pattern",b=n.paint.get(v),P=b&&b.constantOr(1),k=n.getCrossfadeParameters();let L,B,V,Z,U;m?(B=P&&!n.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",L=_.LINES):(B=P?"fillPattern":"fill",L=_.TRIANGLES);const H=b.constantOr(null);for(const K of o){const j=t.getTile(K);if(P&&!j.patternsLoaded())continue;const te=j.getBucket(n);if(!te)continue;const se=te.programConfigurations.get(n.id),le=u.useProgram(B,se),ge=u.style.map.terrain&&u.style.map.terrain.getTerrainData(K);P&&(u.context.activeTexture.set(_.TEXTURE0),j.imageAtlasTexture.bind(_.LINEAR,_.CLAMP_TO_EDGE),se.updatePaintBuffers(k)),$i(se,v,H,j,n);const be=ge?K:null,Le=u.translatePosMatrix(be?be.posMatrix:K.posMatrix,j,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));if(m){Z=te.indexBuffer2,U=te.segments2;const Be=[_.drawingBufferWidth,_.drawingBufferHeight];V=B==="fillOutlinePattern"&&P?Fc(Le,u,k,j,Be):Bc(Le,Be)}else Z=te.indexBuffer,U=te.segments,V=P?zn(Le,u,k,j):ps(Le);le.draw(u.context,L,a,u.stencilModeForClipping(K),h,Mt.disabled,V,ge,n.id,te.layoutVertexBuffer,Z,U,n.paint,u.transform.zoom,se)}}function no(u,t,n,o,a,h,m){const _=u.context,v=_.gl,b="fill-extrusion-pattern",P=n.paint.get(b),k=P.constantOr(1),L=n.getCrossfadeParameters(),B=n.paint.get("fill-extrusion-opacity"),V=P.constantOr(null);for(const Z of o){const U=t.getTile(Z),H=U.getBucket(n);if(!H)continue;const K=u.style.map.terrain&&u.style.map.terrain.getTerrainData(Z),j=H.programConfigurations.get(n.id),te=u.useProgram(k?"fillExtrusionPattern":"fillExtrusion",j);k&&(u.context.activeTexture.set(v.TEXTURE0),U.imageAtlasTexture.bind(v.LINEAR,v.CLAMP_TO_EDGE),j.updatePaintBuffers(L)),$i(j,b,V,U,n);const se=u.translatePosMatrix(Z.posMatrix,U,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),le=n.paint.get("fill-extrusion-vertical-gradient"),ge=k?Xs(se,u,le,B,Z,L,U):Hs(se,u,le,B);te.draw(_,_.gl.TRIANGLES,a,h,m,Mt.backCCW,ge,K,n.id,H.layoutVertexBuffer,H.indexBuffer,H.segments,n.paint,u.transform.zoom,j,u.style.map.terrain&&H.centroidVertexBuffer)}}function na(u,t,n,o,a,h,m){const _=u.context,v=_.gl,b=n.fbo;if(!b)return;const P=u.useProgram("hillshade"),k=u.style.map.terrain&&u.style.map.terrain.getTerrainData(t);_.activeTexture.set(v.TEXTURE0),v.bindTexture(v.TEXTURE_2D,b.colorAttachment.get()),P.draw(_,v.TRIANGLES,a,h,m,Mt.disabled,((L,B,V,Z)=>{const U=V.paint.get("hillshade-shadow-color"),H=V.paint.get("hillshade-highlight-color"),K=V.paint.get("hillshade-accent-color");let j=V.paint.get("hillshade-illumination-direction")*(Math.PI/180);V.paint.get("hillshade-illumination-anchor")==="viewport"&&(j-=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:Ui(0,B.tileID),u_light:[V.paint.get("hillshade-exaggeration"),j],u_shadow:U,u_highlight:H,u_accent:K}})(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,_=m.gl,v=t.dem;if(v&&v.data){const b=v.dim,P=v.stride,k=v.getPixels();if(m.activeTexture.set(_.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(_.NEAREST,_.CLAMP_TO_EDGE)}else t.demTexture=new bt(m,k,_.RGBA,{premultiply:!1}),t.demTexture.bind(_.NEAREST,_.CLAMP_TO_EDGE);m.activeTexture.set(_.TEXTURE0);let L=t.fbo;if(!L){const B=new bt(m,{width:b,height:b,data:null},_.RGBA);B.bind(_.LINEAR,_.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,_.TRIANGLES,o,a,h,Mt.disabled,((B,V)=>{const Z=V.stride,U=c.H();return c.aQ(U,0,c.X,-c.X,0,0,1),c.J(U,U,[0,-c.X,0]),{u_matrix:U,u_image:1,u_dimension:[Z,Z],u_zoom:B.overscaledZ,u_unpack:V.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 _=ce.now(),v=(_-u.timeAdded)/m,b=t?(_-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),zl=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,_=m.gl;_.enable(_.SCISSOR_TEST),_.scissor(t*u.pixelRatio,n*u.pixelRatio,o*u.pixelRatio,a*u.pixelRatio),m.clear({color:h}),_.disable(_.SCISSOR_TEST)}function ft(u,t,n){const o=u.context,a=o.gl,h=n.posMatrix,m=u.useProgram("debug"),_=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),V=t.getTile(n).tileSize,Z=512/Math.min(V,512)*(n.overscaledZ/u.transform.zoom)*.5;let U=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(U+=` => ${n.overscaledZ}`),function(H,K){H.initDebugOverlayCanvas();const j=H.debugOverlayCanvas,te=H.context.gl,se=H.debugOverlayCanvas.getContext("2d");se.clearRect(0,0,j.width,j.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(K,5,5),se.strokeText(K,5,5),H.debugOverlayTexture.update(j),H.debugOverlayTexture.bind(te.LINEAR,te.CLAMP_TO_EDGE)}(u,`${U} ${B}kB`),m.draw(o,a.TRIANGLES,_,v,Et.alphaBlended,Mt.disabled,Wr(h,c.aN.transparent,Z),null,P,u.debugBuffer,u.quadTriangleIndexBuffer,u.debugSegments),m.draw(o,a.LINE_STRIP,_,v,b,Mt.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),_=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),V=u.transform.calculateFogMatrix(b.tileID.toUnwrapped()),Z=$o(L,B,V,u.style.sky,u.transform.pitch);_.draw(o,a.TRIANGLES,m,Vt.disabled,h,Mt.backCCW,Z,k,"terrain",v.vertexBuffer,v.indexBuffer,v.segments)}}class Dl{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 Ll{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 _=new c.aY;_.emplaceBack(0,1,2),_.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(_);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,Et.disabled,Mt.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(Et.disabled),o.setDepthMode(ct.disabled);const h=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const m of n){const _=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},_,255,a.KEEP,a.KEEP,a.REPLACE),Et.disabled,Mt.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,_)=>_.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 _=0;_<h;_++)m[_+a]=new Vt({func:n.GEQUAL,mask:255},_+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 Et([t.CONSTANT_COLOR,t.ONE],new c.aN(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Et.unblended:Et.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(ce.now()),this.imageManager.beginFrame();const a=this.style._order,h=this.style.sourceCaches,m={},_={},v={};for(const b in h){const P=h[b];P.used&&P.prepare(this.context),m[b]=P.getVisibleCoordinates(),_[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=_[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=((K,j,te)=>({u_sky_color:K.properties.get("sky-color"),u_horizon_color:K.properties.get("horizon-color"),u_horizon:(j.height/2+j.getHorizon())*te,u_sky_horizon_blend:K.properties.get("sky-horizon-blend")*j.height/2*te}))(P,b.style.map.transform,b.pixelRatio),V=new ct(L.LEQUAL,ct.ReadWrite,[0,1]),Z=Vt.disabled,U=b.colorModeForRenderPass(),H=b.useProgram("sky");if(!P.mesh){const K=new c.aX;K.emplaceBack(-1,-1),K.emplaceBack(1,-1),K.emplaceBack(1,1),K.emplaceBack(-1,1);const j=new c.aY;j.emplaceBack(0,1,2),j.emplaceBack(0,2,3),P.mesh=new Dl(k.createVertexBuffer(K,us.members),k.createIndexBuffer(j),c.a0.simpleSegment(0,0,K.length,j.length))}H.draw(k,L.TRIANGLES,V,Z,U,Mt.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:_)[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]]:[]),V=B.filter(H=>H.getSource().type==="vector"),Z=B.filter(H=>H.getSource().type!=="vector"),U=H=>{(!L||L.getSource().maxzoom<H.getSource().maxzoom)&&(L=H)};return V.forEach(H=>U(H)),L||Z.forEach(H=>U(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,zl);const k=b.transform.centerPoint;(function(L,B,V,Z){Bn(L,B-1,V-10,2,20,Z),Bn(L,B-10,V-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 _=h.context,v=_.gl,b=Et.unblended,P=new ct(v.LEQUAL,ct.ReadWrite,[0,1]),k=m.getTerrainMesh(),L=m.sourceCache.getRenderableTiles(),B=h.useProgram("terrainDepth");_.bindFramebuffer.set(m.getFramebuffer("depth").framebuffer),_.viewport.set([0,0,h.width/devicePixelRatio,h.height/devicePixelRatio]),_.clear({color:c.aN.transparent,depth:1});for(const V of L){const Z=m.getTerrainData(V.tileID),U={u_matrix:h.transform.calculatePosMatrix(V.tileID.toUnwrapped()),u_ele_delta:m.getMeshFrameDelta(h.transform.zoom)};B.draw(_,v.TRIANGLES,P,Vt.disabled,b,Mt.backCCW,U,Z,"terrain",k.vertexBuffer,k.indexBuffer,k.segments)}_.bindFramebuffer.set(null),_.viewport.set([0,0,h.width,h.height])}(this,this.style.map.terrain),function(h,m){const _=h.context,v=_.gl,b=Et.unblended,P=new ct(v.LEQUAL,ct.ReadWrite,[0,1]),k=m.getTerrainMesh(),L=m.getCoordsTexture(),B=m.sourceCache.getRenderableTiles(),V=h.useProgram("terrainCoords");_.bindFramebuffer.set(m.getFramebuffer("coords").framebuffer),_.viewport.set([0,0,h.width/devicePixelRatio,h.height/devicePixelRatio]),_.clear({color:c.aN.transparent,depth:1}),m.coordsIndex=[];for(const Z of B){const U=m.getTerrainData(Z.tileID);_.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)};V.draw(_,v.TRIANGLES,P,Vt.disabled,b,Mt.backCCW,H,U,"terrain",k.vertexBuffer,k.indexBuffer,k.segments),m.coordsIndex.push(Z.tileID.key)}_.bindFramebuffer.set(null),_.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,_,v,b){if(h.renderPass!=="translucent")return;const P=Vt.disabled,k=h.colorModeForRenderPass();(_._unevaluatedLayout.hasValue("text-variable-anchor")||_._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(L,B,V,Z,U,H,K,j,te){const se=B.transform,le=Us(),ge=U==="map",be=H==="map";for(const Le of L){const Be=Z.getTile(Le),we=Be.getBucket(V);if(!we||!we.text||!we.text.segments.get().length)continue;const Te=c.ah(we.textSizeData,se.zoom),Ne=rt(Be,1,B.transform.zoom),tt=Gr(Le.posMatrix,be,ge,B.transform,Ne),ke=V.layout.get("icon-text-fit")!=="none"&&we.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,Dt=le.translatePosition(se,Be,K,j);ro(we,ge,be,te,se,tt,Le.posMatrix,Me,Te,ke,le,Dt,Le.toUnwrapped(),Ye)}}}(v,h,_,m,_.layout.get("text-rotation-alignment"),_.layout.get("text-pitch-alignment"),_.paint.get("text-translate"),_.paint.get("text-translate-anchor"),b),_.paint.get("icon-opacity").constantOr(1)!==0&&Jr(h,m,_,v,!1,_.paint.get("icon-translate"),_.paint.get("icon-translate-anchor"),_.layout.get("icon-rotation-alignment"),_.layout.get("icon-pitch-alignment"),_.layout.get("icon-keep-upright"),P,k),_.paint.get("text-opacity").constantOr(1)!==0&&Jr(h,m,_,v,!0,_.paint.get("text-translate"),_.paint.get("text-translate-anchor"),_.layout.get("text-rotation-alignment"),_.layout.get("text-pitch-alignment"),_.layout.get("text-keep-upright"),P,k),m.map.showCollisionBoxes&&(Ml(h,m,_,v,!0),Ml(h,m,_,v,!1))})(t,n,o,a,this.style.placement.variableOffsets);break;case"circle":(function(h,m,_,v){if(h.renderPass!=="translucent")return;const b=_.paint.get("circle-opacity"),P=_.paint.get("circle-stroke-width"),k=_.paint.get("circle-stroke-opacity"),L=!_.layout.get("circle-sort-key").isConstant();if(b.constantOr(1)===0&&(P.constantOr(1)===0||k.constantOr(1)===0))return;const B=h.context,V=B.gl,Z=h.depthModeForSublayer(0,ct.ReadOnly),U=Vt.disabled,H=h.colorModeForRenderPass(),K=[];for(let j=0;j<v.length;j++){const te=v[j],se=m.getTile(te),le=se.getBucket(_);if(!le)continue;const ge=le.programConfigurations.get(_.id),be=h.useProgram("circle",ge),Le=le.layoutVertexBuffer,Be=le.indexBuffer,we=h.style.map.terrain&&h.style.map.terrain.getTerrainData(te),Te={programConfiguration:ge,program:be,layoutVertexBuffer:Le,indexBuffer:Be,uniformValues:dl(h,te,se,_),terrainData:we};if(L){const Ne=le.segments.get();for(const tt of Ne)K.push({segments:new c.a0([tt]),sortKey:tt.sortKey,state:Te})}else K.push({segments:le.segments,sortKey:0,state:Te})}L&&K.sort((j,te)=>j.sortKey-te.sortKey);for(const j of K){const{programConfiguration:te,program:se,layoutVertexBuffer:le,indexBuffer:ge,uniformValues:be,terrainData:Le}=j.state;se.draw(B,V.TRIANGLES,Z,U,H,Mt.disabled,be,Le,_.id,le,ge,j.segments,_.paint,h.transform.zoom,te)}})(t,n,o,a);break;case"heatmap":(function(h,m,_,v){if(_.paint.get("heatmap-opacity")!==0)if(h.renderPass==="offscreen"){const b=h.context,P=b.gl,k=Vt.disabled,L=new Et([P.ONE,P.ONE],c.aN.transparent,[!0,!0,!0,!0]);(function(B,V,Z){const U=B.gl;B.activeTexture.set(U.TEXTURE1),B.viewport.set([0,0,V.width/4,V.height/4]);let H=Z.heatmapFbo;if(H)U.bindTexture(U.TEXTURE_2D,H.colorAttachment.get()),B.bindFramebuffer.set(H.framebuffer);else{const K=U.createTexture();U.bindTexture(U.TEXTURE_2D,K),U.texParameteri(U.TEXTURE_2D,U.TEXTURE_WRAP_S,U.CLAMP_TO_EDGE),U.texParameteri(U.TEXTURE_2D,U.TEXTURE_WRAP_T,U.CLAMP_TO_EDGE),U.texParameteri(U.TEXTURE_2D,U.TEXTURE_MIN_FILTER,U.LINEAR),U.texParameteri(U.TEXTURE_2D,U.TEXTURE_MAG_FILTER,U.LINEAR),H=Z.heatmapFbo=B.createFramebuffer(V.width/4,V.height/4,!1,!1),function(j,te,se,le){var ge,be;const Le=j.gl,Be=(ge=j.HALF_FLOAT)!==null&&ge!==void 0?ge:Le.UNSIGNED_BYTE,we=(be=j.RGBA16F)!==null&&be!==void 0?be:Le.RGBA;Le.texImage2D(Le.TEXTURE_2D,0,we,te.width/4,te.height/4,0,Le.RGBA,Be,null),le.colorAttachment.set(se)}(B,V,K,H)}})(b,h,_),b.clear({color:c.aN.transparent});for(let B=0;B<v.length;B++){const V=v[B];if(m.hasRenderableParent(V))continue;const Z=m.getTile(V),U=Z.getBucket(_);if(!U)continue;const H=U.programConfigurations.get(_.id),K=h.useProgram("heatmap",H),{zoom:j}=h.transform;K.draw(b,P.TRIANGLES,ct.disabled,k,L,Mt.disabled,ji(V.posMatrix,Z,j,_.paint.get("heatmap-intensity")),null,_.id,U.layoutVertexBuffer,U.indexBuffer,U.segments,_.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 V=P.colorRampTexture;V||(V=P.colorRampTexture=new bt(k,P.colorRamp,L.RGBA)),V.bind(L.LINEAR,L.CLAMP_TO_EDGE),b.useProgram("heatmapTexture").draw(k,L.TRIANGLES,ct.disabled,Vt.disabled,b.colorModeForRenderPass(),Mt.disabled,((Z,U,H,K)=>{const j=c.H();c.aQ(j,0,Z.width,Z.height,0,0,1);const te=Z.context.gl;return{u_matrix:j,u_world:[te.drawingBufferWidth,te.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:U.paint.get("heatmap-opacity")}})(b,P),null,P.id,b.viewportBuffer,b.quadTriangleIndexBuffer,b.viewportSegments,P.paint,b.transform.zoom)}(h,_))})(t,n,o,a);break;case"line":(function(h,m,_,v){if(h.renderPass!=="translucent")return;const b=_.paint.get("line-opacity"),P=_.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=_.paint.get("line-dasharray"),V=_.paint.get("line-pattern"),Z=V.constantOr(1),U=_.paint.get("line-gradient"),H=_.getCrossfadeParameters(),K=Z?"linePattern":B?"lineSDF":U?"lineGradient":"line",j=h.context,te=j.gl;let se=!0;for(const le of v){const ge=m.getTile(le);if(Z&&!ge.patternsLoaded())continue;const be=ge.getBucket(_);if(!be)continue;const Le=be.programConfigurations.get(_.id),Be=h.context.program.get(),we=h.useProgram(K,Le),Te=se||we.program!==Be,Ne=h.style.map.terrain&&h.style.map.terrain.getTerrainData(le),tt=V.constantOr(null);if(tt&&ge.imageAtlas){const Ye=ge.imageAtlas,Dt=Ye.patternPositions[tt.to.toString()],st=Ye.patternPositions[tt.from.toString()];Dt&&st&&Le.setConstantPatternPositions(Dt,st)}const ke=Ne?le:null,Me=Z?pl(h,ge,_,H,ke):B?fl(h,ge,_,B,H,ke):U?Ws(h,ge,_,be.lineClipsArray.length,ke):ms(h,ge,_,ke);if(Z)j.activeTexture.set(te.TEXTURE0),ge.imageAtlasTexture.bind(te.LINEAR,te.CLAMP_TO_EDGE),Le.updatePaintBuffers(H);else if(B&&(Te||h.lineAtlas.dirty))j.activeTexture.set(te.TEXTURE0),h.lineAtlas.bind(j);else if(U){const Ye=be.gradients[_.id];let Dt=Ye.texture;if(_.gradientVersion!==Ye.version){let st=256;if(_.stepInterpolant){const ht=m.getSource().maxzoom,Lt=le.canonical.z===ht?Math.ceil(1<<h.transform.maxZoom-le.canonical.z):1;st=c.ad(c.aV(be.maxLineLength/c.X*1024*Lt),256,j.maxTextureSize)}Ye.gradient=c.aW({expression:_.gradientExpression(),evaluationKey:"lineProgress",resolution:st,image:Ye.gradient||void 0,clips:be.lineClipsArray}),Ye.texture?Ye.texture.update(Ye.gradient):Ye.texture=new bt(j,Ye.gradient,te.RGBA),Ye.version=_.gradientVersion,Dt=Ye.texture}j.activeTexture.set(te.TEXTURE0),Dt.bind(_.stepInterpolant?te.NEAREST:te.LINEAR,te.CLAMP_TO_EDGE)}we.draw(j,te.TRIANGLES,k,h.stencilModeForClipping(le),L,Mt.disabled,Me,Ne,_.id,be.layoutVertexBuffer,be.indexBuffer,be.segments,_.paint,h.transform.zoom,Le,be.layoutVertexBuffer2),se=!1}})(t,n,o,a);break;case"fill":(function(h,m,_,v){const b=_.paint.get("fill-color"),P=_.paint.get("fill-opacity");if(P.constantOr(1)===0)return;const k=h.colorModeForRenderPass(),L=_.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 V=h.depthModeForSublayer(1,h.renderPass==="opaque"?ct.ReadWrite:ct.ReadOnly);ra(h,m,_,v,V,k,!1)}if(h.renderPass==="translucent"&&_.paint.get("fill-antialias")){const V=h.depthModeForSublayer(_.getPaintProperty("fill-outline-color")?2:0,ct.ReadOnly);ra(h,m,_,v,V,k,!0)}})(t,n,o,a);break;case"fill-extrusion":(function(h,m,_,v){const b=_.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||_.paint.get("fill-extrusion-pattern").constantOr(1))no(h,m,_,v,P,Vt.disabled,Et.disabled),no(h,m,_,v,P,h.stencilModeFor3D(),h.colorModeForRenderPass());else{const k=h.colorModeForRenderPass();no(h,m,_,v,P,Vt.disabled,k)}}})(t,n,o,a);break;case"hillshade":(function(h,m,_,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 V of B){const Z=m.getTile(V);Z.needsHillshadePrepare!==void 0&&Z.needsHillshadePrepare&&h.renderPass==="offscreen"?fn(h,Z,_,P,Vt.disabled,k):h.renderPass==="translucent"&&na(h,V,Z,_,P,L[V.overscaledZ],k)}b.viewport.set([0,0,h.width,h.height])})(t,n,o,a);break;case"raster":(function(h,m,_,v){if(h.renderPass!=="translucent"||_.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(),[V,Z]=k instanceof Cr?[{},v]:h.stencilConfigForOverlap(v),U=Z[Z.length-1].overscaledZ,H=!h.options.moving;for(const K of Z){const j=h.depthModeForSublayer(K.overscaledZ-U,_.paint.get("raster-opacity")===1?ct.ReadWrite:ct.ReadOnly,P.LESS),te=m.getTile(K);te.registerFadeDuration(_.paint.get("raster-fade-duration"));const se=m.findLoadedParent(K,0),le=m.findLoadedSibling(K),ge=so(te,se||le||null,m,_,h.transform,h.style.map.terrain);let be,Le;const Be=_.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),be=Math.pow(2,se.tileID.overscaledZ-te.tileID.overscaledZ),Le=[te.tileID.canonical.x*be%1,te.tileID.canonical.y*be%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 we=h.style.map.terrain&&h.style.map.terrain.getTerrainData(K),Te=we?K:null,Ne=Te?Te.posMatrix:h.transform.calculatePosMatrix(K.toUnwrapped(),H),tt=Vc(Ne,Le||[0,0],be||1,ge,_);k instanceof Cr?L.draw(b,P.TRIANGLES,j,Vt.disabled,B,Mt.disabled,tt,we,_.id,k.boundsBuffer,h.quadTriangleIndexBuffer,k.boundsSegments):L.draw(b,P.TRIANGLES,j,V[K.overscaledZ],B,Mt.disabled,tt,we,_.id,h.rasterBoundsBuffer,h.quadTriangleIndexBuffer,h.rasterBoundsSegments)}})(t,n,o,a);break;case"background":(function(h,m,_,v){const b=_.paint.get("background-color"),P=_.paint.get("background-opacity");if(P===0)return;const k=h.context,L=k.gl,B=h.transform,V=B.tileSize,Z=_.paint.get("background-pattern");if(h.isPatternMissing(Z))return;const U=!Z&&b.a===1&&P===1&&h.opaquePassEnabledForLayer()?"opaque":"translucent";if(h.renderPass!==U)return;const H=Vt.disabled,K=h.depthModeForSublayer(0,U==="opaque"?ct.ReadWrite:ct.ReadOnly),j=h.colorModeForRenderPass(),te=h.useProgram(Z?"backgroundPattern":"background"),se=v||B.coveringTiles({tileSize:V,terrain:h.style.map.terrain});Z&&(k.activeTexture.set(L.TEXTURE0),h.imageManager.bind(h.context));const le=_.getCrossfadeParameters();for(const ge of se){const be=v?ge.posMatrix:h.transform.calculatePosMatrix(ge.toUnwrapped()),Le=Z?qo(be,P,h,Z,{tileID:ge,tileSize:V},le):Js(be,P,b),Be=h.style.map.terrain&&h.style.map.terrain.getTerrainData(ge);te.draw(k,L.TRIANGLES,K,H,j,Mt.disabled,Le,Be,_.id,h.tileExtentBuffer,h.quadTriangleIndexBuffer,h.tileExtentSegments)}})(t,0,o,a);break;case"custom":(function(h,m,_){const v=h.context,b=_.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 _=[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,_),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(_=>{const v=1/(_=c.ag([],_,t))[3]/n*a;return c.b1(_,_,[v,v,1/_[3],v])}),m=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(_=>{const v=function(L,B){var V=B[0],Z=B[1],U=B[2],H=V*V+Z*Z+U*U;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,V){var Z=B[0],U=B[1],H=B[2],K=V[0],j=V[1],te=V[2];return L[0]=U*te-H*j,L[1]=H*K-Z*te,L[2]=Z*j-U*K,L}([],jt([],h[_[0]],h[_[1]]),jt([],h[_[2]],h[_[1]]))),b=-((P=v)[0]*(k=h[_[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 _=0;_<n.length;_++)c.b2(h,n[_])>=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 _=0;_<t.points.length;_++){const v=t.points[_][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],_=a[1],v=a[2],b=a[3],P=Math.sin(h),k=Math.cos(h);o[0]=m*k+v*P,o[1]=_*k+b*P,o[2]=m*-P+v*k,o[3]=_*-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)),_=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=_-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()),_=c.Z.fromLngLat(this.center),v=Math.pow(2,a),b=[v*m.x,v*m.y,0],P=[v*_.x,v*_.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,V=j=>({aabb:new lo([j*v,0,0],[(j+1)*v,v,0]),zoom:0,x:0,y:0,wrap:j,fullyVisible:!1}),Z=[],U=[],H=a,K=t.reparseOverscaled?h:a;if(this._renderWorldCopies)for(let j=1;j<=3;j++)Z.push(V(-j)),Z.push(V(j));for(Z.push(V(0));Z.length>0;){const j=Z.pop(),te=j.x,se=j.y;let le=j.fullyVisible;if(!le){const we=j.aabb.intersects(k);if(we===0)continue;le=we===2}const ge=t.terrain?b:P,be=j.aabb.distanceX(ge),Le=j.aabb.distanceY(ge),Be=Math.max(Math.abs(be),Math.abs(Le));if(j.zoom===H||Be>B+(1<<H-j.zoom)-2&&j.zoom>=L){const we=H-j.zoom,Te=b[0]-.5-(te<<we),Ne=b[1]-.5-(se<<we);U.push({tileID:new c.S(j.zoom===H?K:j.zoom,j.wrap,j.zoom,te,se),distanceSq:Vr([P[0]-.5-te,P[1]-.5-se]),tileDistanceToCamera:Math.sqrt(Te*Te+Ne*Ne)})}else for(let we=0;we<4;we++){const Te=(te<<1)+we%2,Ne=(se<<1)+(we>>1),tt=j.zoom+1;let ke=j.aabb.quadrant(we);if(t.terrain){const Me=new c.S(tt,j.wrap,tt,Te,Ne),Ye=t.terrain.getMinMaxElevation(Me),Dt=(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],Dt],[ke.max[0],ke.max[1],st])}Z.push({aabb:ke,zoom:tt,x:Te,y:Ne,wrap:j.wrap,fullyVisible:le})}}return U.sort((j,te)=>j.distanceSq-te.distanceSq).map(j=>j.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,_=Math.cos(this._pitch)*this.cameraToCenterDistance/m/c.b5(1,a.lat),v=this.scaleZoom(_/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],_=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(_,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 j=179.9999999999;a=[-j,j]}const h=this.tileSize*this.zoomScale(o.zoom);let m=0,_=h,v=0,b=h,P=0,k=0;const{x:L,y:B}=this.size;if(this.latRange){const j=this.latRange;m=c.Q(j[1])*h,_=c.Q(j[0])*h,_-m<B&&(P=B/(_-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:V,y:Z}=this.project.call({worldSize:h},t);let U,H;const K=Math.max(k||0,P||0);if(K){const j=new c.P(k?(b+v)/2:V,P?(_+m)/2:Z);return o.center=this.unproject.call({worldSize:h},j).wrap(),o.zoom+=this.scaleZoom(K),o}if(this.latRange){const j=B/2;Z-j<m&&(H=m+j),Z+j>_&&(H=_-j)}if(a){const j=(v+b)/2;let te=V;this._renderWorldCopies&&(te=c.b3(V,j-h/2,j+h/2));const se=L/2;te-se<v&&(U=v+se),te+se>b&&(U=b-se)}if(U!==void 0||H!==void 0){const j=new c.P(U??V,H??Z);o.center=this.unproject.call({worldSize:h},j).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),_=h-m*this._pixelPerMeter/Math.cos(this._pitch),v=m<0?_: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)),V=Math.sin(B)*v/Math.sin(c.ad(Math.PI-b-B,.01,Math.PI-.01)),Z=Math.min(k,V);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 U=this.width%2/2,H=this.height%2/2,K=Math.cos(this.angle),j=Math.sin(this.angle),te=n-Math.round(n)+K*U+j*H,se=o-Math.round(o)+K*H+j*U,le=new Float64Array(a);if(c.J(le,le,[te>.5?te-1:te,se>.5?se-1:se,0]),this.alignedModelViewProjectionMatrix=le,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 _ of t)o=Math.min(o,_.x),a=Math.min(a,_.y),h=Math.max(h,_.x),m=Math.max(m,_.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(..._)=>(o=!0,h=this,n=_,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,_=Math.round(n.lat*h)/h,v=this._map.getBearing(),b=this._map.getPitch();let P="";if(P+=t?`/${m}/${_}/${o}`:`${o}/${_}/${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(V=>{const Z=V.split("=")[0];return Z===k?(L=!0,`${Z}=${P}`):V}).filter(V=>V);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),Rl=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:ce.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,n=ce.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,Rl);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),_=Math.abs(m)/(h*a);return{easing:n.easing,duration:1e3*_,amount:m*(_/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)),_=h.reduce((v,b,P,k)=>v.add(b.div(k.length)),new c.P(0,0));super(t,{points:h,point:_,lngLats:m,lngLat:n.unproject(_),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),_=Math.min(a.y,o.y),v=Math.max(a.y,o.y);ae.setTransform(this._box,`translate(${h}px,${_}px)`),this._box.style.width=m-h+"px",this._box.style.height=v-_+"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 Bl{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:_=>_.easeTo({duration:300,zoom:m.zoom+1,around:m.unproject(a)},{originalEvent:t})}):h?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:_=>_.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 zt{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 Ai{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 Ai({checkCorrectEvent:a=>ae.mouseButton(a)===0&&a.ctrlKey||ae.mouseButton(a)===2});return new zt({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 Ai({checkCorrectEvent:a=>ae.mouseButton(a)===0&&a.ctrlKey||ae.mouseButton(a)===2});return new zt({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 _=0;for(const b in a){const P=a[b],k=this._touches[b];k&&(h._add(P),m._add(P.sub(k)),_++,a[b]=P)}if(this._touches=a,this._shouldBePrevented(_)||!m.mag())return;const v=m.div(_);return this._sum._add(v),this._sum.mag()<this._clickTolerance?void 0:{around:h.div(_),panDelta:v}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class 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),_=ks(o,n,h);if(!m||!_)return;const v=this._aroundCenter?null:m.add(_).div(2);return this._move([m,_],v,t)}touchend(t,n,o){if(!this._firstTwoTouches)return;const[a,h]=this._firstTwoTouches,m=ks(o,n,a),_=ks(o,n,h);m&&_||(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 Fl={panStep:100,bearingStep:15,pitchStep:10};class ba{constructor(t){this._tr=new On(t);const n=Fl;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:_=>{const v=this._tr;_.easeTo({duration:300,easeId:"keyboardHandler",easing:Ol,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 Ol(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=ce.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 _=ce.now()-this._lastWheelEventTime;if(this._type==="wheel"&&o&&a&&_){const v=Math.min(_/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=(ce.now()-o.start)/o.duration,h=o.easing(a+.01)-o.easing(a),m=.27/Math.sqrt(h*h+1e-4)*.01,_=Math.sqrt(.0729-m*m);n=c.b8(m,_,.25,1)}return this._prevEase={start:ce.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 Es{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 Vl{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 Kc extends c.k{}function Pa(u){return u.panDelta&&u.panDelta.mag()||u.zoomDelta||u.bearingDelta||u.pitchDelta}class Yc{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,_={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:U,allowed:H}of this._handlers){if(!U.isEnabled())continue;let K;this._blockedByActive(b,H,Z)?U.reset():U[h||a.type]&&(K=U[h||a.type](a,L,k),this.mergeHandlerResult(_,v,K,Z,m),K&&K.needsRenderFrame&&this._triggerRenderFrame()),(K||U.isActive())&&(b[Z]=U)}const B={};for(const Z in this._previousActiveHandlers)b[Z]||(B[Z]=m);this._previousActiveHandlers=b,(Object.keys(B).length||Pa(_))&&(this._changes.push([_,v,B]),this._triggerRenderFrame()),(Object.keys(b).length||Pa(_))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:V}=_;V&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],V(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 Bl(n),_=new Es(n);n.doubleClickZoom=new Ta(_,m),this._add("tapZoom",m),this._add("clickZoom",_),t.interactive&&t.doubleClickZoom&&n.doubleClickZoom.enable();const v=new Vl;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:K,clickTolerance:j})=>{const te=new Ai({checkCorrectEvent:se=>ae.mouseButton(se)===0&&!se.ctrlKey});return new zt({clickTolerance:j,move:(se,le)=>({around:le,panDelta:le.sub(se)}),activateOnStart:!0,moveStateManager:te,enable:K,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 V=new xa,Z=new _a;n.touchZoomRotate=new Ia(o,Z,V,v),this._add("touchRotate",V,["touchPan","touchZoom"]),this._add("touchZoom",Z,["touchPan","touchRotate"]),t.interactive&&t.touchZoomRotate&&n.touchZoomRotate.enable(t.touchZoomRotate);const U=n.scrollZoom=new Sa(n,()=>this._triggerRenderFrame());this._add("scrollZoom",U,["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:_,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(_?k.sub(_):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(_)):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 _={};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,_[`${k}end`]=v)}for(const k in _)this._fireEvent(k,_[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&&ce.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 Kc("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class Qc extends c.E{constructor(t,n){super(),this._renderFrameCallback=()=>{const o=Math.min((ce.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 we=a.padding;a.padding={top:we,bottom:we,right:we,left:we}}a.padding=c.e(h,a.padding);const m=this.transform,_=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),V=b.rotate(B),Z=P.rotate(B),U=k.rotate(B),H=L.rotate(B),K=new c.P(Math.max(V.x,Z.x,H.x,U.x),Math.max(V.y,Z.y,H.y,U.y)),j=new c.P(Math.min(V.x,Z.x,H.x,U.x),Math.min(V.y,Z.y,H.y,U.y)),te=K.sub(j),se=(m.width-(_.left+_.right+a.padding.left+a.padding.right))/te.x,le=(m.height-(_.top+_.bottom+a.padding.top+a.padding.bottom))/te.y;if(le<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,le)),a.maxZoom),be=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=be.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),_=m.x-h.x,v=m.y-h.y,b=m.z-h.z,P=Math.hypot(_,v,b);if(P===0)throw new Error("Can't calculate camera options with same From and To");const k=Math.hypot(_,v),L=this.transform.scaleZoom(this.transform.cameraToCenterDistance/P/this.transform.tileSize),B=180*Math.atan2(_,-v)/Math.PI;let V=180*Math.acos(k/P)/Math.PI;return V=b<0?90-V:90+V,{center:m.toLngLat(),zoom:L,pitch:V,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&&ce.prefersReducedMotion)&&(t.duration=0);const a=this._getTransformForUpdate(),h=a.zoom,m=a.bearing,_=a.pitch,v=a.padding,b="bearing"in t?this._normalizeBearing(t.bearing,m):m,P="pitch"in t?+t.pitch:_,k="padding"in t?t.padding:a.padding,L=c.P.convert(t.offset);let B=a.centerPoint.add(L);const V=a.pointLocation(B),{center:Z,zoom:U}=a.getConstrained(c.N.convert(t.center||V),(o=t.zoom)!==null&&o!==void 0?o:h);this._normalizeCenter(Z,a);const H=a.project(V),K=a.project(Z).sub(H),j=a.zoomScale(U-h);let te,se;t.around&&(te=c.N.convert(t.around),se=a.locationPoint(te));const le={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||U!==h,this._rotating=this._rotating||m!==b,this._pitching=this._pitching||P!==_,this._padding=!a.isPaddingEqual(k),this._easeId=t.easeId,this._prepareEase(n,t.noMoveStart,le),this.terrain&&this._prepareElevation(Z),this._ease(ge=>{if(this._zooming&&(a.zoom=c.z.number(h,U,ge)),this._rotating&&(a.bearing=c.z.number(m,b,ge)),this._pitching&&(a.pitch=c.z.number(_,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 be=a.zoomScale(a.zoom-h),Le=U>h?Math.min(2,j):Math.max(.5,j),Be=Math.pow(Le,1-ge),we=a.unproject(H.add(K.mult(ge*Be)).mult(be));a.setLocationAtPoint(a.renderWorldCopies?we.wrap():we,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:_,pitch:v,bearing:b,elevation:P}=a(h);m&&(h.center=m),_!==void 0&&(h.zoom=_),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&&ce.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,_=a.pitch,v=a.padding,b="bearing"in t?this._normalizeBearing(t.bearing,m):m,P="pitch"in t?+t.pitch:_,k="padding"in t?t.padding:a.padding,L=c.P.convert(t.offset);let B=a.centerPoint.add(L);const V=a.pointLocation(B),{center:Z,zoom:U}=a.getConstrained(c.N.convert(t.center||V),(o=t.zoom)!==null&&o!==void 0?o:h);this._normalizeCenter(Z,a);const H=a.zoomScale(U-h),K=a.project(V),j=a.project(Z).sub(K);let te=t.curve;const se=Math.max(a.width,a.height),le=se/H,ge=j.mag();if("minZoom"in t){const Me=c.ad(Math.min(t.minZoom,h,U),a.minZoom,a.maxZoom),Ye=se/a.zoomScale(Me-h);te=Math.sqrt(Ye/ge*2)}const be=te*te;function Le(Me){const Ye=(le*le-se*se+(Me?-1:1)*be*be*ge*ge)/(2*(Me?le:se)*be*ge);return Math.log(Math.sqrt(Ye*Ye+1)-Ye)}function Be(Me){return(Math.exp(Me)-Math.exp(-Me))/2}function we(Me){return(Math.exp(Me)+Math.exp(-Me))/2}const Te=Le(!1);let Ne=function(Me){return we(Te)/we(Te+te*Me)},tt=function(Me){return se*((we(Te)*(Be(Ye=Te+te*Me)/we(Ye))-Be(Te))/be)/ge;var Ye},ke=(Le(!0)-Te)/te;if(Math.abs(ge)<1e-6||!isFinite(ke)){if(Math.abs(se-le)<1e-6)return this.easeTo(t,n);const Me=le<se?-1:1;ke=Math.abs(Math.log(le/se))/te,tt=()=>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!==_,this._padding=!a.isPaddingEqual(k),this._prepareEase(n,!1),this.terrain&&this._prepareElevation(Z),this._ease(Me=>{const Ye=Me*ke,Dt=1/Ne(Ye);a.zoom=Me===1?U:h+a.scaleZoom(Dt),this._rotating&&(a.bearing=c.z.number(m,b,Me)),this._pitching&&(a.pitch=c.z.number(_,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(K.add(j.mult(tt(Ye))).mult(Dt));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=ce.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 Nl=c.Y([{name:"a_pos3d",type:"Int16",components:3}]);class Ea 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,_=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,[-_*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,_=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,[_*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 Ea(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),_=(h=m.tile)===null||h===void 0?void 0:h.dem;if(!_)return 0;const v=function(V,Z,U){var H=Z[0],K=Z[1];return V[0]=U[0]*H+U[4]*K+U[12],V[1]=U[1]*H+U[5]*K+U[13],V}([],[n/a*c.X,o/a*c.X],m.u_terrain_matrix),b=[v[0]*_.dim,v[1]*_.dim],P=Math.floor(b[0]),k=Math.floor(b[1]),L=b[0]-P,B=b[1]-k;return _.get(P,k)*(1-L)*(1-B)+_.get(P+1,k)*L*(1-B)+_.get(P,k+1)*(1-L)*B+_.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),_=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,_*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 _=0;_<this._coordsTextureSize;_++,m+=4)n[m+0]=255&_,n[m+1]=255&h,n[m+2]=_>>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),_=Math.round(this.painter.height/devicePixelRatio);o.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),a.readPixels(h,_-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 _=n.length,v=_+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(_+k,_+k+3,_+k+1),o.emplaceBack(_+k,_+k+2,_+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 Dl(t.createVertexBuffer(n,Nl.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,_=Math.floor(h/c.X),v=Math.floor(m/c.X);return{tileID:new c.S(n,0,n,_,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 Ul{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 _ in m)this._coordsDescendingInv[o][_]||(this._coordsDescendingInv[o][_]=[]),this._coordsDescendingInv[o][_].push(m[_])}}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(_=>_.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 _ of this._renderableTiles){if(this.pool.isFull()&&(bs(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(_),_.rtt[h]){const b=this.pool.getObjectForId(_.rtt[h].id);if(b.stamp===_.rtt[h].stamp){this.pool.useObject(b);continue}}const v=this.pool.getOrCreateFreeObject();this.pool.useObject(v),this.pool.stampObject(v),_.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][_.tileID.key]:[_.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&&(_.rttCoords[P.source]=this._coordsDescendingInvStr[P.source][_.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,eh={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},$l=u=>{u.touchstart=u.dragStart,u.touchmoveWindow=u.dragMove,u.touchend=u.dragEnd},Aa={showCompass:!0,showZoom:!0,visualizePitch:!1};class ql{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:_,bearingDegreesPerPixelMoved:v=.8})=>{const b=new go;return new zt({clickTolerance:_,move:(P,k)=>({bearingDelta:(k.x-P.x)*v}),moveStateManager:b,enable:m,assignEvents:$l})})({clickTolerance:a,enable:!0}),this.map=t,o&&(this.mousePitch=xn({clickTolerance:h,enable:!0}),this.touchPitch=(({enable:m,clickTolerance:_,pitchDegreesPerPixelMoved:v=-.5})=>{const b=new go;return new zt({clickTolerance:_,move:(P,k)=>({pitchDelta:(k.y-P.y)*v}),moveStateManager:b,enable:m,assignEvents:$l})})({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 Zl(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?Zl(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}`),ce.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 _=ae.createNS("http://www.w3.org/2000/svg","g");_.setAttributeNS(null,"transform","translate(3.0, 29.0)"),_.setAttributeNS(null,"fill","#000000");const v=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const H of v){const K=ae.createNS("http://www.w3.org/2000/svg","ellipse");K.setAttributeNS(null,"opacity","0.04"),K.setAttributeNS(null,"cx","10.5"),K.setAttributeNS(null,"cy","5.80029008"),K.setAttributeNS(null,"rx",H.rx),K.setAttributeNS(null,"ry",H.ry),_.appendChild(K)}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 V=ae.createNS("http://www.w3.org/2000/svg","g");V.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 U=ae.createNS("http://www.w3.org/2000/svg","circle");U.setAttributeNS(null,"fill","#FFFFFF"),U.setAttributeNS(null,"cx","5.5"),U.setAttributeNS(null,"cy","5.5"),U.setAttributeNS(null,"r","5.4999962"),V.appendChild(Z),V.appendChild(U),m.appendChild(_),m.appendChild(b),m.appendChild(k),m.appendChild(B),m.appendChild(V),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 _=-this._offset.y/a.transform._pixelPerMeter,v=Math.sin(a.getPitch()*Math.PI/180)*_,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 jn=0,Un=!1;const Gl={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]),_=h.distanceTo(m);if(n&&n.unit==="imperial"){const v=3.2808*_;v>5280?As(t,o,v/5280,u._getUIString("ScaleControl.Miles")):As(t,o,v,u._getUIString("ScaleControl.Feet"))}else n&&n.unit==="nautical"?As(t,o,_/1852,u._getUIString("ScaleControl.NauticalMiles")):_>=1e3?As(t,o,_/1e3,u._getUIString("ScaleControl.Kilometers")):As(t,o,_,u._getUIString("ScaleControl.Meters"))}function As(u,t,n,o){const a=function(h){const m=Math.pow(10,`${Math.floor(h)}`.length-1);let _=h/m;return _=_>=10?10:_>=5?5:_>=3?3:_>=2?2:_>=1?1:function(v){const b=Math.pow(10,Math.ceil(-Math.log(v)/Math.LN10));return Math.round(v*b)/b}(_),m*_}(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&&Un)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,jn=0,Un=!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":jn--,Un=!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"),jn++,jn>1?(u={maximumAge:6e5,timeout:0},Un=!0):(u=this.options.positionOptions,Un=!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 Qc{constructor(u){c.be.mark(c.bf.create);const t=Object.assign(Object.assign({},eh),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=Ae.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 Yc(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 _=this.painter.context.gl;this._maxCanvasSize=[_.drawingBufferWidth,_.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 _ in m.delegates)this.off(_,m.delegates[_]);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 Uo(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 Uo(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 Ul(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:_,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:_,textFitWidth:v,textFitHeight:b,sdf:a,version:0,userImage:B}),B.onAdd&&B.onAdd(this,u),this}}{const{width:P,height:k,data:L}=ce.getImageData(t);this.style.addImage(u,{data:new c.R({width:P,height:k},L),pixelRatio:o,stretchX:h,stretchY:m,content:_,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)?ce.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 _=!(t instanceof HTMLImageElement||c.b(t));return n.data.replace(m,_),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 Ae.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 Ll(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=ce.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()}),_=m.crossFadingFactor();_===1&&_===this._crossFadingFactor||(n=!0,this._crossFadingFactor=_),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),Ae.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,ce.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({},Aa,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 ql(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 _ of this.options.className.split(" "))this._container.classList.add(_);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=this._map.transform.renderWorldCopies&&!this._trackPointer?Zl(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 _=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<_/2?b.push("left"):o.x>this._map.transform.width-_/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=Ut,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({},Gl),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=Uo,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(jr),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(jr)},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=C;return W})})(Zh);var Cp=Zh.exports;const _c=Ep(Cp);function Ap(y){return[{type:"fill",paint:{"fill-color":y.color||"#ccc","fill-outline-color":y.color||"blue","fill-opacity":y.opacity||1}}]}function Mp(y){return[{type:"line",paint:{"line-color":y.color||"#ccc","line-opacity":y.opacity||1}}]}function zp(y){return[{type:"circle",paint:{"circle-radius":y.radius||6,"circle-stroke-color":y.stroke||"#ccc","circle-stroke-width":y.width||1,"circle-color":y.color||"blue"}}]}function Gh(y){if(!y)return null;const S=y.type||"point";return S==="polygon"?Ap(y):S==="line"?Mp(y):zp(y)}const yc={data(){return{layerList:[],activeLayer:""}},computed:{interactiveSources(){return this.layerList.filter(y=>y==null?void 0:y.interactive).map(y=>y.id)}},methods:{moveLayer(y,S=this.map){S.getStyle().layers.forEach(C=>{C.id.match(y)&&S.moveLayer(C.id)})},async setVisible(y,S=!0,C=this.map){if(!y)return;const z=(y==null?void 0:y.id)||y,N=this.layerList.find(T=>T.id===y)||y;if(!(N!=null&&N.id))throw new Error("MixinError: Layer has no id");const W=C.getStyle().layers.filter(T=>T.id.match(z));W.forEach(T=>{C.setLayoutProperty(T.id,"visibility",S?"visible":"none")}),!W.length&&S&&await this.addLayer(N)},async addLayer(y,S={},C=this==null?void 0:this.map){var W,T,c;const z=this.layerList.find(ye=>ye.id===y)||y;this.map.getStyle().layers.find(ye=>ye.id===z.id)||(this.layerList.find(ye=>ye.id===z.id)||this.layerList.push(z),(z.service==="vtile"||z.service==="vector"||(W=z.url)!=null&&W.includes(".vmt"))&&this.addVtileLayer(z,C),z.service==="geojson"&&this.addGeoJsonLayer(z,C),((T=z.url)!=null&&T.includes(".png")||["tms","raster"].includes((c=z.service)==null?void 0:c.toLowerCase()))&&await this.addRasterLayer(z,S,C))},async addRasterLayer(y,S,C=this==null?void 0:this.map){await C.addSource(y.id,{type:"raster",tiles:[y==null?void 0:y.url],tileSize:256,...y!=null&&y.scheme?{scheme:y==null?void 0:y.scheme}:{}});const z=S.order===0?this.getOrder(S.order):null;await C.addLayer({id:y.id,type:"raster",source:y.id,minzoom:0,maxzoom:(y==null?void 0:y.maxzoom)||22},z)},async addVtileLayer(y,S=this==null?void 0:this.map){var W;const C=["props","pointZoom"].filter(T=>y[T]).map(T=>`&${T}=${y[T]}`),z={type:"vector",tiles:[`${(W=y==null?void 0:y.url)!=null&&W.startsWith("http")?"":window.location.origin}${y==null?void 0:y.url}${C}`],minzoom:y.minzoom||5,maxzoom:y.maxzoom||24};S.addSource(y.id,z),(Gh(y.style)||y.layers||[]).forEach((T,c)=>{const ye={...T,id:`${y.id}-${c}`,source:y.id,"source-layer":T["source-layer"]||y.source||y.id,maxzoom:+T.maxzoom||24,minzoom:+T.minzoom||0};S.addLayer(ye)})},async addGeoJsonLayer(y,S=this.map){var N;const C=y.data||((N=y==null?void 0:y.url)!=null&&N.startsWith("http")?"":window.location.origin)+y.url;S.addSource(y.id,{type:"geojson",data:C}),(Gh(y.style)||y.layers||[]).forEach(W=>{const T={...W,source:y.id,id:W.id||y.id,maxzoom:+W.maxzoom||24,minzoom:+W.minzoom||0,type:W.type||"circle"};S.addLayer(T)})},setLayerData(y,S){this.layerList=this.layerList.map(C=>C.id===y?{...C,...S}:C)},async removeLayer(y,S=this.map){await S.getStyle().layers.forEach(async C=>{C.source===y&&await S.removeLayer(C.id)}),S.getSource(y)&&await S.removeSource(y)},async setFilter(y,S){const C=this.layerList.find(N=>N.id===y);await(await this.map.getSource(y)).setTiles([`${window.location.origin}${C.url}${C.url.includes("?")?"&":"?"}filter=${S}${C.props?`&props=${C.props}`:""}`])},getOrder(y){var S;return((S=this.map.getStyle().layers[y])==null?void 0:S.id)||null},async changeBaseLayer(y){y!==this.activeLayer&&(this.activeLayer&&this.map.setLayoutProperty(this.activeLayer,"visibility","none"),await this.addLayer(y,{order:0}),this.map.setLayoutProperty(y,"visibility","visible"),this.activeLayer=y)},async refreshLayer(y,S=this.map){await S.getStyle().layers.forEach(C=>{C.source===y&&S.removeLayer(C.id)}),await S.removeSource(y),this.setVisible(y)}}},Or=(y,S)=>{const C=y.__vccOpts||y;for(const[z,N]of S)C[z]=N;return C},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=[ee.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(y,S){return ee.openBlock(),ee.createElementBlock("svg",Lp,Rp)}const Fp=Or(Dp,[["render",Bp]]);function Hh(y,S){return function(){return y.apply(S,arguments)}}const{toString:Op}=Object.prototype,{getPrototypeOf:xc}=Object,il=(y=>S=>{const C=Op.call(S);return y[C]||(y[C]=C.slice(8,-1).toLowerCase())})(Object.create(null)),Tr=y=>(y=y.toLowerCase(),S=>il(S)===y),rl=y=>S=>typeof S===y,{isArray:Os}=Array,Bo=rl("undefined");function Vp(y){return y!==null&&!Bo(y)&&y.constructor!==null&&!Bo(y.constructor)&&Ki(y.constructor.isBuffer)&&y.constructor.isBuffer(y)}const Xh=Tr("ArrayBuffer");function Np(y){let S;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?S=ArrayBuffer.isView(y):S=y&&y.buffer&&Xh(y.buffer),S}const jp=rl("string"),Ki=rl("function"),Wh=rl("number"),nl=y=>y!==null&&typeof y=="object",Up=y=>y===!0||y===!1,sl=y=>{if(il(y)!=="object")return!1;const S=xc(y);return(S===null||S===Object.prototype||Object.getPrototypeOf(S)===null)&&!(Symbol.toStringTag in y)&&!(Symbol.iterator in y)},$p=Tr("Date"),qp=Tr("File"),Zp=Tr("Blob"),Gp=Tr("FileList"),Hp=y=>nl(y)&&Ki(y.pipe),Xp=y=>{let S;return y&&(typeof FormData=="function"&&y instanceof FormData||Ki(y.append)&&((S=il(y))==="formdata"||S==="object"&&Ki(y.toString)&&y.toString()==="[object FormData]"))},Wp=Tr("URLSearchParams"),[Jp,Kp,Yp,Qp]=["ReadableStream","Request","Response","Headers"].map(Tr),ef=y=>y.trim?y.trim():y.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Fo(y,S,{allOwnKeys:C=!1}={}){if(y===null||typeof y>"u")return;let z,N;if(typeof y!="object"&&(y=[y]),Os(y))for(z=0,N=y.length;z<N;z++)S.call(null,y[z],z,y);else{const W=C?Object.getOwnPropertyNames(y):Object.keys(y),T=W.length;let c;for(z=0;z<T;z++)c=W[z],S.call(null,y[c],c,y)}}function Jh(y,S){S=S.toLowerCase();const C=Object.keys(y);let z=C.length,N;for(;z-- >0;)if(N=C[z],S===N.toLowerCase())return N;return null}const es=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Kh=y=>!Bo(y)&&y!==es;function vc(){const{caseless:y}=Kh(this)&&this||{},S={},C=(z,N)=>{const W=y&&Jh(S,N)||N;sl(S[W])&&sl(z)?S[W]=vc(S[W],z):sl(z)?S[W]=vc({},z):Os(z)?S[W]=z.slice():S[W]=z};for(let z=0,N=arguments.length;z<N;z++)arguments[z]&&Fo(arguments[z],C);return S}const tf=(y,S,C,{allOwnKeys:z}={})=>(Fo(S,(N,W)=>{C&&Ki(N)?y[W]=Hh(N,C):y[W]=N},{allOwnKeys:z}),y),rf=y=>(y.charCodeAt(0)===65279&&(y=y.slice(1)),y),nf=(y,S,C,z)=>{y.prototype=Object.create(S.prototype,z),y.prototype.constructor=y,Object.defineProperty(y,"super",{value:S.prototype}),C&&Object.assign(y.prototype,C)},sf=(y,S,C,z)=>{let N,W,T;const c={};if(S=S||{},y==null)return S;do{for(N=Object.getOwnPropertyNames(y),W=N.length;W-- >0;)T=N[W],(!z||z(T,y,S))&&!c[T]&&(S[T]=y[T],c[T]=!0);y=C!==!1&&xc(y)}while(y&&(!C||C(y,S))&&y!==Object.prototype);return S},of=(y,S,C)=>{y=String(y),(C===void 0||C>y.length)&&(C=y.length),C-=S.length;const z=y.indexOf(S,C);return z!==-1&&z===C},af=y=>{if(!y)return null;if(Os(y))return y;let S=y.length;if(!Wh(S))return null;const C=new Array(S);for(;S-- >0;)C[S]=y[S];return C},lf=(y=>S=>y&&S instanceof y)(typeof Uint8Array<"u"&&xc(Uint8Array)),cf=(y,S)=>{const z=(y&&y[Symbol.iterator]).call(y);let N;for(;(N=z.next())&&!N.done;){const W=N.value;S.call(y,W[0],W[1])}},hf=(y,S)=>{let C;const z=[];for(;(C=y.exec(S))!==null;)z.push(C);return z},uf=Tr("HTMLFormElement"),df=y=>y.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(C,z,N){return z.toUpperCase()+N}),Yh=(({hasOwnProperty:y})=>(S,C)=>y.call(S,C))(Object.prototype),pf=Tr("RegExp"),Qh=(y,S)=>{const C=Object.getOwnPropertyDescriptors(y),z={};Fo(C,(N,W)=>{let T;(T=S(N,W,y))!==!1&&(z[W]=T||N)}),Object.defineProperties(y,z)},ff=y=>{Qh(y,(S,C)=>{if(Ki(y)&&["arguments","caller","callee"].indexOf(C)!==-1)return!1;const z=y[C];if(Ki(z)){if(S.enumerable=!1,"writable"in S){S.writable=!1;return}S.set||(S.set=()=>{throw Error("Can not rewrite read-only method '"+C+"'")})}})},mf=(y,S)=>{const C={},z=N=>{N.forEach(W=>{C[W]=!0})};return Os(y)?z(y):z(String(y).split(S)),C},gf=()=>{},_f=(y,S)=>y!=null&&Number.isFinite(y=+y)?y:S,bc="abcdefghijklmnopqrstuvwxyz",eu="0123456789",tu={DIGIT:eu,ALPHA:bc,ALPHA_DIGIT:bc+bc.toUpperCase()+eu},yf=(y=16,S=tu.ALPHA_DIGIT)=>{let C="";const{length:z}=S;for(;y--;)C+=S[Math.random()*z|0];return C};function xf(y){return!!(y&&Ki(y.append)&&y[Symbol.toStringTag]==="FormData"&&y[Symbol.iterator])}const vf=y=>{const S=new Array(10),C=(z,N)=>{if(nl(z)){if(S.indexOf(z)>=0)return;if(!("toJSON"in z)){S[N]=z;const W=Os(z)?[]:{};return Fo(z,(T,c)=>{const ye=C(T,N+1);!Bo(ye)&&(W[c]=ye)}),S[N]=void 0,W}}return z};return C(y,0)},bf=Tr("AsyncFunction"),wf=y=>y&&(nl(y)||Ki(y))&&Ki(y.then)&&Ki(y.catch),iu=((y,S)=>y?setImmediate:S?((C,z)=>(es.addEventListener("message",({source:N,data:W})=>{N===es&&W===C&&z.length&&z.shift()()},!1),N=>{z.push(N),es.postMessage(C,"*")}))(`axios@${Math.random()}`,[]):C=>setTimeout(C))(typeof setImmediate=="function",Ki(es.postMessage)),Sf=typeof queueMicrotask<"u"?queueMicrotask.bind(es):typeof process<"u"&&process.nextTick||iu,fe={isArray:Os,isArrayBuffer:Xh,isBuffer:Vp,isFormData:Xp,isArrayBufferView:Np,isString:jp,isNumber:Wh,isBoolean:Up,isObject:nl,isPlainObject:sl,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:il,kindOfTest:Tr,endsWith:of,toArray:af,forEachEntry:cf,matchAll:hf,isHTMLForm:uf,hasOwnProperty:Yh,hasOwnProp:Yh,reduceDescriptors:Qh,freezeMethods:ff,toObjectSet:mf,toCamelCase:df,noop:gf,toFiniteNumber:_f,findKey:Jh,global:es,isContextDefined:Kh,ALPHABET:tu,generateString:yf,isSpecCompliantForm:xf,toJSONObject:vf,isAsyncFn:bf,isThenable:wf,setImmediate:iu,asap:Sf};function lt(y,S,C,z,N){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=y,this.name="AxiosError",S&&(this.code=S),C&&(this.config=C),z&&(this.request=z),N&&(this.response=N)}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 ru=lt.prototype,nu={};["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(y=>{nu[y]={value:y}}),Object.defineProperties(lt,nu),Object.defineProperty(ru,"isAxiosError",{value:!0}),lt.from=(y,S,C,z,N,W)=>{const T=Object.create(ru);return fe.toFlatObject(y,T,function(ye){return ye!==Error.prototype},c=>c!=="isAxiosError"),lt.call(T,y.message,S,C,z,N),T.cause=y,T.name=y.name,W&&Object.assign(T,W),T};const Tf=null;function wc(y){return fe.isPlainObject(y)||fe.isArray(y)}function su(y){return fe.endsWith(y,"[]")?y.slice(0,-2):y}function ou(y,S,C){return y?y.concat(S).map(function(N,W){return N=su(N),!C&&W?"["+N+"]":N}).join(C?".":""):S}function If(y){return fe.isArray(y)&&!y.some(wc)}const Pf=fe.toFlatObject(fe,{},null,function(S){return/^is[A-Z]/.test(S)});function ol(y,S,C){if(!fe.isObject(y))throw new TypeError("target must be an object");S=S||new FormData,C=fe.toFlatObject(C,{metaTokens:!0,dots:!1,indexes:!1},!1,function(et,je){return!fe.isUndefined(je[et])});const z=C.metaTokens,N=C.visitor||Se,W=C.dots,T=C.indexes,ye=(C.Blob||typeof Blob<"u"&&Blob)&&fe.isSpecCompliantForm(S);if(!fe.isFunction(N))throw new TypeError("visitor must be a function");function xe(Ge){if(Ge===null)return"";if(fe.isDate(Ge))return Ge.toISOString();if(!ye&&fe.isBlob(Ge))throw new lt("Blob is not supported. Use a Buffer instead.");return fe.isArrayBuffer(Ge)||fe.isTypedArray(Ge)?ye&&typeof Blob=="function"?new Blob([Ge]):Buffer.from(Ge):Ge}function Se(Ge,et,je){let dt=Ge;if(Ge&&!je&&typeof Ge=="object"){if(fe.endsWith(et,"{}"))et=z?et:et.slice(0,-2),Ge=JSON.stringify(Ge);else if(fe.isArray(Ge)&&If(Ge)||(fe.isFileList(Ge)||fe.endsWith(et,"[]"))&&(dt=fe.toArray(Ge)))return et=su(et),dt.forEach(function(Ae,Pt){!(fe.isUndefined(Ae)||Ae===null)&&S.append(T===!0?ou([et],Pt,W):T===null?et:et+"[]",xe(Ae))}),!1}return wc(Ge)?!0:(S.append(ou(je,et,W),xe(Ge)),!1)}const ce=[],ae=Object.assign(Pf,{defaultVisitor:Se,convertValue:xe,isVisitable:wc});function gt(Ge,et){if(!fe.isUndefined(Ge)){if(ce.indexOf(Ge)!==-1)throw Error("Circular reference detected in "+et.join("."));ce.push(Ge),fe.forEach(Ge,function(dt,Ft){(!(fe.isUndefined(dt)||dt===null)&&N.call(S,dt,fe.isString(Ft)?Ft.trim():Ft,et,ae))===!0&>(dt,et?et.concat(Ft):[Ft])}),ce.pop()}}if(!fe.isObject(y))throw new TypeError("data must be an object");return gt(y),S}function au(y){const S={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(y).replace(/[!'()~]|%20|%00/g,function(z){return S[z]})}function Sc(y,S){this._pairs=[],y&&ol(y,this,S)}const lu=Sc.prototype;lu.append=function(S,C){this._pairs.push([S,C])},lu.toString=function(S){const C=S?function(z){return S.call(this,z,au)}:au;return this._pairs.map(function(N){return C(N[0])+"="+C(N[1])},"").join("&")};function kf(y){return encodeURIComponent(y).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function cu(y,S,C){if(!S)return y;const z=C&&C.encode||kf,N=C&&C.serialize;let W;if(N?W=N(S,C):W=fe.isURLSearchParams(S)?S.toString():new Sc(S,C).toString(z),W){const T=y.indexOf("#");T!==-1&&(y=y.slice(0,T)),y+=(y.indexOf("?")===-1?"?":"&")+W}return y}class hu{constructor(){this.handlers=[]}use(S,C,z){return this.handlers.push({fulfilled:S,rejected:C,synchronous:z?z.synchronous:!1,runWhen:z?z.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(z){z!==null&&S(z)})}}const uu={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Ef={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=(y=>Tc&&["ReactNative","NativeScript","NS"].indexOf(y)<0)(typeof navigator<"u"&&navigator.product),Af=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:Af,origin:Mf},Symbol.toStringTag,{value:"Module"})),...Ef};function zf(y,S){return ol(y,new Ir.classes.URLSearchParams,Object.assign({visitor:function(C,z,N,W){return Ir.isNode&&fe.isBuffer(C)?(this.append(z,C.toString("base64")),!1):W.defaultVisitor.apply(this,arguments)}},S))}function Df(y){return fe.matchAll(/\w+|\[(\w*)]/g,y).map(S=>S[0]==="[]"?"":S[1]||S[0])}function Lf(y){const S={},C=Object.keys(y);let z;const N=C.length;let W;for(z=0;z<N;z++)W=C[z],S[W]=y[W];return S}function du(y){function S(C,z,N,W){let T=C[W++];if(T==="__proto__")return!0;const c=Number.isFinite(+T),ye=W>=C.length;return T=!T&&fe.isArray(N)?N.length:T,ye?(fe.hasOwnProp(N,T)?N[T]=[N[T],z]:N[T]=z,!c):((!N[T]||!fe.isObject(N[T]))&&(N[T]=[]),S(C,z,N[T],W)&&fe.isArray(N[T])&&(N[T]=Lf(N[T])),!c)}if(fe.isFormData(y)&&fe.isFunction(y.entries)){const C={};return fe.forEachEntry(y,(z,N)=>{S(Df(z),N,C,0)}),C}return null}function Rf(y,S,C){if(fe.isString(y))try{return(S||JSON.parse)(y),fe.trim(y)}catch(z){if(z.name!=="SyntaxError")throw z}return(C||JSON.stringify)(y)}const Oo={transitional:uu,adapter:["xhr","http","fetch"],transformRequest:[function(S,C){const z=C.getContentType()||"",N=z.indexOf("application/json")>-1,W=fe.isObject(S);if(W&&fe.isHTMLForm(S)&&(S=new FormData(S)),fe.isFormData(S))return N?JSON.stringify(du(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 C.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),S.toString();let c;if(W){if(z.indexOf("application/x-www-form-urlencoded")>-1)return zf(S,this.formSerializer).toString();if((c=fe.isFileList(S))||z.indexOf("multipart/form-data")>-1){const ye=this.env&&this.env.FormData;return ol(c?{"files[]":S}:S,ye&&new ye,this.formSerializer)}}return W||N?(C.setContentType("application/json",!1),Rf(S)):S}],transformResponse:[function(S){const C=this.transitional||Oo.transitional,z=C&&C.forcedJSONParsing,N=this.responseType==="json";if(fe.isResponse(S)||fe.isReadableStream(S))return S;if(S&&fe.isString(S)&&(z&&!this.responseType||N)){const T=!(C&&C.silentJSONParsing)&&N;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"],y=>{Oo.headers[y]={}});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=y=>{const S={};let C,z,N;return y&&y.split(`
|
581
581
|
`).forEach(function(T){N=T.indexOf(":"),C=T.substring(0,N).trim().toLowerCase(),z=T.substring(N+1).trim(),!(!C||S[C]&&Bf[C])&&(C==="set-cookie"?S[C]?S[C].push(z):S[C]=[z]:S[C]=S[C]?S[C]+", "+z:z)}),S},pu=Symbol("internals");function Vo(y){return y&&String(y).trim().toLowerCase()}function al(y){return y===!1||y==null?y:fe.isArray(y)?y.map(al):String(y)}function Of(y){const S=Object.create(null),C=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let z;for(;z=C.exec(y);)S[z[1]]=z[2];return S}const Vf=y=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(y.trim());function Ic(y,S,C,z,N){if(fe.isFunction(z))return z.call(this,S,C);if(N&&(S=C),!!fe.isString(S)){if(fe.isString(z))return S.indexOf(z)!==-1;if(fe.isRegExp(z))return z.test(S)}}function Nf(y){return y.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(S,C,z)=>C.toUpperCase()+z)}function jf(y,S){const C=fe.toCamelCase(" "+S);["get","set","has"].forEach(z=>{Object.defineProperty(y,z+C,{value:function(N,W,T){return this[z].call(this,S,N,W,T)},configurable:!0})})}class Gi{constructor(S){S&&this.set(S)}set(S,C,z){const N=this;function W(c,ye,xe){const Se=Vo(ye);if(!Se)throw new Error("header name must be a non-empty string");const ce=fe.findKey(N,Se);(!ce||N[ce]===void 0||xe===!0||xe===void 0&&N[ce]!==!1)&&(N[ce||ye]=al(c))}const T=(c,ye)=>fe.forEach(c,(xe,Se)=>W(xe,Se,ye));if(fe.isPlainObject(S)||S instanceof this.constructor)T(S,C);else if(fe.isString(S)&&(S=S.trim())&&!Vf(S))T(Ff(S),C);else if(fe.isHeaders(S))for(const[c,ye]of S.entries())W(ye,c,z);else S!=null&&W(C,S,z);return this}get(S,C){if(S=Vo(S),S){const z=fe.findKey(this,S);if(z){const N=this[z];if(!C)return N;if(C===!0)return Of(N);if(fe.isFunction(C))return C.call(this,N,z);if(fe.isRegExp(C))return C.exec(N);throw new TypeError("parser must be boolean|regexp|function")}}}has(S,C){if(S=Vo(S),S){const z=fe.findKey(this,S);return!!(z&&this[z]!==void 0&&(!C||Ic(this,this[z],z,C)))}return!1}delete(S,C){const z=this;let N=!1;function W(T){if(T=Vo(T),T){const c=fe.findKey(z,T);c&&(!C||Ic(z,z[c],c,C))&&(delete z[c],N=!0)}}return fe.isArray(S)?S.forEach(W):W(S),N}clear(S){const C=Object.keys(this);let z=C.length,N=!1;for(;z--;){const W=C[z];(!S||Ic(this,this[W],W,S,!0))&&(delete this[W],N=!0)}return N}normalize(S){const C=this,z={};return fe.forEach(this,(N,W)=>{const T=fe.findKey(z,W);if(T){C[T]=al(N),delete C[W];return}const c=S?Nf(W):String(W).trim();c!==W&&delete C[W],C[c]=al(N),z[c]=!0}),this}concat(...S){return this.constructor.concat(this,...S)}toJSON(S){const C=Object.create(null);return fe.forEach(this,(z,N)=>{z!=null&&z!==!1&&(C[N]=S&&fe.isArray(z)?z.join(", "):z)}),C}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([S,C])=>S+": "+C).join(`
|
582
582
|
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(S){return S instanceof this?S:new this(S)}static concat(S,...C){const z=new this(S);return C.forEach(N=>z.set(N)),z}static accessor(S){const z=(this[pu]=this[pu]={accessors:{}}).accessors,N=this.prototype;function W(T){const c=Vo(T);z[c]||(jf(N,T),z[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:y},S)=>{let C=S[0].toUpperCase()+S.slice(1);return{get:()=>y,set(z){this[C]=z}}}),fe.freezeMethods(Gi);function Pc(y,S){const C=this||Oo,z=S||C,N=Gi.from(z.headers);let W=z.data;return fe.forEach(y,function(c){W=c.call(C,W,N.normalize(),S?S.status:void 0)}),N.normalize(),W}function fu(y){return!!(y&&y.__CANCEL__)}function Vs(y,S,C){lt.call(this,y??"canceled",lt.ERR_CANCELED,S,C),this.name="CanceledError"}fe.inherits(Vs,lt,{__CANCEL__:!0});function mu(y,S,C){const z=C.config.validateStatus;!C.status||!z||z(C.status)?y(C):S(new lt("Request failed with status code "+C.status,[lt.ERR_BAD_REQUEST,lt.ERR_BAD_RESPONSE][Math.floor(C.status/100)-4],C.config,C.request,C))}function Uf(y){const S=/^([-+\w]{1,25})(:?\/\/|:)/.exec(y);return S&&S[1]||""}function $f(y,S){y=y||10;const C=new Array(y),z=new Array(y);let N=0,W=0,T;return S=S!==void 0?S:1e3,function(ye){const xe=Date.now(),Se=z[W];T||(T=xe),C[N]=ye,z[N]=xe;let ce=W,ae=0;for(;ce!==N;)ae+=C[ce++],ce=ce%y;if(N=(N+1)%y,N===W&&(W=(W+1)%y),xe-T<S)return;const gt=Se&&xe-Se;return gt?Math.round(ae*1e3/gt):void 0}}function qf(y,S){let C=0,z=1e3/S,N,W;const T=(xe,Se=Date.now())=>{C=Se,N=null,W&&(clearTimeout(W),W=null),y.apply(null,xe)};return[(...xe)=>{const Se=Date.now(),ce=Se-C;ce>=z?T(xe,Se):(N=xe,W||(W=setTimeout(()=>{W=null,T(N)},z-ce)))},()=>N&&T(N)]}const ll=(y,S,C=3)=>{let z=0;const N=$f(50,250);return qf(W=>{const T=W.loaded,c=W.lengthComputable?W.total:void 0,ye=T-z,xe=N(ye),Se=T<=c;z=T;const ce={loaded:T,total:c,progress:c?T/c:void 0,bytes:ye,rate:xe||void 0,estimated:xe&&c&&Se?(c-T)/xe:void 0,event:W,lengthComputable:c!=null,[S?"download":"upload"]:!0};y(ce)},C)},gu=(y,S)=>{const C=y!=null;return[z=>S[0]({lengthComputable:C,total:y,loaded:z}),S[1]]},_u=y=>(...S)=>fe.asap(()=>y(...S)),Zf=Ir.hasStandardBrowserEnv?function(){const S=/(msie|trident)/i.test(navigator.userAgent),C=document.createElement("a");let z;function N(W){let T=W;return S&&(C.setAttribute("href",T),T=C.href),C.setAttribute("href",T),{href:C.href,protocol:C.protocol?C.protocol.replace(/:$/,""):"",host:C.host,search:C.search?C.search.replace(/^\?/,""):"",hash:C.hash?C.hash.replace(/^#/,""):"",hostname:C.hostname,port:C.port,pathname:C.pathname.charAt(0)==="/"?C.pathname:"/"+C.pathname}}return z=N(window.location.href),function(T){const c=fe.isString(T)?N(T):T;return c.protocol===z.protocol&&c.host===z.host}}():function(){return function(){return!0}}(),Gf=Ir.hasStandardBrowserEnv?{write(y,S,C,z,N,W){const T=[y+"="+encodeURIComponent(S)];fe.isNumber(C)&&T.push("expires="+new Date(C).toGMTString()),fe.isString(z)&&T.push("path="+z),fe.isString(N)&&T.push("domain="+N),W===!0&&T.push("secure"),document.cookie=T.join("; ")},read(y){const S=document.cookie.match(new RegExp("(^|;\\s*)("+y+")=([^;]*)"));return S?decodeURIComponent(S[3]):null},remove(y){this.write(y,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function Hf(y){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(y)}function Xf(y,S){return S?y.replace(/\/?\/$/,"")+"/"+S.replace(/^\/+/,""):y}function yu(y,S){return y&&!Hf(S)?Xf(y,S):S}const xu=y=>y instanceof Gi?{...y}:y;function ts(y,S){S=S||{};const C={};function z(xe,Se,ce){return fe.isPlainObject(xe)&&fe.isPlainObject(Se)?fe.merge.call({caseless:ce},xe,Se):fe.isPlainObject(Se)?fe.merge({},Se):fe.isArray(Se)?Se.slice():Se}function N(xe,Se,ce){if(fe.isUndefined(Se)){if(!fe.isUndefined(xe))return z(void 0,xe,ce)}else return z(xe,Se,ce)}function W(xe,Se){if(!fe.isUndefined(Se))return z(void 0,Se)}function T(xe,Se){if(fe.isUndefined(Se)){if(!fe.isUndefined(xe))return z(void 0,xe)}else return z(void 0,Se)}function c(xe,Se,ce){if(ce in S)return z(xe,Se);if(ce in y)return z(void 0,xe)}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:(xe,Se)=>N(xu(xe),xu(Se),!0)};return fe.forEach(Object.keys(Object.assign({},y,S)),function(Se){const ce=ye[Se]||N,ae=ce(y[Se],S[Se],Se);fe.isUndefined(ae)&&ce!==c||(C[Se]=ae)}),C}const vu=y=>{const S=ts({},y);let{data:C,withXSRFToken:z,xsrfHeaderName:N,xsrfCookieName:W,headers:T,auth:c}=S;S.headers=T=Gi.from(T),S.url=cu(yu(S.baseURL,S.url),y.params,y.paramsSerializer),c&&T.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):"")));let ye;if(fe.isFormData(C)){if(Ir.hasStandardBrowserEnv||Ir.hasStandardBrowserWebWorkerEnv)T.setContentType(void 0);else if((ye=T.getContentType())!==!1){const[xe,...Se]=ye?ye.split(";").map(ce=>ce.trim()).filter(Boolean):[];T.setContentType([xe||"multipart/form-data",...Se].join("; "))}}if(Ir.hasStandardBrowserEnv&&(z&&fe.isFunction(z)&&(z=z(S)),z||z!==!1&&Zf(S.url))){const xe=N&&W&&Gf.read(W);xe&&T.set(N,xe)}return S},Wf=typeof XMLHttpRequest<"u"&&function(y){return new Promise(function(C,z){const N=vu(y);let W=N.data;const T=Gi.from(N.headers).normalize();let{responseType:c,onUploadProgress:ye,onDownloadProgress:xe}=N,Se,ce,ae,gt,Ge;function et(){gt&>(),Ge&&Ge(),N.cancelToken&&N.cancelToken.unsubscribe(Se),N.signal&&N.signal.removeEventListener("abort",Se)}let je=new XMLHttpRequest;je.open(N.method.toUpperCase(),N.url,!0),je.timeout=N.timeout;function dt(){if(!je)return;const Ae=Gi.from("getAllResponseHeaders"in je&&je.getAllResponseHeaders()),Tt={data:!c||c==="text"||c==="json"?je.responseText:je.response,status:je.status,statusText:je.statusText,headers:Ae,config:y,request:je};mu(function(jt){C(jt),et()},function(jt){z(jt),et()},Tt),je=null}"onloadend"in je?je.onloadend=dt:je.onreadystatechange=function(){!je||je.readyState!==4||je.status===0&&!(je.responseURL&&je.responseURL.indexOf("file:")===0)||setTimeout(dt)},je.onabort=function(){je&&(z(new lt("Request aborted",lt.ECONNABORTED,y,je)),je=null)},je.onerror=function(){z(new lt("Network Error",lt.ERR_NETWORK,y,je)),je=null},je.ontimeout=function(){let Pt=N.timeout?"timeout of "+N.timeout+"ms exceeded":"timeout exceeded";const Tt=N.transitional||uu;N.timeoutErrorMessage&&(Pt=N.timeoutErrorMessage),z(new lt(Pt,Tt.clarifyTimeoutError?lt.ETIMEDOUT:lt.ECONNABORTED,y,je)),je=null},W===void 0&&T.setContentType(null),"setRequestHeader"in je&&fe.forEach(T.toJSON(),function(Pt,Tt){je.setRequestHeader(Tt,Pt)}),fe.isUndefined(N.withCredentials)||(je.withCredentials=!!N.withCredentials),c&&c!=="json"&&(je.responseType=N.responseType),xe&&([ae,Ge]=ll(xe,!0),je.addEventListener("progress",ae)),ye&&je.upload&&([ce,gt]=ll(ye),je.upload.addEventListener("progress",ce),je.upload.addEventListener("loadend",gt)),(N.cancelToken||N.signal)&&(Se=Ae=>{je&&(z(!Ae||Ae.type?new Vs(null,y,je):Ae),je.abort(),je=null)},N.cancelToken&&N.cancelToken.subscribe(Se),N.signal&&(N.signal.aborted?Se():N.signal.addEventListener("abort",Se)));const Ft=Uf(N.url);if(Ft&&Ir.protocols.indexOf(Ft)===-1){z(new lt("Unsupported protocol "+Ft+":",lt.ERR_BAD_REQUEST,y));return}je.send(W||null)})},Jf=(y,S)=>{let C=new AbortController,z;const N=function(ye){if(!z){z=!0,T();const xe=ye instanceof Error?ye:this.reason;C.abort(xe instanceof lt?xe:new Vs(xe instanceof Error?xe.message:xe))}};let W=S&&setTimeout(()=>{N(new lt(`timeout ${S} of ms exceeded`,lt.ETIMEDOUT))},S);const T=()=>{y&&(W&&clearTimeout(W),W=null,y.forEach(ye=>{ye&&(ye.removeEventListener?ye.removeEventListener("abort",N):ye.unsubscribe(N))}),y=null)};y.forEach(ye=>ye&&ye.addEventListener&&ye.addEventListener("abort",N));const{signal:c}=C;return c.unsubscribe=T,[c,()=>{W&&clearTimeout(W),W=null}]},Kf=function*(y,S){let C=y.byteLength;if(!S||C<S){yield y;return}let z=0,N;for(;z<C;)N=z+S,yield y.slice(z,N),z=N},Yf=async function*(y,S,C){for await(const z of y)yield*Kf(ArrayBuffer.isView(z)?z:await C(String(z)),S)},bu=(y,S,C,z,N)=>{const W=Yf(y,S,N);let T=0,c,ye=xe=>{c||(c=!0,z&&z(xe))};return new ReadableStream({async pull(xe){try{const{done:Se,value:ce}=await W.next();if(Se){ye(),xe.close();return}let ae=ce.byteLength;if(C){let gt=T+=ae;C(gt)}xe.enqueue(new Uint8Array(ce))}catch(Se){throw ye(Se),Se}},cancel(xe){return ye(xe),W.return()}},{highWaterMark:2})},cl=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",wu=cl&&typeof ReadableStream=="function",kc=cl&&(typeof TextEncoder=="function"?(y=>S=>y.encode(S))(new TextEncoder):async y=>new Uint8Array(await new Response(y).arrayBuffer())),Su=(y,...S)=>{try{return!!y(...S)}catch{return!1}},Qf=wu&&Su(()=>{let y=!1;const S=new Request(Ir.origin,{body:new ReadableStream,method:"POST",get duplex(){return y=!0,"half"}}).headers.has("Content-Type");return y&&!S}),Tu=64*1024,Ec=wu&&Su(()=>fe.isReadableStream(new Response("").body)),hl={stream:Ec&&(y=>y.body)};cl&&(y=>{["text","arrayBuffer","blob","formData","stream"].forEach(S=>{!hl[S]&&(hl[S]=fe.isFunction(y[S])?C=>C[S]():(C,z)=>{throw new lt(`Response type '${S}' is not supported`,lt.ERR_NOT_SUPPORT,z)})})})(new Response);const em=async y=>{if(y==null)return 0;if(fe.isBlob(y))return y.size;if(fe.isSpecCompliantForm(y))return(await new Request(y).arrayBuffer()).byteLength;if(fe.isArrayBufferView(y)||fe.isArrayBuffer(y))return y.byteLength;if(fe.isURLSearchParams(y)&&(y=y+""),fe.isString(y))return(await kc(y)).byteLength},tm=async(y,S)=>{const C=fe.toFiniteNumber(y.getContentLength());return C??em(S)},Cc={http:Tf,xhr:Wf,fetch:cl&&(async y=>{let{url:S,method:C,data:z,signal:N,cancelToken:W,timeout:T,onDownloadProgress:c,onUploadProgress:ye,responseType:xe,headers:Se,withCredentials:ce="same-origin",fetchOptions:ae}=vu(y);xe=xe?(xe+"").toLowerCase():"text";let[gt,Ge]=N||W||T?Jf([N,W],T):[],et,je;const dt=()=>{!et&&setTimeout(()=>{gt&>.unsubscribe()}),et=!0};let Ft;try{if(ye&&Qf&&C!=="get"&&C!=="head"&&(Ft=await tm(Se,z))!==0){let Gt=new Request(S,{method:"POST",body:z,duplex:"half"}),jt;if(fe.isFormData(z)&&(jt=Gt.headers.get("content-type"))&&Se.setContentType(jt),Gt.body){const[Vr,bi]=gu(Ft,ll(_u(ye)));z=bu(Gt.body,Tu,Vr,bi,kc)}}fe.isString(ce)||(ce=ce?"include":"omit"),je=new Request(S,{...ae,signal:gt,method:C.toUpperCase(),headers:Se.normalize().toJSON(),body:z,duplex:"half",credentials:ce});let Ae=await fetch(je);const Pt=Ec&&(xe==="stream"||xe==="response");if(Ec&&(c||Pt)){const Gt={};["status","statusText","headers"].forEach(Nr=>{Gt[Nr]=Ae[Nr]});const jt=fe.toFiniteNumber(Ae.headers.get("content-length")),[Vr,bi]=c&&gu(jt,ll(_u(c),!0))||[];Ae=new Response(bu(Ae.body,Tu,Vr,()=>{bi&&bi(),Pt&&dt()},kc),Gt)}xe=xe||"text";let Tt=await hl[fe.findKey(hl,xe)||"text"](Ae,y);return!Pt&&dt(),Ge&&Ge(),await new Promise((Gt,jt)=>{mu(Gt,jt,{data:Tt,headers:Gi.from(Ae.headers),status:Ae.status,statusText:Ae.statusText,config:y,request:je})})}catch(Ae){throw dt(),Ae&&Ae.name==="TypeError"&&/fetch/i.test(Ae.message)?Object.assign(new lt("Network Error",lt.ERR_NETWORK,y,je),{cause:Ae.cause||Ae}):lt.from(Ae,Ae&&Ae.code,y,je)}})};fe.forEach(Cc,(y,S)=>{if(y){try{Object.defineProperty(y,"name",{value:S})}catch{}Object.defineProperty(y,"adapterName",{value:S})}});const Iu=y=>`- ${y}`,im=y=>fe.isFunction(y)||y===null||y===!1,Pu={getAdapter:y=>{y=fe.isArray(y)?y:[y];const{length:S}=y;let C,z;const N={};for(let W=0;W<S;W++){C=y[W];let T;if(z=C,!im(C)&&(z=Cc[(T=String(C)).toLowerCase()],z===void 0))throw new lt(`Unknown adapter '${T}'`);if(z)break;N[T||"#"+W]=z}if(!z){const W=Object.entries(N).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(Iu).join(`
|
584
584
|
`):" "+Iu(W[0]):"as no adapter specified";throw new lt("There is no suitable adapter to dispatch the request "+T,"ERR_NOT_SUPPORT")}return z},adapters:Cc};function Ac(y){if(y.cancelToken&&y.cancelToken.throwIfRequested(),y.signal&&y.signal.aborted)throw new Vs(null,y)}function ku(y){return Ac(y),y.headers=Gi.from(y.headers),y.data=Pc.call(y,y.transformRequest),["post","put","patch"].indexOf(y.method)!==-1&&y.headers.setContentType("application/x-www-form-urlencoded",!1),Pu.getAdapter(y.adapter||Oo.adapter)(y).then(function(z){return Ac(y),z.data=Pc.call(y,y.transformResponse,z),z.headers=Gi.from(z.headers),z},function(z){return fu(z)||(Ac(y),z&&z.response&&(z.response.data=Pc.call(y,y.transformResponse,z.response),z.response.headers=Gi.from(z.response.headers))),Promise.reject(z)})}const Eu="1.7.4",Mc={};["object","boolean","number","function","string","symbol"].forEach((y,S)=>{Mc[y]=function(z){return typeof z===y||"a"+(S<1?"n ":" ")+y}});const Cu={};Mc.transitional=function(S,C,z){function N(W,T){return"[Axios v"+Eu+"] Transitional option '"+W+"'"+T+(z?". "+z:"")}return(W,T,c)=>{if(S===!1)throw new lt(N(T," has been removed"+(C?" in "+C:"")),lt.ERR_DEPRECATED);return C&&!Cu[T]&&(Cu[T]=!0,console.warn(N(T," has been deprecated since v"+C+" and will be removed in the near future"))),S?S(W,T,c):!0}};function rm(y,S,C){if(typeof y!="object")throw new lt("options must be an object",lt.ERR_BAD_OPTION_VALUE);const z=Object.keys(y);let N=z.length;for(;N-- >0;){const W=z[N],T=S[W];if(T){const c=y[W],ye=c===void 0||T(c,W,y);if(ye!==!0)throw new lt("option "+W+" must be "+ye,lt.ERR_BAD_OPTION_VALUE);continue}if(C!==!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 hu,response:new hu}}async request(S,C){try{return await this._request(S,C)}catch(z){if(z instanceof Error){let N;Error.captureStackTrace?Error.captureStackTrace(N={}):N=new Error;const W=N.stack?N.stack.replace(/^.+\n/,""):"";try{z.stack?W&&!String(z.stack).endsWith(W.replace(/^.+\n.+\n/,""))&&(z.stack+=`
|
585
|
-
`+W):z.stack=W}catch{}}throw z}}_request(S,C){typeof S=="string"?(C=C||{},C.url=S):C=S||{},C=ts(this.defaults,C);const{transitional:z,paramsSerializer:N,headers:W}=C;z!==void 0&&zc.assertOptions(z,{silentJSONParsing:Pn.transitional(Pn.boolean),forcedJSONParsing:Pn.transitional(Pn.boolean),clarifyTimeoutError:Pn.transitional(Pn.boolean)},!1),N!=null&&(fe.isFunction(N)?C.paramsSerializer={serialize:N}:zc.assertOptions(N,{encode:Pn.function,serialize:Pn.function},!0)),C.method=(C.method||this.defaults.method||"get").toLowerCase();let T=W&&fe.merge(W.common,W[C.method]);W&&fe.forEach(["delete","get","head","post","put","patch","common"],Ge=>{delete W[Ge]}),C.headers=Gi.concat(T,W);const c=[];let ye=!0;this.interceptors.request.forEach(function(et){typeof et.runWhen=="function"&&et.runWhen(C)===!1||(ye=ye&&et.synchronous,c.unshift(et.fulfilled,et.rejected))});const xe=[];this.interceptors.response.forEach(function(et){xe.push(et.fulfilled,et.rejected)});let Se,ce=0,ae;if(!ye){const Ge=[ku.bind(this),void 0];for(Ge.unshift.apply(Ge,c),Ge.push.apply(Ge,xe),ae=Ge.length,Se=Promise.resolve(C);ce<ae;)Se=Se.then(Ge[ce++],Ge[ce++]);return Se}ae=c.length;let gt=C;for(ce=0;ce<ae;){const Ge=c[ce++],et=c[ce++];try{gt=Ge(gt)}catch(je){et.call(this,je);break}}try{Se=ku.call(this,gt)}catch(Ge){return Promise.reject(Ge)}for(ce=0,ae=xe.length;ce<ae;)Se=Se.then(xe[ce++],xe[ce++]);return Se}getUri(S){S=ts(this.defaults,S);const C=yu(S.baseURL,S.url);return cu(C,S.params,S.paramsSerializer)}}fe.forEach(["delete","get","head","options"],function(S){is.prototype[S]=function(C,z){return this.request(ts(z||{},{method:S,url:C,data:(z||{}).data}))}}),fe.forEach(["post","put","patch"],function(S){function C(z){return function(W,T,c){return this.request(ts(c||{},{method:S,headers:z?{"Content-Type":"multipart/form-data"}:{},url:W,data:T}))}}is.prototype[S]=C(),is.prototype[S+"Form"]=C(!0)});class Dc{constructor(S){if(typeof S!="function")throw new TypeError("executor must be a function.");let C;this.promise=new Promise(function(W){C=W});const z=this;this.promise.then(N=>{if(!z._listeners)return;let W=z._listeners.length;for(;W-- >0;)z._listeners[W](N);z._listeners=null}),this.promise.then=N=>{let W;const T=new Promise(c=>{z.subscribe(c),W=c}).then(N);return T.cancel=function(){z.unsubscribe(W)},T},S(function(W,T,c){z.reason||(z.reason=new Vs(W,T,c),C(z.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 C=this._listeners.indexOf(S);C!==-1&&this._listeners.splice(C,1)}static source(){let S;return{token:new Dc(function(N){S=N}),cancel:S}}}function nm(y){return function(C){return y.apply(null,C)}}function sm(y){return fe.isObject(y)&&y.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(([y,S])=>{Lc[S]=y});function Au(y){const S=new is(y),C=Hh(is.prototype.request,S);return fe.extend(C,is.prototype,S,{allOwnKeys:!0}),fe.extend(C,S,null,{allOwnKeys:!0}),C.create=function(N){return Au(ts(y,N))},C}const Zt=Au(Oo);Zt.Axios=is,Zt.CanceledError=Vs,Zt.CancelToken=Dc,Zt.isCancel=fu,Zt.VERSION=Eu,Zt.toFormData=ol,Zt.AxiosError=lt,Zt.Cancel=Zt.CanceledError,Zt.all=function(S){return Promise.all(S)},Zt.spread=nm,Zt.isAxiosError=sm,Zt.mergeConfig=ts,Zt.AxiosHeaders=Gi,Zt.formToJSON=y=>du(fe.isHTMLForm(y)?new FormData(y):y),Zt.getAdapter=Pu.getAdapter,Zt.HttpStatusCode=Lc,Zt.default=Zt;const Mu=(y,S=300)=>{let C;return function(...N){clearTimeout(C),C=setTimeout(()=>{y.apply(this,N)},S)}};function ul(y,S,C={}){const z={type:"Feature"};return(C.id===0||C.id)&&(z.id=C.id),C.bbox&&(z.bbox=C.bbox),z.properties=S||{},z.geometry=y,z}function om(y,S,C={}){if(!y)throw new Error("coordinates is required");if(!Array.isArray(y))throw new Error("coordinates must be an Array");if(y.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Ru(y[0])||!Ru(y[1]))throw new Error("coordinates must contain numbers");return ul({type:"Point",coordinates:y},S,C)}function zu(y,S,C={}){for(const N of y){if(N.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(N[N.length-1].length!==N[0].length)throw new Error("First and last Position are not equivalent.");for(let W=0;W<N[N.length-1].length;W++)if(N[N.length-1][W]!==N[0][W])throw new Error("First and last Position are not equivalent.")}return ul({type:"Polygon",coordinates:y},S,C)}function Du(y,S,C={}){return ul({type:"MultiPoint",coordinates:y},S,C)}function Lu(y,S,C={}){return ul({type:"MultiPolygon",coordinates:y},S,C)}function Ru(y){return!isNaN(y)&&y!==null&&!Array.isArray(y)}function Bu(y,S,C){if(y!==null)for(var z,N,W,T,c,ye,xe,Se=0,ce=0,ae,gt=y.type,Ge=gt==="FeatureCollection",et=gt==="Feature",je=Ge?y.features.length:1,dt=0;dt<je;dt++){xe=Ge?y.features[dt].geometry:et?y.geometry:y,ae=xe?xe.type==="GeometryCollection":!1,c=ae?xe.geometries.length:1;for(var Ft=0;Ft<c;Ft++){var Ae=0,Pt=0;if(T=ae?xe.geometries[Ft]:xe,T!==null){ye=T.coordinates;var Tt=T.type;switch(Se=0,Tt){case null:break;case"Point":if(S(ye,ce,dt,Ae,Pt)===!1)return!1;ce++,Ae++;break;case"LineString":case"MultiPoint":for(z=0;z<ye.length;z++){if(S(ye[z],ce,dt,Ae,Pt)===!1)return!1;ce++,Tt==="MultiPoint"&&Ae++}Tt==="LineString"&&Ae++;break;case"Polygon":case"MultiLineString":for(z=0;z<ye.length;z++){for(N=0;N<ye[z].length-Se;N++){if(S(ye[z][N],ce,dt,Ae,Pt)===!1)return!1;ce++}Tt==="MultiLineString"&&Ae++,Tt==="Polygon"&&Pt++}Tt==="Polygon"&&Ae++;break;case"MultiPolygon":for(z=0;z<ye.length;z++){for(Pt=0,N=0;N<ye[z].length;N++){for(W=0;W<ye[z][N].length-Se;W++){if(S(ye[z][N][W],ce,dt,Ae,Pt)===!1)return!1;ce++}Pt++}Ae++}break;case"GeometryCollection":for(z=0;z<T.geometries.length;z++)if(Bu(T.geometries[z],S)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function Fu(y,S={}){if(y.bbox!=null&&S.recompute!==!0)return y.bbox;const C=[1/0,1/0,-1/0,-1/0];return Bu(y,z=>{C[0]>z[0]&&(C[0]=z[0]),C[1]>z[1]&&(C[1]=z[1]),C[2]<z[0]&&(C[2]=z[0]),C[3]<z[1]&&(C[3]=z[1])}),C}function Ou(y,S={}){const C=Fu(y),z=(C[0]+C[2])/2,N=(C[1]+C[3])/2;return om([z,N],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(y){y&&y.on("load",this.handleMapLoad)}},methods:{handleMapLoad(){this.baseLayers.forEach(y=>{this.layerList.push(y)}),this.toggleLayerVisibility("graymap")},toggleLayerVisibility(y){this.selectedLayer=y,this.changeBaseLayer(this.selectedLayer)}}},lm={class:"vs-map-slot-layers"},cm=["onClick"],hm=["src","alt"];function um(y,S,C,z,N,W){return ee.openBlock(),ee.createElementBlock("div",lm,[(ee.openBlock(!0),ee.createElementBlock(ee.Fragment,null,ee.renderList(C.baseLayers,T=>(ee.openBlock(),ee.createElementBlock("div",{key:T.id,class:ee.normalizeClass(["vs-map-slot-layers__layer",{focused:T.id==N.selectedLayer}]),onClick:c=>W.toggleLayerVisibility(T.id)},[ee.createElementVNode("img",{width:"50",height:"50",src:T.image,class:"vs-map-slot-layers__image",alt:T==null?void 0:T.name},null,8,hm)],10,cm))),128))])}const dm=Or(am,[["render",um],["__scopeId","data-v-6644a27d"]]),pm={props:["colors"],methods:{capitalizeFirstLetter(y){return y?y.charAt(0).toUpperCase()+y.slice(1):""}}},fm={class:"absolute left-[20px] bottom-[74px] bg-white max-w-[250px] p-[10px] rounded-lg"},mm={class:"legend-item"},gm={key:0,class:"flex justify-start items-center gap-2"},_m={class:"ml-1"};function ym(y,S,C,z,N,W){return ee.openBlock(),ee.createElementBlock("div",fm,[(ee.openBlock(!0),ee.createElementBlock(ee.Fragment,null,ee.renderList(C.colors,T=>(ee.openBlock(),ee.createElementBlock("div",mm,[T.id>0?(ee.openBlock(),ee.createElementBlock("div",gm,[ee.createElementVNode("div",{class:"w-[15px] h-[15px] rounded-[50%] min-w-[15px]",style:ee.normalizeStyle({backgroundColor:T.color})},null,4),ee.createElementVNode("div",_m,ee.toDisplayString(W.capitalizeFirstLetter(T.text)),1)])):ee.createCommentVNode("",!0)]))),256))])}const xm={components:{MapSlotLayers:dm,MapLegend:Or(pm,[["render",ym]])},props:{colorAttr:null,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:5},basemap:Array,filtersParam:{type:String,default:""},row:{type:Object,default:{}}},mixins:[yc],data(){return{map:null,hoverObject:null,popup:null,colors:[]}},async mounted(){var y,S,C,z;if(await this.createMap(),(y=this.row)!=null&&y.geom){const{type:N,coordinates:W}=this.row.geom;let T;switch(N){case"Polygon":T=zu(W);break;case"MultiPolygon":T=Lu(W);break;case"MultiPoint":T=Du(W);break;default:(S=this.map)==null||S.fitBounds([W,W],{maxZoom:15,padding:30}),this.isSelectObj=!0;return}const c=Ou(T).geometry.coordinates;(C=this.map)==null||C.fitBounds([c,c],{maxZoom:15,padding:30})}else(z=this.map)==null||z.fitBounds(this.maxBounds)},watch:{filtersParam(y){this.setFilter(this.table,y)}},methods:{async getColorStyle(){var y=[["#69D2E7","#A7DBD8","#E0E4CC","#F38630","#FA6900"],["#FE4365","#FC9D9A","#F9CDAD","#C8C8A9","#83AF9B"],["#ECD078","#D95B43","#C02942","#542437","#53777A"]];if(!this.colorAttr)return"blue";try{const{data:{rows:S}}=await Zt.get(`/api/data/${this.table}/${this.colorAttr}`),C=S.reduce((z,N,W)=>N!=null&&N.id?[...z,N.id.toString(),N.color||y[0][W%5]]:z,["match",["get",this.colorAttr]]);return this.colors=[...S],C.push("gray"),C}catch(S){console.log(S)}},async handleMapLoad(){const y=await this.getColorStyle();await this.addLayer({id:this.table,service:"vector",url:`/api/vtile/${this.table}/ua/{z}/{x}/{y}.vmt?pointZoom=12`,layers:[{type:"fill","source-layer":this.table,paint:{"fill-color":y,"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":y}}]})},async createMap(){const y={version:8,glyphs:"https://cdn.softpro.ua/data/fonts/{fontstack}/{range}.pbf",sources:{},layers:[]};this.map=await new _c.Map({container:"maplibre-map",style:y,center:this.center,zoom:this.zoom,minZoom:5,maxBounds:this.maxBounds}),this.$parent.map=this.map,this.map.addControl(new _c.NavigationControl({visualizePitch:!0})),this.map.on("load",this.handleMapLoad)}}},vm={class:"vs-map-portal relative"};function bm(y,S,C,z,N,W){const T=ee.resolveComponent("MapLegend"),c=ee.resolveComponent("MapSlotLayers");return ee.openBlock(),ee.createElementBlock("div",vm,[ee.createElementVNode("div",{id:"maplibre-map",ref:"maplibreMap",style:ee.normalizeStyle({height:C.height,width:C.width})},null,4),ee.createVNode(T,{colors:N.colors},null,8,["colors"]),ee.createVNode(c,{map:N.map,baseLayers:C.basemap},null,8,["map","baseLayers"])])}const wm=Or(xm,[["render",bm]]),Sm={},Tm={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"},Im=[ee.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 Pm(y,S){return ee.openBlock(),ee.createElementBlock("svg",Tm,Im)}const km=Or(Sm,[["render",Pm]]),Em={},Cm={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"},Am=[ee.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),ee.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),ee.createElementVNode("path",{d:"M15 4v16"},null,-1),ee.createElementVNode("path",{d:"M9 10l2 2l-2 2"},null,-1)];function Mm(y,S){return ee.openBlock(),ee.createElementBlock("svg",Cm,Am)}const zm=Or(Em,[["render",Mm]]),Dm={},Lm={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"},Rm=[ee.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),ee.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),ee.createElementVNode("path",{d:"M15 4v16"},null,-1),ee.createElementVNode("path",{d:"M10 10l-2 2l2 2"},null,-1)];function Bm(y,S){return ee.openBlock(),ee.createElementBlock("svg",Lm,Rm)}const Fm=Or(Dm,[["render",Bm]]),Om={},Vm={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"},Nm=[ee.createElementVNode("path",{d:"M18 6 6 18"},null,-1),ee.createElementVNode("path",{d:"m6 6 12 12"},null,-1)];function jm(y,S){return ee.openBlock(),ee.createElementBlock("svg",Vm,Nm)}const Um=Or(Om,[["render",jm]]),$m={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 y;return!!((y=this.$slots)!=null&&y.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:y}){y==="Escape"&&this.handleClose()},handleClose(){this.$emit("update:visible",!1),this.$emit("onClose")}}},Vu=y=>(ee.pushScopeId("data-v-0a173fd8"),y=y(),ee.popScopeId(),y),qm={class:"vsTailwind ui-dialog__wrapper"},Zm={class:"w-full h-full fixed top-0 start-0 z-[80] bg-black bg-opacity-50"},Gm={class:"py-2.5 px-4 flex justify-between items-center border-b"},Hm={class:"font-medium text-gray-800"},Xm=[Vu(()=>ee.createElementVNode("span",{class:"sr-only"},"Close",-1)),Vu(()=>ee.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"},[ee.createElementVNode("path",{d:"M18 6 6 18"}),ee.createElementVNode("path",{d:"m6 6 12 12"})],-1))],Wm={class:"ui-dialog__content p-4"},Jm={key:0,class:"flex justify-end gap-x-2"};function Km(y,S,C,z,N,W){return ee.openBlock(),ee.createBlock(ee.Teleport,{to:"#modal"},[ee.createVNode(ee.Transition,{name:"fade"},{default:ee.withCtx(()=>[ee.withDirectives(ee.createElementVNode("div",qm,[ee.createElementVNode("div",Zm,[ee.createVNode(ee.Transition,{name:"content",appear:""},{default:ee.withCtx(()=>[ee.createElementVNode("div",{class:ee.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]])},[ee.createElementVNode("div",Gm,[ee.createElementVNode("h3",Hm,ee.toDisplayString(C.title),1),ee.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))},Xm)]),ee.createElementVNode("div",Wm,[ee.renderSlot(y.$slots,"default",{},void 0,!0)]),W.hasSlot?(ee.openBlock(),ee.createElementBlock("div",Jm,[ee.renderSlot(y.$slots,"footer",{},void 0,!0)])):ee.createCommentVNode("",!0)],2)]),_:3})])],512),[[ee.vShow,C.visible]])]),_:3})])}const Ym=Or($m,[["render",Km],["__scopeId","data-v-0a173fd8"]]),Qm=ee.defineComponent({props:{title:{type:String,default:()=>""},table:{type:String,default:()=>""},rows:{type:String,default:()=>null},initTotal:{type:String,default:()=>""},colorAttr:{type:String,default:()=>""},maxBounds:{type:String,default:()=>[[22,44.4],[40,52.5]]},id:{type:String,default:()=>""},isAutocomplete:{type:Boolean,default:()=>!1},zoom:{type:String,default:()=>"13"},maskForSearch:{type:String,default:()=>null}},mixins:[yc],components:{MapPortal:wm,NoData:Fp,FilterIcon:km,VisibleMapIcon:zm,HiddenMapIcon:Fm,CloseIcon:Um,VsDialog:Ym},data(){return{filters:"",search:"",limit:20,polyline:null,filtersParam:"",isSelectObj:!1,selectedId:"",searchRegion:"",handleSearchRegionDebounced:Mu(y=>this.updateSearchRegionValue(y),500),searchRegionResult:[],isRegionDropdownVisible:!1,selectedRow:"",activeFilters:"",isMapVisible:!0,tabsIsVisible:!1,filterUrl:"",currentPage:1,regionOptionGeneral:null,isFilterVisible:!1,tableData:null,hoverData:null,atuData:[],map:null,total:null,filterValues:"",activeFiltersCount:"",visibleTrue:!0,regionSelectValue:null,currentBbox:null,optionRowsCount:[{value:10,label:"10"},{value:20,label:"20"},{value:30,label:"30"}],handleDebouncedUpdateValue:Mu(y=>{this.handleSearchValue(y)},10)}},watch:{map(){this.map.on("mousemove",this.handleMapHover),this.map.on("click",this.handleMapClick)},activeFiltersCount(){var y,S;return(S=(y=this.$refs)==null?void 0:y.filter)==null?void 0:S.filteredActiveFiltersLength},activeFilters(){var y,S;return this.isSelectObj&&this.moveToDefaultPage(),(S=(y=this.$refs)==null?void 0:y.filter)==null?void 0:S.activeFilters},isFilterVisible(y){y||this.getData()},async regionSelectValue(y,S){var N,W;if(!this.regionSelectValue){this.map.removeSource("region-search-id");return}y&&this.selectedId&&this.closeObjCard(),this.polyline=this.regionSelectValue.encoded_geom,this.getData();const C=((N=this.regionSelectValue)==null?void 0:N.geom)||Sr.toGeoJSON(this.regionSelectValue.encoded_geom),z=this.map.getSource("region-search-id");if(this.currentBbox=Fu(C),z)z.setData({type:"Feature",geometry:C});else{this.map.addSource("region-search-id",{type:"geojson",data:{type:"Feature",geometry:C}});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:10,padding:20}),this.getData()}},created(){this.tableData=this.rows,this.total=this.initTotal,this.id&&(this.selectedRow=this.rows[0],this.selectedId=this.id,this.isSelectObj=!0)},mounted(){this.rows||this.getData(),this.getFilter()},updated(){this.checkFilterLength()},methods:{async updateSearchRegionValue(y){this.searchRegion=y,await this.getReginOptions()},async getData(){try{const y={search:this.search||null,limit:this.limit,page:this.currentPage,polyline:this.polyline};this.filtersParam!==""&&this.filtersParam!=="no-url"&&(y.filter=this.filtersParam);const{data:S}=await Zt.get(`/api/data/${this.table}`,{params:y});this.tableData=S==null?void 0:S.rows,this.total=S.total}catch(y){console.error(y.message)}},moveToDefaultPage(){var z;const y=new URLSearchParams(window.location.search);y.delete("id");const C=`${window.location.pathname}?${y.toString()}`;(z=this.map)==null||z.fitBounds(this.maxBounds,{}),window.history.pushState({},"",C),this.isSelectObj=!1},regionFullName(y){return`${y.text} / ${y.region}`},getLabelById(y){const S=this.filters.find(C=>C.id===y);return S?S.label:y},getOptionsLabelById(y,S){return Array.isArray(S)?this.filters.find(z=>z.id===y).options.filter(z=>S.includes(z.id)).map(z=>z.text).join(", "):S},async clearFilter(y){var S,C;await((C=(S=this.$refs)==null?void 0:S.filter)==null?void 0:C.clearFilter(y)),await this.updateTableAndMap(),await this.getData()},async getReginOptions(){if(this.searchRegion===""&&this.regionOptionGeneral)this.searchRegionResult=this.regionOptionGeneral;else try{const{data:y}=await Zt.get(`https://data.softpro.ua/api-user/suggest/atu.codifier.type.polyline.select?parent=H&key=${this.searchRegion}`);this.searchRegionResult=y,this.regionOptionGeneral||(this.regionOptionGeneral=y)}catch(y){console.error(y.message)}},handlePageChange(y){this.currentPage=y,this.getData()},async getFilter(){try{const{data:y}=await Zt.get(`/api/filter/${this.table}`);this.filters=y.list}catch(y){console.error(y.message)}},async handleSearchValue(y){this.search=y,await this.getData()},closeObjCard(){var z;const y=new URLSearchParams(window.location.search);y.delete("id");const C=`${window.location.pathname}?${y.toString()}`;(z=this.map)==null||z.fitBounds(this.currentBbox||this.maxBounds,{}),window.history.pushState({},"",C),this.isSelectObj=!1,this.getData()},async handleSearchRegionValue(y){var C;const S=this.map.getLayer("region-search-id");this.searchRegion=y,y===""&&S?((C=this.map)==null||C.fitBounds(this.maxBounds,{}),this.currentBbox=null,this.polyline=null,this.map.removeLayer("region-search-id"),this.getData()):y===""&&this.getData()},handleFilterChange(y){this.currentPage=y.state.page||1,this.filterUrl=y.url.split("|").filter(S=>!S.includes("page=")).join("|")},async updateTableAndMap(){var y,S;this.filtersParam=this.filterUrl,this.activeFilters=(S=(y=this.$refs)==null?void 0:y.filter)==null?void 0:S.activeFilters,this.isFilterVisible=!1},handleFilterSubmit(){var y;this.isSelectObj="",this.selectedId="",this.selectedId=!1,(y=this.map)==null||y.fitBounds(this.maxBounds,{}),this.isFilterVisible=!1},toggleFilterShown(){this.isFilterVisible=!this.isFilterVisible},closeFilterShown(){this.isFilterVisible=!1},toggleMapVisible(){this.isMapVisible=!this.isMapVisible},checkUrl(){const y=new URLSearchParams(window.location.search);y.has("id")?(this.isSelectObj=!0,this.isMapVisible=!0,this.selectedId=y.get("id")):(this.isSelectObj=!1,this.selectedId="")},changeLimit(y){this.limit=y,this.currentPage=1,this.getData()},filterModalClose(){this.toggleFilterShown(),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.currentBbox=null,this.activeFilters=null,this.tabsIsVisible=!1,this.handleSearchRegionValue(""))},checkFilterLength(){var S,C;const y=(C=(S=this.$refs)==null?void 0:S.filter)==null?void 0:C.filteredActiveFiltersLength;y!==this.previousLength&&(this.previousLength=y,this.activeFiltersCount=y)},async handleMapClick(y){var W,T,c,ye,xe;const S=this.map.queryRenderedFeatures(y.point),C=window.location.pathname,z=new URLSearchParams(window.location.search);z.set("id",`${S[0].properties.id}`),this.getObjectData(S[0].properties.id);const N=`${C}?${z.toString()}`;window.history.pushState({},"",N),this.isSelectObj=!0,y.lngLat&&((xe=this.map)==null||xe.fitBounds([[(W=y.lngLat)==null?void 0:W.lng,(T=y.lngLat)==null?void 0:T.lat],[(c=y.lngLat)==null?void 0:c.lng,(ye=y.lngLat)==null?void 0:ye.lat]],{maxZoom:this.zoom,padding:30})),this.checkUrl()},async getObjectData(y){var S;try{const{data:C}=await Zt.get(`/api/data/${this.table}/${y}`);this.selectRow((S=C==null?void 0:C.rows)==null?void 0:S[0])}catch(C){console.error(C.message)}},async selectRow(y){var N,W;this.isMapVisible=!0,this.selectedRow=y;const S=window.location.pathname,C=new URLSearchParams(window.location.search);C.set("id",`${y.id}`);const z=`${S}?${C.toString()}`;if(window.history.pushState({},"",z),this.checkUrl(),y!=null&&y.geom){const{type:T,coordinates:c}=y.geom;let ye;switch(T){case"Polygon":ye=zu(c);break;case"MultiPolygon":ye=Lu(c);break;case"MultiPoint":ye=Du(c);break;default:(N=this.map)==null||N.fitBounds([c,c],{maxZoom:13,padding:30}),this.isSelectObj=!0;return}const xe=Ou(ye).geometry.coordinates;(W=this.map)==null||W.fitBounds([xe,xe],{maxZoom:13,padding:30})}this.isSelectObj=!0},async handleMapHover(y){var N;this.hoverObject&&(this.map.setFeatureState(this.hoverObject,{hover:!1}),this.hoverObject=null),this.popup||(this.popup=new _c.Popup({maxWidth:"400px",closeButton:!1,closeOnClick:!1}));const S=this.map.queryRenderedFeatures(y.point);if(this.map.getCanvas().style.cursor="pointer",!S.length||((N=S==null?void 0:S[0])==null?void 0:N.source)==="region-search-id"){this.map.getCanvas().style.cursor="",this.popup.remove();return}const C=S[0].geometry.coordinates.slice();this.hoverData=S[0].properties;const z={source:S[0].source,sourceLayer:S[0].sourceLayer,id:S[0].id};if(z.source!=="region-search-id"){for(this.map.setFeatureState(z,{hover:!0}),this.hoverObject=z;Math.abs(y.lngLat.lng-C[0])>180;)C[0]+=y.lngLat.lng>C[0]?360:-360;this.popup.setLngLat(y.lngLat).setHTML(this.$refs.popup.innerHTML).addTo(this.map)}}}}),eg={class:"ml-3 pt-5"},tg={class:"w-full gap-5 flex justify-between mb-[10px] pr-3"},ig={class:"flex gap-[20px]"},rg={key:0,class:"font-medium text-[10px] min-w-[16px] py-0.5 px-[5px] bg-gray-800 text-white leading-3 rounded-full"},ng={class:"p-4 flex-1 flex flex-wrap justify-end items-center gap-2"},sg=["title"],og=ee.createElementVNode("span",{class:"sr-only"},"Відкрити мапу",-1),ag={class:"flex"},lg={class:"py-[15px] pb-[24px] pl-2"},cg={class:"font-bold text-2xl mr-[10px]"},hg={class:"text-sm text-stone-500 font-medium"},ug=ee.createElementVNode("span",{class:"text-sm text-stone-500 font-medium"}," об'єктів",-1),dg={class:"wrapperTable flex flex-col",style:{height:"calc(100vh - 302px)"}},pg={key:0,class:"flex gap-x-2 flex-wrap"},fg={class:"font-medium"},mg=ee.createElementVNode("span",{class:"h-3 mx-2 border-s border-gray-200"},null,-1),gg={class:"text-gray-500"},_g=["onClick"],yg={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"},xg=ee.createElementVNode("span",{class:"font-medium"}," Очистити ",-1),vg={key:2,class:"text-center py-28"},bg=ee.createElementVNode("h2",{class:"font-medium text-base text-gray-500 rounded-xl"}," За вашим запитом даних не знайдено! ",-1),wg=ee.createElementVNode("p",{class:"font-normal text-sm text-gray-500 rounded-xl"}," Введіть, будь ласка, інші значення для пошуку. ",-1),Sg={key:0},Tg={key:1,class:"my-5 pr-2"},Ig={class:"flex justify-between"},Pg={key:1,class:"w-2/4"},kg={class:"map-section"},Eg={ref:"popup",style:{display:"none"}};function Cg(y,S,C,z,N,W){const T=ee.resolveComponent("VsAutocompleteOption"),c=ee.resolveComponent("vs-autocomplete"),ye=ee.resolveComponent("VsTextMask"),xe=ee.resolveComponent("vs-text"),Se=ee.resolveComponent("FilterIcon"),ce=ee.resolveComponent("VsFilter"),ae=ee.resolveComponent("VsDialog"),gt=ee.resolveComponent("VisibleMapIcon"),Ge=ee.resolveComponent("HiddenMapIcon"),et=ee.resolveComponent("CloseIcon"),je=ee.resolveComponent("NoData"),dt=ee.resolveComponent("VsPagination"),Ft=ee.resolveComponent("MapPortal");return ee.openBlock(),ee.createElementBlock("section",eg,[ee.createElementVNode("div",null,[ee.createElementVNode("div",tg,[ee.createElementVNode("div",ig,[y.isAutocomplete?(ee.openBlock(),ee.createBlock(c,{key:0,modelValue:y.regionSelectValue,"onUpdate:modelValue":[S[0]||(S[0]=Ae=>y.regionSelectValue=Ae),y.handleSearchRegionValue],searchable:"",clearable:"",searchPlaceholder:"Введіть назву громади",placeholder:"Обрати область чи громаду",onOnSearch:y.handleSearchRegionDebounced,onClick:y.getReginOptions,class:"w-[350px]"},{default:ee.withCtx(()=>[(ee.openBlock(!0),ee.createElementBlock(ee.Fragment,null,ee.renderList(y.searchRegionResult,Ae=>(ee.openBlock(),ee.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:Ae==null?void 0:Ae.id,value:Ae,label:y.regionFullName(Ae)},null,8,["value","label"]))),128))]),_:1},8,["modelValue","onOnSearch","onUpdate:modelValue","onClick"])):ee.createCommentVNode("",!0),y.maskForSearch?(ee.openBlock(),ee.createBlock(ye,{key:1,"model-value":y.search,"onUpdate:modelValue":y.handleDebouncedUpdateValue,class:"w-full table-interface-search [&>input:focus]:ring-1",placeholder:"Пошук",mask:y.maskForSearch,icon:"search",iconPosition:"left",clearable:"",style:{height:"38px","min-width":"300px","max-width":"300px"},ref:"searchInput"},null,8,["model-value","onUpdate:modelValue","mask"])):(ee.openBlock(),ee.createBlock(xe,{key:2,"model-value":y.search,"onUpdate:modelValue":y.handleDebouncedUpdateValue,class:"w-full table-interface-search [&>input:focus]:ring-1",placeholder:"Пошук",icon:"search","icon-position":"left",clearable:"",style:{height:"38px","min-width":"300px","max-width":"300px"},ref:"searchInput"},null,8,["model-value","onUpdate:modelValue"])),ee.createElementVNode("button",{type:"button",class:"py-2 px-2.5 max-h-[38px] inline-flex items-center gap-x-1.5 text-sm font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50",onClick:S[1]||(S[1]=(...Ae)=>y.toggleFilterShown&&y.toggleFilterShown(...Ae))},[ee.createVNode(Se),ee.createTextVNode(" Фільтри "),y.activeFiltersCount>=1?(ee.openBlock(),ee.createElementBlock("span",rg,ee.toDisplayString(y.activeFiltersCount),1)):ee.createCommentVNode("",!0)]),ee.createVNode(ae,{visible:y.isFilterVisible,"onUpdate:visible":S[4]||(S[4]=Ae=>y.isFilterVisible=Ae),title:"Фільтри",size:"small",onOnClose:S[5]||(S[5]=()=>{y.visibleTrue=!0,y.isFilterVisible=!1})},{footer:ee.withCtx(()=>[ee.createElementVNode("div",ng,[ee.createElementVNode("button",{onClick:S[2]||(S[2]=(...Ae)=>y.resetFilters&&y.resetFilters(...Ae)),class:"py-2 px-3 inline-flex justify-center items-center text-start bg-white border border-gray-200 text-gray-800 text-sm font-medium rounded-lg shadow-sm align-middle hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"}," Очистити все "),ee.createElementVNode("button",{onClick:S[3]||(S[3]=(...Ae)=>y.updateTableAndMap&&y.updateTableAndMap(...Ae)),class:"py-2 px-3 inline-flex justify-center items-center gap-x-2 text-start bg-blue-600 border border-blue-600 text-white text-sm font-medium rounded-lg shadow-sm align-middle hover:bg-blue-700 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:ring-1 focus:ring-blue-300 dark:focus:ring-blue-500"}," Застосувати ")])]),default:ee.withCtx(()=>[y.filters?(ee.openBlock(),ee.createBlock(ce,{key:0,ref:"filter",scheme:y.filters,closeFilterBtn:!0,onFilterClose:y.closeFilterShown,name:"filter",layout:"default",onFilterChange:y.handleFilterChange},null,8,["scheme","onFilterClose","onFilterChange"])):ee.createCommentVNode("",!0)]),_:1},8,["visible"])]),ee.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:y.isMapVisible?"Приховати карту":"Показати карту",onClick:S[6]||(S[6]=(...Ae)=>y.toggleMapVisible&&y.toggleMapVisible(...Ae))},[y.isMapVisible?(ee.openBlock(),ee.createBlock(gt,{key:0})):(ee.openBlock(),ee.createBlock(Ge,{key:1})),og],8,sg)]),ee.createElementVNode("div",ag,[ee.createElementVNode("div",{class:ee.normalizeClass(["relative overflow-hidden",y.isMapVisible?"w-2/4 mr-0":"w-full mr-3",y.isSelectObj?"hidden":""])},[ee.createElementVNode("h1",lg,[ee.createElementVNode("span",cg,ee.toDisplayString(y.title),1),ee.createElementVNode("span",hg,ee.toDisplayString(y.total),1),ug]),ee.createElementVNode("div",dg,[y.activeFilters?(ee.openBlock(),ee.createElementBlock("div",pg,[(ee.openBlock(!0),ee.createElementBlock(ee.Fragment,null,ee.renderList(y.activeFilters,(Ae,Pt,Tt)=>(ee.openBlock(),ee.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},[ee.createElementVNode("span",fg,ee.toDisplayString(y.getLabelById(Pt)),1),mg,ee.createElementVNode("span",gg,ee.toDisplayString(y.getOptionsLabelById(Pt,Ae)),1),ee.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=>y.clearFilter(Pt)},[ee.createVNode(et)],8,_g)]))),128)),Object.keys(y.activeFilters).length>=2?(ee.openBlock(),ee.createElementBlock("span",yg,[xg,ee.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[7]||(S[7]=(...Ae)=>y.resetFilters&&y.resetFilters(...Ae))},[ee.createVNode(et)])])):ee.createCommentVNode("",!0)])):ee.createCommentVNode("",!0),y.total>=1?ee.renderSlot(y.$slots,"table",{key:1,rows:y.tableData,map:y.map,selectRow:y.selectRow,getData:y.getData}):(ee.openBlock(),ee.createElementBlock("div",vg,[ee.createVNode(je),bg,wg,ee.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[8]||(S[8]=(...Ae)=>y.resetFilters&&y.resetFilters(...Ae))}," Очистити дані пошуку ")]))]),y.total>=1?(ee.openBlock(),ee.createElementBlock("hr",Sg)):ee.createCommentVNode("",!0),y.total>=1?(ee.openBlock(),ee.createElementBlock("div",Tg,[ee.createElementVNode("div",Ig,[ee.createVNode(dt,{total:y.total,maxPages:7,defaultPage:y.currentPage,pageSize:y.limit,goTo:!1,size:"medium",onPageChange:y.handlePageChange,backgroundColor:"#e5e7eb",borderedCellSelected:"true",pageSizes:[10,20,30],onPageSizeChange:y.changeLimit},null,8,["total","defaultPage","pageSize","onPageChange","onPageSizeChange"])])])):ee.createCommentVNode("",!0)],2),y.isSelectObj?(ee.openBlock(),ee.createElementBlock("div",{key:0,class:ee.normalizeClass(y.isMapVisible?"w-2/4 mr-0 pb-5":"w-full pb-5 mr-3"),style:{height:"calc(100vh - 152px)"}},[ee.renderSlot(y.$slots,"details",{table:y.table,selectedId:y.selectedId,selectedRow:y.selectedRow,map:y.map,closeObjCard:y.closeObjCard})],2)):ee.createCommentVNode("",!0),y.isMapVisible?(ee.openBlock(),ee.createElementBlock("div",Pg,[ee.createElementVNode("section",kg,[ee.createVNode(Ft,{height:"calc(100vh - 152px)",width:"w-2/4",table:y.table,filtersParam:y.filtersParam,row:y.selectedRow,colorAttr:y.colorAttr,maxBounds:y.maxBounds,zoom:y.zoom},null,8,["table","filtersParam","row","colorAttr","maxBounds","zoom"])])])):ee.createCommentVNode("",!0)]),ee.createElementVNode("div",Eg,[ee.renderSlot(y.$slots,"popup",{data:y.hoverData})],512)])])}const Nu=Or(Qm,[["render",Cg]]),ju={install:y=>{y.component("VsPartsMap",Nu)},components:{VsPartsMap:Nu}};return typeof window<"u"&&(window.PartsMap=ju),ju});
|
585
|
+
`+W):z.stack=W}catch{}}throw z}}_request(S,C){typeof S=="string"?(C=C||{},C.url=S):C=S||{},C=ts(this.defaults,C);const{transitional:z,paramsSerializer:N,headers:W}=C;z!==void 0&&zc.assertOptions(z,{silentJSONParsing:Pn.transitional(Pn.boolean),forcedJSONParsing:Pn.transitional(Pn.boolean),clarifyTimeoutError:Pn.transitional(Pn.boolean)},!1),N!=null&&(fe.isFunction(N)?C.paramsSerializer={serialize:N}:zc.assertOptions(N,{encode:Pn.function,serialize:Pn.function},!0)),C.method=(C.method||this.defaults.method||"get").toLowerCase();let T=W&&fe.merge(W.common,W[C.method]);W&&fe.forEach(["delete","get","head","post","put","patch","common"],Ge=>{delete W[Ge]}),C.headers=Gi.concat(T,W);const c=[];let ye=!0;this.interceptors.request.forEach(function(et){typeof et.runWhen=="function"&&et.runWhen(C)===!1||(ye=ye&&et.synchronous,c.unshift(et.fulfilled,et.rejected))});const xe=[];this.interceptors.response.forEach(function(et){xe.push(et.fulfilled,et.rejected)});let Se,ce=0,ae;if(!ye){const Ge=[ku.bind(this),void 0];for(Ge.unshift.apply(Ge,c),Ge.push.apply(Ge,xe),ae=Ge.length,Se=Promise.resolve(C);ce<ae;)Se=Se.then(Ge[ce++],Ge[ce++]);return Se}ae=c.length;let gt=C;for(ce=0;ce<ae;){const Ge=c[ce++],et=c[ce++];try{gt=Ge(gt)}catch(je){et.call(this,je);break}}try{Se=ku.call(this,gt)}catch(Ge){return Promise.reject(Ge)}for(ce=0,ae=xe.length;ce<ae;)Se=Se.then(xe[ce++],xe[ce++]);return Se}getUri(S){S=ts(this.defaults,S);const C=yu(S.baseURL,S.url);return cu(C,S.params,S.paramsSerializer)}}fe.forEach(["delete","get","head","options"],function(S){is.prototype[S]=function(C,z){return this.request(ts(z||{},{method:S,url:C,data:(z||{}).data}))}}),fe.forEach(["post","put","patch"],function(S){function C(z){return function(W,T,c){return this.request(ts(c||{},{method:S,headers:z?{"Content-Type":"multipart/form-data"}:{},url:W,data:T}))}}is.prototype[S]=C(),is.prototype[S+"Form"]=C(!0)});class Dc{constructor(S){if(typeof S!="function")throw new TypeError("executor must be a function.");let C;this.promise=new Promise(function(W){C=W});const z=this;this.promise.then(N=>{if(!z._listeners)return;let W=z._listeners.length;for(;W-- >0;)z._listeners[W](N);z._listeners=null}),this.promise.then=N=>{let W;const T=new Promise(c=>{z.subscribe(c),W=c}).then(N);return T.cancel=function(){z.unsubscribe(W)},T},S(function(W,T,c){z.reason||(z.reason=new Vs(W,T,c),C(z.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 C=this._listeners.indexOf(S);C!==-1&&this._listeners.splice(C,1)}static source(){let S;return{token:new Dc(function(N){S=N}),cancel:S}}}function nm(y){return function(C){return y.apply(null,C)}}function sm(y){return fe.isObject(y)&&y.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(([y,S])=>{Lc[S]=y});function Au(y){const S=new is(y),C=Hh(is.prototype.request,S);return fe.extend(C,is.prototype,S,{allOwnKeys:!0}),fe.extend(C,S,null,{allOwnKeys:!0}),C.create=function(N){return Au(ts(y,N))},C}const Zt=Au(Oo);Zt.Axios=is,Zt.CanceledError=Vs,Zt.CancelToken=Dc,Zt.isCancel=fu,Zt.VERSION=Eu,Zt.toFormData=ol,Zt.AxiosError=lt,Zt.Cancel=Zt.CanceledError,Zt.all=function(S){return Promise.all(S)},Zt.spread=nm,Zt.isAxiosError=sm,Zt.mergeConfig=ts,Zt.AxiosHeaders=Gi,Zt.formToJSON=y=>du(fe.isHTMLForm(y)?new FormData(y):y),Zt.getAdapter=Pu.getAdapter,Zt.HttpStatusCode=Lc,Zt.default=Zt;const Mu=(y,S=300)=>{let C;return function(...N){clearTimeout(C),C=setTimeout(()=>{y.apply(this,N)},S)}};function ul(y,S,C={}){const z={type:"Feature"};return(C.id===0||C.id)&&(z.id=C.id),C.bbox&&(z.bbox=C.bbox),z.properties=S||{},z.geometry=y,z}function om(y,S,C={}){if(!y)throw new Error("coordinates is required");if(!Array.isArray(y))throw new Error("coordinates must be an Array");if(y.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Ru(y[0])||!Ru(y[1]))throw new Error("coordinates must contain numbers");return ul({type:"Point",coordinates:y},S,C)}function zu(y,S,C={}){for(const N of y){if(N.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(N[N.length-1].length!==N[0].length)throw new Error("First and last Position are not equivalent.");for(let W=0;W<N[N.length-1].length;W++)if(N[N.length-1][W]!==N[0][W])throw new Error("First and last Position are not equivalent.")}return ul({type:"Polygon",coordinates:y},S,C)}function Du(y,S,C={}){return ul({type:"MultiPoint",coordinates:y},S,C)}function Lu(y,S,C={}){return ul({type:"MultiPolygon",coordinates:y},S,C)}function Ru(y){return!isNaN(y)&&y!==null&&!Array.isArray(y)}function Bu(y,S,C){if(y!==null)for(var z,N,W,T,c,ye,xe,Se=0,ce=0,ae,gt=y.type,Ge=gt==="FeatureCollection",et=gt==="Feature",je=Ge?y.features.length:1,dt=0;dt<je;dt++){xe=Ge?y.features[dt].geometry:et?y.geometry:y,ae=xe?xe.type==="GeometryCollection":!1,c=ae?xe.geometries.length:1;for(var Ft=0;Ft<c;Ft++){var Ae=0,Pt=0;if(T=ae?xe.geometries[Ft]:xe,T!==null){ye=T.coordinates;var Tt=T.type;switch(Se=0,Tt){case null:break;case"Point":if(S(ye,ce,dt,Ae,Pt)===!1)return!1;ce++,Ae++;break;case"LineString":case"MultiPoint":for(z=0;z<ye.length;z++){if(S(ye[z],ce,dt,Ae,Pt)===!1)return!1;ce++,Tt==="MultiPoint"&&Ae++}Tt==="LineString"&&Ae++;break;case"Polygon":case"MultiLineString":for(z=0;z<ye.length;z++){for(N=0;N<ye[z].length-Se;N++){if(S(ye[z][N],ce,dt,Ae,Pt)===!1)return!1;ce++}Tt==="MultiLineString"&&Ae++,Tt==="Polygon"&&Pt++}Tt==="Polygon"&&Ae++;break;case"MultiPolygon":for(z=0;z<ye.length;z++){for(Pt=0,N=0;N<ye[z].length;N++){for(W=0;W<ye[z][N].length-Se;W++){if(S(ye[z][N][W],ce,dt,Ae,Pt)===!1)return!1;ce++}Pt++}Ae++}break;case"GeometryCollection":for(z=0;z<T.geometries.length;z++)if(Bu(T.geometries[z],S)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function Fu(y,S={}){if(y.bbox!=null&&S.recompute!==!0)return y.bbox;const C=[1/0,1/0,-1/0,-1/0];return Bu(y,z=>{C[0]>z[0]&&(C[0]=z[0]),C[1]>z[1]&&(C[1]=z[1]),C[2]<z[0]&&(C[2]=z[0]),C[3]<z[1]&&(C[3]=z[1])}),C}function Ou(y,S={}){const C=Fu(y),z=(C[0]+C[2])/2,N=(C[1]+C[3])/2;return om([z,N],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(y){y&&y.on("load",this.handleMapLoad)}},methods:{handleMapLoad(){this.baseLayers.forEach(y=>{this.layerList.push(y)}),this.toggleLayerVisibility("graymap")},toggleLayerVisibility(y){this.selectedLayer=y,this.changeBaseLayer(this.selectedLayer)}}},lm={class:"vs-map-slot-layers"},cm=["onClick"],hm=["src"];function um(y,S,C,z,N,W){return ee.openBlock(),ee.createElementBlock("div",lm,[(ee.openBlock(!0),ee.createElementBlock(ee.Fragment,null,ee.renderList(C.baseLayers,(T,c)=>(ee.openBlock(),ee.createElementBlock("div",{key:T.id,class:ee.normalizeClass(["vs-map-slot-layers__layer relative",{focused:T.id==N.selectedLayer}]),onClick:ye=>W.toggleLayerVisibility(T.id)},[ee.createElementVNode("img",{src:T.image,class:"vs-map-slot-layers__image"},null,8,hm),ee.createElementVNode("div",{class:ee.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",[c===0?"left-[-10px]":"left-[50%] translate-x-[-50%] "]])},ee.toDisplayString(T==null?void 0:T.name),3)],10,cm))),128))])}const dm=Or(am,[["render",um],["__scopeId","data-v-feacf7c0"]]),pm={props:["colors"],methods:{capitalizeFirstLetter(y){return y?y.charAt(0).toUpperCase()+y.slice(1):""}}},fm={class:"absolute left-[20px] bottom-[74px] bg-white max-w-[250px] p-[10px] rounded-lg"},mm={class:"legend-item"},gm={key:0,class:"flex justify-start items-center gap-2"},_m={class:"ml-1"};function ym(y,S,C,z,N,W){return ee.openBlock(),ee.createElementBlock("div",fm,[(ee.openBlock(!0),ee.createElementBlock(ee.Fragment,null,ee.renderList(C.colors,T=>(ee.openBlock(),ee.createElementBlock("div",mm,[T.id>0?(ee.openBlock(),ee.createElementBlock("div",gm,[ee.createElementVNode("div",{class:"w-[15px] h-[15px] rounded-[50%] min-w-[15px]",style:ee.normalizeStyle({backgroundColor:T.color})},null,4),ee.createElementVNode("div",_m,ee.toDisplayString(W.capitalizeFirstLetter(T.text)),1)])):ee.createCommentVNode("",!0)]))),256))])}const xm={components:{MapSlotLayers:dm,MapLegend:Or(pm,[["render",ym]])},props:{colorAttr:null,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:5},basemap:Array,filtersParam:{type:String,default:""},row:{type:Object,default:{}}},mixins:[yc],data(){return{map:null,hoverObject:null,popup:null,colors:[]}},async mounted(){var y,S,C,z;if(await this.createMap(),(y=this.row)!=null&&y.geom){const{type:N,coordinates:W}=this.row.geom;let T;switch(N){case"Polygon":T=zu(W);break;case"MultiPolygon":T=Lu(W);break;case"MultiPoint":T=Du(W);break;default:(S=this.map)==null||S.fitBounds([W,W],{maxZoom:15,padding:30}),this.isSelectObj=!0;return}const c=Ou(T).geometry.coordinates;(C=this.map)==null||C.fitBounds([c,c],{maxZoom:15,padding:30})}else(z=this.map)==null||z.fitBounds(this.maxBounds)},watch:{filtersParam(y){this.setFilter(this.table,y)}},methods:{async getColorStyle(){var y=[["#69D2E7","#A7DBD8","#E0E4CC","#F38630","#FA6900"],["#FE4365","#FC9D9A","#F9CDAD","#C8C8A9","#83AF9B"],["#ECD078","#D95B43","#C02942","#542437","#53777A"]];if(!this.colorAttr)return"blue";try{const{data:{rows:S}}=await Zt.get(`/api/data/${this.table}/${this.colorAttr}`),C=S.reduce((z,N,W)=>N!=null&&N.id?[...z,N.id.toString(),N.color||y[0][W%5]]:z,["match",["get",this.colorAttr]]);return this.colors=[...S],C.push("gray"),C}catch(S){console.log(S)}},async handleMapLoad(){const y=await this.getColorStyle();await this.addLayer({id:this.table,service:"vector",url:`/api/vtile/${this.table}/ua/{z}/{x}/{y}.vmt?pointZoom=12`,layers:[{type:"fill","source-layer":this.table,paint:{"fill-color":y,"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":y}}]})},async createMap(){const y={version:8,glyphs:"https://cdn.softpro.ua/data/fonts/{fontstack}/{range}.pbf",sources:{},layers:[]};this.map=await new _c.Map({container:"maplibre-map",style:y,center:this.center,zoom:this.zoom,minZoom:5,maxBounds:this.maxBounds}),this.$parent.map=this.map,this.map.addControl(new _c.NavigationControl({visualizePitch:!0})),this.map.on("load",this.handleMapLoad)}}},vm={class:"vs-map-portal relative"};function bm(y,S,C,z,N,W){const T=ee.resolveComponent("MapLegend"),c=ee.resolveComponent("MapSlotLayers");return ee.openBlock(),ee.createElementBlock("div",vm,[ee.createElementVNode("div",{id:"maplibre-map",ref:"maplibreMap",style:ee.normalizeStyle({height:C.height,width:C.width})},null,4),ee.createVNode(T,{colors:N.colors},null,8,["colors"]),ee.createVNode(c,{map:N.map,baseLayers:C.basemap},null,8,["map","baseLayers"])])}const wm=Or(xm,[["render",bm]]),Sm={},Tm={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"},Im=[ee.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 Pm(y,S){return ee.openBlock(),ee.createElementBlock("svg",Tm,Im)}const km=Or(Sm,[["render",Pm]]),Em={},Cm={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"},Am=[ee.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),ee.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),ee.createElementVNode("path",{d:"M15 4v16"},null,-1),ee.createElementVNode("path",{d:"M9 10l2 2l-2 2"},null,-1)];function Mm(y,S){return ee.openBlock(),ee.createElementBlock("svg",Cm,Am)}const zm=Or(Em,[["render",Mm]]),Dm={},Lm={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"},Rm=[ee.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),ee.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),ee.createElementVNode("path",{d:"M15 4v16"},null,-1),ee.createElementVNode("path",{d:"M10 10l-2 2l2 2"},null,-1)];function Bm(y,S){return ee.openBlock(),ee.createElementBlock("svg",Lm,Rm)}const Fm=Or(Dm,[["render",Bm]]),Om={},Vm={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"},Nm=[ee.createElementVNode("path",{d:"M18 6 6 18"},null,-1),ee.createElementVNode("path",{d:"m6 6 12 12"},null,-1)];function jm(y,S){return ee.openBlock(),ee.createElementBlock("svg",Vm,Nm)}const Um=Or(Om,[["render",jm]]),$m={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 y;return!!((y=this.$slots)!=null&&y.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:y}){y==="Escape"&&this.handleClose()},handleClose(){this.$emit("update:visible",!1),this.$emit("onClose")}}},Vu=y=>(ee.pushScopeId("data-v-0a173fd8"),y=y(),ee.popScopeId(),y),qm={class:"vsTailwind ui-dialog__wrapper"},Zm={class:"w-full h-full fixed top-0 start-0 z-[80] bg-black bg-opacity-50"},Gm={class:"py-2.5 px-4 flex justify-between items-center border-b"},Hm={class:"font-medium text-gray-800"},Xm=[Vu(()=>ee.createElementVNode("span",{class:"sr-only"},"Close",-1)),Vu(()=>ee.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"},[ee.createElementVNode("path",{d:"M18 6 6 18"}),ee.createElementVNode("path",{d:"m6 6 12 12"})],-1))],Wm={class:"ui-dialog__content p-4"},Jm={key:0,class:"flex justify-end gap-x-2"};function Km(y,S,C,z,N,W){return ee.openBlock(),ee.createBlock(ee.Teleport,{to:"#modal"},[ee.createVNode(ee.Transition,{name:"fade"},{default:ee.withCtx(()=>[ee.withDirectives(ee.createElementVNode("div",qm,[ee.createElementVNode("div",Zm,[ee.createVNode(ee.Transition,{name:"content",appear:""},{default:ee.withCtx(()=>[ee.createElementVNode("div",{class:ee.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]])},[ee.createElementVNode("div",Gm,[ee.createElementVNode("h3",Hm,ee.toDisplayString(C.title),1),ee.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))},Xm)]),ee.createElementVNode("div",Wm,[ee.renderSlot(y.$slots,"default",{},void 0,!0)]),W.hasSlot?(ee.openBlock(),ee.createElementBlock("div",Jm,[ee.renderSlot(y.$slots,"footer",{},void 0,!0)])):ee.createCommentVNode("",!0)],2)]),_:3})])],512),[[ee.vShow,C.visible]])]),_:3})])}const Ym=Or($m,[["render",Km],["__scopeId","data-v-0a173fd8"]]),Qm=ee.defineComponent({props:{title:{type:String,default:()=>""},table:{type:String,default:()=>""},rows:{type:String,default:()=>null},initTotal:{type:String,default:()=>""},colorAttr:{type:String,default:()=>""},maxBounds:{type:String,default:()=>[[22,44.4],[40,52.5]]},id:{type:String,default:()=>""},isAutocomplete:{type:Boolean,default:()=>!1},zoom:{type:String,default:()=>"13"},maskForSearch:{type:String,default:()=>null},basemap:{type:Array}},mixins:[yc],components:{MapPortal:wm,NoData:Fp,FilterIcon:km,VisibleMapIcon:zm,HiddenMapIcon:Fm,CloseIcon:Um,VsDialog:Ym},data(){return{filters:"",search:"",limit:20,polyline:null,filtersParam:"",isSelectObj:!1,selectedId:"",searchRegion:"",handleSearchRegionDebounced:Mu(y=>this.updateSearchRegionValue(y),500),searchRegionResult:[],isRegionDropdownVisible:!1,selectedRow:"",activeFilters:"",isMapVisible:!0,tabsIsVisible:!1,filterUrl:"",currentPage:1,regionOptionGeneral:null,isFilterVisible:!1,tableData:null,hoverData:null,atuData:[],map:null,total:null,filterValues:"",activeFiltersCount:"",visibleTrue:!0,regionSelectValue:null,currentBbox:null,optionRowsCount:[{value:10,label:"10"},{value:20,label:"20"},{value:30,label:"30"}],handleDebouncedUpdateValue:Mu(y=>{this.handleSearchValue(y)},10)}},watch:{map(){this.map.on("mousemove",this.handleMapHover),this.map.on("click",this.handleMapClick)},activeFiltersCount(){var y,S;return(S=(y=this.$refs)==null?void 0:y.filter)==null?void 0:S.filteredActiveFiltersLength},activeFilters(){var y,S;return this.isSelectObj&&this.moveToDefaultPage(),(S=(y=this.$refs)==null?void 0:y.filter)==null?void 0:S.activeFilters},isFilterVisible(y){y||this.getData()},async regionSelectValue(y,S){var N,W;if(!this.regionSelectValue){this.map.removeSource("region-search-id");return}y&&this.selectedId&&this.closeObjCard(),this.polyline=this.regionSelectValue.encoded_geom,this.getData();const C=((N=this.regionSelectValue)==null?void 0:N.geom)||Sr.toGeoJSON(this.regionSelectValue.encoded_geom),z=this.map.getSource("region-search-id");if(this.currentBbox=Fu(C),z)z.setData({type:"Feature",geometry:C});else{this.map.addSource("region-search-id",{type:"geojson",data:{type:"Feature",geometry:C}});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:10,padding:20}),this.getData()}},created(){this.tableData=this.rows,this.total=this.initTotal,this.id&&(this.selectedRow=this.rows[0],this.selectedId=this.id,this.isSelectObj=!0)},mounted(){this.rows||this.getData(),this.getFilter()},updated(){this.checkFilterLength()},methods:{async updateSearchRegionValue(y){this.searchRegion=y,await this.getReginOptions()},async getData(){try{const y={search:this.search||null,limit:this.limit,page:this.currentPage,polyline:this.polyline};this.filtersParam!==""&&this.filtersParam!=="no-url"&&(y.filter=this.filtersParam);const{data:S}=await Zt.get(`/api/data/${this.table}`,{params:y});this.tableData=S==null?void 0:S.rows,this.total=S.total}catch(y){console.error(y.message)}},moveToDefaultPage(){var z;const y=new URLSearchParams(window.location.search);y.delete("id");const C=`${window.location.pathname}?${y.toString()}`;(z=this.map)==null||z.fitBounds(this.maxBounds,{}),window.history.pushState({},"",C),this.isSelectObj=!1},regionFullName(y){return`${y.text} / ${y.region}`},getLabelById(y){const S=this.filters.find(C=>C.id===y);return S?S.label:y},getOptionsLabelById(y,S){return Array.isArray(S)?this.filters.find(z=>z.id===y).options.filter(z=>S.includes(z.id)).map(z=>z.text).join(", "):S},async clearFilter(y){var S,C;await((C=(S=this.$refs)==null?void 0:S.filter)==null?void 0:C.clearFilter(y)),await this.updateTableAndMap(),await this.getData()},async getReginOptions(){if(this.searchRegion===""&&this.regionOptionGeneral)this.searchRegionResult=this.regionOptionGeneral;else try{const{data:y}=await Zt.get(`https://data.softpro.ua/api-user/suggest/atu.codifier.type.polyline.select?parent=H&key=${this.searchRegion}`);this.searchRegionResult=y,this.regionOptionGeneral||(this.regionOptionGeneral=y)}catch(y){console.error(y.message)}},handlePageChange(y){this.currentPage=y,this.getData()},async getFilter(){try{const{data:y}=await Zt.get(`/api/filter/${this.table}`);this.filters=y.list}catch(y){console.error(y.message)}},async handleSearchValue(y){this.search=y,await this.getData()},closeObjCard(){var z;const y=new URLSearchParams(window.location.search);y.delete("id");const C=`${window.location.pathname}?${y.toString()}`;(z=this.map)==null||z.fitBounds(this.currentBbox||this.maxBounds,{}),window.history.pushState({},"",C),this.isSelectObj=!1,this.getData()},async handleSearchRegionValue(y){var C;const S=this.map.getLayer("region-search-id");this.searchRegion=y,y===""&&S?((C=this.map)==null||C.fitBounds(this.maxBounds,{}),this.currentBbox=null,this.polyline=null,this.map.removeLayer("region-search-id"),this.getData()):y===""&&this.getData()},handleFilterChange(y){this.currentPage=y.state.page||1,this.filterUrl=y.url.split("|").filter(S=>!S.includes("page=")).join("|")},async updateTableAndMap(){var y,S;this.filtersParam=this.filterUrl,this.activeFilters=(S=(y=this.$refs)==null?void 0:y.filter)==null?void 0:S.activeFilters,this.isFilterVisible=!1},handleFilterSubmit(){var y;this.isSelectObj="",this.selectedId="",this.selectedId=!1,(y=this.map)==null||y.fitBounds(this.maxBounds,{}),this.isFilterVisible=!1},toggleFilterShown(){this.isFilterVisible=!this.isFilterVisible},closeFilterShown(){this.isFilterVisible=!1},toggleMapVisible(){this.isMapVisible=!this.isMapVisible},checkUrl(){const y=new URLSearchParams(window.location.search);y.has("id")?(this.isSelectObj=!0,this.isMapVisible=!0,this.selectedId=y.get("id")):(this.isSelectObj=!1,this.selectedId="")},changeLimit(y){this.limit=y,this.currentPage=1,this.getData()},filterModalClose(){this.toggleFilterShown(),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.currentBbox=null,this.activeFilters=null,this.tabsIsVisible=!1,this.handleSearchRegionValue(""))},checkFilterLength(){var S,C;const y=(C=(S=this.$refs)==null?void 0:S.filter)==null?void 0:C.filteredActiveFiltersLength;y!==this.previousLength&&(this.previousLength=y,this.activeFiltersCount=y)},async handleMapClick(y){var W,T,c,ye,xe;const S=this.map.queryRenderedFeatures(y.point),C=window.location.pathname,z=new URLSearchParams(window.location.search);z.set("id",`${S[0].properties.id}`),this.getObjectData(S[0].properties.id);const N=`${C}?${z.toString()}`;window.history.pushState({},"",N),this.isSelectObj=!0,y.lngLat&&((xe=this.map)==null||xe.fitBounds([[(W=y.lngLat)==null?void 0:W.lng,(T=y.lngLat)==null?void 0:T.lat],[(c=y.lngLat)==null?void 0:c.lng,(ye=y.lngLat)==null?void 0:ye.lat]],{maxZoom:this.zoom,padding:30})),this.checkUrl()},async getObjectData(y){var S;try{const{data:C}=await Zt.get(`/api/data/${this.table}/${y}`);this.selectRow((S=C==null?void 0:C.rows)==null?void 0:S[0])}catch(C){console.error(C.message)}},async selectRow(y){var N,W;this.isMapVisible=!0,this.selectedRow=y;const S=window.location.pathname,C=new URLSearchParams(window.location.search);C.set("id",`${y.id}`);const z=`${S}?${C.toString()}`;if(window.history.pushState({},"",z),this.checkUrl(),y!=null&&y.geom){const{type:T,coordinates:c}=y.geom;let ye;switch(T){case"Polygon":ye=zu(c);break;case"MultiPolygon":ye=Lu(c);break;case"MultiPoint":ye=Du(c);break;default:(N=this.map)==null||N.fitBounds([c,c],{maxZoom:13,padding:30}),this.isSelectObj=!0;return}const xe=Ou(ye).geometry.coordinates;(W=this.map)==null||W.fitBounds([xe,xe],{maxZoom:13,padding:30})}this.isSelectObj=!0},async handleMapHover(y){var N;this.hoverObject&&(this.map.setFeatureState(this.hoverObject,{hover:!1}),this.hoverObject=null),this.popup||(this.popup=new _c.Popup({maxWidth:"400px",closeButton:!1,closeOnClick:!1}));const S=this.map.queryRenderedFeatures(y.point);if(this.map.getCanvas().style.cursor="pointer",!S.length||((N=S==null?void 0:S[0])==null?void 0:N.source)==="region-search-id"){this.map.getCanvas().style.cursor="",this.popup.remove();return}const C=S[0].geometry.coordinates.slice();this.hoverData=S[0].properties;const z={source:S[0].source,sourceLayer:S[0].sourceLayer,id:S[0].id};if(z.source!=="region-search-id"){for(this.map.setFeatureState(z,{hover:!0}),this.hoverObject=z;Math.abs(y.lngLat.lng-C[0])>180;)C[0]+=y.lngLat.lng>C[0]?360:-360;this.popup.setLngLat(y.lngLat).setHTML(this.$refs.popup.innerHTML).addTo(this.map)}}}}),eg={class:"ml-3 pt-5"},tg={class:"w-full gap-5 flex justify-between mb-[10px] pr-3"},ig={class:"flex gap-[20px]"},rg={key:0,class:"font-medium text-[10px] min-w-[16px] py-0.5 px-[5px] bg-gray-800 text-white leading-3 rounded-full"},ng={class:"p-4 flex-1 flex flex-wrap justify-end items-center gap-2"},sg=["title"],og=ee.createElementVNode("span",{class:"sr-only"},"Відкрити мапу",-1),ag={class:"flex"},lg={class:"py-[15px] pb-[24px] pl-2"},cg={class:"font-bold text-2xl mr-[10px]"},hg={class:"text-sm text-stone-500 font-medium"},ug=ee.createElementVNode("span",{class:"text-sm text-stone-500 font-medium"}," об'єктів",-1),dg={class:"wrapperTable flex flex-col",style:{height:"calc(100vh - 302px)"}},pg={key:0,class:"flex gap-x-2 flex-wrap"},fg={class:"font-medium"},mg=ee.createElementVNode("span",{class:"h-3 mx-2 border-s border-gray-200"},null,-1),gg={class:"text-gray-500"},_g=["onClick"],yg={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"},xg=ee.createElementVNode("span",{class:"font-medium"}," Очистити ",-1),vg={key:2,class:"text-center py-28"},bg=ee.createElementVNode("h2",{class:"font-medium text-base text-gray-500 rounded-xl"}," За вашим запитом даних не знайдено! ",-1),wg=ee.createElementVNode("p",{class:"font-normal text-sm text-gray-500 rounded-xl"}," Введіть, будь ласка, інші значення для пошуку. ",-1),Sg={key:0},Tg={key:1,class:"my-5 pr-2"},Ig={class:"flex justify-between"},Pg={key:1,class:"w-2/4"},kg={class:"map-section"},Eg={ref:"popup",style:{display:"none"}};function Cg(y,S,C,z,N,W){const T=ee.resolveComponent("VsAutocompleteOption"),c=ee.resolveComponent("vs-autocomplete"),ye=ee.resolveComponent("VsTextMask"),xe=ee.resolveComponent("vs-text"),Se=ee.resolveComponent("FilterIcon"),ce=ee.resolveComponent("VsFilter"),ae=ee.resolveComponent("VsDialog"),gt=ee.resolveComponent("VisibleMapIcon"),Ge=ee.resolveComponent("HiddenMapIcon"),et=ee.resolveComponent("CloseIcon"),je=ee.resolveComponent("NoData"),dt=ee.resolveComponent("VsPagination"),Ft=ee.resolveComponent("MapPortal");return ee.openBlock(),ee.createElementBlock("section",eg,[ee.createElementVNode("div",null,[ee.createElementVNode("div",tg,[ee.createElementVNode("div",ig,[y.isAutocomplete?(ee.openBlock(),ee.createBlock(c,{key:0,modelValue:y.regionSelectValue,"onUpdate:modelValue":[S[0]||(S[0]=Ae=>y.regionSelectValue=Ae),y.handleSearchRegionValue],searchable:"",clearable:"",searchPlaceholder:"Введіть назву громади",placeholder:"Обрати область чи громаду",onOnSearch:y.handleSearchRegionDebounced,onClick:y.getReginOptions,class:"w-[350px]"},{default:ee.withCtx(()=>[(ee.openBlock(!0),ee.createElementBlock(ee.Fragment,null,ee.renderList(y.searchRegionResult,Ae=>(ee.openBlock(),ee.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:Ae==null?void 0:Ae.id,value:Ae,label:y.regionFullName(Ae)},null,8,["value","label"]))),128))]),_:1},8,["modelValue","onOnSearch","onUpdate:modelValue","onClick"])):ee.createCommentVNode("",!0),y.maskForSearch?(ee.openBlock(),ee.createBlock(ye,{key:1,"model-value":y.search,"onUpdate:modelValue":y.handleDebouncedUpdateValue,class:"w-full table-interface-search [&>input:focus]:ring-1",placeholder:"Пошук",mask:y.maskForSearch,icon:"search",iconPosition:"left",clearable:"",style:{height:"38px","min-width":"300px","max-width":"300px"},ref:"searchInput"},null,8,["model-value","onUpdate:modelValue","mask"])):(ee.openBlock(),ee.createBlock(xe,{key:2,"model-value":y.search,"onUpdate:modelValue":y.handleDebouncedUpdateValue,class:"w-full table-interface-search [&>input:focus]:ring-1",placeholder:"Пошук",icon:"search","icon-position":"left",clearable:"",style:{height:"38px","min-width":"300px","max-width":"300px"},ref:"searchInput"},null,8,["model-value","onUpdate:modelValue"])),ee.createElementVNode("button",{type:"button",class:"py-2 px-2.5 max-h-[38px] inline-flex items-center gap-x-1.5 text-sm font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50",onClick:S[1]||(S[1]=(...Ae)=>y.toggleFilterShown&&y.toggleFilterShown(...Ae))},[ee.createVNode(Se),ee.createTextVNode(" Фільтри "),y.activeFiltersCount>=1?(ee.openBlock(),ee.createElementBlock("span",rg,ee.toDisplayString(y.activeFiltersCount),1)):ee.createCommentVNode("",!0)]),ee.createVNode(ae,{visible:y.isFilterVisible,"onUpdate:visible":S[4]||(S[4]=Ae=>y.isFilterVisible=Ae),title:"Фільтри",size:"small",onOnClose:S[5]||(S[5]=()=>{y.visibleTrue=!0,y.isFilterVisible=!1})},{footer:ee.withCtx(()=>[ee.createElementVNode("div",ng,[ee.createElementVNode("button",{onClick:S[2]||(S[2]=(...Ae)=>y.resetFilters&&y.resetFilters(...Ae)),class:"py-2 px-3 inline-flex justify-center items-center text-start bg-white border border-gray-200 text-gray-800 text-sm font-medium rounded-lg shadow-sm align-middle hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"}," Очистити все "),ee.createElementVNode("button",{onClick:S[3]||(S[3]=(...Ae)=>y.updateTableAndMap&&y.updateTableAndMap(...Ae)),class:"py-2 px-3 inline-flex justify-center items-center gap-x-2 text-start bg-blue-600 border border-blue-600 text-white text-sm font-medium rounded-lg shadow-sm align-middle hover:bg-blue-700 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:ring-1 focus:ring-blue-300 dark:focus:ring-blue-500"}," Застосувати ")])]),default:ee.withCtx(()=>[y.filters?(ee.openBlock(),ee.createBlock(ce,{key:0,ref:"filter",scheme:y.filters,closeFilterBtn:!0,onFilterClose:y.closeFilterShown,name:"filter",layout:"default",onFilterChange:y.handleFilterChange},null,8,["scheme","onFilterClose","onFilterChange"])):ee.createCommentVNode("",!0)]),_:1},8,["visible"])]),ee.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:y.isMapVisible?"Приховати карту":"Показати карту",onClick:S[6]||(S[6]=(...Ae)=>y.toggleMapVisible&&y.toggleMapVisible(...Ae))},[y.isMapVisible?(ee.openBlock(),ee.createBlock(gt,{key:0})):(ee.openBlock(),ee.createBlock(Ge,{key:1})),og],8,sg)]),ee.createElementVNode("div",ag,[ee.createElementVNode("div",{class:ee.normalizeClass(["relative overflow-hidden",y.isMapVisible?"w-2/4 mr-0":"w-full mr-3",y.isSelectObj?"hidden":""])},[ee.createElementVNode("h1",lg,[ee.createElementVNode("span",cg,ee.toDisplayString(y.title),1),ee.createElementVNode("span",hg,ee.toDisplayString(y.total),1),ug]),ee.createElementVNode("div",dg,[y.activeFilters?(ee.openBlock(),ee.createElementBlock("div",pg,[(ee.openBlock(!0),ee.createElementBlock(ee.Fragment,null,ee.renderList(y.activeFilters,(Ae,Pt,Tt)=>(ee.openBlock(),ee.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},[ee.createElementVNode("span",fg,ee.toDisplayString(y.getLabelById(Pt)),1),mg,ee.createElementVNode("span",gg,ee.toDisplayString(y.getOptionsLabelById(Pt,Ae)),1),ee.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=>y.clearFilter(Pt)},[ee.createVNode(et)],8,_g)]))),128)),Object.keys(y.activeFilters).length>=2?(ee.openBlock(),ee.createElementBlock("span",yg,[xg,ee.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[7]||(S[7]=(...Ae)=>y.resetFilters&&y.resetFilters(...Ae))},[ee.createVNode(et)])])):ee.createCommentVNode("",!0)])):ee.createCommentVNode("",!0),y.total>=1?ee.renderSlot(y.$slots,"table",{key:1,rows:y.tableData,map:y.map,selectRow:y.selectRow,getData:y.getData}):(ee.openBlock(),ee.createElementBlock("div",vg,[ee.createVNode(je),bg,wg,ee.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[8]||(S[8]=(...Ae)=>y.resetFilters&&y.resetFilters(...Ae))}," Очистити дані пошуку ")]))]),y.total>=1?(ee.openBlock(),ee.createElementBlock("hr",Sg)):ee.createCommentVNode("",!0),y.total>=1?(ee.openBlock(),ee.createElementBlock("div",Tg,[ee.createElementVNode("div",Ig,[ee.createVNode(dt,{total:y.total,maxPages:7,defaultPage:y.currentPage,pageSize:y.limit,goTo:!1,size:"medium",onPageChange:y.handlePageChange,backgroundColor:"#e5e7eb",borderedCellSelected:"true",pageSizes:[10,20,30],onPageSizeChange:y.changeLimit},null,8,["total","defaultPage","pageSize","onPageChange","onPageSizeChange"])])])):ee.createCommentVNode("",!0)],2),y.isSelectObj?(ee.openBlock(),ee.createElementBlock("div",{key:0,class:ee.normalizeClass(y.isMapVisible?"w-2/4 mr-0 pb-5":"w-full pb-5 mr-3"),style:{height:"calc(100vh - 152px)"}},[ee.renderSlot(y.$slots,"details",{table:y.table,selectedId:y.selectedId,selectedRow:y.selectedRow,map:y.map,closeObjCard:y.closeObjCard})],2)):ee.createCommentVNode("",!0),y.isMapVisible?(ee.openBlock(),ee.createElementBlock("div",Pg,[ee.createElementVNode("section",kg,[ee.createVNode(Ft,{height:"calc(100vh - 152px)",width:"w-2/4",table:y.table,filtersParam:y.filtersParam,row:y.selectedRow,colorAttr:y.colorAttr,maxBounds:y.maxBounds,zoom:y.zoom,basemap:y.basemap},null,8,["table","filtersParam","row","colorAttr","maxBounds","zoom","basemap"])])])):ee.createCommentVNode("",!0)]),ee.createElementVNode("div",Eg,[ee.renderSlot(y.$slots,"popup",{data:y.hoverData})],512)])])}const Nu=Or(Qm,[["render",Cg]]),ju={install:y=>{y.component("VsPartsMap",Nu)},components:{VsPartsMap:Nu}};return typeof window<"u"&&(window.PartsMap=ju),ju});
|