@opengis/partsmap 0.0.73 → 0.0.74

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.
@@ -577,9 +577,9 @@ uniform ${C} ${E} u_${R};
577
577
  #endif
578
578
  `}),staticAttributes:o,staticUniforms:g}}class Gs{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,g,y,b,w){this.context=t;let C=this.boundPaintVertexBuffers.length!==a.length;for(let E=0;!C&&E<a.length;E++)this.boundPaintVertexBuffers[E]!==a[E]&&(C=!0);!this.vao||this.boundProgram!==n||this.boundLayoutVertexBuffer!==o||C||this.boundIndexBuffer!==h||this.boundVertexOffset!==g||this.boundDynamicVertexBuffer!==y||this.boundDynamicVertexBuffer2!==b||this.boundDynamicVertexBuffer3!==w?this.freshBind(n,o,a,h,g,y,b,w):(t.bindVertexArray.set(this.vao),y&&y.bind(),h&&h.dynamicDraw&&h.bind(),b&&b.bind(),w&&w.bind())}freshBind(t,n,o,a,h,g,y,b){const w=t.numAttributes,C=this.context,E=C.gl;this.vao&&this.destroy(),this.vao=C.createVertexArray(),C.bindVertexArray.set(this.vao),this.boundProgram=t,this.boundLayoutVertexBuffer=n,this.boundPaintVertexBuffers=o,this.boundIndexBuffer=a,this.boundVertexOffset=h,this.boundDynamicVertexBuffer=g,this.boundDynamicVertexBuffer2=y,this.boundDynamicVertexBuffer3=b,n.enableAttributes(E,t);for(const R of o)R.enableAttributes(E,t);g&&g.enableAttributes(E,t),y&&y.enableAttributes(E,t),b&&b.enableAttributes(E,t),n.bind(),n.setVertexAttribPointers(E,t,h);for(const R of o)R.bind(),R.setVertexAttribPointers(E,t,h);g&&(g.bind(),g.setVertexAttribPointers(E,t,h)),a&&a.bind(),y&&(y.bind(),y.setVertexAttribPointers(E,t,h)),b&&(b.bind(),b.setVertexAttribPointers(E,t,h)),C.currentNumAttributes=w}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}const Go=(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 ps(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 Hs{constructor(t,n,o,a,h,g){const y=t.gl;this.program=y.createProgram();const b=ps(n.staticAttributes),w=o?o.getBinderAttributes():[],C=b.concat(w),E=Xr.prelude.staticUniforms?ps(Xr.prelude.staticUniforms):[],R=n.staticUniforms?ps(n.staticUniforms):[],F=o?o.getBinderUniforms():[],$=E.concat(R).concat(F),H=[];for(const ce of $)H.indexOf(ce)<0&&H.push(ce);const U=o?o.defines():[];h&&U.push("#define OVERDRAW_INSPECTOR;"),g&&U.push("#define TERRAIN3D;");const W=U.concat(Xr.prelude.fragmentSource,n.fragmentSource).join(`
579
579
  `),Y=U.concat(Xr.prelude.vertexSource,n.vertexSource).join(`
580
- `),j=y.createShader(y.FRAGMENT_SHADER);if(y.isContextLost())return void(this.failedToCreate=!0);if(y.shaderSource(j,W),y.compileShader(j),!y.getShaderParameter(j,y.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${y.getShaderInfoLog(j)}`);y.attachShader(this.program,j);const te=y.createShader(y.VERTEX_SHADER);if(y.isContextLost())return void(this.failedToCreate=!0);if(y.shaderSource(te,Y),y.compileShader(te),!y.getShaderParameter(te,y.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${y.getShaderInfoLog(te)}`);y.attachShader(this.program,te),this.attributes={};const se={};this.numAttributes=C.length;for(let ce=0;ce<this.numAttributes;ce++)C[ce]&&(y.bindAttribLocation(this.program,ce,C[ce]),this.attributes[C[ce]]=ce);if(y.linkProgram(this.program),!y.getProgramParameter(this.program,y.LINK_STATUS))throw new Error(`Program failed to link: ${y.getProgramInfoLog(this.program)}`);y.deleteShader(te),y.deleteShader(j);for(let ce=0;ce<H.length;ce++){const ye=H[ce];if(ye&&!se[ye]){const we=y.getUniformLocation(this.program,ye);we&&(se[ye]=we)}}this.fixedUniforms=a(t,se),this.terrainUniforms=((ce,ye)=>({u_depth:new c.aI(ce,ye.u_depth),u_terrain:new c.aI(ce,ye.u_terrain),u_terrain_dim:new c.aJ(ce,ye.u_terrain_dim),u_terrain_matrix:new c.aK(ce,ye.u_terrain_matrix),u_terrain_unpack:new c.aL(ce,ye.u_terrain_unpack),u_terrain_exaggeration:new c.aJ(ce,ye.u_terrain_exaggeration)}))(t,se),this.binderUniforms=o?o.getUniforms(t,se):[]}draw(t,n,o,a,h,g,y,b,w,C,E,R,F,$,H,U,W,Y){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(g),b){t.activeTexture.set(j.TEXTURE2),j.bindTexture(j.TEXTURE_2D,b.depthTexture),t.activeTexture.set(j.TEXTURE3),j.bindTexture(j.TEXTURE_2D,b.texture);for(const se in this.terrainUniforms)this.terrainUniforms[se].set(b[se])}for(const se in this.fixedUniforms)this.fixedUniforms[se].set(y[se]);H&&H.setUniforms(t,this.binderUniforms,F,{zoom:$});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 R.get()){const ce=se.vaos||(se.vaos={});(ce[w]||(ce[w]=new Gs)).bind(t,this,C,H?H.getPaintVertexBuffers():[],E,se.vertexOffset,U,W,Y),j.drawElements(n,se.primitiveLength*te,j.UNSIGNED_SHORT,se.primitiveOffset*te*2)}}}function Xs(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,g=h*(n.tileID.canonical.x+n.tileID.wrap*a),y=h*n.tileID.canonical.y;return{u_image:0,u_texsize:n.imageAtlasTexture.size,u_scale:[o,u.fromScale,u.toScale],u_fade:u.t,u_pixel_coord_upper:[g>>16,y>>16],u_pixel_coord_lower:[65535&g,65535&y]}}const Ws=(u,t,n,o)=>{const a=t.style.light,h=a.properties.get("position"),g=[h.x,h.y,h.z],y=function(){var w=new c.A(9);return c.A!=Float32Array&&(w[1]=0,w[2]=0,w[3]=0,w[5]=0,w[6]=0,w[7]=0),w[0]=1,w[4]=1,w[8]=1,w}();a.properties.get("anchor")==="viewport"&&function(w,C){var E=Math.sin(C),R=Math.cos(C);w[0]=R,w[1]=E,w[2]=0,w[3]=-E,w[4]=R,w[5]=0,w[6]=0,w[7]=0,w[8]=1}(y,-t.transform.angle),function(w,C,E){var R=C[0],F=C[1],$=C[2];w[0]=R*E[0]+F*E[3]+$*E[6],w[1]=R*E[1]+F*E[4]+$*E[7],w[2]=R*E[2]+F*E[5]+$*E[8]}(g,g,y);const b=a.properties.get("color");return{u_matrix:u,u_lightpos:g,u_lightintensity:a.properties.get("intensity"),u_lightcolor:[b.r,b.g,b.b],u_vertical_gradient:+n,u_opacity:o}},Js=(u,t,n,o,a,h,g)=>c.e(Ws(u,t,n,o),Xs(h,t,g),{u_height_factor:-Math.pow(2,a.overscaledZ)/g.tileSize/8}),fs=u=>({u_matrix:u}),Dn=(u,t,n,o)=>c.e(fs(u),Xs(n,t,o)),Nc=(u,t)=>({u_matrix:u,u_world:t}),$c=(u,t,n,o,a)=>c.e(Dn(u,t,n,o),{u_world:a}),gl=(u,t,n,o)=>{const a=u.transform;let h,g;if(o.paint.get("circle-pitch-alignment")==="map"){const y=rt(n,1,a.zoom);h=!0,g=[y,y]}else h=!1,g=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:g}},jc=(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}),ms=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 gs=(u,t,n,o)=>{const a=u.transform;return{u_matrix:xl(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]]}},Ks=(u,t,n,o,a)=>c.e(gs(u,t,n,a),{u_image:0,u_image_height:o}),_l=(u,t,n,o,a)=>{const h=u.transform,g=un(t,h);return{u_matrix:xl(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:[g,o.fromScale,o.toScale],u_fade:o.t,u_units_to_pixels:[1/h.pixelsToGLUnits[0],1/h.pixelsToGLUnits[1]]}},yl=(u,t,n,o,a,h)=>{const g=u.lineAtlas,y=un(t,u.transform),b=n.layout.get("line-cap")==="round",w=g.getDash(o.from,b),C=g.getDash(o.to,b),E=w.width*a.fromScale,R=C.width*a.toScale;return c.e(gs(u,t,n,h),{u_patternscale_a:[y/E,-w.height/2],u_patternscale_b:[y/R,-C.height/2],u_sdfgamma:g.width/(256*Math.min(E,R)*u.pixelRatio)/2,u_image:0,u_tex_y_a:w.y,u_tex_y_b:C.y,u_mix:a.t})};function un(u,t){return 1/rt(u,1,t.tileZoom)}function xl(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 Uc=(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:(g=a.paint.get("raster-saturation"),g>0?1-1/(1.001-g):-g),u_contrast_factor:(h=a.paint.get("raster-contrast"),h>0?1/(1-h):1+h),u_spin_weights:qc(a.paint.get("raster-hue-rotate"))};var h,g};function qc(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 vl=(u,t,n,o,a,h,g,y,b,w,C,E,R,F)=>{const $=g.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:$.cameraToCenterDistance,u_pitch:$.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:$.width/$.height,u_fade_change:g.options.fadeDuration?g.symbolFadeChange:1,u_matrix:y,u_label_plane_matrix:b,u_coord_matrix:w,u_is_text:+E,u_pitch_with_map:+o,u_is_along_line:a,u_is_variable_anchor:h,u_texsize:R,u_texture:0,u_translation:C,u_pitched_scale:F}},bl=(u,t,n,o,a,h,g,y,b,w,C,E,R,F,$)=>{const H=g.transform;return c.e(vl(u,t,n,o,a,h,g,y,b,w,C,E,R,$),{u_gamma_scale:o?Math.cos(H._pitch)*H.cameraToCenterDistance:1,u_device_pixel_ratio:g.pixelRatio,u_is_halo:+F})},Zc=(u,t,n,o,a,h,g,y,b,w,C,E,R,F)=>c.e(bl(u,t,n,o,a,h,g,y,b,w,C,!0,E,!0,F),{u_texsize_icon:R,u_texture_icon:1}),Ys=(u,t,n)=>({u_matrix:u,u_opacity:t,u_color:n}),Ho=(u,t,n,o,a,h)=>c.e(function(g,y,b,w){const C=b.imageManager.getPattern(g.from.toString()),E=b.imageManager.getPattern(g.to.toString()),{width:R,height:F}=b.imageManager.getPixelSize(),$=Math.pow(2,w.tileID.overscaledZ),H=w.tileSize*Math.pow(2,b.transform.tileZoom)/$,U=H*(w.tileID.canonical.x+w.tileID.wrap*$),W=H*w.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:C.tl,u_pattern_br_a:C.br,u_pattern_tl_b:E.tl,u_pattern_br_b:E.br,u_texsize:[R,F],u_mix:y.t,u_pattern_size_a:C.displaySize,u_pattern_size_b:E.displaySize,u_scale_a:y.fromScale,u_scale_b:y.toScale,u_tile_units_to_pixels:1/rt(w,1,b.transform.tileZoom),u_pixel_coord_upper:[U>>16,W>>16],u_pixel_coord_lower:[65535&U,65535&W]}}(o,h,n,a),{u_matrix:u,u_opacity:t}),Qs={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 Xo{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 Wo={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class yr{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],g=n.attributes[h.name];g!==void 0&&t.vertexAttribPointer(g,h.components,t[Wo[h.type]],!1,this.itemSize,h.offset+this.itemSize*(o||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Jo=new WeakMap;function Ln(u){var t;if(Jo.has(u))return Jo.get(u);{const n=(t=u.getParameter(u.VERSION))===null||t===void 0?void 0:t.startsWith("WebGL 2.0");return Jo.set(u,n),n}}class pt{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 _s extends pt{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 Gc extends pt{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class eo extends pt{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class Hc extends pt{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 Rn extends pt{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class Xc extends pt{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class wl extends pt{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 Wc extends pt{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 Sl extends pt{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 Ko extends pt{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 Tl extends pt{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 kl extends pt{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class Il extends pt{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 Cl extends pt{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 pt{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 El extends pt{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}}class Jc extends pt{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 Kc extends pt{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class Pl extends pt{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}class ys extends pt{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}}class Yc extends pt{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class to extends pt{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 Qc extends pt{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 eh extends pt{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 Al extends pt{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 Ml extends pt{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 zl extends pt{getDefault(){return null}set(t){const n=this.gl;n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Yo extends pt{getDefault(){return null}set(t){var n;if(t===this.current&&!this.dirty)return;const o=this.gl;Ln(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 Dl extends pt{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 io extends pt{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 Dr extends pt{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 xs extends pt{constructor(t,n){super(t),this.context=t,this.parent=n}getDefault(){return null}}class Qo extends xs{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 ea extends xs{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 Ll extends xs{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 ta{constructor(t,n,o,a,h){this.context=t,this.width=n,this.height=o;const g=t.gl,y=this.framebuffer=g.createFramebuffer();if(this.colorAttachment=new Qo(t,y),a)this.depthAttachment=h?new Ll(t,y):new ea(t,y);else if(h)throw new Error("Stencil cannot be set without depth");if(g.checkFramebufferStatus(g.FRAMEBUFFER)!==g.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 ia{constructor(t){var n,o;if(this.gl=t,this.clearColor=new _s(this),this.clearDepth=new Gc(this),this.clearStencil=new eo(this),this.colorMask=new Hc(this),this.depthMask=new Rn(this),this.stencilMask=new Xc(this),this.stencilFunc=new wl(this),this.stencilOp=new Wc(this),this.stencilTest=new Sl(this),this.depthRange=new Ko(this),this.depthTest=new Tl(this),this.depthFunc=new kl(this),this.blend=new Il(this),this.blendFunc=new Cl(this),this.blendColor=new dn(this),this.blendEquation=new El(this),this.cullFace=new Jc(this),this.cullFaceSide=new Kc(this),this.frontFace=new Pl(this),this.program=new ys(this),this.activeTexture=new Yc(this),this.viewport=new to(this),this.bindFramebuffer=new Qc(this),this.bindRenderbuffer=new eh(this),this.bindTexture=new Al(this),this.bindVertexBuffer=new Ml(this),this.bindElementBuffer=new zl(this),this.bindVertexArray=new Yo(this),this.pixelStoreUnpack=new Dl(this),this.pixelStoreUnpackPremultiplyAlpha=new io(this),this.pixelStoreUnpackFlipY=new Dr(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),Ln(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 Xo(this,t,n)}createVertexBuffer(t,n,o){return new yr(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 ta(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 Ln(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 Ln(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 ut{constructor(t,n,o){this.func=t,this.mask=n,this.range=o}}ut.ReadOnly=!1,ut.ReadWrite=!0,ut.disabled=new ut(519,ut.ReadOnly,[0,1]);const ra=7680;class Vt{constructor(t,n,o,a,h,g){this.test=t,this.ref=n,this.mask=o,this.fail=a,this.depthFail=h,this.pass=g}}Vt.disabled=new Vt({func:519,mask:0},0,0,ra,ra,ra);class Mt{constructor(t,n,o){this.enable=t,this.mode=n,this.frontFace=o}}let vs;function Rl(u,t,n,o,a){const h=u.context,g=h.gl,y=u.useProgram("collisionBox"),b=[];let w=0,C=0;for(let W=0;W<o.length;W++){const Y=o[W],j=t.getTile(Y).getBucket(n);if(!j)continue;const te=a?j.textCollisionBox:j.iconCollisionBox,se=j.collisionCircleArray;if(se.length>0){const ce=c.H();c.aR(ce,j.placementInvProjMatrix,u.transform.glCoordMatrix),c.aR(ce,ce,j.placementViewportMatrix),b.push({circleArray:se,circleOffset:C,transform:Y.posMatrix,invTransform:ce,coord:Y}),w+=se.length/4,C=w}te&&y.draw(h,g.LINES,ut.disabled,Vt.disabled,u.colorModeForRenderPass(),Mt.disabled,{u_matrix:Y.posMatrix,u_pixel_extrude_scale:[1/(E=u.transform).width,1/E.height]},u.style.map.terrain&&u.style.map.terrain.getTerrainData(Y),n.id,te.layoutVertexBuffer,te.indexBuffer,te.segments,null,u.transform.zoom,null,null,te.collisionVertexBuffer)}var E;if(!a||!b.length)return;const R=u.useProgram("collisionCircle"),F=new c.aS;F.resize(4*w),F._trim();let $=0;for(const W of b)for(let Y=0;Y<W.circleArray.length/4;Y++){const j=4*Y,te=W.circleArray[j+0],se=W.circleArray[j+1],ce=W.circleArray[j+2],ye=W.circleArray[j+3];F.emplace($++,te,se,ce,ye,0),F.emplace($++,te,se,ce,ye,1),F.emplace($++,te,se,ce,ye,2),F.emplace($++,te,se,ce,ye,3)}(!vs||vs.length<2*w)&&(vs=function(W){const Y=2*W,j=new c.aU;j.resize(Y),j._trim();for(let te=0;te<Y;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}(w));const H=h.createIndexBuffer(vs,!0),U=h.createVertexBuffer(F,c.aT.members,!0);for(const W of b){const Y=jc(W.transform,W.invTransform,u.transform);R.draw(h,g.TRIANGLES,ut.disabled,Vt.disabled,u.colorModeForRenderPass(),Mt.disabled,Y,u.style.map.terrain&&u.style.map.terrain.getTerrainData(W.coord),n.id,U,H,c.a0.simpleSegment(0,2*W.circleOffset,W.circleArray.length,W.circleArray.length/2),null,u.transform.zoom,null,null,null)}U.destroy(),H.destroy()}Mt.disabled=new Mt(!1,1029,2305),Mt.backCCW=new Mt(!0,1029,2305);const na=c.ao(new Float32Array(16));function ro(u,t,n,o,a,h){const{horizontalAlign:g,verticalAlign:y}=c.av(u);return new c.P((-(g-.5)*t/a+o[0])*h,(-(y-.5)*n/a+o[1])*h)}function no(u,t,n,o,a,h){const g=t.tileAnchorPoint.add(new c.P(t.translation[0],t.translation[1]));if(t.pitchWithMap){let y=o.mult(h);return n||(y=y.rotate(-a)),X(g.add(y),t.labelPlaneMatrix,t.getElevation).point}if(n){const y=pe(t.tileAnchorPoint.x+1,t.tileAnchorPoint.y,t).point.sub(u),b=Math.atan(y.y/y.x)+(y.x<0?Math.PI:0);return u.add(o.rotate(b))}return u.add(o)}function so(u,t,n,o,a,h,g,y,b,w,C,E,R,F){const $=u.text.placedSymbolArray,H=u.text.dynamicLayoutVertexArray,U=u.icon.dynamicLayoutVertexArray,W={};H.clear();for(let Y=0;Y<$.length;Y++){const j=$.get(Y),te=j.hidden||!j.crossTileID||u.allowVerticalPlacement&&!j.placedOrientation?null:o[j.crossTileID];if(te){const se=new c.P(j.anchorX,j.anchorY),ce={getElevation:F,width:a.width,height:a.height,labelPlaneMatrix:h,lineVertexArray:null,pitchWithMap:n,projection:C,projectionCache:null,tileAnchorPoint:se,translation:E,unwrappedTileID:R},ye=n?X(se,g,F):pe(se.x,se.y,ce),we=z(a.cameraToCenterDistance,ye.signedDistanceFromCamera);let De=c.aj(u.textSizeData,b,j)*we/c.aq;n&&(De*=u.tilePixelRatio/y);const{width:Re,height:Se,anchor:Te,textOffset:Ne,textBoxScale:tt}=te,Ce=ro(Te,Re,Se,Ne,tt,De),Ae=C.getPitchedTextCorrection(a,se.add(new c.P(E[0],E[1])),R),Qe=no(ye.point,ce,t,Ce,a.angle,Ae),Dt=u.allowVerticalPlacement&&j.placedOrientation===c.ai.vertical?Math.PI/2:0;for(let ot=0;ot<j.numGlyphs;ot++)c.ak(H,Qe,Dt);w&&j.associatedIconIndex>=0&&(W[j.associatedIconIndex]={shiftedAnchor:Qe,angle:Dt})}else Xe(j.numGlyphs,H)}if(w){U.clear();const Y=u.icon.placedSymbolArray;for(let j=0;j<Y.length;j++){const te=Y.get(j);if(te.hidden)Xe(te.numGlyphs,U);else{const se=W[j];if(se)for(let ce=0;ce<te.numGlyphs;ce++)c.ak(U,se.shiftedAnchor,se.angle);else Xe(te.numGlyphs,U)}}u.icon.dynamicLayoutVertexBuffer.updateData(U)}u.text.dynamicLayoutVertexBuffer.updateData(H)}function sa(u,t,n){return n.iconsInText&&t?"symbolTextAndIcon":u?"symbolSDF":"symbolIcon"}function Jr(u,t,n,o,a,h,g,y,b,w,C,E){const R=u.context,F=R.gl,$=u.transform,H=qs(),U=y==="map",W=b==="map",Y=y!=="viewport"&&n.layout.get("symbol-placement")!=="point",j=U&&!W&&!Y,te=!W&&Y,se=!n.layout.get("symbol-sort-key").isConstant();let ce=!1;const ye=u.depthModeForSublayer(0,ut.ReadOnly),we=n._unevaluatedLayout.hasValue("text-variable-anchor")||n._unevaluatedLayout.hasValue("text-variable-anchor-offset"),De=[],Re=H.getCircleRadiusCorrection($);for(const Se of o){const Te=t.getTile(Se),Ne=Te.getBucket(n);if(!Ne)continue;const tt=a?Ne.text:Ne.icon;if(!tt||!tt.segments.get().length||!tt.hasVisibleVertices)continue;const Ce=tt.programConfigurations.get(n.id),Ae=a||Ne.sdfIcons,Qe=a?Ne.textSizeData:Ne.iconSizeData,Dt=W||$.pitch!==0,ot=u.useProgram(sa(Ae,a,Ne),Ce),dt=c.ah(Qe,$.zoom),Lt=u.style.map.terrain&&u.style.map.terrain.getTerrainData(Se);let di,nr,Rt,Mi,ki=[0,0],pi=null;if(a)nr=Te.glyphAtlasTexture,Rt=F.LINEAR,di=Te.glyphAtlasTexture.size,Ne.iconsInText&&(ki=Te.imageAtlasTexture.size,pi=Te.imageAtlasTexture,Mi=Dt||u.options.rotating||u.options.zooming||Qe.kind==="composite"||Qe.kind==="camera"?F.LINEAR:F.NEAREST);else{const Nt=n.layout.get("icon-size").constantOr(0)!==1||Ne.iconsNeedLinear;nr=Te.imageAtlasTexture,Rt=Ae||u.options.rotating||u.options.zooming||Nt||Dt?F.LINEAR:F.NEAREST,di=Te.imageAtlasTexture.size}const fi=rt(Te,1,u.transform.zoom),sr=te?Se.posMatrix:na,vn=Gr(sr,W,U,u.transform,fi),bo=_r(sr,W,U,u.transform,fi),qn=_r(Se.posMatrix,W,U,u.transform,fi),bn=H.translatePosition(u.transform,Te,h,g),wo=we&&Ne.hasTextData(),Ba=n.layout.get("icon-text-fit")!=="none"&&wo&&Ne.hasIconData();if(Y){const Nt=u.style.map.terrain?(Fa,ti)=>u.style.map.terrain.getElevation(Se,Fa,ti):null,Gn=n.layout.get("text-rotation-alignment")==="map";V(Ne,Se.posMatrix,u,a,vn,qn,W,w,Gn,H,Se.toUnwrapped(),$.width,$.height,bn,Nt)}const oi=Se.posMatrix,or=a&&we||Ba,Qr=Y||or?na:vn,Zn=bo,mi=Ae&&n.paint.get(a?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let gi;gi=Ae?Ne.iconsInText?Zc(Qe.kind,dt,j,W,Y,or,u,oi,Qr,Zn,bn,di,ki,Re):bl(Qe.kind,dt,j,W,Y,or,u,oi,Qr,Zn,bn,a,di,!0,Re):vl(Qe.kind,dt,j,W,Y,or,u,oi,Qr,Zn,bn,a,di,Re);const ri={program:ot,buffers:tt,uniformValues:gi,atlasTexture:nr,atlasTextureIcon:pi,atlasInterpolation:Rt,atlasInterpolationIcon:Mi,isSDF:Ae,hasHalo:mi};if(se&&Ne.canOverlap){ce=!0;const Nt=tt.segments.get();for(const Gn of Nt)De.push({segments:new c.a0([Gn]),sortKey:Gn.sortKey,state:ri,terrainData:Lt})}else De.push({segments:tt.segments,sortKey:0,state:ri,terrainData:Lt})}ce&&De.sort((Se,Te)=>Se.sortKey-Te.sortKey);for(const Se of De){const Te=Se.state;if(R.activeTexture.set(F.TEXTURE0),Te.atlasTexture.bind(Te.atlasInterpolation,F.CLAMP_TO_EDGE),Te.atlasTextureIcon&&(R.activeTexture.set(F.TEXTURE1),Te.atlasTextureIcon&&Te.atlasTextureIcon.bind(Te.atlasInterpolationIcon,F.CLAMP_TO_EDGE)),Te.isSDF){const Ne=Te.uniformValues;Te.hasHalo&&(Ne.u_is_halo=1,pn(Te.buffers,Se.segments,n,u,Te.program,ye,C,E,Ne,Se.terrainData)),Ne.u_is_halo=0}pn(Te.buffers,Se.segments,n,u,Te.program,ye,C,E,Te.uniformValues,Se.terrainData)}}function pn(u,t,n,o,a,h,g,y,b,w){const C=o.context;a.draw(C,C.gl.TRIANGLES,h,g,y,Mt.disabled,b,w,n.id,u.layoutVertexBuffer,u.indexBuffer,t,n.paint,o.transform.zoom,u.programConfigurations.get(n.id),u.dynamicLayoutVertexBuffer,u.opacityVertexBuffer)}function qi(u,t,n,o,a){if(!n||!o||!o.imageAtlas)return;const h=o.imageAtlas.patternPositions;let g=h[n.to.toString()],y=h[n.from.toString()];if(!g&&y&&(g=y),!y&&g&&(y=g),!g||!y){const b=a.getPaintProperty(t);g=h[b],y=h[b]}g&&y&&u.setConstantPatternPositions(g,y)}function oa(u,t,n,o,a,h,g){const y=u.context.gl,b="fill-pattern",w=n.paint.get(b),C=w&&w.constantOr(1),E=n.getCrossfadeParameters();let R,F,$,H,U;g?(F=C&&!n.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",R=y.LINES):(F=C?"fillPattern":"fill",R=y.TRIANGLES);const W=w.constantOr(null);for(const Y of o){const j=t.getTile(Y);if(C&&!j.patternsLoaded())continue;const te=j.getBucket(n);if(!te)continue;const se=te.programConfigurations.get(n.id),ce=u.useProgram(F,se),ye=u.style.map.terrain&&u.style.map.terrain.getTerrainData(Y);C&&(u.context.activeTexture.set(y.TEXTURE0),j.imageAtlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE),se.updatePaintBuffers(E)),qi(se,b,W,j,n);const we=ye?Y:null,De=u.translatePosMatrix(we?we.posMatrix:Y.posMatrix,j,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));if(g){H=te.indexBuffer2,U=te.segments2;const Re=[y.drawingBufferWidth,y.drawingBufferHeight];$=F==="fillOutlinePattern"&&C?$c(De,u,E,j,Re):Nc(De,Re)}else H=te.indexBuffer,U=te.segments,$=C?Dn(De,u,E,j):fs(De);ce.draw(u.context,R,a,u.stencilModeForClipping(Y),h,Mt.disabled,$,ye,n.id,te.layoutVertexBuffer,H,U,n.paint,u.transform.zoom,se)}}function oo(u,t,n,o,a,h,g){const y=u.context,b=y.gl,w="fill-extrusion-pattern",C=n.paint.get(w),E=C.constantOr(1),R=n.getCrossfadeParameters(),F=n.paint.get("fill-extrusion-opacity"),$=C.constantOr(null);for(const H of o){const U=t.getTile(H),W=U.getBucket(n);if(!W)continue;const Y=u.style.map.terrain&&u.style.map.terrain.getTerrainData(H),j=W.programConfigurations.get(n.id),te=u.useProgram(E?"fillExtrusionPattern":"fillExtrusion",j);E&&(u.context.activeTexture.set(b.TEXTURE0),U.imageAtlasTexture.bind(b.LINEAR,b.CLAMP_TO_EDGE),j.updatePaintBuffers(R)),qi(j,w,$,U,n);const se=u.translatePosMatrix(H.posMatrix,U,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),ce=n.paint.get("fill-extrusion-vertical-gradient"),ye=E?Js(se,u,ce,F,H,R,U):Ws(se,u,ce,F);te.draw(y,y.gl.TRIANGLES,a,h,g,Mt.backCCW,ye,Y,n.id,W.layoutVertexBuffer,W.indexBuffer,W.segments,n.paint,u.transform.zoom,j,u.style.map.terrain&&W.centroidVertexBuffer)}}function aa(u,t,n,o,a,h,g){const y=u.context,b=y.gl,w=n.fbo;if(!w)return;const C=u.useProgram("hillshade"),E=u.style.map.terrain&&u.style.map.terrain.getTerrainData(t);y.activeTexture.set(b.TEXTURE0),b.bindTexture(b.TEXTURE_2D,w.colorAttachment.get()),C.draw(y,b.TRIANGLES,a,h,g,Mt.disabled,((R,F,$,H)=>{const U=$.paint.get("hillshade-shadow-color"),W=$.paint.get("hillshade-highlight-color"),Y=$.paint.get("hillshade-accent-color");let j=$.paint.get("hillshade-illumination-direction")*(Math.PI/180);$.paint.get("hillshade-illumination-anchor")==="viewport"&&(j-=R.transform.angle);const te=!R.options.moving;return{u_matrix:H?H.posMatrix:R.transform.calculatePosMatrix(F.tileID.toUnwrapped(),te),u_image:0,u_latrange:Ui(0,F.tileID),u_light:[$.paint.get("hillshade-exaggeration"),j],u_shadow:U,u_highlight:W,u_accent:Y}})(u,n,o,E?t:null),E,o.id,u.rasterBoundsBuffer,u.quadTriangleIndexBuffer,u.rasterBoundsSegments)}function fn(u,t,n,o,a,h){const g=u.context,y=g.gl,b=t.dem;if(b&&b.data){const w=b.dim,C=b.stride,E=b.getPixels();if(g.activeTexture.set(y.TEXTURE1),g.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||u.getTileTexture(C),t.demTexture){const F=t.demTexture;F.update(E,{premultiply:!1}),F.bind(y.NEAREST,y.CLAMP_TO_EDGE)}else t.demTexture=new St(g,E,y.RGBA,{premultiply:!1}),t.demTexture.bind(y.NEAREST,y.CLAMP_TO_EDGE);g.activeTexture.set(y.TEXTURE0);let R=t.fbo;if(!R){const F=new St(g,{width:w,height:w,data:null},y.RGBA);F.bind(y.LINEAR,y.CLAMP_TO_EDGE),R=t.fbo=g.createFramebuffer(w,w,!0,!1),R.colorAttachment.set(F.texture)}g.bindFramebuffer.set(R.framebuffer),g.viewport.set([0,0,w,w]),u.useProgram("hillshadePrepare").draw(g,y.TRIANGLES,o,a,h,Mt.disabled,((F,$)=>{const H=$.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:[H,H],u_zoom:F.overscaledZ,u_unpack:$.getUnpackVector()}})(t.tileID,b),null,n.id,u.rasterBoundsBuffer,u.quadTriangleIndexBuffer,u.rasterBoundsSegments),t.needsHillshadePrepare=!1}}function ao(u,t,n,o,a,h){const g=o.paint.get("raster-fade-duration");if(!h&&g>0){const y=le.now(),b=(y-u.timeAdded)/g,w=t?(y-t.timeAdded)/g:-1,C=n.getSource(),E=a.coveringZoomLevel({tileSize:C.tileSize,roundZoom:C.roundZoom}),R=!t||Math.abs(t.tileID.overscaledZ-E)>Math.abs(u.tileID.overscaledZ-E),F=R&&u.refreshedUponExpiration?1:c.ad(R?b:1-w,0,1);return u.refreshedUponExpiration&&b>=1&&(u.refreshedUponExpiration=!1),t?{opacity:1,mix:1-F}:{opacity:F,mix:0}}return{opacity:1,mix:0}}const lo=new c.aN(1,0,0,1),bs=new c.aN(0,1,0,1),co=new c.aN(0,0,1,1),Bl=new c.aN(1,0,1,1),Bn=new c.aN(0,1,1,1);function mn(u,t,n,o){Fn(u,0,t+n/2,u.transform.width,n,o)}function la(u,t,n,o){Fn(u,t-n/2,0,n,u.transform.height,o)}function Fn(u,t,n,o,a,h){const g=u.context,y=g.gl;y.enable(y.SCISSOR_TEST),y.scissor(t*u.pixelRatio,n*u.pixelRatio,o*u.pixelRatio,a*u.pixelRatio),g.clear({color:h}),y.disable(y.SCISSOR_TEST)}function gt(u,t,n){const o=u.context,a=o.gl,h=n.posMatrix,g=u.useProgram("debug"),y=ut.disabled,b=Vt.disabled,w=u.colorModeForRenderPass(),C="$debug",E=u.style.map.terrain&&u.style.map.terrain.getTerrainData(n);o.activeTexture.set(a.TEXTURE0);const R=t.getTileByID(n.key).latestRawTileData,F=Math.floor((R&&R.byteLength||0)/1024),$=t.getTile(n).tileSize,H=512/Math.min($,512)*(n.overscaledZ/u.transform.zoom)*.5;let U=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(U+=` => ${n.overscaledZ}`),function(W,Y){W.initDebugOverlayCanvas();const j=W.debugOverlayCanvas,te=W.context.gl,se=W.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(Y,5,5),se.strokeText(Y,5,5),W.debugOverlayTexture.update(j),W.debugOverlayTexture.bind(te.LINEAR,te.CLAMP_TO_EDGE)}(u,`${U} ${F}kB`),g.draw(o,a.TRIANGLES,y,b,Et.alphaBlended,Mt.disabled,Wr(h,c.aN.transparent,H),null,C,u.debugBuffer,u.quadTriangleIndexBuffer,u.debugSegments),g.draw(o,a.LINE_STRIP,y,b,w,Mt.disabled,Wr(h,c.aN.red),E,C,u.debugBuffer,u.tileBorderIndexBuffer,u.debugSegments)}function ws(u,t,n){const o=u.context,a=o.gl,h=u.colorModeForRenderPass(),g=new ut(a.LEQUAL,ut.ReadWrite,u.depthRangeFor3D),y=u.useProgram("terrain"),b=t.getTerrainMesh();o.bindFramebuffer.set(null),o.viewport.set([0,0,u.width,u.height]);for(const w of n){const C=u.renderToTexture.getTexture(w),E=t.getTerrainData(w.tileID);o.activeTexture.set(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,C.texture);const R=u.transform.calculatePosMatrix(w.tileID.toUnwrapped()),F=t.getMeshFrameDelta(u.transform.zoom),$=u.transform.calculateFogMatrix(w.tileID.toUnwrapped()),H=Go(R,F,$,u.style.sky,u.transform.pitch);y.draw(o,a.TRIANGLES,g,Vt.disabled,h,Mt.backCCW,H,E,"terrain",b.vertexBuffer,b.indexBuffer,b.segments)}}class Fl{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 Ol{constructor(t,n){this.context=new ia(t),this.transform=n,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:c.ao(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Ye.maxUnderzooming+Ye.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Wi}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,ds.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,ds.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,ds.members),this.viewportSegments=c.a0.simpleSegment(0,0,4,2);const g=new c.aZ;g.emplaceBack(0),g.emplaceBack(1),g.emplaceBack(3),g.emplaceBack(2),g.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(g);const y=new c.aY;y.emplaceBack(0,1,2),y.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(y);const b=this.context.gl;this.stencilClearMode=new Vt({func:b.ALWAYS,mask:0},0,255,b.ZERO,b.ZERO,b.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,ut.disabled,this.stencilClearMode,Et.disabled,Mt.disabled,ms(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(ut.disabled);const h=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const g of n){const y=this._tileClippingMaskIDs[g.key]=this.nextStencilID++,b=this.style.map.terrain&&this.style.map.terrain.getTerrainData(g);h.draw(o,a.TRIANGLES,ut.disabled,new Vt({func:a.ALWAYS,mask:0},y,255,a.KEEP,a.KEEP,a.REPLACE),Et.disabled,Mt.disabled,ms(g.posMatrix),b,"$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((g,y)=>y.overscaledZ-g.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 g={};for(let y=0;y<h;y++)g[y+a]=new Vt({func:n.GEQUAL,mask:255},y+this.nextStencilID,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID+=h,[g,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 ut.disabled;const a=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new ut(o||this.context.gl.LEQUAL,n,[a,a])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(t,n){var o;this.style=t,this.options=n,this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(le.now()),this.imageManager.beginFrame();const a=this.style._order,h=this.style.sourceCaches,g={},y={},b={};for(const w in h){const C=h[w];C.used&&C.prepare(this.context),g[w]=C.getVisibleCoordinates(),y[w]=g[w].slice().reverse(),b[w]=C.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let w=0;w<a.length;w++)if(this.style._layers[a[w]].is3D()){this.opaquePassCutoff=w;break}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const w of a){const C=this.style._layers[w];if(!C.hasOffscreenPass()||C.isHidden(this.transform.zoom))continue;const E=y[C.source];(C.type==="custom"||E.length)&&this.renderLayer(this,h[C.source],C,E)}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(w,C){const E=w.context,R=E.gl,F=((Y,j,te)=>({u_sky_color:Y.properties.get("sky-color"),u_horizon_color:Y.properties.get("horizon-color"),u_horizon:(j.height/2+j.getHorizon())*te,u_sky_horizon_blend:Y.properties.get("sky-horizon-blend")*j.height/2*te}))(C,w.style.map.transform,w.pixelRatio),$=new ut(R.LEQUAL,ut.ReadWrite,[0,1]),H=Vt.disabled,U=w.colorModeForRenderPass(),W=w.useProgram("sky");if(!C.mesh){const Y=new c.aX;Y.emplaceBack(-1,-1),Y.emplaceBack(1,-1),Y.emplaceBack(1,1),Y.emplaceBack(-1,1);const j=new c.aY;j.emplaceBack(0,1,2),j.emplaceBack(0,2,3),C.mesh=new Fl(E.createVertexBuffer(Y,ds.members),E.createIndexBuffer(j),c.a0.simpleSegment(0,0,Y.length,j.length))}W.draw(E,R.TRIANGLES,$,H,U,Mt.disabled,F,void 0,"sky",C.mesh.vertexBuffer,C.mesh.indexBuffer,C.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 w=this.style._layers[a[this.currentLayer]],C=h[w.source],E=g[w.source];this._renderTileClippingMasks(w,E),this.renderLayer(this,C,w,E)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<a.length;this.currentLayer++){const w=this.style._layers[a[this.currentLayer]],C=h[w.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(w))continue;const E=(w.type==="symbol"?b:y)[w.source];this._renderTileClippingMasks(w,g[w.source]),this.renderLayer(this,C,w,E)}if(this.options.showTileBoundaries){const w=function(C,E){let R=null;const F=Object.values(C._layers).flatMap(W=>W.source&&!W.isHidden(E)?[C.sourceCaches[W.source]]:[]),$=F.filter(W=>W.getSource().type==="vector"),H=F.filter(W=>W.getSource().type!=="vector"),U=W=>{(!R||R.getSource().maxzoom<W.getSource().maxzoom)&&(R=W)};return $.forEach(W=>U(W)),R||H.forEach(W=>U(W)),R}(this.style,this.transform.zoom);w&&function(C,E,R){for(let F=0;F<R.length;F++)gt(C,E,R[F])}(this,w,w.getVisibleCoordinates())}this.options.showPadding&&function(w){const C=w.transform.padding;mn(w,w.transform.height-(C.top||0),3,lo),mn(w,C.bottom||0,3,bs),la(w,C.left||0,3,co),la(w,w.transform.width-(C.right||0),3,Bl);const E=w.transform.centerPoint;(function(R,F,$,H){Fn(R,F-1,$-10,2,20,H),Fn(R,F-10,$-1,20,2,H)})(w,E.x,w.transform.height-E.y,Bn)}(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,g){const y=h.context,b=y.gl,w=Et.unblended,C=new ut(b.LEQUAL,ut.ReadWrite,[0,1]),E=g.getTerrainMesh(),R=g.sourceCache.getRenderableTiles(),F=h.useProgram("terrainDepth");y.bindFramebuffer.set(g.getFramebuffer("depth").framebuffer),y.viewport.set([0,0,h.width/devicePixelRatio,h.height/devicePixelRatio]),y.clear({color:c.aN.transparent,depth:1});for(const $ of R){const H=g.getTerrainData($.tileID),U={u_matrix:h.transform.calculatePosMatrix($.tileID.toUnwrapped()),u_ele_delta:g.getMeshFrameDelta(h.transform.zoom)};F.draw(y,b.TRIANGLES,C,Vt.disabled,w,Mt.backCCW,U,H,"terrain",E.vertexBuffer,E.indexBuffer,E.segments)}y.bindFramebuffer.set(null),y.viewport.set([0,0,h.width,h.height])}(this,this.style.map.terrain),function(h,g){const y=h.context,b=y.gl,w=Et.unblended,C=new ut(b.LEQUAL,ut.ReadWrite,[0,1]),E=g.getTerrainMesh(),R=g.getCoordsTexture(),F=g.sourceCache.getRenderableTiles(),$=h.useProgram("terrainCoords");y.bindFramebuffer.set(g.getFramebuffer("coords").framebuffer),y.viewport.set([0,0,h.width/devicePixelRatio,h.height/devicePixelRatio]),y.clear({color:c.aN.transparent,depth:1}),g.coordsIndex=[];for(const H of F){const U=g.getTerrainData(H.tileID);y.activeTexture.set(b.TEXTURE0),b.bindTexture(b.TEXTURE_2D,R.texture);const W={u_matrix:h.transform.calculatePosMatrix(H.tileID.toUnwrapped()),u_terrain_coords_id:(255-g.coordsIndex.length)/255,u_texture:0,u_ele_delta:g.getMeshFrameDelta(h.transform.zoom)};$.draw(y,b.TRIANGLES,C,Vt.disabled,w,Mt.backCCW,W,U,"terrain",E.vertexBuffer,E.indexBuffer,E.segments),g.coordsIndex.push(H.tileID.key)}y.bindFramebuffer.set(null),y.viewport.set([0,0,h.width,h.height])}(this,this.style.map.terrain))}renderLayer(t,n,o,a){if(!o.isHidden(this.transform.zoom)&&(o.type==="background"||o.type==="custom"||(a||[]).length))switch(this.id=o.id,o.type){case"symbol":(function(h,g,y,b,w){if(h.renderPass!=="translucent")return;const C=Vt.disabled,E=h.colorModeForRenderPass();(y._unevaluatedLayout.hasValue("text-variable-anchor")||y._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(R,F,$,H,U,W,Y,j,te){const se=F.transform,ce=qs(),ye=U==="map",we=W==="map";for(const De of R){const Re=H.getTile(De),Se=Re.getBucket($);if(!Se||!Se.text||!Se.text.segments.get().length)continue;const Te=c.ah(Se.textSizeData,se.zoom),Ne=rt(Re,1,F.transform.zoom),tt=Gr(De.posMatrix,we,ye,F.transform,Ne),Ce=$.layout.get("icon-text-fit")!=="none"&&Se.hasIconData();if(Te){const Ae=Math.pow(2,se.zoom-Re.tileID.overscaledZ),Qe=F.style.map.terrain?(ot,dt)=>F.style.map.terrain.getElevation(De,ot,dt):null,Dt=ce.translatePosition(se,Re,Y,j);so(Se,ye,we,te,se,tt,De.posMatrix,Ae,Te,Ce,ce,Dt,De.toUnwrapped(),Qe)}}}(b,h,y,g,y.layout.get("text-rotation-alignment"),y.layout.get("text-pitch-alignment"),y.paint.get("text-translate"),y.paint.get("text-translate-anchor"),w),y.paint.get("icon-opacity").constantOr(1)!==0&&Jr(h,g,y,b,!1,y.paint.get("icon-translate"),y.paint.get("icon-translate-anchor"),y.layout.get("icon-rotation-alignment"),y.layout.get("icon-pitch-alignment"),y.layout.get("icon-keep-upright"),C,E),y.paint.get("text-opacity").constantOr(1)!==0&&Jr(h,g,y,b,!0,y.paint.get("text-translate"),y.paint.get("text-translate-anchor"),y.layout.get("text-rotation-alignment"),y.layout.get("text-pitch-alignment"),y.layout.get("text-keep-upright"),C,E),g.map.showCollisionBoxes&&(Rl(h,g,y,b,!0),Rl(h,g,y,b,!1))})(t,n,o,a,this.style.placement.variableOffsets);break;case"circle":(function(h,g,y,b){if(h.renderPass!=="translucent")return;const w=y.paint.get("circle-opacity"),C=y.paint.get("circle-stroke-width"),E=y.paint.get("circle-stroke-opacity"),R=!y.layout.get("circle-sort-key").isConstant();if(w.constantOr(1)===0&&(C.constantOr(1)===0||E.constantOr(1)===0))return;const F=h.context,$=F.gl,H=h.depthModeForSublayer(0,ut.ReadOnly),U=Vt.disabled,W=h.colorModeForRenderPass(),Y=[];for(let j=0;j<b.length;j++){const te=b[j],se=g.getTile(te),ce=se.getBucket(y);if(!ce)continue;const ye=ce.programConfigurations.get(y.id),we=h.useProgram("circle",ye),De=ce.layoutVertexBuffer,Re=ce.indexBuffer,Se=h.style.map.terrain&&h.style.map.terrain.getTerrainData(te),Te={programConfiguration:ye,program:we,layoutVertexBuffer:De,indexBuffer:Re,uniformValues:gl(h,te,se,y),terrainData:Se};if(R){const Ne=ce.segments.get();for(const tt of Ne)Y.push({segments:new c.a0([tt]),sortKey:tt.sortKey,state:Te})}else Y.push({segments:ce.segments,sortKey:0,state:Te})}R&&Y.sort((j,te)=>j.sortKey-te.sortKey);for(const j of Y){const{programConfiguration:te,program:se,layoutVertexBuffer:ce,indexBuffer:ye,uniformValues:we,terrainData:De}=j.state;se.draw(F,$.TRIANGLES,H,U,W,Mt.disabled,we,De,y.id,ce,ye,j.segments,y.paint,h.transform.zoom,te)}})(t,n,o,a);break;case"heatmap":(function(h,g,y,b){if(y.paint.get("heatmap-opacity")!==0)if(h.renderPass==="offscreen"){const w=h.context,C=w.gl,E=Vt.disabled,R=new Et([C.ONE,C.ONE],c.aN.transparent,[!0,!0,!0,!0]);(function(F,$,H){const U=F.gl;F.activeTexture.set(U.TEXTURE1),F.viewport.set([0,0,$.width/4,$.height/4]);let W=H.heatmapFbo;if(W)U.bindTexture(U.TEXTURE_2D,W.colorAttachment.get()),F.bindFramebuffer.set(W.framebuffer);else{const Y=U.createTexture();U.bindTexture(U.TEXTURE_2D,Y),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),W=H.heatmapFbo=F.createFramebuffer($.width/4,$.height/4,!1,!1),function(j,te,se,ce){var ye,we;const De=j.gl,Re=(ye=j.HALF_FLOAT)!==null&&ye!==void 0?ye:De.UNSIGNED_BYTE,Se=(we=j.RGBA16F)!==null&&we!==void 0?we:De.RGBA;De.texImage2D(De.TEXTURE_2D,0,Se,te.width/4,te.height/4,0,De.RGBA,Re,null),ce.colorAttachment.set(se)}(F,$,Y,W)}})(w,h,y),w.clear({color:c.aN.transparent});for(let F=0;F<b.length;F++){const $=b[F];if(g.hasRenderableParent($))continue;const H=g.getTile($),U=H.getBucket(y);if(!U)continue;const W=U.programConfigurations.get(y.id),Y=h.useProgram("heatmap",W),{zoom:j}=h.transform;Y.draw(w,C.TRIANGLES,ut.disabled,E,R,Mt.disabled,ji($.posMatrix,H,j,y.paint.get("heatmap-intensity")),null,y.id,U.layoutVertexBuffer,U.indexBuffer,U.segments,y.paint,h.transform.zoom,W)}w.viewport.set([0,0,h.width,h.height])}else h.renderPass==="translucent"&&(h.context.setColorMode(h.colorModeForRenderPass()),function(w,C){const E=w.context,R=E.gl,F=C.heatmapFbo;if(!F)return;E.activeTexture.set(R.TEXTURE0),R.bindTexture(R.TEXTURE_2D,F.colorAttachment.get()),E.activeTexture.set(R.TEXTURE1);let $=C.colorRampTexture;$||($=C.colorRampTexture=new St(E,C.colorRamp,R.RGBA)),$.bind(R.LINEAR,R.CLAMP_TO_EDGE),w.useProgram("heatmapTexture").draw(E,R.TRIANGLES,ut.disabled,Vt.disabled,w.colorModeForRenderPass(),Mt.disabled,((H,U,W,Y)=>{const j=c.H();c.aQ(j,0,H.width,H.height,0,0,1);const te=H.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")}})(w,C),null,C.id,w.viewportBuffer,w.quadTriangleIndexBuffer,w.viewportSegments,C.paint,w.transform.zoom)}(h,y))})(t,n,o,a);break;case"line":(function(h,g,y,b){if(h.renderPass!=="translucent")return;const w=y.paint.get("line-opacity"),C=y.paint.get("line-width");if(w.constantOr(1)===0||C.constantOr(1)===0)return;const E=h.depthModeForSublayer(0,ut.ReadOnly),R=h.colorModeForRenderPass(),F=y.paint.get("line-dasharray"),$=y.paint.get("line-pattern"),H=$.constantOr(1),U=y.paint.get("line-gradient"),W=y.getCrossfadeParameters(),Y=H?"linePattern":F?"lineSDF":U?"lineGradient":"line",j=h.context,te=j.gl;let se=!0;for(const ce of b){const ye=g.getTile(ce);if(H&&!ye.patternsLoaded())continue;const we=ye.getBucket(y);if(!we)continue;const De=we.programConfigurations.get(y.id),Re=h.context.program.get(),Se=h.useProgram(Y,De),Te=se||Se.program!==Re,Ne=h.style.map.terrain&&h.style.map.terrain.getTerrainData(ce),tt=$.constantOr(null);if(tt&&ye.imageAtlas){const Qe=ye.imageAtlas,Dt=Qe.patternPositions[tt.to.toString()],ot=Qe.patternPositions[tt.from.toString()];Dt&&ot&&De.setConstantPatternPositions(Dt,ot)}const Ce=Ne?ce:null,Ae=H?_l(h,ye,y,W,Ce):F?yl(h,ye,y,F,W,Ce):U?Ks(h,ye,y,we.lineClipsArray.length,Ce):gs(h,ye,y,Ce);if(H)j.activeTexture.set(te.TEXTURE0),ye.imageAtlasTexture.bind(te.LINEAR,te.CLAMP_TO_EDGE),De.updatePaintBuffers(W);else if(F&&(Te||h.lineAtlas.dirty))j.activeTexture.set(te.TEXTURE0),h.lineAtlas.bind(j);else if(U){const Qe=we.gradients[y.id];let Dt=Qe.texture;if(y.gradientVersion!==Qe.version){let ot=256;if(y.stepInterpolant){const dt=g.getSource().maxzoom,Lt=ce.canonical.z===dt?Math.ceil(1<<h.transform.maxZoom-ce.canonical.z):1;ot=c.ad(c.aV(we.maxLineLength/c.X*1024*Lt),256,j.maxTextureSize)}Qe.gradient=c.aW({expression:y.gradientExpression(),evaluationKey:"lineProgress",resolution:ot,image:Qe.gradient||void 0,clips:we.lineClipsArray}),Qe.texture?Qe.texture.update(Qe.gradient):Qe.texture=new St(j,Qe.gradient,te.RGBA),Qe.version=y.gradientVersion,Dt=Qe.texture}j.activeTexture.set(te.TEXTURE0),Dt.bind(y.stepInterpolant?te.NEAREST:te.LINEAR,te.CLAMP_TO_EDGE)}Se.draw(j,te.TRIANGLES,E,h.stencilModeForClipping(ce),R,Mt.disabled,Ae,Ne,y.id,we.layoutVertexBuffer,we.indexBuffer,we.segments,y.paint,h.transform.zoom,De,we.layoutVertexBuffer2),se=!1}})(t,n,o,a);break;case"fill":(function(h,g,y,b){const w=y.paint.get("fill-color"),C=y.paint.get("fill-opacity");if(C.constantOr(1)===0)return;const E=h.colorModeForRenderPass(),R=y.paint.get("fill-pattern"),F=h.opaquePassEnabledForLayer()&&!R.constantOr(1)&&w.constantOr(c.aN.transparent).a===1&&C.constantOr(0)===1?"opaque":"translucent";if(h.renderPass===F){const $=h.depthModeForSublayer(1,h.renderPass==="opaque"?ut.ReadWrite:ut.ReadOnly);oa(h,g,y,b,$,E,!1)}if(h.renderPass==="translucent"&&y.paint.get("fill-antialias")){const $=h.depthModeForSublayer(y.getPaintProperty("fill-outline-color")?2:0,ut.ReadOnly);oa(h,g,y,b,$,E,!0)}})(t,n,o,a);break;case"fill-extrusion":(function(h,g,y,b){const w=y.paint.get("fill-extrusion-opacity");if(w!==0&&h.renderPass==="translucent"){const C=new ut(h.context.gl.LEQUAL,ut.ReadWrite,h.depthRangeFor3D);if(w!==1||y.paint.get("fill-extrusion-pattern").constantOr(1))oo(h,g,y,b,C,Vt.disabled,Et.disabled),oo(h,g,y,b,C,h.stencilModeFor3D(),h.colorModeForRenderPass());else{const E=h.colorModeForRenderPass();oo(h,g,y,b,C,Vt.disabled,E)}}})(t,n,o,a);break;case"hillshade":(function(h,g,y,b){if(h.renderPass!=="offscreen"&&h.renderPass!=="translucent")return;const w=h.context,C=h.depthModeForSublayer(0,ut.ReadOnly),E=h.colorModeForRenderPass(),[R,F]=h.renderPass==="translucent"?h.stencilConfigForOverlap(b):[{},b];for(const $ of F){const H=g.getTile($);H.needsHillshadePrepare!==void 0&&H.needsHillshadePrepare&&h.renderPass==="offscreen"?fn(h,H,y,C,Vt.disabled,E):h.renderPass==="translucent"&&aa(h,$,H,y,C,R[$.overscaledZ],E)}w.viewport.set([0,0,h.width,h.height])})(t,n,o,a);break;case"raster":(function(h,g,y,b){if(h.renderPass!=="translucent"||y.paint.get("raster-opacity")===0||!b.length)return;const w=h.context,C=w.gl,E=g.getSource(),R=h.useProgram("raster"),F=h.colorModeForRenderPass(),[$,H]=E instanceof Ar?[{},b]:h.stencilConfigForOverlap(b),U=H[H.length-1].overscaledZ,W=!h.options.moving;for(const Y of H){const j=h.depthModeForSublayer(Y.overscaledZ-U,y.paint.get("raster-opacity")===1?ut.ReadWrite:ut.ReadOnly,C.LESS),te=g.getTile(Y);te.registerFadeDuration(y.paint.get("raster-fade-duration"));const se=g.findLoadedParent(Y,0),ce=g.findLoadedSibling(Y),ye=ao(te,se||ce||null,g,y,h.transform,h.style.map.terrain);let we,De;const Re=y.paint.get("raster-resampling")==="nearest"?C.NEAREST:C.LINEAR;w.activeTexture.set(C.TEXTURE0),te.texture.bind(Re,C.CLAMP_TO_EDGE,C.LINEAR_MIPMAP_NEAREST),w.activeTexture.set(C.TEXTURE1),se?(se.texture.bind(Re,C.CLAMP_TO_EDGE,C.LINEAR_MIPMAP_NEAREST),we=Math.pow(2,se.tileID.overscaledZ-te.tileID.overscaledZ),De=[te.tileID.canonical.x*we%1,te.tileID.canonical.y*we%1]):te.texture.bind(Re,C.CLAMP_TO_EDGE,C.LINEAR_MIPMAP_NEAREST),te.texture.useMipmap&&w.extTextureFilterAnisotropic&&h.transform.pitch>20&&C.texParameterf(C.TEXTURE_2D,w.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,w.extTextureFilterAnisotropicMax);const Se=h.style.map.terrain&&h.style.map.terrain.getTerrainData(Y),Te=Se?Y:null,Ne=Te?Te.posMatrix:h.transform.calculatePosMatrix(Y.toUnwrapped(),W),tt=Uc(Ne,De||[0,0],we||1,ye,y);E instanceof Ar?R.draw(w,C.TRIANGLES,j,Vt.disabled,F,Mt.disabled,tt,Se,y.id,E.boundsBuffer,h.quadTriangleIndexBuffer,E.boundsSegments):R.draw(w,C.TRIANGLES,j,$[Y.overscaledZ],F,Mt.disabled,tt,Se,y.id,h.rasterBoundsBuffer,h.quadTriangleIndexBuffer,h.rasterBoundsSegments)}})(t,n,o,a);break;case"background":(function(h,g,y,b){const w=y.paint.get("background-color"),C=y.paint.get("background-opacity");if(C===0)return;const E=h.context,R=E.gl,F=h.transform,$=F.tileSize,H=y.paint.get("background-pattern");if(h.isPatternMissing(H))return;const U=!H&&w.a===1&&C===1&&h.opaquePassEnabledForLayer()?"opaque":"translucent";if(h.renderPass!==U)return;const W=Vt.disabled,Y=h.depthModeForSublayer(0,U==="opaque"?ut.ReadWrite:ut.ReadOnly),j=h.colorModeForRenderPass(),te=h.useProgram(H?"backgroundPattern":"background"),se=b||F.coveringTiles({tileSize:$,terrain:h.style.map.terrain});H&&(E.activeTexture.set(R.TEXTURE0),h.imageManager.bind(h.context));const ce=y.getCrossfadeParameters();for(const ye of se){const we=b?ye.posMatrix:h.transform.calculatePosMatrix(ye.toUnwrapped()),De=H?Ho(we,C,h,H,{tileID:ye,tileSize:$},ce):Ys(we,C,w),Re=h.style.map.terrain&&h.style.map.terrain.getTerrainData(ye);te.draw(E,R.TRIANGLES,Y,W,j,Mt.disabled,De,Re,y.id,h.tileExtentBuffer,h.quadTriangleIndexBuffer,h.tileExtentSegments)}})(t,0,o,a);break;case"custom":(function(h,g,y){const b=h.context,w=y.implementation;if(h.renderPass==="offscreen"){const C=w.prerender;C&&(h.setCustomLayerDefaults(),b.setColorMode(h.colorModeForRenderPass()),C.call(w,b.gl,h.transform.customLayerMatrix()),b.setDirty(),h.setBaseState())}else if(h.renderPass==="translucent"){h.setCustomLayerDefaults(),b.setColorMode(h.colorModeForRenderPass()),b.setStencilMode(Vt.disabled);const C=w.renderingMode==="3d"?new ut(h.context.gl.LEQUAL,ut.ReadWrite,h.depthRangeFor3D):h.depthModeForSublayer(0,ut.ReadOnly);b.setDepthMode(C),w.render(b.gl,h.transform.customLayerMatrix(),{farZ:h.transform.farZ,nearZ:h.transform.nearZ,fov:h.transform._fov,modelViewProjectionMatrix:h.transform.modelViewProjectionMatrix,projectionMatrix:h.transform.projectionMatrix}),b.setDirty(),h.setBaseState(),b.bindFramebuffer.set(null)}})(t,0,o)}}translatePosMatrix(t,n,o,a,h){if(!o[0]&&!o[1])return t;const g=h?a==="map"?this.transform.angle:0:a==="viewport"?-this.transform.angle:0;if(g){const w=Math.sin(g),C=Math.cos(g);o=[o[0]*C-o[1]*w,o[0]*w+o[1]*C]}const y=[h?o[0]:rt(n,o[0],this.transform.zoom),h?o[1]:rt(n,o[1],this.transform.zoom),0],b=new Float32Array(16);return c.J(b,t,y),b}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 Hs(this.context,Xr[t],n,Qs[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 St(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:t,drawingBufferHeight:n}=this.context.gl;return this.width!==t||this.height!==n}}class gn{constructor(t,n){this.points=t,this.planes=n}static fromInvProjectionMatrix(t,n,o){const a=Math.pow(2,o),h=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(y=>{const b=1/(y=c.ag([],y,t))[3]/n*a;return c.b1(y,y,[b,b,1/y[3],b])}),g=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(y=>{const b=function(R,F){var $=F[0],H=F[1],U=F[2],W=$*$+H*H+U*U;return W>0&&(W=1/Math.sqrt(W)),R[0]=F[0]*W,R[1]=F[1]*W,R[2]=F[2]*W,R}([],function(R,F,$){var H=F[0],U=F[1],W=F[2],Y=$[0],j=$[1],te=$[2];return R[0]=U*te-W*j,R[1]=W*Y-H*te,R[2]=H*j-U*Y,R}([],$t([],h[y[0]],h[y[1]]),$t([],h[y[2]],h[y[1]]))),w=-((C=b)[0]*(E=h[y[1]])[0]+C[1]*E[1]+C[2]*E[2]);var C,E;return b.concat(w)});return new gn(h,g)}}class ho{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=wt(this.min),a=wt(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 ho(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 g=0;for(let y=0;y<n.length;y++)c.b2(h,n[y])>=0&&g++;if(g===0)return 0;g!==n.length&&(o=!1)}if(o)return 2;for(let a=0;a<3;a++){let h=Number.MAX_VALUE,g=-Number.MAX_VALUE;for(let y=0;y<t.points.length;y++){const b=t.points[y][a]-this.min[a];h=Math.min(h,b),g=Math.max(g,b)}if(g<0||h>this.max[a]-this.min[a])return 0}return 1}}class uo{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 uo(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const ca=85.051129;class ha{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 uo,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={},this.minElevationForCurrentTile=0}clone(){const t=new ha(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 g=a[0],y=a[1],b=a[2],w=a[3],C=Math.sin(h),E=Math.cos(h);o[0]=g*E+b*C,o[1]=y*E+w*C,o[2]=g*-C+b*E,o[3]=y*-C+w*E}(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)),g=this.pointCoordinate(new c.P(0,this.height)),y=Math.floor(Math.min(o.x,a.x,h.x,g.x)),b=Math.floor(Math.max(o.x,a.x,h.x,g.x)),w=1;for(let C=y-w;C<=b+w;C++)C!==0&&n.push(new c.b4(C,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 g=this.pointCoordinate(this.getCameraPoint()),y=c.Z.fromLngLat(this.center),b=Math.pow(2,a),w=[b*g.x,b*g.y,0],C=[b*y.x,b*y.y,0],E=gn.fromInvProjectionMatrix(this.invModelViewProjectionMatrix,this.worldSize,a);let R=t.minzoom||0;!t.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(R=a);const F=t.terrain?2/Math.min(this.tileSize,t.tileSize)*this.tileSize:3,$=j=>({aabb:new ho([j*b,0,0],[(j+1)*b,b,0]),zoom:0,x:0,y:0,wrap:j,fullyVisible:!1}),H=[],U=[],W=a,Y=t.reparseOverscaled?h:a;if(this._renderWorldCopies)for(let j=1;j<=3;j++)H.push($(-j)),H.push($(j));for(H.push($(0));H.length>0;){const j=H.pop(),te=j.x,se=j.y;let ce=j.fullyVisible;if(!ce){const Se=j.aabb.intersects(E);if(Se===0)continue;ce=Se===2}const ye=t.terrain?w:C,we=j.aabb.distanceX(ye),De=j.aabb.distanceY(ye),Re=Math.max(Math.abs(we),Math.abs(De));if(j.zoom===W||Re>F+(1<<W-j.zoom)-2&&j.zoom>=R){const Se=W-j.zoom,Te=w[0]-.5-(te<<Se),Ne=w[1]-.5-(se<<Se);U.push({tileID:new c.S(j.zoom===W?Y:j.zoom,j.wrap,j.zoom,te,se),distanceSq:Vr([C[0]-.5-te,C[1]-.5-se]),tileDistanceToCamera:Math.sqrt(Te*Te+Ne*Ne)})}else for(let Se=0;Se<4;Se++){const Te=(te<<1)+Se%2,Ne=(se<<1)+(Se>>1),tt=j.zoom+1;let Ce=j.aabb.quadrant(Se);if(t.terrain){const Ae=new c.S(tt,j.wrap,tt,Te,Ne),Qe=t.terrain.getMinMaxElevation(Ae),Dt=(n=Qe.minElevation)!==null&&n!==void 0?n:this.elevation,ot=(o=Qe.maxElevation)!==null&&o!==void 0?o:this.elevation;Ce=new ho([Ce.min[0],Ce.min[1],Dt],[Ce.max[0],Ce.max[1],ot])}H.push({aabb:Ce,zoom:tt,x:Te,y:Ne,wrap:j.wrap,fullyVisible:ce})}}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,ca);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 g=o+n-h,y=Math.cos(this._pitch)*this.cameraToCenterDistance/g/c.b5(1,a.lat),b=this.scaleZoom(y/this.tileSize);this._elevation=h,this._center=a,this.zoom=b}setLocationAtPoint(t,n){const o=this.pointCoordinate(n),a=this.pointCoordinate(this.centerPoint),h=this.locationCoordinate(t),g=new c.Z(h.x-(o.x-a.x),h.y-(o.y-a.y));this.center=this.coordinateLocation(g),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 R=n.pointCoordinate(t);if(R!=null)return R}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],g=a[3],y=o[1]/h,b=a[1]/g,w=o[2]/h,C=a[2]/g,E=w===C?0:(0-w)/(C-w);return new c.Z(c.z.number(o[0]/h,a[0]/g,E)/this.worldSize,c.z.number(y,b,E)/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,ca])}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 g=0,y=h,b=0,w=h,C=0,E=0;const{x:R,y:F}=this.size;if(this.latRange){const j=this.latRange;g=c.Q(j[1])*h,y=c.Q(j[0])*h,y-g<F&&(C=F/(y-g))}a&&(b=c.b3(c.O(a[0])*h,0,h),w=c.b3(c.O(a[1])*h,0,h),w<b&&(w+=h),w-b<R&&(E=R/(w-b)));const{x:$,y:H}=this.project.call({worldSize:h},t);let U,W;const Y=Math.max(E||0,C||0);if(Y){const j=new c.P(E?(w+b)/2:$,C?(y+g)/2:H);return o.center=this.unproject.call({worldSize:h},j).wrap(),o.zoom+=this.scaleZoom(Y),o}if(this.latRange){const j=F/2;H-j<g&&(W=g+j),H+j>y&&(W=y-j)}if(a){const j=(b+w)/2;let te=$;this._renderWorldCopies&&(te=c.b3($,j-h/2,j+h/2));const se=R/2;te-se<b&&(U=b+se),te+se>w&&(U=w-se)}if(U!==void 0||W!==void 0){const j=new c.P(U??$,W??H);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),g=Math.min(this.elevation,this.minElevationForCurrentTile),y=h-g*this._pixelPerMeter/Math.cos(this._pitch),b=g<0?y:h,w=Math.PI/2+this._pitch,C=this._fov*(.5+t.y/this.height),E=Math.sin(C)*b/Math.sin(c.ad(Math.PI-w-C,.01,Math.PI-.01)),R=this.getHorizon(),F=2*Math.atan(R/this.cameraToCenterDistance)*(.5+t.y/(2*R)),$=Math.sin(F)*b/Math.sin(c.ad(Math.PI-w-F,.01,Math.PI-.01)),H=Math.min(E,$);this.farZ=1.01*(Math.cos(Math.PI/2-this._pitch)*H+b),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,W=this.height%2/2,Y=Math.cos(this.angle),j=Math.sin(this.angle),te=n-Math.round(n)+Y*U+j*W,se=o-Math.round(o)+Y*W+j*U,ce=new Float64Array(a);if(c.J(ce,ce,[te>.5?te-1:te,se>.5?se-1:se,0]),this.alignedModelViewProjectionMatrix=ce,a=c.at(new Float64Array(16),this.pixelMatrix),!a)throw new Error("failed to invert matrix");this.pixelMatrixInverse=a,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const t=this.pointCoordinate(new c.P(0,0)),n=[t.x*this.worldSize,t.y*this.worldSize,0,1];return c.ag(n,n,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new c.P(0,t))}getCameraQueryGeometry(t){const n=this.getCameraPoint();if(t.length===1)return[t[0],n];{let o=n.x,a=n.y,h=n.x,g=n.y;for(const y of t)o=Math.min(o,y.x),a=Math.min(a,y.y),h=Math.max(h,y.x),g=Math.max(g,y.y);return[new c.P(o,a),new c.P(h,a),new c.P(h,g),new c.P(o,g),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 po(u,t){let n,o=!1,a=null,h=null;const g=()=>{a=null,o&&(u.apply(h,n),a=setTimeout(g,t),o=!1)};return(...y)=>(o=!0,h=this,n=y,a||g(),a)}class Ss{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 g=window.location.href.replace(/(#.+)?$/,h);g=g.replace("&&","&"),window.history.replaceState(window.history.state,null,g)},this._updateHash=po(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),g=Math.round(n.lng*h)/h,y=Math.round(n.lat*h)/h,b=this._map.getBearing(),w=this._map.getPitch();let C="";if(C+=t?`/${g}/${y}/${o}`:`${o}/${y}/${g}`,(b||w)&&(C+="/"+Math.round(10*b)/10),w&&(C+=`/${Math.round(w)}`),this._hashName){const E=this._hashName;let R=!1;const F=window.location.hash.slice(1).split("&").map($=>{const H=$.split("=")[0];return H===E?(R=!0,`${H}=${C}`):$}).filter($=>$);return R||F.push(`${E}=${C}`),`#${F.join("&")}`}return`#${C}`}}const _n={linearity:.3,easing:c.b8(0,0,.3,1)},ua=c.e({deceleration:2500,maxSpeed:1400},_n),da=c.e({deceleration:20,maxSpeed:1400},_n),Vl=c.e({deceleration:1e3,maxSpeed:360},_n),fo=c.e({deceleration:1e3,maxSpeed:90},_n);class mo{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:le.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,n=le.now();for(;t.length>0&&n-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const n={zoom:0,bearing:0,pitch:0,pan:new c.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:h}of this._inertiaBuffer)n.zoom+=h.zoomDelta||0,n.bearing+=h.bearingDelta||0,n.pitch+=h.pitchDelta||0,h.panDelta&&n.pan._add(h.panDelta),h.around&&(n.around=h.around),h.pinchAround&&(n.pinchAround=h.pinchAround);const o=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,a={};if(n.pan.mag()){const h=go(n.pan.mag(),o,c.e({},ua,t||{}));a.offset=n.pan.mult(h.amount/n.pan.mag()),a.center=this._map.transform.center,On(a,h)}if(n.zoom){const h=go(n.zoom,o,da);a.zoom=this._map.transform.zoom+h.amount,On(a,h)}if(n.bearing){const h=go(n.bearing,o,Vl);a.bearing=this._map.transform.bearing+c.ad(h.amount,-179,179),On(a,h)}if(n.pitch){const h=go(n.pitch,o,fo);a.pitch=this._map.transform.pitch+h.amount,On(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 On(u,t){(!u.duration||u.duration<t.duration)&&(u.duration=t.duration,u.easing=t.easing)}function go(u,t,n){const{maxSpeed:o,linearity:a,deceleration:h}=n,g=c.ad(u*a/(t/1e3),-o,o),y=Math.abs(g)/(h*a);return{easing:n.easing,duration:1e3*y,amount:g*(y/2)}}class Ti extends c.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,o,a={}){const h=oe.mousePos(n.getCanvas(),o),g=n.unproject(h);super(t,c.e({point:h,lngLat:g,originalEvent:o},a)),this._defaultPrevented=!1,this.target=n}}class Ts 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=oe.touchPos(n.getCanvasContainer(),a),g=h.map(b=>n.unproject(b)),y=h.reduce((b,w,C,E)=>b.add(w.div(E.length)),new c.P(0,0));super(t,{points:h,point:y,lngLats:g,lngLat:n.unproject(y),originalEvent:o}),this._defaultPrevented=!1}}class pa extends c.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,o){super(t,{originalEvent:o}),this._defaultPrevented=!1}}class _o{constructor(t,n){this._map=t,this._clickTolerance=n.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new pa(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 Ts(t.type,this._map,t))}touchmove(t){this._map.fire(new Ts(t.type,this._map,t))}touchend(t){this._map.fire(new Ts(t.type,this._map,t))}touchcancel(t){this._map.fire(new Ts(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class fa{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 Vn{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 ma{constructor(t,n){this._map=t,this._tr=new Vn(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&&(oe.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=oe.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",t));const h=Math.min(a.x,o.x),g=Math.max(a.x,o.x),y=Math.min(a.y,o.y),b=Math.max(a.y,o.y);oe.setTransform(this._box,`translate(${h}px,${y}px)`),this._box.style.width=g-h+"px",this._box.style.height=b-y+"px"}mouseupWindow(t,n){if(!this._active||t.button!==0)return;const o=this._startPos,a=n;if(this.reset(),oe.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&&(oe.remove(this._box),this._box=null),oe.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,n){return this._map.fire(new c.k(t,{originalEvent:n}))}}function Nn(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 ga{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 g of a)h._add(g);return h.div(a.length)}(n),this.touches=Nn(o,n)))}touchmove(t,n,o){if(this.aborted||!this.centroid)return;const a=Nn(o,n);for(const h in this.touches){const g=a[h];(!g||g.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 _a{constructor(t){this.singleTap=new ga(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,g=!this.lastTap||this.lastTap.dist(a)<30;if(h&&g||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=a,this.count===this.numTaps)return this.reset(),a}}}class Nl{constructor(t){this._tr=new Vn(t),this._zoomIn=new _a({numTouches:1,numTaps:2}),this._zoomOut=new _a({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),g=this._tr;return a?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:y=>y.easeTo({duration:300,zoom:g.zoom+1,around:g.unproject(a)},{originalEvent:t})}):h?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:y=>y.easeTo({duration:300,zoom:g.zoom-1,around:g.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&&oe.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=oe.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 oe.mouseButton(t)===this._eventButton}}class yo{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 ks=u=>{u.mousedown=u.dragStart,u.mousemoveWindow=u.dragMove,u.mouseup=u.dragEnd,u.contextmenu=t=>{t.preventDefault()}},ya=({enable:u,clickTolerance:t,bearingDegreesPerPixelMoved:n=.8})=>{const o=new Ai({checkCorrectEvent:a=>oe.mouseButton(a)===0&&a.ctrlKey||oe.mouseButton(a)===2});return new zt({clickTolerance:t,move:(a,h)=>({bearingDelta:(h.x-a.x)*n}),moveStateManager:o,enable:u,assignEvents:ks})},xn=({enable:u,clickTolerance:t,pitchDegreesPerPixelMoved:n=-.5})=>{const o=new Ai({checkCorrectEvent:a=>oe.mouseButton(a)===0&&a.ctrlKey||oe.mouseButton(a)===2});return new zt({clickTolerance:t,move:(a,h)=>({pitchDelta:(h.y-a.y)*n}),moveStateManager:o,enable:u,assignEvents:ks})};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=Nn(o,n),h=new c.P(0,0),g=new c.P(0,0);let y=0;for(const w in a){const C=a[w],E=this._touches[w];E&&(h._add(C),g._add(C.sub(E)),y++,a[w]=C)}if(this._touches=a,this._shouldBePrevented(y)||!g.mag())return;const b=g.div(y);return this._sum._add(b),this._sum.mag()<this._clickTolerance?void 0:{around:h.div(y),panDelta:b}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Cs{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,g=Es(o,n,a),y=Es(o,n,h);if(!g||!y)return;const b=this._aroundCenter?null:g.add(y).div(2);return this._move([g,y],b,t)}touchend(t,n,o){if(!this._firstTwoTouches)return;const[a,h]=this._firstTwoTouches,g=Es(o,n,a),y=Es(o,n,h);g&&y||(this._active&&oe.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 Es(u,t,n){for(let o=0;o<u.length;o++)if(u[o].identifier===n)return t[o]}function xa(u,t){return Math.log(u/t)/Math.LN2}class va extends Cs{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(xa(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:xa(this._distance,o),pinchAround:n}}}function ba(u,t){return 180*u.angleWith(t)/Math.PI}class wa extends Cs{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:ba(this._vector,a),pinchAround:n}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const n=25/(Math.PI*this._minDiameter)*360,o=ba(t,this._startVector);return Math.abs(o)<n}}function Lr(u){return Math.abs(u.y)>Math.abs(u.x)}class Sa extends Cs{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,Lr(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 g=t.y>0==n.y>0;return Lr(t)&&Lr(n)&&g}}const $l={panStep:100,bearingStep:15,pitchStep:10};class Ta{constructor(t){this._tr=new Vn(t);const n=$l;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,g=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(),g=-1);break;case 40:t.shiftKey?a=-1:(t.preventDefault(),g=1);break;default:return}return this._rotationDisabled&&(o=0,a=0),{cameraAnimation:y=>{const b=this._tr;y.easeTo({duration:300,easeId:"keyboardHandler",easing:jl,zoom:n?Math.round(b.zoom)+n*(t.shiftKey?2:1):b.zoom,bearing:b.bearing+o*this._bearingStep,pitch:b.pitch+a*this._pitchStep,offset:[-h*this._panStep,-g*this._panStep],center:b.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 jl(u){return u*(2-u)}const ka=4.000244140625;class Ia{constructor(t,n){this._onTimeout=o=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(o)},this._map=t,this._tr=new Vn(t),this._triggerRenderFrame=n,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!t&&t.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(t){return!!this._map.cooperativeGestures.isEnabled()&&!(t.ctrlKey||this._map.cooperativeGestures.isBypassed(t))}wheel(t){if(!this.isEnabled())return;if(this._shouldBePrevented(t))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",t);let n=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const o=le.now(),a=o-(this._lastWheelEventTime||0);this._lastWheelEventTime=o,n!==0&&n%ka==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=oe.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 b=this._type==="wheel"&&Math.abs(this._delta)>ka?this._wheelZoomRate:this._defaultZoomRate;let w=2/(1+Math.exp(-Math.abs(this._delta*b)));this._delta<0&&w!==0&&(w=1/w);const C=typeof this._targetZoom=="number"?t.zoomScale(this._targetZoom):t.scale;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(C*w))),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,g=!1;const y=le.now()-this._lastWheelEventTime;if(this._type==="wheel"&&o&&a&&y){const b=Math.min(y/200,1),w=a(b);h=c.z.number(o,n,w),b<1?this._frameId||(this._frameId=!0):g=!0}else h=n,g=!0;return this._active=!0,g&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!g,zoomDelta:h-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let n=c.b9;if(this._prevEase){const o=this._prevEase,a=(le.now()-o.start)/o.duration,h=o.easing(a+.01)-o.easing(a),g=.27/Math.sqrt(h*h+1e-4)*.01,y=Math.sqrt(.0729-g*g);n=c.b8(g,y,.25,1)}return this._prevEase={start:le.now(),duration:t,easing:n},n}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class Ca{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 Ps{constructor(t){this._tr=new Vn(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 Ul{constructor(){this._tap=new _a({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,g=this._tapPoint.dist(a)<30;h&&g?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 Ji{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 ir{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 Ea{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 rr{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=oe.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&&(oe.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 Rr=u=>u.zoom||u.drag||u.pitch||u.rotate;class th extends c.k{}function Pa(u){return u.panDelta&&u.panDelta.mag()||u.zoomDelta||u.bearingDelta||u.pitchDelta}class ih{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 g=a.type==="renderFrame"?void 0:a,y={needsRenderFrame:!1},b={},w={},C=a.touches,E=C?this._getMapTouches(C):void 0,R=E?oe.touchPos(this._map.getCanvas(),E):oe.mousePos(this._map.getCanvas(),a);for(const{handlerName:H,handler:U,allowed:W}of this._handlers){if(!U.isEnabled())continue;let Y;this._blockedByActive(w,W,H)?U.reset():U[h||a.type]&&(Y=U[h||a.type](a,R,E),this.mergeHandlerResult(y,b,Y,H,g),Y&&Y.needsRenderFrame&&this._triggerRenderFrame()),(Y||U.isActive())&&(w[H]=U)}const F={};for(const H in this._previousActiveHandlers)w[H]||(F[H]=g);this._previousActiveHandlers=w,(Object.keys(F).length||Pa(y))&&(this._changes.push([y,b,F]),this._triggerRenderFrame()),(Object.keys(w).length||Pa(y))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:$}=y;$&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],$(this._map))},this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new mo(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,g]of this._listeners)oe.addEventListener(a,h,a===document?this.handleWindowEvent:this.handleEvent,g)}destroy(){for(const[t,n,o]of this._listeners)oe.removeEventListener(t,n,t===document?this.handleWindowEvent:this.handleEvent,o)}_addDefaultHandlers(t){const n=this._map,o=n.getCanvasContainer();this._add("mapEvent",new _o(n,t));const a=n.boxZoom=new ma(n,t);this._add("boxZoom",a),t.interactive&&t.boxZoom&&a.enable();const h=n.cooperativeGestures=new rr(n,t.cooperativeGestures);this._add("cooperativeGestures",h),t.cooperativeGestures&&h.enable();const g=new Nl(n),y=new Ps(n);n.doubleClickZoom=new Ca(y,g),this._add("tapZoom",g),this._add("clickZoom",y),t.interactive&&t.doubleClickZoom&&n.doubleClickZoom.enable();const b=new Ul;this._add("tapDragZoom",b);const w=n.touchPitch=new Sa(n);this._add("touchPitch",w),t.interactive&&t.touchPitch&&n.touchPitch.enable(t.touchPitch);const C=ya(t),E=xn(t);n.dragRotate=new ir(t,C,E),this._add("mouseRotate",C,["mousePitch"]),this._add("mousePitch",E,["mouseRotate"]),t.interactive&&t.dragRotate&&n.dragRotate.enable();const R=(({enable:Y,clickTolerance:j})=>{const te=new Ai({checkCorrectEvent:se=>oe.mouseButton(se)===0&&!se.ctrlKey});return new zt({clickTolerance:j,move:(se,ce)=>({around:ce,panDelta:ce.sub(se)}),activateOnStart:!0,moveStateManager:te,enable:Y,assignEvents:ks})})(t),F=new Is(t,n);n.dragPan=new Ji(o,R,F),this._add("mousePan",R),this._add("touchPan",F,["touchZoom","touchRotate"]),t.interactive&&t.dragPan&&n.dragPan.enable(t.dragPan);const $=new wa,H=new va;n.touchZoomRotate=new Ea(o,H,$,b),this._add("touchRotate",$,["touchPan","touchZoom"]),this._add("touchZoom",H,["touchPan","touchRotate"]),t.interactive&&t.touchZoomRotate&&n.touchZoomRotate.enable(t.touchZoomRotate);const U=n.scrollZoom=new Ia(n,()=>this._triggerRenderFrame());this._add("scrollZoom",U,["mousePan"]),t.interactive&&t.scrollZoom&&n.scrollZoom.enable(t.scrollZoom);const W=n.keyboard=new Ta(n);this._add("keyboard",W),t.interactive&&t.keyboard&&n.keyboard.enable(),this._add("blockableMapEvent",new fa(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!!Rr(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 g={handlerName:a,originalEvent:o.originalEvent||h};o.zoomDelta!==void 0&&(n.zoom=g),o.panDelta!==void 0&&(n.drag=g),o.pitchDelta!==void 0&&(n.pitch=g),o.bearingDelta!==void 0&&(n.rotate=g)}_applyChanges(){const t={},n={},o={};for(const[a,h,g]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,g);this._updateMapTransform(t,n,o),this._changes=[]}_updateMapTransform(t,n,o){const a=this._map,h=a._getTransformForUpdate(),g=a.terrain;if(!(Pa(t)||g&&this._terrainMovement))return this._fireEvents(n,o,!0);let{panDelta:y,zoomDelta:b,bearingDelta:w,pitchDelta:C,around:E,pinchAround:R}=t;R!==void 0&&(E=R),a._stop(!0),E=E||a.transform.centerPoint;const F=h.pointLocation(y?E.sub(y):E);w&&(h.bearing+=w),C&&(h.pitch+=C),b&&(h.zoom+=b),g?this._terrainMovement||!n.drag&&!n.zoom?n.drag&&this._terrainMovement?h.center=h.pointLocation(h.centerPoint.sub(y)):h.setLocationAtPoint(F,E):(this._terrainMovement=!0,this._map._elevationFreeze=!0,h.setLocationAtPoint(F,E)):h.setLocationAtPoint(F,E),a._applyUpdatedTransform(h),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(n,o,!0)}_fireEvents(t,n,o){const a=Rr(this._eventsInProgress),h=Rr(t),g={};for(const E in t){const{originalEvent:R}=t[E];this._eventsInProgress[E]||(g[`${E}start`]=R),this._eventsInProgress[E]=t[E]}!a&&h&&this._fireEvent("movestart",h.originalEvent);for(const E in g)this._fireEvent(E,g[E]);h&&this._fireEvent("move",h.originalEvent);for(const E in t){const{originalEvent:R}=t[E];this._fireEvent(E,R)}const y={};let b;for(const E in this._eventsInProgress){const{handlerName:R,originalEvent:F}=this._eventsInProgress[E];this._handlersById[R].isActive()||(delete this._eventsInProgress[E],b=n[R]||F,y[`${E}end`]=b)}for(const E in y)this._fireEvent(E,y[E]);const w=Rr(this._eventsInProgress),C=(a||h)&&!w;if(C&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const E=this._map._getTransformForUpdate();E.recalculateZoom(this._map.terrain),this._map._applyUpdatedTransform(E)}if(o&&C){this._updatingCamera=!0;const E=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),R=F=>F!==0&&-this._bearingSnap<F&&F<this._bearingSnap;!E||!E.essential&&le.prefersReducedMotion?(this._map.fire(new c.k("moveend",{originalEvent:b})),R(this._map.getBearing())&&this._map.resetNorth()):(R(E.bearing||this._map.getBearing())&&(E.bearing=0),E.freezeElevation=!0,this._map.easeTo(E,{originalEvent:b})),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 th("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class rh extends c.E{constructor(t,n){super(),this._renderFrameCallback=()=>{const o=Math.min((le.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(o)),o<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=n.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new c.N(this.transform.center.lng,this.transform.center.lat)}setCenter(t,n){return this.jumpTo({center:t},n)}panBy(t,n,o){return t=c.P.convert(t).mult(-1),this.panTo(this.transform.center,c.e({offset:t},n),o)}panTo(t,n,o){return this.easeTo(c.e({center:t},n),o)}getZoom(){return this.transform.zoom}setZoom(t,n){return this.jumpTo({zoom:t},n),this}zoomTo(t,n,o){return this.easeTo(c.e({zoom:t},n),o)}zoomIn(t,n){return this.zoomTo(this.getZoom()+1,t,n),this}zoomOut(t,n){return this.zoomTo(this.getZoom()-1,t,n),this}getBearing(){return this.transform.bearing}setBearing(t,n){return this.jumpTo({bearing:t},n),this}getPadding(){return this.transform.padding}setPadding(t,n){return this.jumpTo({padding:t},n),this}rotateTo(t,n,o){return this.easeTo(c.e({bearing:t},n),o)}resetNorth(t,n){return this.rotateTo(0,c.e({duration:1e3},t),n),this}resetNorthPitch(t,n){return this.easeTo(c.e({bearing:0,pitch:0,duration:1e3},t),n),this}snapToNorth(t,n){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,n):this}getPitch(){return this.transform.pitch}setPitch(t,n){return this.jumpTo({pitch:t},n),this}cameraForBounds(t,n){t=ue.convert(t);const o=n&&n.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),o,n)}_cameraForBoxAndBearing(t,n,o,a){const h={top:0,bottom:0,right:0,left:0};if(typeof(a=c.e({padding:h,offset:[0,0],maxZoom:this.transform.maxZoom},a)).padding=="number"){const Se=a.padding;a.padding={top:Se,bottom:Se,right:Se,left:Se}}a.padding=c.e(h,a.padding);const g=this.transform,y=g.padding,b=new ue(t,n),w=g.project(b.getNorthWest()),C=g.project(b.getNorthEast()),E=g.project(b.getSouthEast()),R=g.project(b.getSouthWest()),F=c.ba(-o),$=w.rotate(F),H=C.rotate(F),U=E.rotate(F),W=R.rotate(F),Y=new c.P(Math.max($.x,H.x,W.x,U.x),Math.max($.y,H.y,W.y,U.y)),j=new c.P(Math.min($.x,H.x,W.x,U.x),Math.min($.y,H.y,W.y,U.y)),te=Y.sub(j),se=(g.width-(y.left+y.right+a.padding.left+a.padding.right))/te.x,ce=(g.height-(y.top+y.bottom+a.padding.top+a.padding.bottom))/te.y;if(ce<0||se<0)return void c.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");const ye=Math.min(g.scaleZoom(g.scale*Math.min(se,ce)),a.maxZoom),we=c.P.convert(a.offset),De=new c.P((a.padding.left-a.padding.right)/2,(a.padding.top-a.padding.bottom)/2).rotate(c.ba(o)),Re=we.add(De).mult(g.scale/g.zoomScale(ye));return{center:g.unproject(w.add(E).div(2).sub(Re)),zoom:ye,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,g=!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&&(g=!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)),g&&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),g=c.Z.fromLngLat(o,a),y=g.x-h.x,b=g.y-h.y,w=g.z-h.z,C=Math.hypot(y,b,w);if(C===0)throw new Error("Can't calculate camera options with same From and To");const E=Math.hypot(y,b),R=this.transform.scaleZoom(this.transform.cameraToCenterDistance/C/this.transform.tileSize),F=180*Math.atan2(y,-b)/Math.PI;let $=180*Math.acos(E/C)/Math.PI;return $=w<0?90-$:90+$,{center:g.toLngLat(),zoom:R,pitch:$,bearing:F}}easeTo(t,n){var o;this._stop(!1,t.easeId),((t=c.e({offset:[0,0],duration:500,easing:c.b9},t)).animate===!1||!t.essential&&le.prefersReducedMotion)&&(t.duration=0);const a=this._getTransformForUpdate(),h=a.zoom,g=a.bearing,y=a.pitch,b=a.padding,w="bearing"in t?this._normalizeBearing(t.bearing,g):g,C="pitch"in t?+t.pitch:y,E="padding"in t?t.padding:a.padding,R=c.P.convert(t.offset);let F=a.centerPoint.add(R);const $=a.pointLocation(F),{center:H,zoom:U}=a.getConstrained(c.N.convert(t.center||$),(o=t.zoom)!==null&&o!==void 0?o:h);this._normalizeCenter(H,a);const W=a.project($),Y=a.project(H).sub(W),j=a.zoomScale(U-h);let te,se;t.around&&(te=c.N.convert(t.around),se=a.locationPoint(te));const ce={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||U!==h,this._rotating=this._rotating||g!==w,this._pitching=this._pitching||C!==y,this._padding=!a.isPaddingEqual(E),this._easeId=t.easeId,this._prepareEase(n,t.noMoveStart,ce),this.terrain&&this._prepareElevation(H),this._ease(ye=>{if(this._zooming&&(a.zoom=c.z.number(h,U,ye)),this._rotating&&(a.bearing=c.z.number(g,w,ye)),this._pitching&&(a.pitch=c.z.number(y,C,ye)),this._padding&&(a.interpolatePadding(b,E,ye),F=a.centerPoint.add(R)),this.terrain&&!t.freezeElevation&&this._updateElevation(ye),te)a.setLocationAtPoint(te,se);else{const we=a.zoomScale(a.zoom-h),De=U>h?Math.min(2,j):Math.max(.5,j),Re=Math.pow(De,1-ye),Se=a.unproject(W.add(Y.mult(ye*Re)).mult(we));a.setLocationAtPoint(a.renderWorldCopies?Se.wrap():Se,F)}this._applyUpdatedTransform(a),this._fireMoveEvents(n)},ye=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(n,ye)},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:g,zoom:y,pitch:b,bearing:w,elevation:C}=a(h);g&&(h.center=g),y!==void 0&&(h.zoom=y),b!==void 0&&(h.pitch=b),w!==void 0&&(h.bearing=w),C!==void 0&&(h.elevation=C),o.apply(h)}this.transform.apply(o)}_fireMoveEvents(t){this.fire(new c.k("move",t)),this._zooming&&this.fire(new c.k("zoom",t)),this._rotating&&this.fire(new c.k("rotate",t)),this._pitching&&this.fire(new c.k("pitch",t))}_afterEase(t,n){if(this._easeId&&n&&this._easeId===n)return;delete this._easeId;const o=this._zooming,a=this._rotating,h=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,o&&this.fire(new c.k("zoomend",t)),a&&this.fire(new c.k("rotateend",t)),h&&this.fire(new c.k("pitchend",t)),this.fire(new c.k("moveend",t))}flyTo(t,n){var o;if(!t.essential&&le.prefersReducedMotion){const Ae=c.M(t,["center","zoom","bearing","pitch","around"]);return this.jumpTo(Ae,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,g=a.bearing,y=a.pitch,b=a.padding,w="bearing"in t?this._normalizeBearing(t.bearing,g):g,C="pitch"in t?+t.pitch:y,E="padding"in t?t.padding:a.padding,R=c.P.convert(t.offset);let F=a.centerPoint.add(R);const $=a.pointLocation(F),{center:H,zoom:U}=a.getConstrained(c.N.convert(t.center||$),(o=t.zoom)!==null&&o!==void 0?o:h);this._normalizeCenter(H,a);const W=a.zoomScale(U-h),Y=a.project($),j=a.project(H).sub(Y);let te=t.curve;const se=Math.max(a.width,a.height),ce=se/W,ye=j.mag();if("minZoom"in t){const Ae=c.ad(Math.min(t.minZoom,h,U),a.minZoom,a.maxZoom),Qe=se/a.zoomScale(Ae-h);te=Math.sqrt(Qe/ye*2)}const we=te*te;function De(Ae){const Qe=(ce*ce-se*se+(Ae?-1:1)*we*we*ye*ye)/(2*(Ae?ce:se)*we*ye);return Math.log(Math.sqrt(Qe*Qe+1)-Qe)}function Re(Ae){return(Math.exp(Ae)-Math.exp(-Ae))/2}function Se(Ae){return(Math.exp(Ae)+Math.exp(-Ae))/2}const Te=De(!1);let Ne=function(Ae){return Se(Te)/Se(Te+te*Ae)},tt=function(Ae){return se*((Se(Te)*(Re(Qe=Te+te*Ae)/Se(Qe))-Re(Te))/we)/ye;var Qe},Ce=(De(!0)-Te)/te;if(Math.abs(ye)<1e-6||!isFinite(Ce)){if(Math.abs(se-ce)<1e-6)return this.easeTo(t,n);const Ae=ce<se?-1:1;Ce=Math.abs(Math.log(ce/se))/te,tt=()=>0,Ne=Qe=>Math.exp(Ae*te*Qe)}return t.duration="duration"in t?+t.duration:1e3*Ce/("screenSpeed"in t?+t.screenSpeed/te:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=g!==w,this._pitching=C!==y,this._padding=!a.isPaddingEqual(E),this._prepareEase(n,!1),this.terrain&&this._prepareElevation(H),this._ease(Ae=>{const Qe=Ae*Ce,Dt=1/Ne(Qe);a.zoom=Ae===1?U:h+a.scaleZoom(Dt),this._rotating&&(a.bearing=c.z.number(g,w,Ae)),this._pitching&&(a.pitch=c.z.number(y,C,Ae)),this._padding&&(a.interpolatePadding(b,E,Ae),F=a.centerPoint.add(R)),this.terrain&&!t.freezeElevation&&this._updateElevation(Ae);const ot=Ae===1?H:a.unproject(Y.add(j.mult(tt(Qe))).mult(Dt));a.setLocationAtPoint(a.renderWorldCopies?ot.wrap():ot,F),this._applyUpdatedTransform(a),this._fireMoveEvents(n)},()=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(n)},t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,n){var o;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const a=this._onEaseEnd;delete this._onEaseEnd,a.call(this,n)}return t||(o=this.handlers)===null||o===void 0||o.stop(!1),this}_ease(t,n,o){o.animate===!1||o.duration===0?(t(1),n()):(this._easeStart=le.now(),this._easeOptions=o,this._onEaseFrame=t,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(t,n){t=c.b3(t,-180,180);const o=Math.abs(t-n);return Math.abs(t-360-n)<o&&(t-=360),Math.abs(t+360-n)<o&&(t+=360),t}_normalizeCenter(t,n){if(!n.renderWorldCopies||n.lngRange)return;const o=t.lng-n.center.lng;t.lng+=o>180?-360:o<-180?360:0}queryTerrainElevation(t){return this.terrain?this.terrain.getElevationForLngLatZoom(c.N.convert(t),this.transform.tileZoom)-this.transform.elevation:null}}const Aa={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class $n{constructor(t=Aa){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=oe.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=oe.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=oe.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(){oe.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 g=h.getSource();g.attribution&&t.indexOf(g.attribution)<0&&t.push(g.attribution)}}t=t.filter(a=>String(a).trim()),t.sort((a,h)=>a.length-h.length),t=t.filter((a,h)=>{for(let g=h+1;g<t.length;g++)if(t[g].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 xr{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=oe.create("div","maplibregl-ctrl");const n=oe.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(){oe.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class Fe{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 ql=c.Y([{name:"a_pos3d",type:"Int16",components:3}]);class Ma 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 g=a.canonical.z-t.canonical.z,y=a.canonical.x-(a.canonical.x>>g<<g),b=a.canonical.y-(a.canonical.y>>g<<g),w=c.X>>g;c.aQ(h.posMatrix,0,w,0,w,0,1),c.J(h.posMatrix,h.posMatrix,[-y*w,-b*w,0]),n[o]=h}else if(t.canonical.isChildOf(a.canonical)){const h=t.clone();h.posMatrix=new Float64Array(16);const g=t.canonical.z-a.canonical.z,y=t.canonical.x-(t.canonical.x>>g<<g),b=t.canonical.y-(t.canonical.y>>g<<g),w=c.X>>g;c.aQ(h.posMatrix,0,c.X,0,c.X,0,1),c.J(h.posMatrix,h.posMatrix,[y*w,b*w,0]),c.K(h.posMatrix,h.posMatrix,[1/2**g,1/2**g,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 Zl{constructor(t,n,o){this.painter=t,this.sourceCache=new Ma(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 g=this.getTerrainData(t),y=(h=g.tile)===null||h===void 0?void 0:h.dem;if(!y)return 0;const b=function($,H,U){var W=H[0],Y=H[1];return $[0]=U[0]*W+U[4]*Y+U[12],$[1]=U[1]*W+U[5]*Y+U[13],$}([],[n/a*c.X,o/a*c.X],g.u_terrain_matrix),w=[b[0]*y.dim,b[1]*y.dim],C=Math.floor(w[0]),E=Math.floor(w[1]),R=w[0]-C,F=w[1]-E;return y.get(C,E)*(1-R)*(1-F)+y.get(C+1,E)*R*(1-F)+y.get(C,E+1)*(1-R)*F+y.get(C+1,E+1)*R*F}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 St(a,h,a.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new St(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 St(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 g=t.canonical.x-(t.canonical.x>>h<<h),y=t.canonical.y-(t.canonical.y>>h<<h),b=c.bb(new Float64Array(16),[1/(c.X<<h),1/(c.X<<h),0]);c.J(b,b,[g*c.X,y*c.X,0]),this._demMatrixCache[t.key]={matrix:b,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 St(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 St(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,g=0;h<this._coordsTextureSize;h++)for(let y=0;y<this._coordsTextureSize;y++,g+=4)n[g+0]=255&y,n[g+1]=255&h,n[g+2]=y>>8<<4|h>>8,n[g+3]=0;const o=new c.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(n.buffer)),a=new St(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),g=Math.round(t.y*this.painter.pixelRatio/devicePixelRatio),y=Math.round(this.painter.height/devicePixelRatio);o.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),a.readPixels(h,y-g-1,1,1,a.RGBA,a.UNSIGNED_BYTE,n),o.bindFramebuffer.set(null);const b=n[0]+(n[2]>>4<<8),w=n[1]+((15&n[2])<<8),C=this.coordsIndex[255-n[3]],E=C&&this.sourceCache.getTileByID(C);if(!E)return null;const R=this._coordsTextureSize,F=(1<<E.tileID.canonical.z)*R;return new c.Z((E.tileID.canonical.x*R+b)/F+E.tileID.wrap,(E.tileID.canonical.y*R+w)/F,this.getElevation(E.tileID,b,w,R))}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,g=a*a;for(let E=0;E<=a;E++)for(let R=0;R<=a;R++)n.emplaceBack(R*h,E*h,0);for(let E=0;E<g;E+=a+1)for(let R=0;R<a;R++)o.emplaceBack(R+E,a+R+E+1,a+R+E+2),o.emplaceBack(R+E,a+R+E+2,R+E+1);const y=n.length,b=y+2*(a+1);for(const E of[0,1])for(let R=0;R<=a;R++)for(const F of[0,1])n.emplaceBack(R*h,E*c.X,F);for(let E=0;E<2*a;E+=2)o.emplaceBack(b+E,b+E+1,b+E+3),o.emplaceBack(b+E,b+E+3,b+E+2),o.emplaceBack(y+E,y+E+3,y+E+1),o.emplaceBack(y+E,y+E+2,y+E+3);const w=n.length,C=w+2*(a+1);for(const E of[0,1])for(let R=0;R<=a;R++)for(const F of[0,1])n.emplaceBack(E*c.X,R*h,F);for(let E=0;E<2*a;E+=2)o.emplaceBack(w+E,w+E+1,w+E+3),o.emplaceBack(w+E,w+E+3,w+E+2),o.emplaceBack(C+E,C+E+3,C+E+1),o.emplaceBack(C+E,C+E+2,C+E+3);return this._mesh=new Fl(t.createVertexBuffer(n,ql.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,g=o.y*a,y=Math.floor(h/c.X),b=Math.floor(g/c.X);return{tileID:new c.S(n,0,n,y,b),mercatorX:h,mercatorY:g}}}class As{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 St(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 vr={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class Gl{constructor(t,n){this.painter=t,this.terrain=n,this.pool=new As(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 g=this.terrain.sourceCache.getTerrainCoords(h);for(const y in g)this._coordsDescendingInv[o][y]||(this._coordsDescendingInv[o][y]=[]),this._coordsDescendingInv[o][y].push(g[y])}}this._coordsDescendingInvStr={};for(const o of t._order){const a=t._layers[o],h=a.source;if(vr[a.type]&&!this._coordsDescendingInvStr[h]){this._coordsDescendingInvStr[h]={};for(const g in this._coordsDescendingInv[h])this._coordsDescendingInvStr[h][g]=this._coordsDescendingInv[h][g].map(y=>y.key).sort().join()}}for(const o of this._renderableTiles)for(const a in this._coordsDescendingInvStr){const h=this._coordsDescendingInvStr[a][o.tileID.key];h&&h!==o.rttCoords[a]&&(o.rtt=[])}}renderLayer(t){if(t.isHidden(this.painter.transform.zoom))return!1;const n=t.type,o=this.painter,a=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(vr[n]&&(this._prevType&&vr[this._prevType]||this._stacks.push([]),this._prevType=n,this._stacks[this._stacks.length-1].push(t.id),!a))return!0;if(vr[this._prevType]||vr[n]&&a){this._prevType=n;const h=this._stacks.length-1,g=this._stacks[h]||[];for(const y of this._renderableTiles){if(this.pool.isFull()&&(ws(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(y),y.rtt[h]){const w=this.pool.getObjectForId(y.rtt[h].id);if(w.stamp===y.rtt[h].stamp){this.pool.useObject(w);continue}}const b=this.pool.getOrCreateFreeObject();this.pool.useObject(b),this.pool.stampObject(b),y.rtt[h]={id:b.id,stamp:b.stamp},o.context.bindFramebuffer.set(b.fbo.framebuffer),o.context.clear({color:c.aN.transparent,stencil:0}),o.currentStencilSource=void 0;for(let w=0;w<g.length;w++){const C=o.style._layers[g[w]],E=C.source?this._coordsDescendingInv[C.source][y.tileID.key]:[y.tileID];o.context.viewport.set([0,0,b.fbo.width,b.fbo.height]),o._renderTileClippingMasks(C,E),o.renderLayer(o,o.style.sourceCaches[C.source],C,E),C.source&&(y.rttCoords[C.source]=this._coordsDescendingInvStr[C.source][y.tileID.key])}}return ws(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects(),vr[n]}return!1}}const ze={"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"},za=fe,nh={hash:!1,interactive:!0,bearingSnap:7,attributionControl:Aa,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},Hl=u=>{u.touchstart=u.dragStart,u.touchmoveWindow=u.dragMove,u.touchend=u.dragEnd},Da={showCompass:!0,showZoom:!0,visualizePitch:!1};class Xl{constructor(t,n,o=!1){this.mousedown=g=>{this.startMouse(c.e({},g,{ctrlKey:!0,preventDefault:()=>g.preventDefault()}),oe.mousePos(this.element,g)),oe.addEventListener(window,"mousemove",this.mousemove),oe.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=g=>{this.moveMouse(g,oe.mousePos(this.element,g))},this.mouseup=g=>{this.mouseRotate.dragEnd(g),this.mousePitch&&this.mousePitch.dragEnd(g),this.offTemp()},this.touchstart=g=>{g.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=oe.touchPos(this.element,g.targetTouches)[0],this.startTouch(g,this._startPos),oe.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),oe.addEventListener(window,"touchend",this.touchend))},this.touchmove=g=>{g.targetTouches.length!==1?this.reset():(this._lastPos=oe.touchPos(this.element,g.targetTouches)[0],this.moveTouch(g,this._lastPos))},this.touchend=g=>{g.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()},this.reset=()=>{this.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=ya({clickTolerance:a,enable:!0}),this.touchRotate=(({enable:g,clickTolerance:y,bearingDegreesPerPixelMoved:b=.8})=>{const w=new yo;return new zt({clickTolerance:y,move:(C,E)=>({bearingDelta:(E.x-C.x)*b}),moveStateManager:w,enable:g,assignEvents:Hl})})({clickTolerance:a,enable:!0}),this.map=t,o&&(this.mousePitch=xn({clickTolerance:h,enable:!0}),this.touchPitch=(({enable:g,clickTolerance:y,pitchDegreesPerPixelMoved:b=-.5})=>{const w=new yo;return new zt({clickTolerance:y,move:(C,E)=>({pitchDelta:(E.y-C.y)*b}),moveStateManager:w,enable:g,assignEvents:Hl})})({clickTolerance:h,enable:!0})),oe.addEventListener(n,"mousedown",this.mousedown),oe.addEventListener(n,"touchstart",this.touchstart,{passive:!1}),oe.addEventListener(n,"touchcancel",this.reset)}startMouse(t,n){this.mouseRotate.dragStart(t,n),this.mousePitch&&this.mousePitch.dragStart(t,n),oe.disableDrag()}startTouch(t,n){this.touchRotate.dragStart(t,n),this.touchPitch&&this.touchPitch.dragStart(t,n),oe.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;oe.removeEventListener(t,"mousedown",this.mousedown),oe.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),oe.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),oe.removeEventListener(window,"touchend",this.touchend),oe.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){oe.enableDrag(),oe.removeEventListener(window,"mousemove",this.mousemove),oe.removeEventListener(window,"mouseup",this.mouseup),oe.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),oe.removeEventListener(window,"touchend",this.touchend)}}let Kr;function Wl(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),g=n.locationPoint(u).distSqr(t);n.locationPoint(a).distSqr(t)<g?u=a:n.locationPoint(h).distSqr(t)<g&&(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 La={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 La)o.remove(`maplibregl-${n}-anchor-${a}`);o.add(`maplibregl-${n}-anchor-${t}`)}class Pt 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?Wl(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 g="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?g="rotateX(0deg)":this._pitchAlignment==="map"&&(g=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||n&&n.type!=="moveend"||(this._pos=this._pos.round()),oe.setTransform(this._element,`${La[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${g} ${h}`),le.frameAsync(new AbortController).then(()=>{this._updateOpacity(n&&n.type==="moveend")}).catch(()=>{})},this._onMove=n=>{if(!this._isDragging){const o=this._clickTolerance||this._map._clickTolerance;this._isDragging=n.point.dist(this._pointerdownPos)>=o}this._isDragging&&(this._pos=n.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new c.k("dragstart"))),this.fire(new c.k("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new c.k("dragend")),this._state="inactive"},this._addDragHandler=n=>{this._element.contains(n.originalEvent.target)&&(n.preventDefault(),this._positionDelta=n.point.sub(this._pos).add(this._offset),this._pointerdownPos=n.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=t&&t.anchor||"center",this._color=t&&t.color||"#3FB1CE",this._scale=t&&t.scale||1,this._draggable=t&&t.draggable||!1,this._clickTolerance=t&&t.clickTolerance||0,this._subpixelPositioning=t&&t.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||"auto",this._pitchAlignment=t&&t.pitchAlignment&&t.pitchAlignment!=="auto"?t.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(t==null?void 0:t.opacity,t==null?void 0:t.opacityWhenCovered),t&&t.element)this._element=t.element,this._offset=c.P.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=oe.create("div");const n=oe.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=oe.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 g=oe.createNS("http://www.w3.org/2000/svg","g");g.setAttributeNS(null,"fill-rule","nonzero");const y=oe.createNS("http://www.w3.org/2000/svg","g");y.setAttributeNS(null,"transform","translate(3.0, 29.0)"),y.setAttributeNS(null,"fill","#000000");const b=[{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 W of b){const Y=oe.createNS("http://www.w3.org/2000/svg","ellipse");Y.setAttributeNS(null,"opacity","0.04"),Y.setAttributeNS(null,"cx","10.5"),Y.setAttributeNS(null,"cy","5.80029008"),Y.setAttributeNS(null,"rx",W.rx),Y.setAttributeNS(null,"ry",W.ry),y.appendChild(Y)}const w=oe.createNS("http://www.w3.org/2000/svg","g");w.setAttributeNS(null,"fill",this._color);const C=oe.createNS("http://www.w3.org/2000/svg","path");C.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),w.appendChild(C);const E=oe.createNS("http://www.w3.org/2000/svg","g");E.setAttributeNS(null,"opacity","0.25"),E.setAttributeNS(null,"fill","#000000");const R=oe.createNS("http://www.w3.org/2000/svg","path");R.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"),E.appendChild(R);const F=oe.createNS("http://www.w3.org/2000/svg","g");F.setAttributeNS(null,"transform","translate(6.0, 7.0)"),F.setAttributeNS(null,"fill","#FFFFFF");const $=oe.createNS("http://www.w3.org/2000/svg","g");$.setAttributeNS(null,"transform","translate(8.0, 8.0)");const H=oe.createNS("http://www.w3.org/2000/svg","circle");H.setAttributeNS(null,"fill","#000000"),H.setAttributeNS(null,"opacity","0.25"),H.setAttributeNS(null,"cx","5.5"),H.setAttributeNS(null,"cy","5.5"),H.setAttributeNS(null,"r","5.4999962");const U=oe.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"),$.appendChild(H),$.appendChild(U),g.appendChild(y),g.appendChild(w),g.appendChild(E),g.appendChild(F),g.appendChild($),n.appendChild(g),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),oe.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),g=a.terrain.getElevationForLngLatZoom(this._lngLat,a.transform.tileZoom);if(a.transform.lngLatToCameraDepth(this._lngLat,g)-h<.006)return void(this._element.style.opacity=this._opacity);const y=-this._offset.y/a.transform._pixelPerMeter,b=Math.sin(a.getPitch()*Math.PI/180)*y,w=a.terrain.depthAtPoint(new c.P(this._pos.x,this._pos.y-this._offset.y)),C=a.transform.lngLatToCameraDepth(this._lngLat,g+b)-w>.006;!((o=this._popup)===null||o===void 0)&&o.isOpen()&&C&&this._popup.remove(),this._element.style.opacity=C?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 xo={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let jn=0,Un=!1;const Jl={maxWidth:100,unit:"metric"};function Ra(u,t,n){const o=n&&n.maxWidth||100,a=u._container.clientHeight/2,h=u.unproject([0,a]),g=u.unproject([o,a]),y=h.distanceTo(g);if(n&&n.unit==="imperial"){const b=3.2808*y;b>5280?Ms(t,o,b/5280,u._getUIString("ScaleControl.Miles")):Ms(t,o,b,u._getUIString("ScaleControl.Feet"))}else n&&n.unit==="nautical"?Ms(t,o,y/1852,u._getUIString("ScaleControl.NauticalMiles")):y>=1e3?Ms(t,o,y/1e3,u._getUIString("ScaleControl.Kilometers")):Ms(t,o,y,u._getUIString("ScaleControl.Meters"))}function Ms(u,t,n,o){const a=function(h){const g=Math.pow(10,`${Math.floor(h)}`.length-1);let y=h/g;return y=y>=10?10:y>=5?5:y>=3?3:y>=2?2:y>=1?1:function(b){const w=Math.pow(10,Math.ceil(-Math.log(b)/Math.LN10));return Math.round(b*w)/w}(y),g*y}(n);u.style.width=t*(a/n)+"px",u.innerHTML=`${a}&nbsp;${o}`}const br={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},vo=["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=fe;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=$n,T.BoxZoomHandler=ma,T.CanvasSource=Xi,T.CooperativeGesturesHandler=rr,T.DoubleClickZoomHandler=Ca,T.DragPanHandler=Ji,T.DragRotateHandler=ir,T.EdgeInsets=uo,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=oe.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){oe.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const u=this._fullscreenButton=oe.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);oe.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=os,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),g=ue.fromLngLat(n,o);this._map.fitBounds(g,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=oe.create("button","maplibregl-ctrl-geolocate",this._container),oe.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=oe.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Pt({element:this._dotElement}),this._circleElement=oe.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Pt({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({},xo,u)}onAdd(u){return this._map=u,this._container=oe.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(),oe.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=Ss,T.ImageSource=Ar,T.KeyboardHandler=Ta,T.LngLatBounds=ue,T.LogoControl=xr,T.Map=class extends rh{constructor(u){c.be.mark(c.bf.create);const t=Object.assign(Object.assign({},nh),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 ha(t.minZoom,t.maxZoom,t.minPitch,t.maxPitch,t.renderWorldCopies),{bearingSnap:t.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new Fe,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({},ze),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=He.addThrottleControl(()=>this.isMoving()),this._requestManager=new Ft(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=po(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 ih(this,t),this._hash=t.hash&&new Ss(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 $n(typeof t.attributionControl=="boolean"?void 0:t.attributionControl)),t.maplibreLogo&&this.addControl(new xr,t.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",n=>{this._update(n.dataType==="style"),this.fire(new c.k(`${n.dataType}data`,n))}),this.on("dataloading",n=>{this.fire(new c.k(`${n.dataType}dataloading`,n))}),this.on("dataabort",n=>{this.fire(new c.k("sourcedataabort",n))})}_getMapId(){return this._mapId}addControl(u,t){if(t===void 0&&(t=u.getDefaultPosition?u.getDefaultPosition():"top-right"),!u||!u.onAdd)return this.fire(new c.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const n=u.onAdd(this);this._controls.push(u);const o=this._controlPositions[t];return t.indexOf("bottom")!==-1?o.insertBefore(n,o.firstChild):o.appendChild(n),this}removeControl(u){if(!u||!u.onRemove)return this.fire(new c.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(u);return t>-1&&this._controls.splice(t,1),u.onRemove(this),this}hasControl(u){return this._controls.indexOf(u)>-1}calculateCameraOptionsFromTo(u,t,n,o){return o==null&&this.terrain&&(o=this.terrain.getElevationForLngLatZoom(n,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(u,t,n,o)}resize(u){var t;const n=this._containerDimensions(),o=n[0],a=n[1],h=this._getClampedPixelRatio(o,a);if(this._resizeCanvas(o,a,h),this.painter.resize(o,a,h),this.painter.overLimit()){const y=this.painter.context.gl;this._maxCanvasSize=[y.drawingBufferWidth,y.drawingBufferHeight];const b=this._getClampedPixelRatio(o,a);this._resizeCanvas(o,a,b),this.painter.resize(o,a,b)}this.transform.resize(o,a),(t=this._requestedCameraState)===null||t===void 0||t.resize(o,a);const g=!this._moving;return g&&(this.stop(),this.fire(new c.k("movestart",u)).fire(new c.k("move",u))),this.fire(new c.k("resize",u)),g&&this.fire(new c.k("moveend",u)),this}_getClampedPixelRatio(u,t){const{0:n,1:o}=this._maxCanvasSize,a=this.getPixelRatio(),h=u*a,g=t*a;return Math.min(h>n?n/h:1,g>o?o/g: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 g=this.getLayer(t)?this.queryRenderedFeatures(h.point,{layers:[t]}):[];g.length?o||(o=!0,n.call(this,new Ti(u,this,h.originalEvent,{features:g}))):o=!1},mouseout:()=>{o=!1}}}}if(u==="mouseleave"||u==="mouseout"){let o=!1;return{layer:t,listener:n,delegates:{mousemove:g=>{(this.getLayer(t)?this.queryRenderedFeatures(g.point,{layers:[t]}):[]).length?o=!0:o&&(o=!1,n.call(this,new Ti(u,this,g.originalEvent)))},mouseout:g=>{o&&(o=!1,n.call(this,new Ti(u,this,g.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 g=a[h];if(g.layer===t&&g.listener===n){for(const y in g.delegates)this.off(y,g.delegates[y]);return a.splice(h,1),this}}})(),this)}queryRenderedFeatures(u,t){if(!this.style)return[];let n;const o=u instanceof c.P||Array.isArray(u),a=o?u:[[0,0],[this.transform.width,this.transform.height]];if(t=t||(o?{}:u)||{},a instanceof c.P||typeof a[0]=="number")n=[c.P.convert(a)];else{const h=c.P.convert(a[0]),g=c.P.convert(a[1]);n=[h,new c.P(g.x,h.y),g,new c.P(h.x,g.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 Zo(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 Zo(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 Zl(this.painter,t,u),this.painter.renderToTexture=new Gl(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:g,content:y,textFitWidth:b,textFitHeight:w}=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:C,height:E,data:R}=t,F=t;return this.style.addImage(u,{data:new c.R({width:C,height:E},new Uint8Array(R)),pixelRatio:o,stretchX:h,stretchY:g,content:y,textFitWidth:b,textFitHeight:w,sdf:a,version:0,userImage:F}),F.onAdd&&F.onAdd(this,u),this}}{const{width:C,height:E,data:R}=le.getImageData(t);this.style.addImage(u,{data:new c.R({width:C,height:E},R),pixelRatio:o,stretchX:h,stretchY:g,content:y,textFitWidth:b,textFitHeight:w,sdf:a,version:0})}}updateImage(u,t){const n=this.style.getImage(u);if(!n)return this.fire(new c.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const o=t instanceof HTMLImageElement||c.b(t)?le.getImageData(t):t,{width:a,height:h,data:g}=o;if(a===void 0||h===void 0)return this.fire(new c.j(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(a!==n.data.width||h!==n.data.height)return this.fire(new c.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));const y=!(t instanceof HTMLImageElement||c.b(t));return n.data.replace(g,y),this.style.updateImage(u,n),this}getImage(u){return this.style.getImage(u)}hasImage(u){return u?!!this.style.getImage(u):(this.fire(new c.j(new Error("Missing required image id"))),!1)}removeImage(u){this.style.removeImage(u)}loadImage(u){return He.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=oe.create("div","maplibregl-canvas-container",u);this._interactive&&t.classList.add("maplibregl-interactive"),this._canvas=oe.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=oe.create("div","maplibregl-control-container",u),h=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(g=>{h[g]=oe.create("div",`maplibregl-ctrl-${g} `,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 Ol(n,this.transform),ht.testSupport(n)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(u){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||u,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(u){return this._update(),this._renderTaskQueue.add(u)}_cancelRenderFrame(u){this._renderTaskQueue.remove(u)}_render(u){const t=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(u),this._removed)return;let n=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const a=this.transform.zoom,h=le.now();this.style.zoomHistory.update(a,h);const g=new c.a9(a,{now:h,fadeDuration:t,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),y=g.crossFadingFactor();y===1&&y===this._crossFadingFactor||(n=!0,this._crossFadingFactor=y),this.style.update(g)}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),He.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),oe.remove(this._canvasContainer),oe.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),c.be.clearMetrics(),this._removed=!0,this.fire(new c.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,le.frameAsync(this._frameRequest).then(u=>{c.be.frame(u),this._frameRequest=null,this._render(u)}).catch(()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(u){this._showTileBoundaries!==u&&(this._showTileBoundaries=u,this._update())}get showPadding(){return!!this._showPadding}set showPadding(u){this._showPadding!==u&&(this._showPadding=u,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(u){this._showCollisionBoxes!==u&&(this._showCollisionBoxes=u,u?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(u){this._showOverdrawInspector!==u&&(this._showOverdrawInspector=u,this._update())}get repaint(){return!!this._repaint}set repaint(u){this._repaint!==u&&(this._repaint=u,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(u){this._vertices=u,this._update()}get version(){return za}getCameraTargetElevation(){return this.transform.elevation}},T.MapMouseEvent=Ti,T.MapTouchEvent=Ts,T.MapWheelEvent=pa,T.Marker=Pt,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({},Da,u),this._container=oe.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})),oe.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})),oe.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=oe.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 Xl(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){oe.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=oe.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&&oe.remove(this._content),this._container&&(oe.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=oe.create("div","maplibregl-popup",this._map.getContainer()),this._tip=oe.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const y of this.options.className.split(" "))this._container.classList.add(y);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=this._map.transform.renderWorldCopies&&!this._trackPointer?Wl(this._lngLat,this._flatPos,this._map.transform):(n=this._lngLat)===null||n===void 0?void 0:n.wrap(),this._trackPointer&&!t)return;const o=this._flatPos=this._pos=this._trackPointer&&t?t:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&t?t:this._map.transform.locationPoint(this._lngLat));let a=this.options.anchor;const h=qe(this.options.offset);if(!a){const y=this._container.offsetWidth,b=this._container.offsetHeight;let w;w=o.y+h.bottom.y<b?["top"]:o.y>this._map.transform.height-b?["bottom"]:[],o.x<y/2?w.push("left"):o.x>this._map.transform.width-y/2&&w.push("right"),a=w.length===0?"bottom":w.join("-")}let g=o.add(h[a]);this.options.subpixelPositioning||(g=g.round()),oe.setTransform(this._container,`${La[a]} translate(${g.x}px,${g.y}px)`),Yr(this._container,a,"popup")},this._onClose=()=>{this.remove()},this.options=c.e(Object.create(br),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=oe.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=oe.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const u=this._container.querySelector(vo);u&&u.focus()}},T.RasterDEMTileSource=jt,T.RasterTileSource=yt,T.ScaleControl=class{constructor(u){this._onMove=()=>{Ra(this._map,this._container,this.options)},this.setUnit=t=>{this.options.unit=t,Ra(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Jl),u)}getDefaultPosition(){return"bottom-left"}onAdd(u){return this._map=u,this._container=oe.create("div","maplibregl-ctrl maplibregl-ctrl-scale",u.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){oe.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},T.ScrollZoomHandler=Ia,T.Style=Zo,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=oe.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=oe.create("button","maplibregl-ctrl-terrain",this._container),oe.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(){oe.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},T.TwoFingersTouchPitchHandler=Sa,T.TwoFingersTouchRotateHandler=wa,T.TwoFingersTouchZoomHandler=va,T.TwoFingersTouchZoomRotateHandler=Ea,T.VectorTileSource=ss,T.VideoSource=zn,T.addSourceType=(u,t)=>c._(void 0,void 0,void 0,function*(){if(ls(u))throw new Error(`A source type called "${u}" already exists.`);((n,o)=>{as[n]=o})(u,t)}),T.clearPrewarmedResources=function(){const u=Oi;u&&(u.isPreloaded()&&u.numActive()===1?(u.release($r),Oi=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 mr().getRTLTextPluginStatus()},T.getVersion=function(){return Je},T.getWorkerCount=function(){return pr.workerCount},T.getWorkerUrl=function(){return c.a.WORKER_URL},T.importScriptInWorkers=function(u){return ns().broadcast("IS",u)},T.prewarm=function(){an().acquire($r)},T.setMaxParallelImageRequests=function(u){c.a.MAX_PARALLEL_IMAGE_REQUESTS=u},T.setRTLTextPlugin=function(u,t){return mr().setRTLTextPlugin(u,t)},T.setWorkerCount=function(u){pr.workerCount=u},T.setWorkerUrl=function(u){c.a.WORKER_URL=u}});var Z=k;return Z})})(Wh);var Lp=Wh.exports;const In=Dp(Lp);function Rp(f){const v=[{type:"fill",minzoom:f.pointZoom||0,paint:{"fill-color":f.color||"#ccc","fill-outline-color":f.stroke||"#blue","fill-opacity":f.opacity||1}}];return f.pointZoom&&v.push({type:"circle",maxzoom:f.pointZoom,paint:{"circle-color":f.color||"#ccc","circle-stroke-color":f.stroke||"#ccc","circle-stroke-width":f.width||1,"circle-opacity":f.opacity||1}}),f.label&&v.push({type:"symbol",layout:{"text-field":["get",f.label],"text-font":["Open Sans Regular"],"text-size":12,"text-anchor":"center"},paint:{"text-color":"#000","text-halo-color":"#fff","text-halo-width":1.5}}),v}function Bp(f){const v=[{type:"line",paint:{"line-color":f.color||"#ccc","line-opacity":f.opacity||1}}];return f.label&&v.push({type:"symbol",layout:{"text-field":["get",f.label],"text-font":["Open Sans Regular"],"text-size":12,"symbol-placement":"line-center"},paint:{"text-color":"#000","text-halo-color":"#fff","text-halo-width":1.5}}),v}function Fp(f){const v=[{type:"circle",maxzoom:f.icon&&+f.iconZoom||22,paint:{"circle-radius":f.radius||6,"circle-stroke-color":f.stroke||"#ccc","circle-stroke-width":f.width||1,"circle-color":f.color||"blue","circle-opacity":f.opacity||1}}];return f!=null&&f.clusterZoom&&(v.push({type:"circle",filter:["has","point_count"],paint:{"circle-color":["step",["get","point_count"],"#51bbd6",100,"#f1f075",750,"#f28cb1"],"circle-radius":["step",["get","point_count"],20,100,30,750,40]}}),v.push({type:"symbol",filter:["has","point_count"],layout:{"text-field":["get","point_count"],"text-font":["Open Sans Regular"],"text-size":12}})),f.icon&&v.push({type:"symbol",minzoom:+f.iconZoom||16,layout:{"icon-image":f.icon,"icon-allow-overlap":!0}}),f.label&&v.push({type:"symbol",layout:{"text-field":["get",f.label],"text-font":["Open Sans Regular"],"text-size":12,"text-anchor":"top"},paint:{"text-color":"#000","text-halo-color":"#fff","text-halo-width":1.5}}),v}function Op(f){if(!f)return null;const v=f.type||"point";return v==="polygon"?Rp(f):v==="line"?Bp(f):Fp(f)}const Jh=["#69D2E7","yellow","#FE4365","#125B9A","#41B3A2","#D7C3F1","#F1D3CE"],Vp=["ma-star","ma-water","ma-swimming","fa-home","fa-search","fa-trash","fa-check"],Kh={};async function Yh(f,v,k="api"){const P=await fetch(`${k}/gis-layer/${f}/${v}`),{rows:L}=await P.json();return L}async function bc(f,v,k,P){if(!f)return null;const L=JSON.parse(JSON.stringify(f)),Z=L.colorAttr?await Yh(v,L.colorAttr,P):null;Z==null||Z.forEach((c,fe)=>{var me,ve;c.color=c.color||((me=L.colorSet)==null?void 0:me[c.id])||((ve=L.colorSet)==null?void 0:ve[fe])||Jh[fe%Jh.length],c.icon=L.icon?L.icon.split("+")[0]+"+"+c.color.replace("#","")+".png":null});const T=L.iconAttr?await Yh(v,L.iconAttr,P):null;if(T==null||T.forEach((c,fe)=>{var ht,je,Ke,Oe;const me=c.icon||((ht=L.iconSet)==null?void 0:ht[c.id])||((je=L.iconPattern)==null?void 0:je.replace("{id}",c.id))||((Ke=L.iconSet)==null?void 0:Ke[fe])||(L.iconPrefix?null:Vp[fe]);if(!me)return;const ve=c.color||((Oe=L.color)==null?void 0:Oe.replace("#",""))||"red",[le="pin6",oe="m"]=L.icon?L.icon.split("-"):[];c.icon=L.iconPrefix||me!=null&&me.includes("/")?(L.iconPrefix||"")+me:`${le}-${oe}-${me}+${ve}.png`}),L.colorAttr&&Z){const c=["match",["get",L.colorAttr]];Z.filter(fe=>fe.id).forEach(fe=>{c.push(fe.id),c.push(fe.color)}),c.push(L.color||"gray"),L.color=c}if(L.icon&&L.iconAttr&&T){const c=["match",["get",L.iconAttr]];T.filter(fe=>fe.icon).forEach(({id:fe,icon:me})=>{if(L.colorAttr&&Z){c.push(fe);const ve=["match",["get",L.colorAttr]];Z.forEach(le=>{ve.push(le.id);const oe=me.split("+")[0]+"+"+le.color.replace("#","")+".png";ve.push(oe),Vs(oe,k,P)}),ve.push(L.icon),c.push(ve)}else c.push(fe),c.push(me),Vs(me,k,P)}),c.push((L.iconPrefix||"")+L.icon),Vs((L.iconPrefix||"")+L.icon,k,P),L.icon=c}else if(L.icon&&L.colorAttr&&Z){const c=["match",["get",L.colorAttr]];Z.forEach(fe=>{c.push(fe.id),c.push(fe.icon),Vs(fe.icon,k,P)}),c.push(L.icon),Vs(L.icon,k,P),L.icon=c}else L.icon&&await Vs(L.icon,k,P);return Np({style:f,colors:Z,icons:T,map:k,id:v}),Op(L)}async function Vs(f="pin4-sm-mi-plumber+f45942.png",v=null,k){if(Kh[f])return null;Kh[f]=!0;const P=await(v==null?void 0:v.loadImage(f!=null&&f.startsWith("/")||f!=null&&f.includes("//")?f:`${k}/marker_icon/${f.replace(".png","")}.png`));v==null||v.addImage(f,P.data)}function Np({style:f,colors:v,icons:k,map:P,id:L}){P.legend||Object.assign(P,{legend:{}}),window.map||(window.map=P),Object.assign(P.legend,{[L]:{icon:f.icon,colors:v,icons:k,color:f.color||"blue",type:f.type||"point"}})}const Oo={data(){return{layerList:[],activeLayer:""}},computed:{interactiveSources(){return this.layerList.filter(f=>f==null?void 0:f.interactive).map(f=>f.id)}},methods:{moveLayer(f,v=this.map){v.getStyle().layers.forEach(k=>{k.id.match(f)&&v.moveLayer(k.id)})},async setVisible(f,v=!0,k=this.map){if(!f)return;const P=(f==null?void 0:f.id)||f,L=this.layerList.find(T=>T.id===f)||f;if(!(L!=null&&L.id))throw new Error("MixinError: Layer has no id");k.getStyle().layers.filter(T=>T.id.match(P)).forEach(T=>{k.setLayoutProperty(T.id,"visibility",v?"visible":"none")}),v&&await this.addLayer(L)},async addLayer(f,v=this==null?void 0:this.map){var L,Z;const k=this.layerList.find(T=>T.id===f)||f;!this.map.getStyle()||this.map.getStyle().layers.find(T=>T.id===k.id)||(this.layerList.find(T=>T.id===k.id)||this.layerList.push(k),(k.service==="vtile"||k.service==="vector"||(L=k.url)!=null&&L.includes(".vmt"))&&this.addVtileLayer(k,v),k.service==="geojson"&&this.addGeoJsonLayer(k,v),((Z=k.url)!=null&&Z.includes(".png")||["tms","raster"].includes(k.service))&&await this.addRasterLayer(k,v))},async addRasterLayer(f,v=this==null?void 0:this.map){v.getSource(f.id)||(typeof f.bounds=="string"&&Object.assign(f,{bounds:f.bounds.split(",")}),await v.addSource(f.id,{type:"raster",tiles:[`${this.prefix?f==null?void 0:f.url.replace(/(\/api[^\/]*)/,this.prefix):f==null?void 0:f.url}${f!=null&&f.url.includes("?")?"&":"?"}dt=${new Date().toISOString().split("T")[0]}`],tileSize:256,...f.bounds?{bounds:f.bounds.map(k=>k-0)}:{},...f!=null&&f.scheme?{scheme:f==null?void 0:f.scheme}:{}}),await v.addLayer({id:f.id,type:"raster",source:f.id,minzoom:0,maxzoom:(f==null?void 0:f.maxzoom)||22}))},async updateStyle(f,v=this==null?void 0:this.map){const k=f.id;v.getStyle().layers.forEach(async L=>{L.source===k&&await v.removeLayer(L.id)}),(await bc(f.style,f.source||f.id,v,this.prefix)||f.layers||[]).forEach((L,Z)=>{const T={...L,id:`${f.id}-${Z}`,source:f.id,"source-layer":L["source-layer"]||f.source||f.id,maxzoom:+L.maxzoom||24,minzoom:+L.minzoom||0};v.addLayer(T)})},async addVtileLayer(f,v=this==null?void 0:this.map){var Z;const k=["props","pointZoom","clusterZoom"].filter(T=>f[T]).map(T=>`&${T}=${f[T]}`),P={type:"vector",tiles:[`${(Z=f==null?void 0:f.url)!=null&&Z.startsWith("http")?"":window.location.origin}${f==null?void 0:f.url}${k}`],minzoom:f.minzoom||5,maxzoom:f.maxzoom||24};v.addSource(f.id,P),(f.layers||await bc(f.style,f.source||f.id,v,this.prefix)||[]).forEach((T,c)=>{const fe={...T,id:`${f.id}-${c}`,source:f.id,"source-layer":T["source-layer"]||f.source||f.id,maxzoom:+T.maxzoom||24,minzoom:+T.minzoom||0};v.addLayer(fe)})},async addGeoJsonLayer(f,v=this.map){var L;const k=f.data||((L=f==null?void 0:f.url)!=null&&L.startsWith("http")?"":window.location.origin)+f.url;v.addSource(f.id,{type:"geojson",data:k}),(await bc(f.style,k.source||k.id,v,this.prefix)||f.layers||[]).forEach(Z=>{const T={...Z,source:f.id,id:Z.id||f.id,maxzoom:+Z.maxzoom||24,minzoom:+Z.minzoom||0,type:Z.type||"circle"};v.addLayer(T)})},setLayerData(f,v){this.layerList=this.layerList.map(k=>k.id===f?{...k,...v}:k)},async removeLayer(f,v=this.map){v.getSource(f)&&(await v.getStyle().layers.forEach(async k=>{k.source===f&&await v.removeLayer(k.id)}),await v.removeSource(f))},async setFilter(f,v){const k=this.layerList.find(L=>L.id===f);await(await this.map.getSource(f)).setTiles([`${window.location.origin}${k.url}${k.url.includes("?")?"&":"?"}filter=${v}${k.props?`&props=${k.props}`:""}`])},async changeBaseLayer(f){f!==this.activeLayer&&(this.activeLayer&&this.map.setLayoutProperty(this.activeLayer,"visibility","none"),await this.setVisible(this.activeLayer,!1),await this.setVisible(f,!0),this.map.getStyle().layers.forEach(v=>{v.source!==f&&v.type!=="background"&&this.map.moveLayer(v.id)}),this.activeLayer=f)},async refreshLayer(f,v=this.map){await v.getStyle().layers.forEach(k=>{k.source===f&&v.removeLayer(k.id)}),await v.removeSource(f),this.setVisible(f)}}},Fi=(f,v)=>{const k=f.__vccOpts||f;for(const[P,L]of v)k[P]=L;return k},$p={},jp={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"},Up=[N.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 qp(f,v){return N.openBlock(),N.createElementBlock("svg",jp,Up)}const Zp=Fi($p,[["render",qp]]);function Qh(f,v){return function(){return f.apply(v,arguments)}}const{toString:Gp}=Object.prototype,{getPrototypeOf:wc}=Object,sl=(f=>v=>{const k=Gp.call(v);return f[k]||(f[k]=k.slice(8,-1).toLowerCase())})(Object.create(null)),kr=f=>(f=f.toLowerCase(),v=>sl(v)===f),ol=f=>v=>typeof v===f,{isArray:Ns}=Array,Vo=ol("undefined");function Hp(f){return f!==null&&!Vo(f)&&f.constructor!==null&&!Vo(f.constructor)&&Yi(f.constructor.isBuffer)&&f.constructor.isBuffer(f)}const eu=kr("ArrayBuffer");function Xp(f){let v;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?v=ArrayBuffer.isView(f):v=f&&f.buffer&&eu(f.buffer),v}const Wp=ol("string"),Yi=ol("function"),tu=ol("number"),al=f=>f!==null&&typeof f=="object",Jp=f=>f===!0||f===!1,ll=f=>{if(sl(f)!=="object")return!1;const v=wc(f);return(v===null||v===Object.prototype||Object.getPrototypeOf(v)===null)&&!(Symbol.toStringTag in f)&&!(Symbol.iterator in f)},Kp=kr("Date"),Yp=kr("File"),Qp=kr("Blob"),ef=kr("FileList"),tf=f=>al(f)&&Yi(f.pipe),rf=f=>{let v;return f&&(typeof FormData=="function"&&f instanceof FormData||Yi(f.append)&&((v=sl(f))==="formdata"||v==="object"&&Yi(f.toString)&&f.toString()==="[object FormData]"))},nf=kr("URLSearchParams"),[sf,of,af,lf]=["ReadableStream","Request","Response","Headers"].map(kr),cf=f=>f.trim?f.trim():f.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function No(f,v,{allOwnKeys:k=!1}={}){if(f===null||typeof f>"u")return;let P,L;if(typeof f!="object"&&(f=[f]),Ns(f))for(P=0,L=f.length;P<L;P++)v.call(null,f[P],P,f);else{const Z=k?Object.getOwnPropertyNames(f):Object.keys(f),T=Z.length;let c;for(P=0;P<T;P++)c=Z[P],v.call(null,f[c],c,f)}}function iu(f,v){v=v.toLowerCase();const k=Object.keys(f);let P=k.length,L;for(;P-- >0;)if(L=k[P],v===L.toLowerCase())return L;return null}const ts=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,ru=f=>!Vo(f)&&f!==ts;function Sc(){const{caseless:f}=ru(this)&&this||{},v={},k=(P,L)=>{const Z=f&&iu(v,L)||L;ll(v[Z])&&ll(P)?v[Z]=Sc(v[Z],P):ll(P)?v[Z]=Sc({},P):Ns(P)?v[Z]=P.slice():v[Z]=P};for(let P=0,L=arguments.length;P<L;P++)arguments[P]&&No(arguments[P],k);return v}const hf=(f,v,k,{allOwnKeys:P}={})=>(No(v,(L,Z)=>{k&&Yi(L)?f[Z]=Qh(L,k):f[Z]=L},{allOwnKeys:P}),f),uf=f=>(f.charCodeAt(0)===65279&&(f=f.slice(1)),f),df=(f,v,k,P)=>{f.prototype=Object.create(v.prototype,P),f.prototype.constructor=f,Object.defineProperty(f,"super",{value:v.prototype}),k&&Object.assign(f.prototype,k)},pf=(f,v,k,P)=>{let L,Z,T;const c={};if(v=v||{},f==null)return v;do{for(L=Object.getOwnPropertyNames(f),Z=L.length;Z-- >0;)T=L[Z],(!P||P(T,f,v))&&!c[T]&&(v[T]=f[T],c[T]=!0);f=k!==!1&&wc(f)}while(f&&(!k||k(f,v))&&f!==Object.prototype);return v},ff=(f,v,k)=>{f=String(f),(k===void 0||k>f.length)&&(k=f.length),k-=v.length;const P=f.indexOf(v,k);return P!==-1&&P===k},mf=f=>{if(!f)return null;if(Ns(f))return f;let v=f.length;if(!tu(v))return null;const k=new Array(v);for(;v-- >0;)k[v]=f[v];return k},gf=(f=>v=>f&&v instanceof f)(typeof Uint8Array<"u"&&wc(Uint8Array)),_f=(f,v)=>{const P=(f&&f[Symbol.iterator]).call(f);let L;for(;(L=P.next())&&!L.done;){const Z=L.value;v.call(f,Z[0],Z[1])}},yf=(f,v)=>{let k;const P=[];for(;(k=f.exec(v))!==null;)P.push(k);return P},xf=kr("HTMLFormElement"),vf=f=>f.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(k,P,L){return P.toUpperCase()+L}),nu=(({hasOwnProperty:f})=>(v,k)=>f.call(v,k))(Object.prototype),bf=kr("RegExp"),su=(f,v)=>{const k=Object.getOwnPropertyDescriptors(f),P={};No(k,(L,Z)=>{let T;(T=v(L,Z,f))!==!1&&(P[Z]=T||L)}),Object.defineProperties(f,P)},wf=f=>{su(f,(v,k)=>{if(Yi(f)&&["arguments","caller","callee"].indexOf(k)!==-1)return!1;const P=f[k];if(Yi(P)){if(v.enumerable=!1,"writable"in v){v.writable=!1;return}v.set||(v.set=()=>{throw Error("Can not rewrite read-only method '"+k+"'")})}})},Sf=(f,v)=>{const k={},P=L=>{L.forEach(Z=>{k[Z]=!0})};return Ns(f)?P(f):P(String(f).split(v)),k},Tf=()=>{},kf=(f,v)=>f!=null&&Number.isFinite(f=+f)?f:v,Tc="abcdefghijklmnopqrstuvwxyz",ou="0123456789",au={DIGIT:ou,ALPHA:Tc,ALPHA_DIGIT:Tc+Tc.toUpperCase()+ou},If=(f=16,v=au.ALPHA_DIGIT)=>{let k="";const{length:P}=v;for(;f--;)k+=v[Math.random()*P|0];return k};function Cf(f){return!!(f&&Yi(f.append)&&f[Symbol.toStringTag]==="FormData"&&f[Symbol.iterator])}const Ef=f=>{const v=new Array(10),k=(P,L)=>{if(al(P)){if(v.indexOf(P)>=0)return;if(!("toJSON"in P)){v[L]=P;const Z=Ns(P)?[]:{};return No(P,(T,c)=>{const fe=k(T,L+1);!Vo(fe)&&(Z[c]=fe)}),v[L]=void 0,Z}}return P};return k(f,0)},Pf=kr("AsyncFunction"),Af=f=>f&&(al(f)||Yi(f))&&Yi(f.then)&&Yi(f.catch),lu=((f,v)=>f?setImmediate:v?((k,P)=>(ts.addEventListener("message",({source:L,data:Z})=>{L===ts&&Z===k&&P.length&&P.shift()()},!1),L=>{P.push(L),ts.postMessage(k,"*")}))(`axios@${Math.random()}`,[]):k=>setTimeout(k))(typeof setImmediate=="function",Yi(ts.postMessage)),Mf=typeof queueMicrotask<"u"?queueMicrotask.bind(ts):typeof process<"u"&&process.nextTick||lu,ge={isArray:Ns,isArrayBuffer:eu,isBuffer:Hp,isFormData:rf,isArrayBufferView:Xp,isString:Wp,isNumber:tu,isBoolean:Jp,isObject:al,isPlainObject:ll,isReadableStream:sf,isRequest:of,isResponse:af,isHeaders:lf,isUndefined:Vo,isDate:Kp,isFile:Yp,isBlob:Qp,isRegExp:bf,isFunction:Yi,isStream:tf,isURLSearchParams:nf,isTypedArray:gf,isFileList:ef,forEach:No,merge:Sc,extend:hf,trim:cf,stripBOM:uf,inherits:df,toFlatObject:pf,kindOf:sl,kindOfTest:kr,endsWith:ff,toArray:mf,forEachEntry:_f,matchAll:yf,isHTMLForm:xf,hasOwnProperty:nu,hasOwnProp:nu,reduceDescriptors:su,freezeMethods:wf,toObjectSet:Sf,toCamelCase:vf,noop:Tf,toFiniteNumber:kf,findKey:iu,global:ts,isContextDefined:ru,ALPHABET:au,generateString:If,isSpecCompliantForm:Cf,toJSONObject:Ef,isAsyncFn:Pf,isThenable:Af,setImmediate:lu,asap:Mf};function ct(f,v,k,P,L){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=f,this.name="AxiosError",v&&(this.code=v),k&&(this.config=k),P&&(this.request=P),L&&(this.response=L)}ge.inherits(ct,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:ge.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const cu=ct.prototype,hu={};["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(f=>{hu[f]={value:f}}),Object.defineProperties(ct,hu),Object.defineProperty(cu,"isAxiosError",{value:!0}),ct.from=(f,v,k,P,L,Z)=>{const T=Object.create(cu);return ge.toFlatObject(f,T,function(fe){return fe!==Error.prototype},c=>c!=="isAxiosError"),ct.call(T,f.message,v,k,P,L),T.cause=f,T.name=f.name,Z&&Object.assign(T,Z),T};const zf=null;function kc(f){return ge.isPlainObject(f)||ge.isArray(f)}function uu(f){return ge.endsWith(f,"[]")?f.slice(0,-2):f}function du(f,v,k){return f?f.concat(v).map(function(L,Z){return L=uu(L),!k&&Z?"["+L+"]":L}).join(k?".":""):v}function Df(f){return ge.isArray(f)&&!f.some(kc)}const Lf=ge.toFlatObject(ge,{},null,function(v){return/^is[A-Z]/.test(v)});function cl(f,v,k){if(!ge.isObject(f))throw new TypeError("target must be an object");v=v||new FormData,k=ge.toFlatObject(k,{metaTokens:!0,dots:!1,indexes:!1},!1,function(Ke,Oe){return!ge.isUndefined(Oe[Ke])});const P=k.metaTokens,L=k.visitor||ve,Z=k.dots,T=k.indexes,fe=(k.Blob||typeof Blob<"u"&&Blob)&&ge.isSpecCompliantForm(v);if(!ge.isFunction(L))throw new TypeError("visitor must be a function");function me(je){if(je===null)return"";if(ge.isDate(je))return je.toISOString();if(!fe&&ge.isBlob(je))throw new ct("Blob is not supported. Use a Buffer instead.");return ge.isArrayBuffer(je)||ge.isTypedArray(je)?fe&&typeof Blob=="function"?new Blob([je]):Buffer.from(je):je}function ve(je,Ke,Oe){let ft=je;if(je&&!Oe&&typeof je=="object"){if(ge.endsWith(Ke,"{}"))Ke=P?Ke:Ke.slice(0,-2),je=JSON.stringify(je);else if(ge.isArray(je)&&Df(je)||(ge.isFileList(je)||ge.endsWith(Ke,"[]"))&&(ft=ge.toArray(je)))return Ke=uu(Ke),ft.forEach(function(He,Ft){!(ge.isUndefined(He)||He===null)&&v.append(T===!0?du([Ke],Ft,Z):T===null?Ke:Ke+"[]",me(He))}),!1}return kc(je)?!0:(v.append(du(Oe,Ke,Z),me(je)),!1)}const le=[],oe=Object.assign(Lf,{defaultVisitor:ve,convertValue:me,isVisitable:kc});function ht(je,Ke){if(!ge.isUndefined(je)){if(le.indexOf(je)!==-1)throw Error("Circular reference detected in "+Ke.join("."));le.push(je),ge.forEach(je,function(ft,st){(!(ge.isUndefined(ft)||ft===null)&&L.call(v,ft,ge.isString(st)?st.trim():st,Ke,oe))===!0&&ht(ft,Ke?Ke.concat(st):[st])}),le.pop()}}if(!ge.isObject(f))throw new TypeError("data must be an object");return ht(f),v}function pu(f){const v={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(f).replace(/[!'()~]|%20|%00/g,function(P){return v[P]})}function Ic(f,v){this._pairs=[],f&&cl(f,this,v)}const fu=Ic.prototype;fu.append=function(v,k){this._pairs.push([v,k])},fu.toString=function(v){const k=v?function(P){return v.call(this,P,pu)}:pu;return this._pairs.map(function(L){return k(L[0])+"="+k(L[1])},"").join("&")};function Rf(f){return encodeURIComponent(f).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function mu(f,v,k){if(!v)return f;const P=k&&k.encode||Rf,L=k&&k.serialize;let Z;if(L?Z=L(v,k):Z=ge.isURLSearchParams(v)?v.toString():new Ic(v,k).toString(P),Z){const T=f.indexOf("#");T!==-1&&(f=f.slice(0,T)),f+=(f.indexOf("?")===-1?"?":"&")+Z}return f}class gu{constructor(){this.handlers=[]}use(v,k,P){return this.handlers.push({fulfilled:v,rejected:k,synchronous:P?P.synchronous:!1,runWhen:P?P.runWhen:null}),this.handlers.length-1}eject(v){this.handlers[v]&&(this.handlers[v]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(v){ge.forEach(this.handlers,function(P){P!==null&&v(P)})}}const _u={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Bf={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:Ic,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},Cc=typeof window<"u"&&typeof document<"u",Ff=(f=>Cc&&["ReactNative","NativeScript","NS"].indexOf(f)<0)(typeof navigator<"u"&&navigator.product),Of=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Vf=Cc&&window.location.href||"http://localhost",Ir={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Cc,hasStandardBrowserEnv:Ff,hasStandardBrowserWebWorkerEnv:Of,origin:Vf},Symbol.toStringTag,{value:"Module"})),...Bf};function Nf(f,v){return cl(f,new Ir.classes.URLSearchParams,Object.assign({visitor:function(k,P,L,Z){return Ir.isNode&&ge.isBuffer(k)?(this.append(P,k.toString("base64")),!1):Z.defaultVisitor.apply(this,arguments)}},v))}function $f(f){return ge.matchAll(/\w+|\[(\w*)]/g,f).map(v=>v[0]==="[]"?"":v[1]||v[0])}function jf(f){const v={},k=Object.keys(f);let P;const L=k.length;let Z;for(P=0;P<L;P++)Z=k[P],v[Z]=f[Z];return v}function yu(f){function v(k,P,L,Z){let T=k[Z++];if(T==="__proto__")return!0;const c=Number.isFinite(+T),fe=Z>=k.length;return T=!T&&ge.isArray(L)?L.length:T,fe?(ge.hasOwnProp(L,T)?L[T]=[L[T],P]:L[T]=P,!c):((!L[T]||!ge.isObject(L[T]))&&(L[T]=[]),v(k,P,L[T],Z)&&ge.isArray(L[T])&&(L[T]=jf(L[T])),!c)}if(ge.isFormData(f)&&ge.isFunction(f.entries)){const k={};return ge.forEachEntry(f,(P,L)=>{v($f(P),L,k,0)}),k}return null}function Uf(f,v,k){if(ge.isString(f))try{return(v||JSON.parse)(f),ge.trim(f)}catch(P){if(P.name!=="SyntaxError")throw P}return(k||JSON.stringify)(f)}const $o={transitional:_u,adapter:["xhr","http","fetch"],transformRequest:[function(v,k){const P=k.getContentType()||"",L=P.indexOf("application/json")>-1,Z=ge.isObject(v);if(Z&&ge.isHTMLForm(v)&&(v=new FormData(v)),ge.isFormData(v))return L?JSON.stringify(yu(v)):v;if(ge.isArrayBuffer(v)||ge.isBuffer(v)||ge.isStream(v)||ge.isFile(v)||ge.isBlob(v)||ge.isReadableStream(v))return v;if(ge.isArrayBufferView(v))return v.buffer;if(ge.isURLSearchParams(v))return k.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),v.toString();let c;if(Z){if(P.indexOf("application/x-www-form-urlencoded")>-1)return Nf(v,this.formSerializer).toString();if((c=ge.isFileList(v))||P.indexOf("multipart/form-data")>-1){const fe=this.env&&this.env.FormData;return cl(c?{"files[]":v}:v,fe&&new fe,this.formSerializer)}}return Z||L?(k.setContentType("application/json",!1),Uf(v)):v}],transformResponse:[function(v){const k=this.transitional||$o.transitional,P=k&&k.forcedJSONParsing,L=this.responseType==="json";if(ge.isResponse(v)||ge.isReadableStream(v))return v;if(v&&ge.isString(v)&&(P&&!this.responseType||L)){const T=!(k&&k.silentJSONParsing)&&L;try{return JSON.parse(v)}catch(c){if(T)throw c.name==="SyntaxError"?ct.from(c,ct.ERR_BAD_RESPONSE,this,null,this.response):c}}return v}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ir.classes.FormData,Blob:Ir.classes.Blob},validateStatus:function(v){return v>=200&&v<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ge.forEach(["delete","get","head","post","put","patch"],f=>{$o.headers[f]={}});const qf=ge.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"]),Zf=f=>{const v={};let k,P,L;return f&&f.split(`
580
+ `),j=y.createShader(y.FRAGMENT_SHADER);if(y.isContextLost())return void(this.failedToCreate=!0);if(y.shaderSource(j,W),y.compileShader(j),!y.getShaderParameter(j,y.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${y.getShaderInfoLog(j)}`);y.attachShader(this.program,j);const te=y.createShader(y.VERTEX_SHADER);if(y.isContextLost())return void(this.failedToCreate=!0);if(y.shaderSource(te,Y),y.compileShader(te),!y.getShaderParameter(te,y.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${y.getShaderInfoLog(te)}`);y.attachShader(this.program,te),this.attributes={};const se={};this.numAttributes=C.length;for(let ce=0;ce<this.numAttributes;ce++)C[ce]&&(y.bindAttribLocation(this.program,ce,C[ce]),this.attributes[C[ce]]=ce);if(y.linkProgram(this.program),!y.getProgramParameter(this.program,y.LINK_STATUS))throw new Error(`Program failed to link: ${y.getProgramInfoLog(this.program)}`);y.deleteShader(te),y.deleteShader(j);for(let ce=0;ce<H.length;ce++){const ye=H[ce];if(ye&&!se[ye]){const we=y.getUniformLocation(this.program,ye);we&&(se[ye]=we)}}this.fixedUniforms=a(t,se),this.terrainUniforms=((ce,ye)=>({u_depth:new c.aI(ce,ye.u_depth),u_terrain:new c.aI(ce,ye.u_terrain),u_terrain_dim:new c.aJ(ce,ye.u_terrain_dim),u_terrain_matrix:new c.aK(ce,ye.u_terrain_matrix),u_terrain_unpack:new c.aL(ce,ye.u_terrain_unpack),u_terrain_exaggeration:new c.aJ(ce,ye.u_terrain_exaggeration)}))(t,se),this.binderUniforms=o?o.getUniforms(t,se):[]}draw(t,n,o,a,h,g,y,b,w,C,E,R,F,$,H,U,W,Y){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(g),b){t.activeTexture.set(j.TEXTURE2),j.bindTexture(j.TEXTURE_2D,b.depthTexture),t.activeTexture.set(j.TEXTURE3),j.bindTexture(j.TEXTURE_2D,b.texture);for(const se in this.terrainUniforms)this.terrainUniforms[se].set(b[se])}for(const se in this.fixedUniforms)this.fixedUniforms[se].set(y[se]);H&&H.setUniforms(t,this.binderUniforms,F,{zoom:$});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 R.get()){const ce=se.vaos||(se.vaos={});(ce[w]||(ce[w]=new Gs)).bind(t,this,C,H?H.getPaintVertexBuffers():[],E,se.vertexOffset,U,W,Y),j.drawElements(n,se.primitiveLength*te,j.UNSIGNED_SHORT,se.primitiveOffset*te*2)}}}function Xs(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,g=h*(n.tileID.canonical.x+n.tileID.wrap*a),y=h*n.tileID.canonical.y;return{u_image:0,u_texsize:n.imageAtlasTexture.size,u_scale:[o,u.fromScale,u.toScale],u_fade:u.t,u_pixel_coord_upper:[g>>16,y>>16],u_pixel_coord_lower:[65535&g,65535&y]}}const Ws=(u,t,n,o)=>{const a=t.style.light,h=a.properties.get("position"),g=[h.x,h.y,h.z],y=function(){var w=new c.A(9);return c.A!=Float32Array&&(w[1]=0,w[2]=0,w[3]=0,w[5]=0,w[6]=0,w[7]=0),w[0]=1,w[4]=1,w[8]=1,w}();a.properties.get("anchor")==="viewport"&&function(w,C){var E=Math.sin(C),R=Math.cos(C);w[0]=R,w[1]=E,w[2]=0,w[3]=-E,w[4]=R,w[5]=0,w[6]=0,w[7]=0,w[8]=1}(y,-t.transform.angle),function(w,C,E){var R=C[0],F=C[1],$=C[2];w[0]=R*E[0]+F*E[3]+$*E[6],w[1]=R*E[1]+F*E[4]+$*E[7],w[2]=R*E[2]+F*E[5]+$*E[8]}(g,g,y);const b=a.properties.get("color");return{u_matrix:u,u_lightpos:g,u_lightintensity:a.properties.get("intensity"),u_lightcolor:[b.r,b.g,b.b],u_vertical_gradient:+n,u_opacity:o}},Js=(u,t,n,o,a,h,g)=>c.e(Ws(u,t,n,o),Xs(h,t,g),{u_height_factor:-Math.pow(2,a.overscaledZ)/g.tileSize/8}),fs=u=>({u_matrix:u}),Dn=(u,t,n,o)=>c.e(fs(u),Xs(n,t,o)),Nc=(u,t)=>({u_matrix:u,u_world:t}),$c=(u,t,n,o,a)=>c.e(Dn(u,t,n,o),{u_world:a}),gl=(u,t,n,o)=>{const a=u.transform;let h,g;if(o.paint.get("circle-pitch-alignment")==="map"){const y=rt(n,1,a.zoom);h=!0,g=[y,y]}else h=!1,g=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:g}},jc=(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}),ms=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 gs=(u,t,n,o)=>{const a=u.transform;return{u_matrix:xl(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]]}},Ks=(u,t,n,o,a)=>c.e(gs(u,t,n,a),{u_image:0,u_image_height:o}),_l=(u,t,n,o,a)=>{const h=u.transform,g=un(t,h);return{u_matrix:xl(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:[g,o.fromScale,o.toScale],u_fade:o.t,u_units_to_pixels:[1/h.pixelsToGLUnits[0],1/h.pixelsToGLUnits[1]]}},yl=(u,t,n,o,a,h)=>{const g=u.lineAtlas,y=un(t,u.transform),b=n.layout.get("line-cap")==="round",w=g.getDash(o.from,b),C=g.getDash(o.to,b),E=w.width*a.fromScale,R=C.width*a.toScale;return c.e(gs(u,t,n,h),{u_patternscale_a:[y/E,-w.height/2],u_patternscale_b:[y/R,-C.height/2],u_sdfgamma:g.width/(256*Math.min(E,R)*u.pixelRatio)/2,u_image:0,u_tex_y_a:w.y,u_tex_y_b:C.y,u_mix:a.t})};function un(u,t){return 1/rt(u,1,t.tileZoom)}function xl(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 Uc=(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:(g=a.paint.get("raster-saturation"),g>0?1-1/(1.001-g):-g),u_contrast_factor:(h=a.paint.get("raster-contrast"),h>0?1/(1-h):1+h),u_spin_weights:qc(a.paint.get("raster-hue-rotate"))};var h,g};function qc(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 vl=(u,t,n,o,a,h,g,y,b,w,C,E,R,F)=>{const $=g.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:$.cameraToCenterDistance,u_pitch:$.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:$.width/$.height,u_fade_change:g.options.fadeDuration?g.symbolFadeChange:1,u_matrix:y,u_label_plane_matrix:b,u_coord_matrix:w,u_is_text:+E,u_pitch_with_map:+o,u_is_along_line:a,u_is_variable_anchor:h,u_texsize:R,u_texture:0,u_translation:C,u_pitched_scale:F}},bl=(u,t,n,o,a,h,g,y,b,w,C,E,R,F,$)=>{const H=g.transform;return c.e(vl(u,t,n,o,a,h,g,y,b,w,C,E,R,$),{u_gamma_scale:o?Math.cos(H._pitch)*H.cameraToCenterDistance:1,u_device_pixel_ratio:g.pixelRatio,u_is_halo:+F})},Zc=(u,t,n,o,a,h,g,y,b,w,C,E,R,F)=>c.e(bl(u,t,n,o,a,h,g,y,b,w,C,!0,E,!0,F),{u_texsize_icon:R,u_texture_icon:1}),Ys=(u,t,n)=>({u_matrix:u,u_opacity:t,u_color:n}),Ho=(u,t,n,o,a,h)=>c.e(function(g,y,b,w){const C=b.imageManager.getPattern(g.from.toString()),E=b.imageManager.getPattern(g.to.toString()),{width:R,height:F}=b.imageManager.getPixelSize(),$=Math.pow(2,w.tileID.overscaledZ),H=w.tileSize*Math.pow(2,b.transform.tileZoom)/$,U=H*(w.tileID.canonical.x+w.tileID.wrap*$),W=H*w.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:C.tl,u_pattern_br_a:C.br,u_pattern_tl_b:E.tl,u_pattern_br_b:E.br,u_texsize:[R,F],u_mix:y.t,u_pattern_size_a:C.displaySize,u_pattern_size_b:E.displaySize,u_scale_a:y.fromScale,u_scale_b:y.toScale,u_tile_units_to_pixels:1/rt(w,1,b.transform.tileZoom),u_pixel_coord_upper:[U>>16,W>>16],u_pixel_coord_lower:[65535&U,65535&W]}}(o,h,n,a),{u_matrix:u,u_opacity:t}),Qs={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 Xo{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 Wo={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class yr{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],g=n.attributes[h.name];g!==void 0&&t.vertexAttribPointer(g,h.components,t[Wo[h.type]],!1,this.itemSize,h.offset+this.itemSize*(o||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Jo=new WeakMap;function Ln(u){var t;if(Jo.has(u))return Jo.get(u);{const n=(t=u.getParameter(u.VERSION))===null||t===void 0?void 0:t.startsWith("WebGL 2.0");return Jo.set(u,n),n}}class pt{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 _s extends pt{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 Gc extends pt{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class eo extends pt{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class Hc extends pt{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 Rn extends pt{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class Xc extends pt{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class wl extends pt{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 Wc extends pt{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 Sl extends pt{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 Ko extends pt{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 Tl extends pt{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 kl extends pt{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class Il extends pt{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 Cl extends pt{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 pt{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 El extends pt{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}}class Jc extends pt{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 Kc extends pt{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class Pl extends pt{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}class ys extends pt{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}}class Yc extends pt{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class to extends pt{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 Qc extends pt{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 eh extends pt{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 Al extends pt{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 Ml extends pt{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 zl extends pt{getDefault(){return null}set(t){const n=this.gl;n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Yo extends pt{getDefault(){return null}set(t){var n;if(t===this.current&&!this.dirty)return;const o=this.gl;Ln(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 Dl extends pt{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 io extends pt{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 Dr extends pt{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 xs extends pt{constructor(t,n){super(t),this.context=t,this.parent=n}getDefault(){return null}}class Qo extends xs{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 ea extends xs{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 Ll extends xs{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 ta{constructor(t,n,o,a,h){this.context=t,this.width=n,this.height=o;const g=t.gl,y=this.framebuffer=g.createFramebuffer();if(this.colorAttachment=new Qo(t,y),a)this.depthAttachment=h?new Ll(t,y):new ea(t,y);else if(h)throw new Error("Stencil cannot be set without depth");if(g.checkFramebufferStatus(g.FRAMEBUFFER)!==g.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 ia{constructor(t){var n,o;if(this.gl=t,this.clearColor=new _s(this),this.clearDepth=new Gc(this),this.clearStencil=new eo(this),this.colorMask=new Hc(this),this.depthMask=new Rn(this),this.stencilMask=new Xc(this),this.stencilFunc=new wl(this),this.stencilOp=new Wc(this),this.stencilTest=new Sl(this),this.depthRange=new Ko(this),this.depthTest=new Tl(this),this.depthFunc=new kl(this),this.blend=new Il(this),this.blendFunc=new Cl(this),this.blendColor=new dn(this),this.blendEquation=new El(this),this.cullFace=new Jc(this),this.cullFaceSide=new Kc(this),this.frontFace=new Pl(this),this.program=new ys(this),this.activeTexture=new Yc(this),this.viewport=new to(this),this.bindFramebuffer=new Qc(this),this.bindRenderbuffer=new eh(this),this.bindTexture=new Al(this),this.bindVertexBuffer=new Ml(this),this.bindElementBuffer=new zl(this),this.bindVertexArray=new Yo(this),this.pixelStoreUnpack=new Dl(this),this.pixelStoreUnpackPremultiplyAlpha=new io(this),this.pixelStoreUnpackFlipY=new Dr(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),Ln(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 Xo(this,t,n)}createVertexBuffer(t,n,o){return new yr(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 ta(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 Ln(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 Ln(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 ut{constructor(t,n,o){this.func=t,this.mask=n,this.range=o}}ut.ReadOnly=!1,ut.ReadWrite=!0,ut.disabled=new ut(519,ut.ReadOnly,[0,1]);const ra=7680;class Vt{constructor(t,n,o,a,h,g){this.test=t,this.ref=n,this.mask=o,this.fail=a,this.depthFail=h,this.pass=g}}Vt.disabled=new Vt({func:519,mask:0},0,0,ra,ra,ra);class Mt{constructor(t,n,o){this.enable=t,this.mode=n,this.frontFace=o}}let vs;function Rl(u,t,n,o,a){const h=u.context,g=h.gl,y=u.useProgram("collisionBox"),b=[];let w=0,C=0;for(let W=0;W<o.length;W++){const Y=o[W],j=t.getTile(Y).getBucket(n);if(!j)continue;const te=a?j.textCollisionBox:j.iconCollisionBox,se=j.collisionCircleArray;if(se.length>0){const ce=c.H();c.aR(ce,j.placementInvProjMatrix,u.transform.glCoordMatrix),c.aR(ce,ce,j.placementViewportMatrix),b.push({circleArray:se,circleOffset:C,transform:Y.posMatrix,invTransform:ce,coord:Y}),w+=se.length/4,C=w}te&&y.draw(h,g.LINES,ut.disabled,Vt.disabled,u.colorModeForRenderPass(),Mt.disabled,{u_matrix:Y.posMatrix,u_pixel_extrude_scale:[1/(E=u.transform).width,1/E.height]},u.style.map.terrain&&u.style.map.terrain.getTerrainData(Y),n.id,te.layoutVertexBuffer,te.indexBuffer,te.segments,null,u.transform.zoom,null,null,te.collisionVertexBuffer)}var E;if(!a||!b.length)return;const R=u.useProgram("collisionCircle"),F=new c.aS;F.resize(4*w),F._trim();let $=0;for(const W of b)for(let Y=0;Y<W.circleArray.length/4;Y++){const j=4*Y,te=W.circleArray[j+0],se=W.circleArray[j+1],ce=W.circleArray[j+2],ye=W.circleArray[j+3];F.emplace($++,te,se,ce,ye,0),F.emplace($++,te,se,ce,ye,1),F.emplace($++,te,se,ce,ye,2),F.emplace($++,te,se,ce,ye,3)}(!vs||vs.length<2*w)&&(vs=function(W){const Y=2*W,j=new c.aU;j.resize(Y),j._trim();for(let te=0;te<Y;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}(w));const H=h.createIndexBuffer(vs,!0),U=h.createVertexBuffer(F,c.aT.members,!0);for(const W of b){const Y=jc(W.transform,W.invTransform,u.transform);R.draw(h,g.TRIANGLES,ut.disabled,Vt.disabled,u.colorModeForRenderPass(),Mt.disabled,Y,u.style.map.terrain&&u.style.map.terrain.getTerrainData(W.coord),n.id,U,H,c.a0.simpleSegment(0,2*W.circleOffset,W.circleArray.length,W.circleArray.length/2),null,u.transform.zoom,null,null,null)}U.destroy(),H.destroy()}Mt.disabled=new Mt(!1,1029,2305),Mt.backCCW=new Mt(!0,1029,2305);const na=c.ao(new Float32Array(16));function ro(u,t,n,o,a,h){const{horizontalAlign:g,verticalAlign:y}=c.av(u);return new c.P((-(g-.5)*t/a+o[0])*h,(-(y-.5)*n/a+o[1])*h)}function no(u,t,n,o,a,h){const g=t.tileAnchorPoint.add(new c.P(t.translation[0],t.translation[1]));if(t.pitchWithMap){let y=o.mult(h);return n||(y=y.rotate(-a)),X(g.add(y),t.labelPlaneMatrix,t.getElevation).point}if(n){const y=pe(t.tileAnchorPoint.x+1,t.tileAnchorPoint.y,t).point.sub(u),b=Math.atan(y.y/y.x)+(y.x<0?Math.PI:0);return u.add(o.rotate(b))}return u.add(o)}function so(u,t,n,o,a,h,g,y,b,w,C,E,R,F){const $=u.text.placedSymbolArray,H=u.text.dynamicLayoutVertexArray,U=u.icon.dynamicLayoutVertexArray,W={};H.clear();for(let Y=0;Y<$.length;Y++){const j=$.get(Y),te=j.hidden||!j.crossTileID||u.allowVerticalPlacement&&!j.placedOrientation?null:o[j.crossTileID];if(te){const se=new c.P(j.anchorX,j.anchorY),ce={getElevation:F,width:a.width,height:a.height,labelPlaneMatrix:h,lineVertexArray:null,pitchWithMap:n,projection:C,projectionCache:null,tileAnchorPoint:se,translation:E,unwrappedTileID:R},ye=n?X(se,g,F):pe(se.x,se.y,ce),we=z(a.cameraToCenterDistance,ye.signedDistanceFromCamera);let De=c.aj(u.textSizeData,b,j)*we/c.aq;n&&(De*=u.tilePixelRatio/y);const{width:Re,height:Se,anchor:Te,textOffset:Ne,textBoxScale:tt}=te,Ce=ro(Te,Re,Se,Ne,tt,De),Ae=C.getPitchedTextCorrection(a,se.add(new c.P(E[0],E[1])),R),Qe=no(ye.point,ce,t,Ce,a.angle,Ae),Dt=u.allowVerticalPlacement&&j.placedOrientation===c.ai.vertical?Math.PI/2:0;for(let ot=0;ot<j.numGlyphs;ot++)c.ak(H,Qe,Dt);w&&j.associatedIconIndex>=0&&(W[j.associatedIconIndex]={shiftedAnchor:Qe,angle:Dt})}else Xe(j.numGlyphs,H)}if(w){U.clear();const Y=u.icon.placedSymbolArray;for(let j=0;j<Y.length;j++){const te=Y.get(j);if(te.hidden)Xe(te.numGlyphs,U);else{const se=W[j];if(se)for(let ce=0;ce<te.numGlyphs;ce++)c.ak(U,se.shiftedAnchor,se.angle);else Xe(te.numGlyphs,U)}}u.icon.dynamicLayoutVertexBuffer.updateData(U)}u.text.dynamicLayoutVertexBuffer.updateData(H)}function sa(u,t,n){return n.iconsInText&&t?"symbolTextAndIcon":u?"symbolSDF":"symbolIcon"}function Jr(u,t,n,o,a,h,g,y,b,w,C,E){const R=u.context,F=R.gl,$=u.transform,H=qs(),U=y==="map",W=b==="map",Y=y!=="viewport"&&n.layout.get("symbol-placement")!=="point",j=U&&!W&&!Y,te=!W&&Y,se=!n.layout.get("symbol-sort-key").isConstant();let ce=!1;const ye=u.depthModeForSublayer(0,ut.ReadOnly),we=n._unevaluatedLayout.hasValue("text-variable-anchor")||n._unevaluatedLayout.hasValue("text-variable-anchor-offset"),De=[],Re=H.getCircleRadiusCorrection($);for(const Se of o){const Te=t.getTile(Se),Ne=Te.getBucket(n);if(!Ne)continue;const tt=a?Ne.text:Ne.icon;if(!tt||!tt.segments.get().length||!tt.hasVisibleVertices)continue;const Ce=tt.programConfigurations.get(n.id),Ae=a||Ne.sdfIcons,Qe=a?Ne.textSizeData:Ne.iconSizeData,Dt=W||$.pitch!==0,ot=u.useProgram(sa(Ae,a,Ne),Ce),dt=c.ah(Qe,$.zoom),Lt=u.style.map.terrain&&u.style.map.terrain.getTerrainData(Se);let di,nr,Rt,Mi,ki=[0,0],pi=null;if(a)nr=Te.glyphAtlasTexture,Rt=F.LINEAR,di=Te.glyphAtlasTexture.size,Ne.iconsInText&&(ki=Te.imageAtlasTexture.size,pi=Te.imageAtlasTexture,Mi=Dt||u.options.rotating||u.options.zooming||Qe.kind==="composite"||Qe.kind==="camera"?F.LINEAR:F.NEAREST);else{const Nt=n.layout.get("icon-size").constantOr(0)!==1||Ne.iconsNeedLinear;nr=Te.imageAtlasTexture,Rt=Ae||u.options.rotating||u.options.zooming||Nt||Dt?F.LINEAR:F.NEAREST,di=Te.imageAtlasTexture.size}const fi=rt(Te,1,u.transform.zoom),sr=te?Se.posMatrix:na,vn=Gr(sr,W,U,u.transform,fi),bo=_r(sr,W,U,u.transform,fi),qn=_r(Se.posMatrix,W,U,u.transform,fi),bn=H.translatePosition(u.transform,Te,h,g),wo=we&&Ne.hasTextData(),Ba=n.layout.get("icon-text-fit")!=="none"&&wo&&Ne.hasIconData();if(Y){const Nt=u.style.map.terrain?(Fa,ti)=>u.style.map.terrain.getElevation(Se,Fa,ti):null,Gn=n.layout.get("text-rotation-alignment")==="map";V(Ne,Se.posMatrix,u,a,vn,qn,W,w,Gn,H,Se.toUnwrapped(),$.width,$.height,bn,Nt)}const oi=Se.posMatrix,or=a&&we||Ba,Qr=Y||or?na:vn,Zn=bo,mi=Ae&&n.paint.get(a?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let gi;gi=Ae?Ne.iconsInText?Zc(Qe.kind,dt,j,W,Y,or,u,oi,Qr,Zn,bn,di,ki,Re):bl(Qe.kind,dt,j,W,Y,or,u,oi,Qr,Zn,bn,a,di,!0,Re):vl(Qe.kind,dt,j,W,Y,or,u,oi,Qr,Zn,bn,a,di,Re);const ri={program:ot,buffers:tt,uniformValues:gi,atlasTexture:nr,atlasTextureIcon:pi,atlasInterpolation:Rt,atlasInterpolationIcon:Mi,isSDF:Ae,hasHalo:mi};if(se&&Ne.canOverlap){ce=!0;const Nt=tt.segments.get();for(const Gn of Nt)De.push({segments:new c.a0([Gn]),sortKey:Gn.sortKey,state:ri,terrainData:Lt})}else De.push({segments:tt.segments,sortKey:0,state:ri,terrainData:Lt})}ce&&De.sort((Se,Te)=>Se.sortKey-Te.sortKey);for(const Se of De){const Te=Se.state;if(R.activeTexture.set(F.TEXTURE0),Te.atlasTexture.bind(Te.atlasInterpolation,F.CLAMP_TO_EDGE),Te.atlasTextureIcon&&(R.activeTexture.set(F.TEXTURE1),Te.atlasTextureIcon&&Te.atlasTextureIcon.bind(Te.atlasInterpolationIcon,F.CLAMP_TO_EDGE)),Te.isSDF){const Ne=Te.uniformValues;Te.hasHalo&&(Ne.u_is_halo=1,pn(Te.buffers,Se.segments,n,u,Te.program,ye,C,E,Ne,Se.terrainData)),Ne.u_is_halo=0}pn(Te.buffers,Se.segments,n,u,Te.program,ye,C,E,Te.uniformValues,Se.terrainData)}}function pn(u,t,n,o,a,h,g,y,b,w){const C=o.context;a.draw(C,C.gl.TRIANGLES,h,g,y,Mt.disabled,b,w,n.id,u.layoutVertexBuffer,u.indexBuffer,t,n.paint,o.transform.zoom,u.programConfigurations.get(n.id),u.dynamicLayoutVertexBuffer,u.opacityVertexBuffer)}function qi(u,t,n,o,a){if(!n||!o||!o.imageAtlas)return;const h=o.imageAtlas.patternPositions;let g=h[n.to.toString()],y=h[n.from.toString()];if(!g&&y&&(g=y),!y&&g&&(y=g),!g||!y){const b=a.getPaintProperty(t);g=h[b],y=h[b]}g&&y&&u.setConstantPatternPositions(g,y)}function oa(u,t,n,o,a,h,g){const y=u.context.gl,b="fill-pattern",w=n.paint.get(b),C=w&&w.constantOr(1),E=n.getCrossfadeParameters();let R,F,$,H,U;g?(F=C&&!n.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",R=y.LINES):(F=C?"fillPattern":"fill",R=y.TRIANGLES);const W=w.constantOr(null);for(const Y of o){const j=t.getTile(Y);if(C&&!j.patternsLoaded())continue;const te=j.getBucket(n);if(!te)continue;const se=te.programConfigurations.get(n.id),ce=u.useProgram(F,se),ye=u.style.map.terrain&&u.style.map.terrain.getTerrainData(Y);C&&(u.context.activeTexture.set(y.TEXTURE0),j.imageAtlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE),se.updatePaintBuffers(E)),qi(se,b,W,j,n);const we=ye?Y:null,De=u.translatePosMatrix(we?we.posMatrix:Y.posMatrix,j,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));if(g){H=te.indexBuffer2,U=te.segments2;const Re=[y.drawingBufferWidth,y.drawingBufferHeight];$=F==="fillOutlinePattern"&&C?$c(De,u,E,j,Re):Nc(De,Re)}else H=te.indexBuffer,U=te.segments,$=C?Dn(De,u,E,j):fs(De);ce.draw(u.context,R,a,u.stencilModeForClipping(Y),h,Mt.disabled,$,ye,n.id,te.layoutVertexBuffer,H,U,n.paint,u.transform.zoom,se)}}function oo(u,t,n,o,a,h,g){const y=u.context,b=y.gl,w="fill-extrusion-pattern",C=n.paint.get(w),E=C.constantOr(1),R=n.getCrossfadeParameters(),F=n.paint.get("fill-extrusion-opacity"),$=C.constantOr(null);for(const H of o){const U=t.getTile(H),W=U.getBucket(n);if(!W)continue;const Y=u.style.map.terrain&&u.style.map.terrain.getTerrainData(H),j=W.programConfigurations.get(n.id),te=u.useProgram(E?"fillExtrusionPattern":"fillExtrusion",j);E&&(u.context.activeTexture.set(b.TEXTURE0),U.imageAtlasTexture.bind(b.LINEAR,b.CLAMP_TO_EDGE),j.updatePaintBuffers(R)),qi(j,w,$,U,n);const se=u.translatePosMatrix(H.posMatrix,U,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),ce=n.paint.get("fill-extrusion-vertical-gradient"),ye=E?Js(se,u,ce,F,H,R,U):Ws(se,u,ce,F);te.draw(y,y.gl.TRIANGLES,a,h,g,Mt.backCCW,ye,Y,n.id,W.layoutVertexBuffer,W.indexBuffer,W.segments,n.paint,u.transform.zoom,j,u.style.map.terrain&&W.centroidVertexBuffer)}}function aa(u,t,n,o,a,h,g){const y=u.context,b=y.gl,w=n.fbo;if(!w)return;const C=u.useProgram("hillshade"),E=u.style.map.terrain&&u.style.map.terrain.getTerrainData(t);y.activeTexture.set(b.TEXTURE0),b.bindTexture(b.TEXTURE_2D,w.colorAttachment.get()),C.draw(y,b.TRIANGLES,a,h,g,Mt.disabled,((R,F,$,H)=>{const U=$.paint.get("hillshade-shadow-color"),W=$.paint.get("hillshade-highlight-color"),Y=$.paint.get("hillshade-accent-color");let j=$.paint.get("hillshade-illumination-direction")*(Math.PI/180);$.paint.get("hillshade-illumination-anchor")==="viewport"&&(j-=R.transform.angle);const te=!R.options.moving;return{u_matrix:H?H.posMatrix:R.transform.calculatePosMatrix(F.tileID.toUnwrapped(),te),u_image:0,u_latrange:Ui(0,F.tileID),u_light:[$.paint.get("hillshade-exaggeration"),j],u_shadow:U,u_highlight:W,u_accent:Y}})(u,n,o,E?t:null),E,o.id,u.rasterBoundsBuffer,u.quadTriangleIndexBuffer,u.rasterBoundsSegments)}function fn(u,t,n,o,a,h){const g=u.context,y=g.gl,b=t.dem;if(b&&b.data){const w=b.dim,C=b.stride,E=b.getPixels();if(g.activeTexture.set(y.TEXTURE1),g.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||u.getTileTexture(C),t.demTexture){const F=t.demTexture;F.update(E,{premultiply:!1}),F.bind(y.NEAREST,y.CLAMP_TO_EDGE)}else t.demTexture=new St(g,E,y.RGBA,{premultiply:!1}),t.demTexture.bind(y.NEAREST,y.CLAMP_TO_EDGE);g.activeTexture.set(y.TEXTURE0);let R=t.fbo;if(!R){const F=new St(g,{width:w,height:w,data:null},y.RGBA);F.bind(y.LINEAR,y.CLAMP_TO_EDGE),R=t.fbo=g.createFramebuffer(w,w,!0,!1),R.colorAttachment.set(F.texture)}g.bindFramebuffer.set(R.framebuffer),g.viewport.set([0,0,w,w]),u.useProgram("hillshadePrepare").draw(g,y.TRIANGLES,o,a,h,Mt.disabled,((F,$)=>{const H=$.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:[H,H],u_zoom:F.overscaledZ,u_unpack:$.getUnpackVector()}})(t.tileID,b),null,n.id,u.rasterBoundsBuffer,u.quadTriangleIndexBuffer,u.rasterBoundsSegments),t.needsHillshadePrepare=!1}}function ao(u,t,n,o,a,h){const g=o.paint.get("raster-fade-duration");if(!h&&g>0){const y=le.now(),b=(y-u.timeAdded)/g,w=t?(y-t.timeAdded)/g:-1,C=n.getSource(),E=a.coveringZoomLevel({tileSize:C.tileSize,roundZoom:C.roundZoom}),R=!t||Math.abs(t.tileID.overscaledZ-E)>Math.abs(u.tileID.overscaledZ-E),F=R&&u.refreshedUponExpiration?1:c.ad(R?b:1-w,0,1);return u.refreshedUponExpiration&&b>=1&&(u.refreshedUponExpiration=!1),t?{opacity:1,mix:1-F}:{opacity:F,mix:0}}return{opacity:1,mix:0}}const lo=new c.aN(1,0,0,1),bs=new c.aN(0,1,0,1),co=new c.aN(0,0,1,1),Bl=new c.aN(1,0,1,1),Bn=new c.aN(0,1,1,1);function mn(u,t,n,o){Fn(u,0,t+n/2,u.transform.width,n,o)}function la(u,t,n,o){Fn(u,t-n/2,0,n,u.transform.height,o)}function Fn(u,t,n,o,a,h){const g=u.context,y=g.gl;y.enable(y.SCISSOR_TEST),y.scissor(t*u.pixelRatio,n*u.pixelRatio,o*u.pixelRatio,a*u.pixelRatio),g.clear({color:h}),y.disable(y.SCISSOR_TEST)}function gt(u,t,n){const o=u.context,a=o.gl,h=n.posMatrix,g=u.useProgram("debug"),y=ut.disabled,b=Vt.disabled,w=u.colorModeForRenderPass(),C="$debug",E=u.style.map.terrain&&u.style.map.terrain.getTerrainData(n);o.activeTexture.set(a.TEXTURE0);const R=t.getTileByID(n.key).latestRawTileData,F=Math.floor((R&&R.byteLength||0)/1024),$=t.getTile(n).tileSize,H=512/Math.min($,512)*(n.overscaledZ/u.transform.zoom)*.5;let U=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(U+=` => ${n.overscaledZ}`),function(W,Y){W.initDebugOverlayCanvas();const j=W.debugOverlayCanvas,te=W.context.gl,se=W.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(Y,5,5),se.strokeText(Y,5,5),W.debugOverlayTexture.update(j),W.debugOverlayTexture.bind(te.LINEAR,te.CLAMP_TO_EDGE)}(u,`${U} ${F}kB`),g.draw(o,a.TRIANGLES,y,b,Et.alphaBlended,Mt.disabled,Wr(h,c.aN.transparent,H),null,C,u.debugBuffer,u.quadTriangleIndexBuffer,u.debugSegments),g.draw(o,a.LINE_STRIP,y,b,w,Mt.disabled,Wr(h,c.aN.red),E,C,u.debugBuffer,u.tileBorderIndexBuffer,u.debugSegments)}function ws(u,t,n){const o=u.context,a=o.gl,h=u.colorModeForRenderPass(),g=new ut(a.LEQUAL,ut.ReadWrite,u.depthRangeFor3D),y=u.useProgram("terrain"),b=t.getTerrainMesh();o.bindFramebuffer.set(null),o.viewport.set([0,0,u.width,u.height]);for(const w of n){const C=u.renderToTexture.getTexture(w),E=t.getTerrainData(w.tileID);o.activeTexture.set(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,C.texture);const R=u.transform.calculatePosMatrix(w.tileID.toUnwrapped()),F=t.getMeshFrameDelta(u.transform.zoom),$=u.transform.calculateFogMatrix(w.tileID.toUnwrapped()),H=Go(R,F,$,u.style.sky,u.transform.pitch);y.draw(o,a.TRIANGLES,g,Vt.disabled,h,Mt.backCCW,H,E,"terrain",b.vertexBuffer,b.indexBuffer,b.segments)}}class Fl{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 Ol{constructor(t,n){this.context=new ia(t),this.transform=n,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:c.ao(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Ye.maxUnderzooming+Ye.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Wi}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,ds.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,ds.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,ds.members),this.viewportSegments=c.a0.simpleSegment(0,0,4,2);const g=new c.aZ;g.emplaceBack(0),g.emplaceBack(1),g.emplaceBack(3),g.emplaceBack(2),g.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(g);const y=new c.aY;y.emplaceBack(0,1,2),y.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(y);const b=this.context.gl;this.stencilClearMode=new Vt({func:b.ALWAYS,mask:0},0,255,b.ZERO,b.ZERO,b.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,ut.disabled,this.stencilClearMode,Et.disabled,Mt.disabled,ms(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(ut.disabled);const h=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const g of n){const y=this._tileClippingMaskIDs[g.key]=this.nextStencilID++,b=this.style.map.terrain&&this.style.map.terrain.getTerrainData(g);h.draw(o,a.TRIANGLES,ut.disabled,new Vt({func:a.ALWAYS,mask:0},y,255,a.KEEP,a.KEEP,a.REPLACE),Et.disabled,Mt.disabled,ms(g.posMatrix),b,"$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((g,y)=>y.overscaledZ-g.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 g={};for(let y=0;y<h;y++)g[y+a]=new Vt({func:n.GEQUAL,mask:255},y+this.nextStencilID,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID+=h,[g,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 ut.disabled;const a=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new ut(o||this.context.gl.LEQUAL,n,[a,a])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(t,n){var o;this.style=t,this.options=n,this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(le.now()),this.imageManager.beginFrame();const a=this.style._order,h=this.style.sourceCaches,g={},y={},b={};for(const w in h){const C=h[w];C.used&&C.prepare(this.context),g[w]=C.getVisibleCoordinates(),y[w]=g[w].slice().reverse(),b[w]=C.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let w=0;w<a.length;w++)if(this.style._layers[a[w]].is3D()){this.opaquePassCutoff=w;break}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const w of a){const C=this.style._layers[w];if(!C.hasOffscreenPass()||C.isHidden(this.transform.zoom))continue;const E=y[C.source];(C.type==="custom"||E.length)&&this.renderLayer(this,h[C.source],C,E)}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(w,C){const E=w.context,R=E.gl,F=((Y,j,te)=>({u_sky_color:Y.properties.get("sky-color"),u_horizon_color:Y.properties.get("horizon-color"),u_horizon:(j.height/2+j.getHorizon())*te,u_sky_horizon_blend:Y.properties.get("sky-horizon-blend")*j.height/2*te}))(C,w.style.map.transform,w.pixelRatio),$=new ut(R.LEQUAL,ut.ReadWrite,[0,1]),H=Vt.disabled,U=w.colorModeForRenderPass(),W=w.useProgram("sky");if(!C.mesh){const Y=new c.aX;Y.emplaceBack(-1,-1),Y.emplaceBack(1,-1),Y.emplaceBack(1,1),Y.emplaceBack(-1,1);const j=new c.aY;j.emplaceBack(0,1,2),j.emplaceBack(0,2,3),C.mesh=new Fl(E.createVertexBuffer(Y,ds.members),E.createIndexBuffer(j),c.a0.simpleSegment(0,0,Y.length,j.length))}W.draw(E,R.TRIANGLES,$,H,U,Mt.disabled,F,void 0,"sky",C.mesh.vertexBuffer,C.mesh.indexBuffer,C.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 w=this.style._layers[a[this.currentLayer]],C=h[w.source],E=g[w.source];this._renderTileClippingMasks(w,E),this.renderLayer(this,C,w,E)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<a.length;this.currentLayer++){const w=this.style._layers[a[this.currentLayer]],C=h[w.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(w))continue;const E=(w.type==="symbol"?b:y)[w.source];this._renderTileClippingMasks(w,g[w.source]),this.renderLayer(this,C,w,E)}if(this.options.showTileBoundaries){const w=function(C,E){let R=null;const F=Object.values(C._layers).flatMap(W=>W.source&&!W.isHidden(E)?[C.sourceCaches[W.source]]:[]),$=F.filter(W=>W.getSource().type==="vector"),H=F.filter(W=>W.getSource().type!=="vector"),U=W=>{(!R||R.getSource().maxzoom<W.getSource().maxzoom)&&(R=W)};return $.forEach(W=>U(W)),R||H.forEach(W=>U(W)),R}(this.style,this.transform.zoom);w&&function(C,E,R){for(let F=0;F<R.length;F++)gt(C,E,R[F])}(this,w,w.getVisibleCoordinates())}this.options.showPadding&&function(w){const C=w.transform.padding;mn(w,w.transform.height-(C.top||0),3,lo),mn(w,C.bottom||0,3,bs),la(w,C.left||0,3,co),la(w,w.transform.width-(C.right||0),3,Bl);const E=w.transform.centerPoint;(function(R,F,$,H){Fn(R,F-1,$-10,2,20,H),Fn(R,F-10,$-1,20,2,H)})(w,E.x,w.transform.height-E.y,Bn)}(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,g){const y=h.context,b=y.gl,w=Et.unblended,C=new ut(b.LEQUAL,ut.ReadWrite,[0,1]),E=g.getTerrainMesh(),R=g.sourceCache.getRenderableTiles(),F=h.useProgram("terrainDepth");y.bindFramebuffer.set(g.getFramebuffer("depth").framebuffer),y.viewport.set([0,0,h.width/devicePixelRatio,h.height/devicePixelRatio]),y.clear({color:c.aN.transparent,depth:1});for(const $ of R){const H=g.getTerrainData($.tileID),U={u_matrix:h.transform.calculatePosMatrix($.tileID.toUnwrapped()),u_ele_delta:g.getMeshFrameDelta(h.transform.zoom)};F.draw(y,b.TRIANGLES,C,Vt.disabled,w,Mt.backCCW,U,H,"terrain",E.vertexBuffer,E.indexBuffer,E.segments)}y.bindFramebuffer.set(null),y.viewport.set([0,0,h.width,h.height])}(this,this.style.map.terrain),function(h,g){const y=h.context,b=y.gl,w=Et.unblended,C=new ut(b.LEQUAL,ut.ReadWrite,[0,1]),E=g.getTerrainMesh(),R=g.getCoordsTexture(),F=g.sourceCache.getRenderableTiles(),$=h.useProgram("terrainCoords");y.bindFramebuffer.set(g.getFramebuffer("coords").framebuffer),y.viewport.set([0,0,h.width/devicePixelRatio,h.height/devicePixelRatio]),y.clear({color:c.aN.transparent,depth:1}),g.coordsIndex=[];for(const H of F){const U=g.getTerrainData(H.tileID);y.activeTexture.set(b.TEXTURE0),b.bindTexture(b.TEXTURE_2D,R.texture);const W={u_matrix:h.transform.calculatePosMatrix(H.tileID.toUnwrapped()),u_terrain_coords_id:(255-g.coordsIndex.length)/255,u_texture:0,u_ele_delta:g.getMeshFrameDelta(h.transform.zoom)};$.draw(y,b.TRIANGLES,C,Vt.disabled,w,Mt.backCCW,W,U,"terrain",E.vertexBuffer,E.indexBuffer,E.segments),g.coordsIndex.push(H.tileID.key)}y.bindFramebuffer.set(null),y.viewport.set([0,0,h.width,h.height])}(this,this.style.map.terrain))}renderLayer(t,n,o,a){if(!o.isHidden(this.transform.zoom)&&(o.type==="background"||o.type==="custom"||(a||[]).length))switch(this.id=o.id,o.type){case"symbol":(function(h,g,y,b,w){if(h.renderPass!=="translucent")return;const C=Vt.disabled,E=h.colorModeForRenderPass();(y._unevaluatedLayout.hasValue("text-variable-anchor")||y._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(R,F,$,H,U,W,Y,j,te){const se=F.transform,ce=qs(),ye=U==="map",we=W==="map";for(const De of R){const Re=H.getTile(De),Se=Re.getBucket($);if(!Se||!Se.text||!Se.text.segments.get().length)continue;const Te=c.ah(Se.textSizeData,se.zoom),Ne=rt(Re,1,F.transform.zoom),tt=Gr(De.posMatrix,we,ye,F.transform,Ne),Ce=$.layout.get("icon-text-fit")!=="none"&&Se.hasIconData();if(Te){const Ae=Math.pow(2,se.zoom-Re.tileID.overscaledZ),Qe=F.style.map.terrain?(ot,dt)=>F.style.map.terrain.getElevation(De,ot,dt):null,Dt=ce.translatePosition(se,Re,Y,j);so(Se,ye,we,te,se,tt,De.posMatrix,Ae,Te,Ce,ce,Dt,De.toUnwrapped(),Qe)}}}(b,h,y,g,y.layout.get("text-rotation-alignment"),y.layout.get("text-pitch-alignment"),y.paint.get("text-translate"),y.paint.get("text-translate-anchor"),w),y.paint.get("icon-opacity").constantOr(1)!==0&&Jr(h,g,y,b,!1,y.paint.get("icon-translate"),y.paint.get("icon-translate-anchor"),y.layout.get("icon-rotation-alignment"),y.layout.get("icon-pitch-alignment"),y.layout.get("icon-keep-upright"),C,E),y.paint.get("text-opacity").constantOr(1)!==0&&Jr(h,g,y,b,!0,y.paint.get("text-translate"),y.paint.get("text-translate-anchor"),y.layout.get("text-rotation-alignment"),y.layout.get("text-pitch-alignment"),y.layout.get("text-keep-upright"),C,E),g.map.showCollisionBoxes&&(Rl(h,g,y,b,!0),Rl(h,g,y,b,!1))})(t,n,o,a,this.style.placement.variableOffsets);break;case"circle":(function(h,g,y,b){if(h.renderPass!=="translucent")return;const w=y.paint.get("circle-opacity"),C=y.paint.get("circle-stroke-width"),E=y.paint.get("circle-stroke-opacity"),R=!y.layout.get("circle-sort-key").isConstant();if(w.constantOr(1)===0&&(C.constantOr(1)===0||E.constantOr(1)===0))return;const F=h.context,$=F.gl,H=h.depthModeForSublayer(0,ut.ReadOnly),U=Vt.disabled,W=h.colorModeForRenderPass(),Y=[];for(let j=0;j<b.length;j++){const te=b[j],se=g.getTile(te),ce=se.getBucket(y);if(!ce)continue;const ye=ce.programConfigurations.get(y.id),we=h.useProgram("circle",ye),De=ce.layoutVertexBuffer,Re=ce.indexBuffer,Se=h.style.map.terrain&&h.style.map.terrain.getTerrainData(te),Te={programConfiguration:ye,program:we,layoutVertexBuffer:De,indexBuffer:Re,uniformValues:gl(h,te,se,y),terrainData:Se};if(R){const Ne=ce.segments.get();for(const tt of Ne)Y.push({segments:new c.a0([tt]),sortKey:tt.sortKey,state:Te})}else Y.push({segments:ce.segments,sortKey:0,state:Te})}R&&Y.sort((j,te)=>j.sortKey-te.sortKey);for(const j of Y){const{programConfiguration:te,program:se,layoutVertexBuffer:ce,indexBuffer:ye,uniformValues:we,terrainData:De}=j.state;se.draw(F,$.TRIANGLES,H,U,W,Mt.disabled,we,De,y.id,ce,ye,j.segments,y.paint,h.transform.zoom,te)}})(t,n,o,a);break;case"heatmap":(function(h,g,y,b){if(y.paint.get("heatmap-opacity")!==0)if(h.renderPass==="offscreen"){const w=h.context,C=w.gl,E=Vt.disabled,R=new Et([C.ONE,C.ONE],c.aN.transparent,[!0,!0,!0,!0]);(function(F,$,H){const U=F.gl;F.activeTexture.set(U.TEXTURE1),F.viewport.set([0,0,$.width/4,$.height/4]);let W=H.heatmapFbo;if(W)U.bindTexture(U.TEXTURE_2D,W.colorAttachment.get()),F.bindFramebuffer.set(W.framebuffer);else{const Y=U.createTexture();U.bindTexture(U.TEXTURE_2D,Y),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),W=H.heatmapFbo=F.createFramebuffer($.width/4,$.height/4,!1,!1),function(j,te,se,ce){var ye,we;const De=j.gl,Re=(ye=j.HALF_FLOAT)!==null&&ye!==void 0?ye:De.UNSIGNED_BYTE,Se=(we=j.RGBA16F)!==null&&we!==void 0?we:De.RGBA;De.texImage2D(De.TEXTURE_2D,0,Se,te.width/4,te.height/4,0,De.RGBA,Re,null),ce.colorAttachment.set(se)}(F,$,Y,W)}})(w,h,y),w.clear({color:c.aN.transparent});for(let F=0;F<b.length;F++){const $=b[F];if(g.hasRenderableParent($))continue;const H=g.getTile($),U=H.getBucket(y);if(!U)continue;const W=U.programConfigurations.get(y.id),Y=h.useProgram("heatmap",W),{zoom:j}=h.transform;Y.draw(w,C.TRIANGLES,ut.disabled,E,R,Mt.disabled,ji($.posMatrix,H,j,y.paint.get("heatmap-intensity")),null,y.id,U.layoutVertexBuffer,U.indexBuffer,U.segments,y.paint,h.transform.zoom,W)}w.viewport.set([0,0,h.width,h.height])}else h.renderPass==="translucent"&&(h.context.setColorMode(h.colorModeForRenderPass()),function(w,C){const E=w.context,R=E.gl,F=C.heatmapFbo;if(!F)return;E.activeTexture.set(R.TEXTURE0),R.bindTexture(R.TEXTURE_2D,F.colorAttachment.get()),E.activeTexture.set(R.TEXTURE1);let $=C.colorRampTexture;$||($=C.colorRampTexture=new St(E,C.colorRamp,R.RGBA)),$.bind(R.LINEAR,R.CLAMP_TO_EDGE),w.useProgram("heatmapTexture").draw(E,R.TRIANGLES,ut.disabled,Vt.disabled,w.colorModeForRenderPass(),Mt.disabled,((H,U,W,Y)=>{const j=c.H();c.aQ(j,0,H.width,H.height,0,0,1);const te=H.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")}})(w,C),null,C.id,w.viewportBuffer,w.quadTriangleIndexBuffer,w.viewportSegments,C.paint,w.transform.zoom)}(h,y))})(t,n,o,a);break;case"line":(function(h,g,y,b){if(h.renderPass!=="translucent")return;const w=y.paint.get("line-opacity"),C=y.paint.get("line-width");if(w.constantOr(1)===0||C.constantOr(1)===0)return;const E=h.depthModeForSublayer(0,ut.ReadOnly),R=h.colorModeForRenderPass(),F=y.paint.get("line-dasharray"),$=y.paint.get("line-pattern"),H=$.constantOr(1),U=y.paint.get("line-gradient"),W=y.getCrossfadeParameters(),Y=H?"linePattern":F?"lineSDF":U?"lineGradient":"line",j=h.context,te=j.gl;let se=!0;for(const ce of b){const ye=g.getTile(ce);if(H&&!ye.patternsLoaded())continue;const we=ye.getBucket(y);if(!we)continue;const De=we.programConfigurations.get(y.id),Re=h.context.program.get(),Se=h.useProgram(Y,De),Te=se||Se.program!==Re,Ne=h.style.map.terrain&&h.style.map.terrain.getTerrainData(ce),tt=$.constantOr(null);if(tt&&ye.imageAtlas){const Qe=ye.imageAtlas,Dt=Qe.patternPositions[tt.to.toString()],ot=Qe.patternPositions[tt.from.toString()];Dt&&ot&&De.setConstantPatternPositions(Dt,ot)}const Ce=Ne?ce:null,Ae=H?_l(h,ye,y,W,Ce):F?yl(h,ye,y,F,W,Ce):U?Ks(h,ye,y,we.lineClipsArray.length,Ce):gs(h,ye,y,Ce);if(H)j.activeTexture.set(te.TEXTURE0),ye.imageAtlasTexture.bind(te.LINEAR,te.CLAMP_TO_EDGE),De.updatePaintBuffers(W);else if(F&&(Te||h.lineAtlas.dirty))j.activeTexture.set(te.TEXTURE0),h.lineAtlas.bind(j);else if(U){const Qe=we.gradients[y.id];let Dt=Qe.texture;if(y.gradientVersion!==Qe.version){let ot=256;if(y.stepInterpolant){const dt=g.getSource().maxzoom,Lt=ce.canonical.z===dt?Math.ceil(1<<h.transform.maxZoom-ce.canonical.z):1;ot=c.ad(c.aV(we.maxLineLength/c.X*1024*Lt),256,j.maxTextureSize)}Qe.gradient=c.aW({expression:y.gradientExpression(),evaluationKey:"lineProgress",resolution:ot,image:Qe.gradient||void 0,clips:we.lineClipsArray}),Qe.texture?Qe.texture.update(Qe.gradient):Qe.texture=new St(j,Qe.gradient,te.RGBA),Qe.version=y.gradientVersion,Dt=Qe.texture}j.activeTexture.set(te.TEXTURE0),Dt.bind(y.stepInterpolant?te.NEAREST:te.LINEAR,te.CLAMP_TO_EDGE)}Se.draw(j,te.TRIANGLES,E,h.stencilModeForClipping(ce),R,Mt.disabled,Ae,Ne,y.id,we.layoutVertexBuffer,we.indexBuffer,we.segments,y.paint,h.transform.zoom,De,we.layoutVertexBuffer2),se=!1}})(t,n,o,a);break;case"fill":(function(h,g,y,b){const w=y.paint.get("fill-color"),C=y.paint.get("fill-opacity");if(C.constantOr(1)===0)return;const E=h.colorModeForRenderPass(),R=y.paint.get("fill-pattern"),F=h.opaquePassEnabledForLayer()&&!R.constantOr(1)&&w.constantOr(c.aN.transparent).a===1&&C.constantOr(0)===1?"opaque":"translucent";if(h.renderPass===F){const $=h.depthModeForSublayer(1,h.renderPass==="opaque"?ut.ReadWrite:ut.ReadOnly);oa(h,g,y,b,$,E,!1)}if(h.renderPass==="translucent"&&y.paint.get("fill-antialias")){const $=h.depthModeForSublayer(y.getPaintProperty("fill-outline-color")?2:0,ut.ReadOnly);oa(h,g,y,b,$,E,!0)}})(t,n,o,a);break;case"fill-extrusion":(function(h,g,y,b){const w=y.paint.get("fill-extrusion-opacity");if(w!==0&&h.renderPass==="translucent"){const C=new ut(h.context.gl.LEQUAL,ut.ReadWrite,h.depthRangeFor3D);if(w!==1||y.paint.get("fill-extrusion-pattern").constantOr(1))oo(h,g,y,b,C,Vt.disabled,Et.disabled),oo(h,g,y,b,C,h.stencilModeFor3D(),h.colorModeForRenderPass());else{const E=h.colorModeForRenderPass();oo(h,g,y,b,C,Vt.disabled,E)}}})(t,n,o,a);break;case"hillshade":(function(h,g,y,b){if(h.renderPass!=="offscreen"&&h.renderPass!=="translucent")return;const w=h.context,C=h.depthModeForSublayer(0,ut.ReadOnly),E=h.colorModeForRenderPass(),[R,F]=h.renderPass==="translucent"?h.stencilConfigForOverlap(b):[{},b];for(const $ of F){const H=g.getTile($);H.needsHillshadePrepare!==void 0&&H.needsHillshadePrepare&&h.renderPass==="offscreen"?fn(h,H,y,C,Vt.disabled,E):h.renderPass==="translucent"&&aa(h,$,H,y,C,R[$.overscaledZ],E)}w.viewport.set([0,0,h.width,h.height])})(t,n,o,a);break;case"raster":(function(h,g,y,b){if(h.renderPass!=="translucent"||y.paint.get("raster-opacity")===0||!b.length)return;const w=h.context,C=w.gl,E=g.getSource(),R=h.useProgram("raster"),F=h.colorModeForRenderPass(),[$,H]=E instanceof Ar?[{},b]:h.stencilConfigForOverlap(b),U=H[H.length-1].overscaledZ,W=!h.options.moving;for(const Y of H){const j=h.depthModeForSublayer(Y.overscaledZ-U,y.paint.get("raster-opacity")===1?ut.ReadWrite:ut.ReadOnly,C.LESS),te=g.getTile(Y);te.registerFadeDuration(y.paint.get("raster-fade-duration"));const se=g.findLoadedParent(Y,0),ce=g.findLoadedSibling(Y),ye=ao(te,se||ce||null,g,y,h.transform,h.style.map.terrain);let we,De;const Re=y.paint.get("raster-resampling")==="nearest"?C.NEAREST:C.LINEAR;w.activeTexture.set(C.TEXTURE0),te.texture.bind(Re,C.CLAMP_TO_EDGE,C.LINEAR_MIPMAP_NEAREST),w.activeTexture.set(C.TEXTURE1),se?(se.texture.bind(Re,C.CLAMP_TO_EDGE,C.LINEAR_MIPMAP_NEAREST),we=Math.pow(2,se.tileID.overscaledZ-te.tileID.overscaledZ),De=[te.tileID.canonical.x*we%1,te.tileID.canonical.y*we%1]):te.texture.bind(Re,C.CLAMP_TO_EDGE,C.LINEAR_MIPMAP_NEAREST),te.texture.useMipmap&&w.extTextureFilterAnisotropic&&h.transform.pitch>20&&C.texParameterf(C.TEXTURE_2D,w.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,w.extTextureFilterAnisotropicMax);const Se=h.style.map.terrain&&h.style.map.terrain.getTerrainData(Y),Te=Se?Y:null,Ne=Te?Te.posMatrix:h.transform.calculatePosMatrix(Y.toUnwrapped(),W),tt=Uc(Ne,De||[0,0],we||1,ye,y);E instanceof Ar?R.draw(w,C.TRIANGLES,j,Vt.disabled,F,Mt.disabled,tt,Se,y.id,E.boundsBuffer,h.quadTriangleIndexBuffer,E.boundsSegments):R.draw(w,C.TRIANGLES,j,$[Y.overscaledZ],F,Mt.disabled,tt,Se,y.id,h.rasterBoundsBuffer,h.quadTriangleIndexBuffer,h.rasterBoundsSegments)}})(t,n,o,a);break;case"background":(function(h,g,y,b){const w=y.paint.get("background-color"),C=y.paint.get("background-opacity");if(C===0)return;const E=h.context,R=E.gl,F=h.transform,$=F.tileSize,H=y.paint.get("background-pattern");if(h.isPatternMissing(H))return;const U=!H&&w.a===1&&C===1&&h.opaquePassEnabledForLayer()?"opaque":"translucent";if(h.renderPass!==U)return;const W=Vt.disabled,Y=h.depthModeForSublayer(0,U==="opaque"?ut.ReadWrite:ut.ReadOnly),j=h.colorModeForRenderPass(),te=h.useProgram(H?"backgroundPattern":"background"),se=b||F.coveringTiles({tileSize:$,terrain:h.style.map.terrain});H&&(E.activeTexture.set(R.TEXTURE0),h.imageManager.bind(h.context));const ce=y.getCrossfadeParameters();for(const ye of se){const we=b?ye.posMatrix:h.transform.calculatePosMatrix(ye.toUnwrapped()),De=H?Ho(we,C,h,H,{tileID:ye,tileSize:$},ce):Ys(we,C,w),Re=h.style.map.terrain&&h.style.map.terrain.getTerrainData(ye);te.draw(E,R.TRIANGLES,Y,W,j,Mt.disabled,De,Re,y.id,h.tileExtentBuffer,h.quadTriangleIndexBuffer,h.tileExtentSegments)}})(t,0,o,a);break;case"custom":(function(h,g,y){const b=h.context,w=y.implementation;if(h.renderPass==="offscreen"){const C=w.prerender;C&&(h.setCustomLayerDefaults(),b.setColorMode(h.colorModeForRenderPass()),C.call(w,b.gl,h.transform.customLayerMatrix()),b.setDirty(),h.setBaseState())}else if(h.renderPass==="translucent"){h.setCustomLayerDefaults(),b.setColorMode(h.colorModeForRenderPass()),b.setStencilMode(Vt.disabled);const C=w.renderingMode==="3d"?new ut(h.context.gl.LEQUAL,ut.ReadWrite,h.depthRangeFor3D):h.depthModeForSublayer(0,ut.ReadOnly);b.setDepthMode(C),w.render(b.gl,h.transform.customLayerMatrix(),{farZ:h.transform.farZ,nearZ:h.transform.nearZ,fov:h.transform._fov,modelViewProjectionMatrix:h.transform.modelViewProjectionMatrix,projectionMatrix:h.transform.projectionMatrix}),b.setDirty(),h.setBaseState(),b.bindFramebuffer.set(null)}})(t,0,o)}}translatePosMatrix(t,n,o,a,h){if(!o[0]&&!o[1])return t;const g=h?a==="map"?this.transform.angle:0:a==="viewport"?-this.transform.angle:0;if(g){const w=Math.sin(g),C=Math.cos(g);o=[o[0]*C-o[1]*w,o[0]*w+o[1]*C]}const y=[h?o[0]:rt(n,o[0],this.transform.zoom),h?o[1]:rt(n,o[1],this.transform.zoom),0],b=new Float32Array(16);return c.J(b,t,y),b}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 Hs(this.context,Xr[t],n,Qs[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 St(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:t,drawingBufferHeight:n}=this.context.gl;return this.width!==t||this.height!==n}}class gn{constructor(t,n){this.points=t,this.planes=n}static fromInvProjectionMatrix(t,n,o){const a=Math.pow(2,o),h=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(y=>{const b=1/(y=c.ag([],y,t))[3]/n*a;return c.b1(y,y,[b,b,1/y[3],b])}),g=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(y=>{const b=function(R,F){var $=F[0],H=F[1],U=F[2],W=$*$+H*H+U*U;return W>0&&(W=1/Math.sqrt(W)),R[0]=F[0]*W,R[1]=F[1]*W,R[2]=F[2]*W,R}([],function(R,F,$){var H=F[0],U=F[1],W=F[2],Y=$[0],j=$[1],te=$[2];return R[0]=U*te-W*j,R[1]=W*Y-H*te,R[2]=H*j-U*Y,R}([],$t([],h[y[0]],h[y[1]]),$t([],h[y[2]],h[y[1]]))),w=-((C=b)[0]*(E=h[y[1]])[0]+C[1]*E[1]+C[2]*E[2]);var C,E;return b.concat(w)});return new gn(h,g)}}class ho{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=wt(this.min),a=wt(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 ho(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 g=0;for(let y=0;y<n.length;y++)c.b2(h,n[y])>=0&&g++;if(g===0)return 0;g!==n.length&&(o=!1)}if(o)return 2;for(let a=0;a<3;a++){let h=Number.MAX_VALUE,g=-Number.MAX_VALUE;for(let y=0;y<t.points.length;y++){const b=t.points[y][a]-this.min[a];h=Math.min(h,b),g=Math.max(g,b)}if(g<0||h>this.max[a]-this.min[a])return 0}return 1}}class uo{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 uo(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const ca=85.051129;class ha{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 uo,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={},this.minElevationForCurrentTile=0}clone(){const t=new ha(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 g=a[0],y=a[1],b=a[2],w=a[3],C=Math.sin(h),E=Math.cos(h);o[0]=g*E+b*C,o[1]=y*E+w*C,o[2]=g*-C+b*E,o[3]=y*-C+w*E}(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)),g=this.pointCoordinate(new c.P(0,this.height)),y=Math.floor(Math.min(o.x,a.x,h.x,g.x)),b=Math.floor(Math.max(o.x,a.x,h.x,g.x)),w=1;for(let C=y-w;C<=b+w;C++)C!==0&&n.push(new c.b4(C,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 g=this.pointCoordinate(this.getCameraPoint()),y=c.Z.fromLngLat(this.center),b=Math.pow(2,a),w=[b*g.x,b*g.y,0],C=[b*y.x,b*y.y,0],E=gn.fromInvProjectionMatrix(this.invModelViewProjectionMatrix,this.worldSize,a);let R=t.minzoom||0;!t.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(R=a);const F=t.terrain?2/Math.min(this.tileSize,t.tileSize)*this.tileSize:3,$=j=>({aabb:new ho([j*b,0,0],[(j+1)*b,b,0]),zoom:0,x:0,y:0,wrap:j,fullyVisible:!1}),H=[],U=[],W=a,Y=t.reparseOverscaled?h:a;if(this._renderWorldCopies)for(let j=1;j<=3;j++)H.push($(-j)),H.push($(j));for(H.push($(0));H.length>0;){const j=H.pop(),te=j.x,se=j.y;let ce=j.fullyVisible;if(!ce){const Se=j.aabb.intersects(E);if(Se===0)continue;ce=Se===2}const ye=t.terrain?w:C,we=j.aabb.distanceX(ye),De=j.aabb.distanceY(ye),Re=Math.max(Math.abs(we),Math.abs(De));if(j.zoom===W||Re>F+(1<<W-j.zoom)-2&&j.zoom>=R){const Se=W-j.zoom,Te=w[0]-.5-(te<<Se),Ne=w[1]-.5-(se<<Se);U.push({tileID:new c.S(j.zoom===W?Y:j.zoom,j.wrap,j.zoom,te,se),distanceSq:Vr([C[0]-.5-te,C[1]-.5-se]),tileDistanceToCamera:Math.sqrt(Te*Te+Ne*Ne)})}else for(let Se=0;Se<4;Se++){const Te=(te<<1)+Se%2,Ne=(se<<1)+(Se>>1),tt=j.zoom+1;let Ce=j.aabb.quadrant(Se);if(t.terrain){const Ae=new c.S(tt,j.wrap,tt,Te,Ne),Qe=t.terrain.getMinMaxElevation(Ae),Dt=(n=Qe.minElevation)!==null&&n!==void 0?n:this.elevation,ot=(o=Qe.maxElevation)!==null&&o!==void 0?o:this.elevation;Ce=new ho([Ce.min[0],Ce.min[1],Dt],[Ce.max[0],Ce.max[1],ot])}H.push({aabb:Ce,zoom:tt,x:Te,y:Ne,wrap:j.wrap,fullyVisible:ce})}}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,ca);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 g=o+n-h,y=Math.cos(this._pitch)*this.cameraToCenterDistance/g/c.b5(1,a.lat),b=this.scaleZoom(y/this.tileSize);this._elevation=h,this._center=a,this.zoom=b}setLocationAtPoint(t,n){const o=this.pointCoordinate(n),a=this.pointCoordinate(this.centerPoint),h=this.locationCoordinate(t),g=new c.Z(h.x-(o.x-a.x),h.y-(o.y-a.y));this.center=this.coordinateLocation(g),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 R=n.pointCoordinate(t);if(R!=null)return R}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],g=a[3],y=o[1]/h,b=a[1]/g,w=o[2]/h,C=a[2]/g,E=w===C?0:(0-w)/(C-w);return new c.Z(c.z.number(o[0]/h,a[0]/g,E)/this.worldSize,c.z.number(y,b,E)/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,ca])}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 g=0,y=h,b=0,w=h,C=0,E=0;const{x:R,y:F}=this.size;if(this.latRange){const j=this.latRange;g=c.Q(j[1])*h,y=c.Q(j[0])*h,y-g<F&&(C=F/(y-g))}a&&(b=c.b3(c.O(a[0])*h,0,h),w=c.b3(c.O(a[1])*h,0,h),w<b&&(w+=h),w-b<R&&(E=R/(w-b)));const{x:$,y:H}=this.project.call({worldSize:h},t);let U,W;const Y=Math.max(E||0,C||0);if(Y){const j=new c.P(E?(w+b)/2:$,C?(y+g)/2:H);return o.center=this.unproject.call({worldSize:h},j).wrap(),o.zoom+=this.scaleZoom(Y),o}if(this.latRange){const j=F/2;H-j<g&&(W=g+j),H+j>y&&(W=y-j)}if(a){const j=(b+w)/2;let te=$;this._renderWorldCopies&&(te=c.b3($,j-h/2,j+h/2));const se=R/2;te-se<b&&(U=b+se),te+se>w&&(U=w-se)}if(U!==void 0||W!==void 0){const j=new c.P(U??$,W??H);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),g=Math.min(this.elevation,this.minElevationForCurrentTile),y=h-g*this._pixelPerMeter/Math.cos(this._pitch),b=g<0?y:h,w=Math.PI/2+this._pitch,C=this._fov*(.5+t.y/this.height),E=Math.sin(C)*b/Math.sin(c.ad(Math.PI-w-C,.01,Math.PI-.01)),R=this.getHorizon(),F=2*Math.atan(R/this.cameraToCenterDistance)*(.5+t.y/(2*R)),$=Math.sin(F)*b/Math.sin(c.ad(Math.PI-w-F,.01,Math.PI-.01)),H=Math.min(E,$);this.farZ=1.01*(Math.cos(Math.PI/2-this._pitch)*H+b),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,W=this.height%2/2,Y=Math.cos(this.angle),j=Math.sin(this.angle),te=n-Math.round(n)+Y*U+j*W,se=o-Math.round(o)+Y*W+j*U,ce=new Float64Array(a);if(c.J(ce,ce,[te>.5?te-1:te,se>.5?se-1:se,0]),this.alignedModelViewProjectionMatrix=ce,a=c.at(new Float64Array(16),this.pixelMatrix),!a)throw new Error("failed to invert matrix");this.pixelMatrixInverse=a,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const t=this.pointCoordinate(new c.P(0,0)),n=[t.x*this.worldSize,t.y*this.worldSize,0,1];return c.ag(n,n,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new c.P(0,t))}getCameraQueryGeometry(t){const n=this.getCameraPoint();if(t.length===1)return[t[0],n];{let o=n.x,a=n.y,h=n.x,g=n.y;for(const y of t)o=Math.min(o,y.x),a=Math.min(a,y.y),h=Math.max(h,y.x),g=Math.max(g,y.y);return[new c.P(o,a),new c.P(h,a),new c.P(h,g),new c.P(o,g),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 po(u,t){let n,o=!1,a=null,h=null;const g=()=>{a=null,o&&(u.apply(h,n),a=setTimeout(g,t),o=!1)};return(...y)=>(o=!0,h=this,n=y,a||g(),a)}class Ss{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 g=window.location.href.replace(/(#.+)?$/,h);g=g.replace("&&","&"),window.history.replaceState(window.history.state,null,g)},this._updateHash=po(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),g=Math.round(n.lng*h)/h,y=Math.round(n.lat*h)/h,b=this._map.getBearing(),w=this._map.getPitch();let C="";if(C+=t?`/${g}/${y}/${o}`:`${o}/${y}/${g}`,(b||w)&&(C+="/"+Math.round(10*b)/10),w&&(C+=`/${Math.round(w)}`),this._hashName){const E=this._hashName;let R=!1;const F=window.location.hash.slice(1).split("&").map($=>{const H=$.split("=")[0];return H===E?(R=!0,`${H}=${C}`):$}).filter($=>$);return R||F.push(`${E}=${C}`),`#${F.join("&")}`}return`#${C}`}}const _n={linearity:.3,easing:c.b8(0,0,.3,1)},ua=c.e({deceleration:2500,maxSpeed:1400},_n),da=c.e({deceleration:20,maxSpeed:1400},_n),Vl=c.e({deceleration:1e3,maxSpeed:360},_n),fo=c.e({deceleration:1e3,maxSpeed:90},_n);class mo{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:le.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,n=le.now();for(;t.length>0&&n-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const n={zoom:0,bearing:0,pitch:0,pan:new c.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:h}of this._inertiaBuffer)n.zoom+=h.zoomDelta||0,n.bearing+=h.bearingDelta||0,n.pitch+=h.pitchDelta||0,h.panDelta&&n.pan._add(h.panDelta),h.around&&(n.around=h.around),h.pinchAround&&(n.pinchAround=h.pinchAround);const o=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,a={};if(n.pan.mag()){const h=go(n.pan.mag(),o,c.e({},ua,t||{}));a.offset=n.pan.mult(h.amount/n.pan.mag()),a.center=this._map.transform.center,On(a,h)}if(n.zoom){const h=go(n.zoom,o,da);a.zoom=this._map.transform.zoom+h.amount,On(a,h)}if(n.bearing){const h=go(n.bearing,o,Vl);a.bearing=this._map.transform.bearing+c.ad(h.amount,-179,179),On(a,h)}if(n.pitch){const h=go(n.pitch,o,fo);a.pitch=this._map.transform.pitch+h.amount,On(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 On(u,t){(!u.duration||u.duration<t.duration)&&(u.duration=t.duration,u.easing=t.easing)}function go(u,t,n){const{maxSpeed:o,linearity:a,deceleration:h}=n,g=c.ad(u*a/(t/1e3),-o,o),y=Math.abs(g)/(h*a);return{easing:n.easing,duration:1e3*y,amount:g*(y/2)}}class Ti extends c.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,o,a={}){const h=oe.mousePos(n.getCanvas(),o),g=n.unproject(h);super(t,c.e({point:h,lngLat:g,originalEvent:o},a)),this._defaultPrevented=!1,this.target=n}}class Ts 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=oe.touchPos(n.getCanvasContainer(),a),g=h.map(b=>n.unproject(b)),y=h.reduce((b,w,C,E)=>b.add(w.div(E.length)),new c.P(0,0));super(t,{points:h,point:y,lngLats:g,lngLat:n.unproject(y),originalEvent:o}),this._defaultPrevented=!1}}class pa extends c.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,o){super(t,{originalEvent:o}),this._defaultPrevented=!1}}class _o{constructor(t,n){this._map=t,this._clickTolerance=n.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new pa(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 Ts(t.type,this._map,t))}touchmove(t){this._map.fire(new Ts(t.type,this._map,t))}touchend(t){this._map.fire(new Ts(t.type,this._map,t))}touchcancel(t){this._map.fire(new Ts(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class fa{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 Vn{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 ma{constructor(t,n){this._map=t,this._tr=new Vn(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&&(oe.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=oe.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",t));const h=Math.min(a.x,o.x),g=Math.max(a.x,o.x),y=Math.min(a.y,o.y),b=Math.max(a.y,o.y);oe.setTransform(this._box,`translate(${h}px,${y}px)`),this._box.style.width=g-h+"px",this._box.style.height=b-y+"px"}mouseupWindow(t,n){if(!this._active||t.button!==0)return;const o=this._startPos,a=n;if(this.reset(),oe.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&&(oe.remove(this._box),this._box=null),oe.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,n){return this._map.fire(new c.k(t,{originalEvent:n}))}}function Nn(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 ga{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 g of a)h._add(g);return h.div(a.length)}(n),this.touches=Nn(o,n)))}touchmove(t,n,o){if(this.aborted||!this.centroid)return;const a=Nn(o,n);for(const h in this.touches){const g=a[h];(!g||g.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 _a{constructor(t){this.singleTap=new ga(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,g=!this.lastTap||this.lastTap.dist(a)<30;if(h&&g||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=a,this.count===this.numTaps)return this.reset(),a}}}class Nl{constructor(t){this._tr=new Vn(t),this._zoomIn=new _a({numTouches:1,numTaps:2}),this._zoomOut=new _a({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),g=this._tr;return a?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:y=>y.easeTo({duration:300,zoom:g.zoom+1,around:g.unproject(a)},{originalEvent:t})}):h?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:y=>y.easeTo({duration:300,zoom:g.zoom-1,around:g.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&&oe.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=oe.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 oe.mouseButton(t)===this._eventButton}}class yo{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 ks=u=>{u.mousedown=u.dragStart,u.mousemoveWindow=u.dragMove,u.mouseup=u.dragEnd,u.contextmenu=t=>{t.preventDefault()}},ya=({enable:u,clickTolerance:t,bearingDegreesPerPixelMoved:n=.8})=>{const o=new Ai({checkCorrectEvent:a=>oe.mouseButton(a)===0&&a.ctrlKey||oe.mouseButton(a)===2});return new zt({clickTolerance:t,move:(a,h)=>({bearingDelta:(h.x-a.x)*n}),moveStateManager:o,enable:u,assignEvents:ks})},xn=({enable:u,clickTolerance:t,pitchDegreesPerPixelMoved:n=-.5})=>{const o=new Ai({checkCorrectEvent:a=>oe.mouseButton(a)===0&&a.ctrlKey||oe.mouseButton(a)===2});return new zt({clickTolerance:t,move:(a,h)=>({pitchDelta:(h.y-a.y)*n}),moveStateManager:o,enable:u,assignEvents:ks})};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=Nn(o,n),h=new c.P(0,0),g=new c.P(0,0);let y=0;for(const w in a){const C=a[w],E=this._touches[w];E&&(h._add(C),g._add(C.sub(E)),y++,a[w]=C)}if(this._touches=a,this._shouldBePrevented(y)||!g.mag())return;const b=g.div(y);return this._sum._add(b),this._sum.mag()<this._clickTolerance?void 0:{around:h.div(y),panDelta:b}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Cs{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,g=Es(o,n,a),y=Es(o,n,h);if(!g||!y)return;const b=this._aroundCenter?null:g.add(y).div(2);return this._move([g,y],b,t)}touchend(t,n,o){if(!this._firstTwoTouches)return;const[a,h]=this._firstTwoTouches,g=Es(o,n,a),y=Es(o,n,h);g&&y||(this._active&&oe.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 Es(u,t,n){for(let o=0;o<u.length;o++)if(u[o].identifier===n)return t[o]}function xa(u,t){return Math.log(u/t)/Math.LN2}class va extends Cs{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(xa(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:xa(this._distance,o),pinchAround:n}}}function ba(u,t){return 180*u.angleWith(t)/Math.PI}class wa extends Cs{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:ba(this._vector,a),pinchAround:n}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const n=25/(Math.PI*this._minDiameter)*360,o=ba(t,this._startVector);return Math.abs(o)<n}}function Lr(u){return Math.abs(u.y)>Math.abs(u.x)}class Sa extends Cs{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,Lr(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 g=t.y>0==n.y>0;return Lr(t)&&Lr(n)&&g}}const $l={panStep:100,bearingStep:15,pitchStep:10};class Ta{constructor(t){this._tr=new Vn(t);const n=$l;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,g=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(),g=-1);break;case 40:t.shiftKey?a=-1:(t.preventDefault(),g=1);break;default:return}return this._rotationDisabled&&(o=0,a=0),{cameraAnimation:y=>{const b=this._tr;y.easeTo({duration:300,easeId:"keyboardHandler",easing:jl,zoom:n?Math.round(b.zoom)+n*(t.shiftKey?2:1):b.zoom,bearing:b.bearing+o*this._bearingStep,pitch:b.pitch+a*this._pitchStep,offset:[-h*this._panStep,-g*this._panStep],center:b.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 jl(u){return u*(2-u)}const ka=4.000244140625;class Ia{constructor(t,n){this._onTimeout=o=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(o)},this._map=t,this._tr=new Vn(t),this._triggerRenderFrame=n,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!t&&t.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(t){return!!this._map.cooperativeGestures.isEnabled()&&!(t.ctrlKey||this._map.cooperativeGestures.isBypassed(t))}wheel(t){if(!this.isEnabled())return;if(this._shouldBePrevented(t))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",t);let n=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const o=le.now(),a=o-(this._lastWheelEventTime||0);this._lastWheelEventTime=o,n!==0&&n%ka==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=oe.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 b=this._type==="wheel"&&Math.abs(this._delta)>ka?this._wheelZoomRate:this._defaultZoomRate;let w=2/(1+Math.exp(-Math.abs(this._delta*b)));this._delta<0&&w!==0&&(w=1/w);const C=typeof this._targetZoom=="number"?t.zoomScale(this._targetZoom):t.scale;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(C*w))),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,g=!1;const y=le.now()-this._lastWheelEventTime;if(this._type==="wheel"&&o&&a&&y){const b=Math.min(y/200,1),w=a(b);h=c.z.number(o,n,w),b<1?this._frameId||(this._frameId=!0):g=!0}else h=n,g=!0;return this._active=!0,g&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!g,zoomDelta:h-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let n=c.b9;if(this._prevEase){const o=this._prevEase,a=(le.now()-o.start)/o.duration,h=o.easing(a+.01)-o.easing(a),g=.27/Math.sqrt(h*h+1e-4)*.01,y=Math.sqrt(.0729-g*g);n=c.b8(g,y,.25,1)}return this._prevEase={start:le.now(),duration:t,easing:n},n}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class Ca{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 Ps{constructor(t){this._tr=new Vn(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 Ul{constructor(){this._tap=new _a({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,g=this._tapPoint.dist(a)<30;h&&g?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 Ji{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 ir{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 Ea{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 rr{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=oe.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&&(oe.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 Rr=u=>u.zoom||u.drag||u.pitch||u.rotate;class th extends c.k{}function Pa(u){return u.panDelta&&u.panDelta.mag()||u.zoomDelta||u.bearingDelta||u.pitchDelta}class ih{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 g=a.type==="renderFrame"?void 0:a,y={needsRenderFrame:!1},b={},w={},C=a.touches,E=C?this._getMapTouches(C):void 0,R=E?oe.touchPos(this._map.getCanvas(),E):oe.mousePos(this._map.getCanvas(),a);for(const{handlerName:H,handler:U,allowed:W}of this._handlers){if(!U.isEnabled())continue;let Y;this._blockedByActive(w,W,H)?U.reset():U[h||a.type]&&(Y=U[h||a.type](a,R,E),this.mergeHandlerResult(y,b,Y,H,g),Y&&Y.needsRenderFrame&&this._triggerRenderFrame()),(Y||U.isActive())&&(w[H]=U)}const F={};for(const H in this._previousActiveHandlers)w[H]||(F[H]=g);this._previousActiveHandlers=w,(Object.keys(F).length||Pa(y))&&(this._changes.push([y,b,F]),this._triggerRenderFrame()),(Object.keys(w).length||Pa(y))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:$}=y;$&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],$(this._map))},this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new mo(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,g]of this._listeners)oe.addEventListener(a,h,a===document?this.handleWindowEvent:this.handleEvent,g)}destroy(){for(const[t,n,o]of this._listeners)oe.removeEventListener(t,n,t===document?this.handleWindowEvent:this.handleEvent,o)}_addDefaultHandlers(t){const n=this._map,o=n.getCanvasContainer();this._add("mapEvent",new _o(n,t));const a=n.boxZoom=new ma(n,t);this._add("boxZoom",a),t.interactive&&t.boxZoom&&a.enable();const h=n.cooperativeGestures=new rr(n,t.cooperativeGestures);this._add("cooperativeGestures",h),t.cooperativeGestures&&h.enable();const g=new Nl(n),y=new Ps(n);n.doubleClickZoom=new Ca(y,g),this._add("tapZoom",g),this._add("clickZoom",y),t.interactive&&t.doubleClickZoom&&n.doubleClickZoom.enable();const b=new Ul;this._add("tapDragZoom",b);const w=n.touchPitch=new Sa(n);this._add("touchPitch",w),t.interactive&&t.touchPitch&&n.touchPitch.enable(t.touchPitch);const C=ya(t),E=xn(t);n.dragRotate=new ir(t,C,E),this._add("mouseRotate",C,["mousePitch"]),this._add("mousePitch",E,["mouseRotate"]),t.interactive&&t.dragRotate&&n.dragRotate.enable();const R=(({enable:Y,clickTolerance:j})=>{const te=new Ai({checkCorrectEvent:se=>oe.mouseButton(se)===0&&!se.ctrlKey});return new zt({clickTolerance:j,move:(se,ce)=>({around:ce,panDelta:ce.sub(se)}),activateOnStart:!0,moveStateManager:te,enable:Y,assignEvents:ks})})(t),F=new Is(t,n);n.dragPan=new Ji(o,R,F),this._add("mousePan",R),this._add("touchPan",F,["touchZoom","touchRotate"]),t.interactive&&t.dragPan&&n.dragPan.enable(t.dragPan);const $=new wa,H=new va;n.touchZoomRotate=new Ea(o,H,$,b),this._add("touchRotate",$,["touchPan","touchZoom"]),this._add("touchZoom",H,["touchPan","touchRotate"]),t.interactive&&t.touchZoomRotate&&n.touchZoomRotate.enable(t.touchZoomRotate);const U=n.scrollZoom=new Ia(n,()=>this._triggerRenderFrame());this._add("scrollZoom",U,["mousePan"]),t.interactive&&t.scrollZoom&&n.scrollZoom.enable(t.scrollZoom);const W=n.keyboard=new Ta(n);this._add("keyboard",W),t.interactive&&t.keyboard&&n.keyboard.enable(),this._add("blockableMapEvent",new fa(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!!Rr(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 g={handlerName:a,originalEvent:o.originalEvent||h};o.zoomDelta!==void 0&&(n.zoom=g),o.panDelta!==void 0&&(n.drag=g),o.pitchDelta!==void 0&&(n.pitch=g),o.bearingDelta!==void 0&&(n.rotate=g)}_applyChanges(){const t={},n={},o={};for(const[a,h,g]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,g);this._updateMapTransform(t,n,o),this._changes=[]}_updateMapTransform(t,n,o){const a=this._map,h=a._getTransformForUpdate(),g=a.terrain;if(!(Pa(t)||g&&this._terrainMovement))return this._fireEvents(n,o,!0);let{panDelta:y,zoomDelta:b,bearingDelta:w,pitchDelta:C,around:E,pinchAround:R}=t;R!==void 0&&(E=R),a._stop(!0),E=E||a.transform.centerPoint;const F=h.pointLocation(y?E.sub(y):E);w&&(h.bearing+=w),C&&(h.pitch+=C),b&&(h.zoom+=b),g?this._terrainMovement||!n.drag&&!n.zoom?n.drag&&this._terrainMovement?h.center=h.pointLocation(h.centerPoint.sub(y)):h.setLocationAtPoint(F,E):(this._terrainMovement=!0,this._map._elevationFreeze=!0,h.setLocationAtPoint(F,E)):h.setLocationAtPoint(F,E),a._applyUpdatedTransform(h),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(n,o,!0)}_fireEvents(t,n,o){const a=Rr(this._eventsInProgress),h=Rr(t),g={};for(const E in t){const{originalEvent:R}=t[E];this._eventsInProgress[E]||(g[`${E}start`]=R),this._eventsInProgress[E]=t[E]}!a&&h&&this._fireEvent("movestart",h.originalEvent);for(const E in g)this._fireEvent(E,g[E]);h&&this._fireEvent("move",h.originalEvent);for(const E in t){const{originalEvent:R}=t[E];this._fireEvent(E,R)}const y={};let b;for(const E in this._eventsInProgress){const{handlerName:R,originalEvent:F}=this._eventsInProgress[E];this._handlersById[R].isActive()||(delete this._eventsInProgress[E],b=n[R]||F,y[`${E}end`]=b)}for(const E in y)this._fireEvent(E,y[E]);const w=Rr(this._eventsInProgress),C=(a||h)&&!w;if(C&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const E=this._map._getTransformForUpdate();E.recalculateZoom(this._map.terrain),this._map._applyUpdatedTransform(E)}if(o&&C){this._updatingCamera=!0;const E=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),R=F=>F!==0&&-this._bearingSnap<F&&F<this._bearingSnap;!E||!E.essential&&le.prefersReducedMotion?(this._map.fire(new c.k("moveend",{originalEvent:b})),R(this._map.getBearing())&&this._map.resetNorth()):(R(E.bearing||this._map.getBearing())&&(E.bearing=0),E.freezeElevation=!0,this._map.easeTo(E,{originalEvent:b})),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 th("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class rh extends c.E{constructor(t,n){super(),this._renderFrameCallback=()=>{const o=Math.min((le.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(o)),o<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=n.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new c.N(this.transform.center.lng,this.transform.center.lat)}setCenter(t,n){return this.jumpTo({center:t},n)}panBy(t,n,o){return t=c.P.convert(t).mult(-1),this.panTo(this.transform.center,c.e({offset:t},n),o)}panTo(t,n,o){return this.easeTo(c.e({center:t},n),o)}getZoom(){return this.transform.zoom}setZoom(t,n){return this.jumpTo({zoom:t},n),this}zoomTo(t,n,o){return this.easeTo(c.e({zoom:t},n),o)}zoomIn(t,n){return this.zoomTo(this.getZoom()+1,t,n),this}zoomOut(t,n){return this.zoomTo(this.getZoom()-1,t,n),this}getBearing(){return this.transform.bearing}setBearing(t,n){return this.jumpTo({bearing:t},n),this}getPadding(){return this.transform.padding}setPadding(t,n){return this.jumpTo({padding:t},n),this}rotateTo(t,n,o){return this.easeTo(c.e({bearing:t},n),o)}resetNorth(t,n){return this.rotateTo(0,c.e({duration:1e3},t),n),this}resetNorthPitch(t,n){return this.easeTo(c.e({bearing:0,pitch:0,duration:1e3},t),n),this}snapToNorth(t,n){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,n):this}getPitch(){return this.transform.pitch}setPitch(t,n){return this.jumpTo({pitch:t},n),this}cameraForBounds(t,n){t=ue.convert(t);const o=n&&n.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),o,n)}_cameraForBoxAndBearing(t,n,o,a){const h={top:0,bottom:0,right:0,left:0};if(typeof(a=c.e({padding:h,offset:[0,0],maxZoom:this.transform.maxZoom},a)).padding=="number"){const Se=a.padding;a.padding={top:Se,bottom:Se,right:Se,left:Se}}a.padding=c.e(h,a.padding);const g=this.transform,y=g.padding,b=new ue(t,n),w=g.project(b.getNorthWest()),C=g.project(b.getNorthEast()),E=g.project(b.getSouthEast()),R=g.project(b.getSouthWest()),F=c.ba(-o),$=w.rotate(F),H=C.rotate(F),U=E.rotate(F),W=R.rotate(F),Y=new c.P(Math.max($.x,H.x,W.x,U.x),Math.max($.y,H.y,W.y,U.y)),j=new c.P(Math.min($.x,H.x,W.x,U.x),Math.min($.y,H.y,W.y,U.y)),te=Y.sub(j),se=(g.width-(y.left+y.right+a.padding.left+a.padding.right))/te.x,ce=(g.height-(y.top+y.bottom+a.padding.top+a.padding.bottom))/te.y;if(ce<0||se<0)return void c.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");const ye=Math.min(g.scaleZoom(g.scale*Math.min(se,ce)),a.maxZoom),we=c.P.convert(a.offset),De=new c.P((a.padding.left-a.padding.right)/2,(a.padding.top-a.padding.bottom)/2).rotate(c.ba(o)),Re=we.add(De).mult(g.scale/g.zoomScale(ye));return{center:g.unproject(w.add(E).div(2).sub(Re)),zoom:ye,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,g=!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&&(g=!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)),g&&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),g=c.Z.fromLngLat(o,a),y=g.x-h.x,b=g.y-h.y,w=g.z-h.z,C=Math.hypot(y,b,w);if(C===0)throw new Error("Can't calculate camera options with same From and To");const E=Math.hypot(y,b),R=this.transform.scaleZoom(this.transform.cameraToCenterDistance/C/this.transform.tileSize),F=180*Math.atan2(y,-b)/Math.PI;let $=180*Math.acos(E/C)/Math.PI;return $=w<0?90-$:90+$,{center:g.toLngLat(),zoom:R,pitch:$,bearing:F}}easeTo(t,n){var o;this._stop(!1,t.easeId),((t=c.e({offset:[0,0],duration:500,easing:c.b9},t)).animate===!1||!t.essential&&le.prefersReducedMotion)&&(t.duration=0);const a=this._getTransformForUpdate(),h=a.zoom,g=a.bearing,y=a.pitch,b=a.padding,w="bearing"in t?this._normalizeBearing(t.bearing,g):g,C="pitch"in t?+t.pitch:y,E="padding"in t?t.padding:a.padding,R=c.P.convert(t.offset);let F=a.centerPoint.add(R);const $=a.pointLocation(F),{center:H,zoom:U}=a.getConstrained(c.N.convert(t.center||$),(o=t.zoom)!==null&&o!==void 0?o:h);this._normalizeCenter(H,a);const W=a.project($),Y=a.project(H).sub(W),j=a.zoomScale(U-h);let te,se;t.around&&(te=c.N.convert(t.around),se=a.locationPoint(te));const ce={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||U!==h,this._rotating=this._rotating||g!==w,this._pitching=this._pitching||C!==y,this._padding=!a.isPaddingEqual(E),this._easeId=t.easeId,this._prepareEase(n,t.noMoveStart,ce),this.terrain&&this._prepareElevation(H),this._ease(ye=>{if(this._zooming&&(a.zoom=c.z.number(h,U,ye)),this._rotating&&(a.bearing=c.z.number(g,w,ye)),this._pitching&&(a.pitch=c.z.number(y,C,ye)),this._padding&&(a.interpolatePadding(b,E,ye),F=a.centerPoint.add(R)),this.terrain&&!t.freezeElevation&&this._updateElevation(ye),te)a.setLocationAtPoint(te,se);else{const we=a.zoomScale(a.zoom-h),De=U>h?Math.min(2,j):Math.max(.5,j),Re=Math.pow(De,1-ye),Se=a.unproject(W.add(Y.mult(ye*Re)).mult(we));a.setLocationAtPoint(a.renderWorldCopies?Se.wrap():Se,F)}this._applyUpdatedTransform(a),this._fireMoveEvents(n)},ye=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(n,ye)},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:g,zoom:y,pitch:b,bearing:w,elevation:C}=a(h);g&&(h.center=g),y!==void 0&&(h.zoom=y),b!==void 0&&(h.pitch=b),w!==void 0&&(h.bearing=w),C!==void 0&&(h.elevation=C),o.apply(h)}this.transform.apply(o)}_fireMoveEvents(t){this.fire(new c.k("move",t)),this._zooming&&this.fire(new c.k("zoom",t)),this._rotating&&this.fire(new c.k("rotate",t)),this._pitching&&this.fire(new c.k("pitch",t))}_afterEase(t,n){if(this._easeId&&n&&this._easeId===n)return;delete this._easeId;const o=this._zooming,a=this._rotating,h=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,o&&this.fire(new c.k("zoomend",t)),a&&this.fire(new c.k("rotateend",t)),h&&this.fire(new c.k("pitchend",t)),this.fire(new c.k("moveend",t))}flyTo(t,n){var o;if(!t.essential&&le.prefersReducedMotion){const Ae=c.M(t,["center","zoom","bearing","pitch","around"]);return this.jumpTo(Ae,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,g=a.bearing,y=a.pitch,b=a.padding,w="bearing"in t?this._normalizeBearing(t.bearing,g):g,C="pitch"in t?+t.pitch:y,E="padding"in t?t.padding:a.padding,R=c.P.convert(t.offset);let F=a.centerPoint.add(R);const $=a.pointLocation(F),{center:H,zoom:U}=a.getConstrained(c.N.convert(t.center||$),(o=t.zoom)!==null&&o!==void 0?o:h);this._normalizeCenter(H,a);const W=a.zoomScale(U-h),Y=a.project($),j=a.project(H).sub(Y);let te=t.curve;const se=Math.max(a.width,a.height),ce=se/W,ye=j.mag();if("minZoom"in t){const Ae=c.ad(Math.min(t.minZoom,h,U),a.minZoom,a.maxZoom),Qe=se/a.zoomScale(Ae-h);te=Math.sqrt(Qe/ye*2)}const we=te*te;function De(Ae){const Qe=(ce*ce-se*se+(Ae?-1:1)*we*we*ye*ye)/(2*(Ae?ce:se)*we*ye);return Math.log(Math.sqrt(Qe*Qe+1)-Qe)}function Re(Ae){return(Math.exp(Ae)-Math.exp(-Ae))/2}function Se(Ae){return(Math.exp(Ae)+Math.exp(-Ae))/2}const Te=De(!1);let Ne=function(Ae){return Se(Te)/Se(Te+te*Ae)},tt=function(Ae){return se*((Se(Te)*(Re(Qe=Te+te*Ae)/Se(Qe))-Re(Te))/we)/ye;var Qe},Ce=(De(!0)-Te)/te;if(Math.abs(ye)<1e-6||!isFinite(Ce)){if(Math.abs(se-ce)<1e-6)return this.easeTo(t,n);const Ae=ce<se?-1:1;Ce=Math.abs(Math.log(ce/se))/te,tt=()=>0,Ne=Qe=>Math.exp(Ae*te*Qe)}return t.duration="duration"in t?+t.duration:1e3*Ce/("screenSpeed"in t?+t.screenSpeed/te:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=g!==w,this._pitching=C!==y,this._padding=!a.isPaddingEqual(E),this._prepareEase(n,!1),this.terrain&&this._prepareElevation(H),this._ease(Ae=>{const Qe=Ae*Ce,Dt=1/Ne(Qe);a.zoom=Ae===1?U:h+a.scaleZoom(Dt),this._rotating&&(a.bearing=c.z.number(g,w,Ae)),this._pitching&&(a.pitch=c.z.number(y,C,Ae)),this._padding&&(a.interpolatePadding(b,E,Ae),F=a.centerPoint.add(R)),this.terrain&&!t.freezeElevation&&this._updateElevation(Ae);const ot=Ae===1?H:a.unproject(Y.add(j.mult(tt(Qe))).mult(Dt));a.setLocationAtPoint(a.renderWorldCopies?ot.wrap():ot,F),this._applyUpdatedTransform(a),this._fireMoveEvents(n)},()=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(n)},t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,n){var o;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const a=this._onEaseEnd;delete this._onEaseEnd,a.call(this,n)}return t||(o=this.handlers)===null||o===void 0||o.stop(!1),this}_ease(t,n,o){o.animate===!1||o.duration===0?(t(1),n()):(this._easeStart=le.now(),this._easeOptions=o,this._onEaseFrame=t,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(t,n){t=c.b3(t,-180,180);const o=Math.abs(t-n);return Math.abs(t-360-n)<o&&(t-=360),Math.abs(t+360-n)<o&&(t+=360),t}_normalizeCenter(t,n){if(!n.renderWorldCopies||n.lngRange)return;const o=t.lng-n.center.lng;t.lng+=o>180?-360:o<-180?360:0}queryTerrainElevation(t){return this.terrain?this.terrain.getElevationForLngLatZoom(c.N.convert(t),this.transform.tileZoom)-this.transform.elevation:null}}const Aa={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class $n{constructor(t=Aa){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=oe.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=oe.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=oe.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(){oe.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 g=h.getSource();g.attribution&&t.indexOf(g.attribution)<0&&t.push(g.attribution)}}t=t.filter(a=>String(a).trim()),t.sort((a,h)=>a.length-h.length),t=t.filter((a,h)=>{for(let g=h+1;g<t.length;g++)if(t[g].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 xr{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=oe.create("div","maplibregl-ctrl");const n=oe.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(){oe.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class Fe{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 ql=c.Y([{name:"a_pos3d",type:"Int16",components:3}]);class Ma 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 g=a.canonical.z-t.canonical.z,y=a.canonical.x-(a.canonical.x>>g<<g),b=a.canonical.y-(a.canonical.y>>g<<g),w=c.X>>g;c.aQ(h.posMatrix,0,w,0,w,0,1),c.J(h.posMatrix,h.posMatrix,[-y*w,-b*w,0]),n[o]=h}else if(t.canonical.isChildOf(a.canonical)){const h=t.clone();h.posMatrix=new Float64Array(16);const g=t.canonical.z-a.canonical.z,y=t.canonical.x-(t.canonical.x>>g<<g),b=t.canonical.y-(t.canonical.y>>g<<g),w=c.X>>g;c.aQ(h.posMatrix,0,c.X,0,c.X,0,1),c.J(h.posMatrix,h.posMatrix,[y*w,b*w,0]),c.K(h.posMatrix,h.posMatrix,[1/2**g,1/2**g,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 Zl{constructor(t,n,o){this.painter=t,this.sourceCache=new Ma(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 g=this.getTerrainData(t),y=(h=g.tile)===null||h===void 0?void 0:h.dem;if(!y)return 0;const b=function($,H,U){var W=H[0],Y=H[1];return $[0]=U[0]*W+U[4]*Y+U[12],$[1]=U[1]*W+U[5]*Y+U[13],$}([],[n/a*c.X,o/a*c.X],g.u_terrain_matrix),w=[b[0]*y.dim,b[1]*y.dim],C=Math.floor(w[0]),E=Math.floor(w[1]),R=w[0]-C,F=w[1]-E;return y.get(C,E)*(1-R)*(1-F)+y.get(C+1,E)*R*(1-F)+y.get(C,E+1)*(1-R)*F+y.get(C+1,E+1)*R*F}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 St(a,h,a.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new St(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 St(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 g=t.canonical.x-(t.canonical.x>>h<<h),y=t.canonical.y-(t.canonical.y>>h<<h),b=c.bb(new Float64Array(16),[1/(c.X<<h),1/(c.X<<h),0]);c.J(b,b,[g*c.X,y*c.X,0]),this._demMatrixCache[t.key]={matrix:b,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 St(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 St(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,g=0;h<this._coordsTextureSize;h++)for(let y=0;y<this._coordsTextureSize;y++,g+=4)n[g+0]=255&y,n[g+1]=255&h,n[g+2]=y>>8<<4|h>>8,n[g+3]=0;const o=new c.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(n.buffer)),a=new St(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),g=Math.round(t.y*this.painter.pixelRatio/devicePixelRatio),y=Math.round(this.painter.height/devicePixelRatio);o.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),a.readPixels(h,y-g-1,1,1,a.RGBA,a.UNSIGNED_BYTE,n),o.bindFramebuffer.set(null);const b=n[0]+(n[2]>>4<<8),w=n[1]+((15&n[2])<<8),C=this.coordsIndex[255-n[3]],E=C&&this.sourceCache.getTileByID(C);if(!E)return null;const R=this._coordsTextureSize,F=(1<<E.tileID.canonical.z)*R;return new c.Z((E.tileID.canonical.x*R+b)/F+E.tileID.wrap,(E.tileID.canonical.y*R+w)/F,this.getElevation(E.tileID,b,w,R))}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,g=a*a;for(let E=0;E<=a;E++)for(let R=0;R<=a;R++)n.emplaceBack(R*h,E*h,0);for(let E=0;E<g;E+=a+1)for(let R=0;R<a;R++)o.emplaceBack(R+E,a+R+E+1,a+R+E+2),o.emplaceBack(R+E,a+R+E+2,R+E+1);const y=n.length,b=y+2*(a+1);for(const E of[0,1])for(let R=0;R<=a;R++)for(const F of[0,1])n.emplaceBack(R*h,E*c.X,F);for(let E=0;E<2*a;E+=2)o.emplaceBack(b+E,b+E+1,b+E+3),o.emplaceBack(b+E,b+E+3,b+E+2),o.emplaceBack(y+E,y+E+3,y+E+1),o.emplaceBack(y+E,y+E+2,y+E+3);const w=n.length,C=w+2*(a+1);for(const E of[0,1])for(let R=0;R<=a;R++)for(const F of[0,1])n.emplaceBack(E*c.X,R*h,F);for(let E=0;E<2*a;E+=2)o.emplaceBack(w+E,w+E+1,w+E+3),o.emplaceBack(w+E,w+E+3,w+E+2),o.emplaceBack(C+E,C+E+3,C+E+1),o.emplaceBack(C+E,C+E+2,C+E+3);return this._mesh=new Fl(t.createVertexBuffer(n,ql.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,g=o.y*a,y=Math.floor(h/c.X),b=Math.floor(g/c.X);return{tileID:new c.S(n,0,n,y,b),mercatorX:h,mercatorY:g}}}class As{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 St(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 vr={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class Gl{constructor(t,n){this.painter=t,this.terrain=n,this.pool=new As(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 g=this.terrain.sourceCache.getTerrainCoords(h);for(const y in g)this._coordsDescendingInv[o][y]||(this._coordsDescendingInv[o][y]=[]),this._coordsDescendingInv[o][y].push(g[y])}}this._coordsDescendingInvStr={};for(const o of t._order){const a=t._layers[o],h=a.source;if(vr[a.type]&&!this._coordsDescendingInvStr[h]){this._coordsDescendingInvStr[h]={};for(const g in this._coordsDescendingInv[h])this._coordsDescendingInvStr[h][g]=this._coordsDescendingInv[h][g].map(y=>y.key).sort().join()}}for(const o of this._renderableTiles)for(const a in this._coordsDescendingInvStr){const h=this._coordsDescendingInvStr[a][o.tileID.key];h&&h!==o.rttCoords[a]&&(o.rtt=[])}}renderLayer(t){if(t.isHidden(this.painter.transform.zoom))return!1;const n=t.type,o=this.painter,a=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(vr[n]&&(this._prevType&&vr[this._prevType]||this._stacks.push([]),this._prevType=n,this._stacks[this._stacks.length-1].push(t.id),!a))return!0;if(vr[this._prevType]||vr[n]&&a){this._prevType=n;const h=this._stacks.length-1,g=this._stacks[h]||[];for(const y of this._renderableTiles){if(this.pool.isFull()&&(ws(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(y),y.rtt[h]){const w=this.pool.getObjectForId(y.rtt[h].id);if(w.stamp===y.rtt[h].stamp){this.pool.useObject(w);continue}}const b=this.pool.getOrCreateFreeObject();this.pool.useObject(b),this.pool.stampObject(b),y.rtt[h]={id:b.id,stamp:b.stamp},o.context.bindFramebuffer.set(b.fbo.framebuffer),o.context.clear({color:c.aN.transparent,stencil:0}),o.currentStencilSource=void 0;for(let w=0;w<g.length;w++){const C=o.style._layers[g[w]],E=C.source?this._coordsDescendingInv[C.source][y.tileID.key]:[y.tileID];o.context.viewport.set([0,0,b.fbo.width,b.fbo.height]),o._renderTileClippingMasks(C,E),o.renderLayer(o,o.style.sourceCaches[C.source],C,E),C.source&&(y.rttCoords[C.source]=this._coordsDescendingInvStr[C.source][y.tileID.key])}}return ws(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects(),vr[n]}return!1}}const ze={"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"},za=fe,nh={hash:!1,interactive:!0,bearingSnap:7,attributionControl:Aa,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},Hl=u=>{u.touchstart=u.dragStart,u.touchmoveWindow=u.dragMove,u.touchend=u.dragEnd},Da={showCompass:!0,showZoom:!0,visualizePitch:!1};class Xl{constructor(t,n,o=!1){this.mousedown=g=>{this.startMouse(c.e({},g,{ctrlKey:!0,preventDefault:()=>g.preventDefault()}),oe.mousePos(this.element,g)),oe.addEventListener(window,"mousemove",this.mousemove),oe.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=g=>{this.moveMouse(g,oe.mousePos(this.element,g))},this.mouseup=g=>{this.mouseRotate.dragEnd(g),this.mousePitch&&this.mousePitch.dragEnd(g),this.offTemp()},this.touchstart=g=>{g.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=oe.touchPos(this.element,g.targetTouches)[0],this.startTouch(g,this._startPos),oe.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),oe.addEventListener(window,"touchend",this.touchend))},this.touchmove=g=>{g.targetTouches.length!==1?this.reset():(this._lastPos=oe.touchPos(this.element,g.targetTouches)[0],this.moveTouch(g,this._lastPos))},this.touchend=g=>{g.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()},this.reset=()=>{this.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=ya({clickTolerance:a,enable:!0}),this.touchRotate=(({enable:g,clickTolerance:y,bearingDegreesPerPixelMoved:b=.8})=>{const w=new yo;return new zt({clickTolerance:y,move:(C,E)=>({bearingDelta:(E.x-C.x)*b}),moveStateManager:w,enable:g,assignEvents:Hl})})({clickTolerance:a,enable:!0}),this.map=t,o&&(this.mousePitch=xn({clickTolerance:h,enable:!0}),this.touchPitch=(({enable:g,clickTolerance:y,pitchDegreesPerPixelMoved:b=-.5})=>{const w=new yo;return new zt({clickTolerance:y,move:(C,E)=>({pitchDelta:(E.y-C.y)*b}),moveStateManager:w,enable:g,assignEvents:Hl})})({clickTolerance:h,enable:!0})),oe.addEventListener(n,"mousedown",this.mousedown),oe.addEventListener(n,"touchstart",this.touchstart,{passive:!1}),oe.addEventListener(n,"touchcancel",this.reset)}startMouse(t,n){this.mouseRotate.dragStart(t,n),this.mousePitch&&this.mousePitch.dragStart(t,n),oe.disableDrag()}startTouch(t,n){this.touchRotate.dragStart(t,n),this.touchPitch&&this.touchPitch.dragStart(t,n),oe.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;oe.removeEventListener(t,"mousedown",this.mousedown),oe.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),oe.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),oe.removeEventListener(window,"touchend",this.touchend),oe.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){oe.enableDrag(),oe.removeEventListener(window,"mousemove",this.mousemove),oe.removeEventListener(window,"mouseup",this.mouseup),oe.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),oe.removeEventListener(window,"touchend",this.touchend)}}let Kr;function Wl(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),g=n.locationPoint(u).distSqr(t);n.locationPoint(a).distSqr(t)<g?u=a:n.locationPoint(h).distSqr(t)<g&&(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 La={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 La)o.remove(`maplibregl-${n}-anchor-${a}`);o.add(`maplibregl-${n}-anchor-${t}`)}class Pt 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?Wl(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 g="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?g="rotateX(0deg)":this._pitchAlignment==="map"&&(g=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||n&&n.type!=="moveend"||(this._pos=this._pos.round()),oe.setTransform(this._element,`${La[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${g} ${h}`),le.frameAsync(new AbortController).then(()=>{this._updateOpacity(n&&n.type==="moveend")}).catch(()=>{})},this._onMove=n=>{if(!this._isDragging){const o=this._clickTolerance||this._map._clickTolerance;this._isDragging=n.point.dist(this._pointerdownPos)>=o}this._isDragging&&(this._pos=n.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new c.k("dragstart"))),this.fire(new c.k("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new c.k("dragend")),this._state="inactive"},this._addDragHandler=n=>{this._element.contains(n.originalEvent.target)&&(n.preventDefault(),this._positionDelta=n.point.sub(this._pos).add(this._offset),this._pointerdownPos=n.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=t&&t.anchor||"center",this._color=t&&t.color||"#3FB1CE",this._scale=t&&t.scale||1,this._draggable=t&&t.draggable||!1,this._clickTolerance=t&&t.clickTolerance||0,this._subpixelPositioning=t&&t.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||"auto",this._pitchAlignment=t&&t.pitchAlignment&&t.pitchAlignment!=="auto"?t.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(t==null?void 0:t.opacity,t==null?void 0:t.opacityWhenCovered),t&&t.element)this._element=t.element,this._offset=c.P.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=oe.create("div");const n=oe.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=oe.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 g=oe.createNS("http://www.w3.org/2000/svg","g");g.setAttributeNS(null,"fill-rule","nonzero");const y=oe.createNS("http://www.w3.org/2000/svg","g");y.setAttributeNS(null,"transform","translate(3.0, 29.0)"),y.setAttributeNS(null,"fill","#000000");const b=[{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 W of b){const Y=oe.createNS("http://www.w3.org/2000/svg","ellipse");Y.setAttributeNS(null,"opacity","0.04"),Y.setAttributeNS(null,"cx","10.5"),Y.setAttributeNS(null,"cy","5.80029008"),Y.setAttributeNS(null,"rx",W.rx),Y.setAttributeNS(null,"ry",W.ry),y.appendChild(Y)}const w=oe.createNS("http://www.w3.org/2000/svg","g");w.setAttributeNS(null,"fill",this._color);const C=oe.createNS("http://www.w3.org/2000/svg","path");C.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),w.appendChild(C);const E=oe.createNS("http://www.w3.org/2000/svg","g");E.setAttributeNS(null,"opacity","0.25"),E.setAttributeNS(null,"fill","#000000");const R=oe.createNS("http://www.w3.org/2000/svg","path");R.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"),E.appendChild(R);const F=oe.createNS("http://www.w3.org/2000/svg","g");F.setAttributeNS(null,"transform","translate(6.0, 7.0)"),F.setAttributeNS(null,"fill","#FFFFFF");const $=oe.createNS("http://www.w3.org/2000/svg","g");$.setAttributeNS(null,"transform","translate(8.0, 8.0)");const H=oe.createNS("http://www.w3.org/2000/svg","circle");H.setAttributeNS(null,"fill","#000000"),H.setAttributeNS(null,"opacity","0.25"),H.setAttributeNS(null,"cx","5.5"),H.setAttributeNS(null,"cy","5.5"),H.setAttributeNS(null,"r","5.4999962");const U=oe.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"),$.appendChild(H),$.appendChild(U),g.appendChild(y),g.appendChild(w),g.appendChild(E),g.appendChild(F),g.appendChild($),n.appendChild(g),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),oe.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),g=a.terrain.getElevationForLngLatZoom(this._lngLat,a.transform.tileZoom);if(a.transform.lngLatToCameraDepth(this._lngLat,g)-h<.006)return void(this._element.style.opacity=this._opacity);const y=-this._offset.y/a.transform._pixelPerMeter,b=Math.sin(a.getPitch()*Math.PI/180)*y,w=a.terrain.depthAtPoint(new c.P(this._pos.x,this._pos.y-this._offset.y)),C=a.transform.lngLatToCameraDepth(this._lngLat,g+b)-w>.006;!((o=this._popup)===null||o===void 0)&&o.isOpen()&&C&&this._popup.remove(),this._element.style.opacity=C?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 xo={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let jn=0,Un=!1;const Jl={maxWidth:100,unit:"metric"};function Ra(u,t,n){const o=n&&n.maxWidth||100,a=u._container.clientHeight/2,h=u.unproject([0,a]),g=u.unproject([o,a]),y=h.distanceTo(g);if(n&&n.unit==="imperial"){const b=3.2808*y;b>5280?Ms(t,o,b/5280,u._getUIString("ScaleControl.Miles")):Ms(t,o,b,u._getUIString("ScaleControl.Feet"))}else n&&n.unit==="nautical"?Ms(t,o,y/1852,u._getUIString("ScaleControl.NauticalMiles")):y>=1e3?Ms(t,o,y/1e3,u._getUIString("ScaleControl.Kilometers")):Ms(t,o,y,u._getUIString("ScaleControl.Meters"))}function Ms(u,t,n,o){const a=function(h){const g=Math.pow(10,`${Math.floor(h)}`.length-1);let y=h/g;return y=y>=10?10:y>=5?5:y>=3?3:y>=2?2:y>=1?1:function(b){const w=Math.pow(10,Math.ceil(-Math.log(b)/Math.LN10));return Math.round(b*w)/w}(y),g*y}(n);u.style.width=t*(a/n)+"px",u.innerHTML=`${a}&nbsp;${o}`}const br={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},vo=["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=fe;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=$n,T.BoxZoomHandler=ma,T.CanvasSource=Xi,T.CooperativeGesturesHandler=rr,T.DoubleClickZoomHandler=Ca,T.DragPanHandler=Ji,T.DragRotateHandler=ir,T.EdgeInsets=uo,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=oe.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){oe.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const u=this._fullscreenButton=oe.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);oe.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=os,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),g=ue.fromLngLat(n,o);this._map.fitBounds(g,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=oe.create("button","maplibregl-ctrl-geolocate",this._container),oe.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=oe.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Pt({element:this._dotElement}),this._circleElement=oe.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Pt({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({},xo,u)}onAdd(u){return this._map=u,this._container=oe.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(),oe.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=Ss,T.ImageSource=Ar,T.KeyboardHandler=Ta,T.LngLatBounds=ue,T.LogoControl=xr,T.Map=class extends rh{constructor(u){c.be.mark(c.bf.create);const t=Object.assign(Object.assign({},nh),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 ha(t.minZoom,t.maxZoom,t.minPitch,t.maxPitch,t.renderWorldCopies),{bearingSnap:t.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new Fe,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({},ze),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=He.addThrottleControl(()=>this.isMoving()),this._requestManager=new Ft(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=po(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 ih(this,t),this._hash=t.hash&&new Ss(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 $n(typeof t.attributionControl=="boolean"?void 0:t.attributionControl)),t.maplibreLogo&&this.addControl(new xr,t.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",n=>{this._update(n.dataType==="style"),this.fire(new c.k(`${n.dataType}data`,n))}),this.on("dataloading",n=>{this.fire(new c.k(`${n.dataType}dataloading`,n))}),this.on("dataabort",n=>{this.fire(new c.k("sourcedataabort",n))})}_getMapId(){return this._mapId}addControl(u,t){if(t===void 0&&(t=u.getDefaultPosition?u.getDefaultPosition():"top-right"),!u||!u.onAdd)return this.fire(new c.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const n=u.onAdd(this);this._controls.push(u);const o=this._controlPositions[t];return t.indexOf("bottom")!==-1?o.insertBefore(n,o.firstChild):o.appendChild(n),this}removeControl(u){if(!u||!u.onRemove)return this.fire(new c.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(u);return t>-1&&this._controls.splice(t,1),u.onRemove(this),this}hasControl(u){return this._controls.indexOf(u)>-1}calculateCameraOptionsFromTo(u,t,n,o){return o==null&&this.terrain&&(o=this.terrain.getElevationForLngLatZoom(n,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(u,t,n,o)}resize(u){var t;const n=this._containerDimensions(),o=n[0],a=n[1],h=this._getClampedPixelRatio(o,a);if(this._resizeCanvas(o,a,h),this.painter.resize(o,a,h),this.painter.overLimit()){const y=this.painter.context.gl;this._maxCanvasSize=[y.drawingBufferWidth,y.drawingBufferHeight];const b=this._getClampedPixelRatio(o,a);this._resizeCanvas(o,a,b),this.painter.resize(o,a,b)}this.transform.resize(o,a),(t=this._requestedCameraState)===null||t===void 0||t.resize(o,a);const g=!this._moving;return g&&(this.stop(),this.fire(new c.k("movestart",u)).fire(new c.k("move",u))),this.fire(new c.k("resize",u)),g&&this.fire(new c.k("moveend",u)),this}_getClampedPixelRatio(u,t){const{0:n,1:o}=this._maxCanvasSize,a=this.getPixelRatio(),h=u*a,g=t*a;return Math.min(h>n?n/h:1,g>o?o/g: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 g=this.getLayer(t)?this.queryRenderedFeatures(h.point,{layers:[t]}):[];g.length?o||(o=!0,n.call(this,new Ti(u,this,h.originalEvent,{features:g}))):o=!1},mouseout:()=>{o=!1}}}}if(u==="mouseleave"||u==="mouseout"){let o=!1;return{layer:t,listener:n,delegates:{mousemove:g=>{(this.getLayer(t)?this.queryRenderedFeatures(g.point,{layers:[t]}):[]).length?o=!0:o&&(o=!1,n.call(this,new Ti(u,this,g.originalEvent)))},mouseout:g=>{o&&(o=!1,n.call(this,new Ti(u,this,g.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 g=a[h];if(g.layer===t&&g.listener===n){for(const y in g.delegates)this.off(y,g.delegates[y]);return a.splice(h,1),this}}})(),this)}queryRenderedFeatures(u,t){if(!this.style)return[];let n;const o=u instanceof c.P||Array.isArray(u),a=o?u:[[0,0],[this.transform.width,this.transform.height]];if(t=t||(o?{}:u)||{},a instanceof c.P||typeof a[0]=="number")n=[c.P.convert(a)];else{const h=c.P.convert(a[0]),g=c.P.convert(a[1]);n=[h,new c.P(g.x,h.y),g,new c.P(h.x,g.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 Zo(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 Zo(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 Zl(this.painter,t,u),this.painter.renderToTexture=new Gl(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:g,content:y,textFitWidth:b,textFitHeight:w}=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:C,height:E,data:R}=t,F=t;return this.style.addImage(u,{data:new c.R({width:C,height:E},new Uint8Array(R)),pixelRatio:o,stretchX:h,stretchY:g,content:y,textFitWidth:b,textFitHeight:w,sdf:a,version:0,userImage:F}),F.onAdd&&F.onAdd(this,u),this}}{const{width:C,height:E,data:R}=le.getImageData(t);this.style.addImage(u,{data:new c.R({width:C,height:E},R),pixelRatio:o,stretchX:h,stretchY:g,content:y,textFitWidth:b,textFitHeight:w,sdf:a,version:0})}}updateImage(u,t){const n=this.style.getImage(u);if(!n)return this.fire(new c.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const o=t instanceof HTMLImageElement||c.b(t)?le.getImageData(t):t,{width:a,height:h,data:g}=o;if(a===void 0||h===void 0)return this.fire(new c.j(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(a!==n.data.width||h!==n.data.height)return this.fire(new c.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));const y=!(t instanceof HTMLImageElement||c.b(t));return n.data.replace(g,y),this.style.updateImage(u,n),this}getImage(u){return this.style.getImage(u)}hasImage(u){return u?!!this.style.getImage(u):(this.fire(new c.j(new Error("Missing required image id"))),!1)}removeImage(u){this.style.removeImage(u)}loadImage(u){return He.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=oe.create("div","maplibregl-canvas-container",u);this._interactive&&t.classList.add("maplibregl-interactive"),this._canvas=oe.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=oe.create("div","maplibregl-control-container",u),h=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(g=>{h[g]=oe.create("div",`maplibregl-ctrl-${g} `,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 Ol(n,this.transform),ht.testSupport(n)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(u){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||u,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(u){return this._update(),this._renderTaskQueue.add(u)}_cancelRenderFrame(u){this._renderTaskQueue.remove(u)}_render(u){const t=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(u),this._removed)return;let n=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const a=this.transform.zoom,h=le.now();this.style.zoomHistory.update(a,h);const g=new c.a9(a,{now:h,fadeDuration:t,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),y=g.crossFadingFactor();y===1&&y===this._crossFadingFactor||(n=!0,this._crossFadingFactor=y),this.style.update(g)}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),He.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),oe.remove(this._canvasContainer),oe.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),c.be.clearMetrics(),this._removed=!0,this.fire(new c.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,le.frameAsync(this._frameRequest).then(u=>{c.be.frame(u),this._frameRequest=null,this._render(u)}).catch(()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(u){this._showTileBoundaries!==u&&(this._showTileBoundaries=u,this._update())}get showPadding(){return!!this._showPadding}set showPadding(u){this._showPadding!==u&&(this._showPadding=u,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(u){this._showCollisionBoxes!==u&&(this._showCollisionBoxes=u,u?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(u){this._showOverdrawInspector!==u&&(this._showOverdrawInspector=u,this._update())}get repaint(){return!!this._repaint}set repaint(u){this._repaint!==u&&(this._repaint=u,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(u){this._vertices=u,this._update()}get version(){return za}getCameraTargetElevation(){return this.transform.elevation}},T.MapMouseEvent=Ti,T.MapTouchEvent=Ts,T.MapWheelEvent=pa,T.Marker=Pt,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({},Da,u),this._container=oe.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})),oe.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})),oe.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=oe.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 Xl(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){oe.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=oe.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&&oe.remove(this._content),this._container&&(oe.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=oe.create("div","maplibregl-popup",this._map.getContainer()),this._tip=oe.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const y of this.options.className.split(" "))this._container.classList.add(y);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=this._map.transform.renderWorldCopies&&!this._trackPointer?Wl(this._lngLat,this._flatPos,this._map.transform):(n=this._lngLat)===null||n===void 0?void 0:n.wrap(),this._trackPointer&&!t)return;const o=this._flatPos=this._pos=this._trackPointer&&t?t:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&t?t:this._map.transform.locationPoint(this._lngLat));let a=this.options.anchor;const h=qe(this.options.offset);if(!a){const y=this._container.offsetWidth,b=this._container.offsetHeight;let w;w=o.y+h.bottom.y<b?["top"]:o.y>this._map.transform.height-b?["bottom"]:[],o.x<y/2?w.push("left"):o.x>this._map.transform.width-y/2&&w.push("right"),a=w.length===0?"bottom":w.join("-")}let g=o.add(h[a]);this.options.subpixelPositioning||(g=g.round()),oe.setTransform(this._container,`${La[a]} translate(${g.x}px,${g.y}px)`),Yr(this._container,a,"popup")},this._onClose=()=>{this.remove()},this.options=c.e(Object.create(br),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=oe.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=oe.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const u=this._container.querySelector(vo);u&&u.focus()}},T.RasterDEMTileSource=jt,T.RasterTileSource=yt,T.ScaleControl=class{constructor(u){this._onMove=()=>{Ra(this._map,this._container,this.options)},this.setUnit=t=>{this.options.unit=t,Ra(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Jl),u)}getDefaultPosition(){return"bottom-left"}onAdd(u){return this._map=u,this._container=oe.create("div","maplibregl-ctrl maplibregl-ctrl-scale",u.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){oe.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},T.ScrollZoomHandler=Ia,T.Style=Zo,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=oe.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=oe.create("button","maplibregl-ctrl-terrain",this._container),oe.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(){oe.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},T.TwoFingersTouchPitchHandler=Sa,T.TwoFingersTouchRotateHandler=wa,T.TwoFingersTouchZoomHandler=va,T.TwoFingersTouchZoomRotateHandler=Ea,T.VectorTileSource=ss,T.VideoSource=zn,T.addSourceType=(u,t)=>c._(void 0,void 0,void 0,function*(){if(ls(u))throw new Error(`A source type called "${u}" already exists.`);((n,o)=>{as[n]=o})(u,t)}),T.clearPrewarmedResources=function(){const u=Oi;u&&(u.isPreloaded()&&u.numActive()===1?(u.release($r),Oi=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 mr().getRTLTextPluginStatus()},T.getVersion=function(){return Je},T.getWorkerCount=function(){return pr.workerCount},T.getWorkerUrl=function(){return c.a.WORKER_URL},T.importScriptInWorkers=function(u){return ns().broadcast("IS",u)},T.prewarm=function(){an().acquire($r)},T.setMaxParallelImageRequests=function(u){c.a.MAX_PARALLEL_IMAGE_REQUESTS=u},T.setRTLTextPlugin=function(u,t){return mr().setRTLTextPlugin(u,t)},T.setWorkerCount=function(u){pr.workerCount=u},T.setWorkerUrl=function(u){c.a.WORKER_URL=u}});var Z=k;return Z})})(Wh);var Lp=Wh.exports;const In=Dp(Lp);function Rp(f){const v=[{type:"fill",minzoom:f.pointZoom||0,paint:{"fill-color":f.color||"#ccc","fill-outline-color":f.stroke||"#blue","fill-opacity":f.opacity||1}}];return f.pointZoom&&v.push({type:"circle",maxzoom:f.pointZoom,paint:{"circle-color":f.color||"#ccc","circle-stroke-color":f.stroke||"#ccc","circle-stroke-width":f.width||1,"circle-opacity":f.opacity||1}}),f.label&&v.push({type:"symbol",layout:{"text-field":["get",f.label],"text-font":["Open Sans Regular"],"text-size":12,"text-anchor":"center"},paint:{"text-color":"#000","text-halo-color":"#fff","text-halo-width":1.5}}),v}function Bp(f){const v=[{type:"line",paint:{"line-color":f.color||"#ccc","line-opacity":f.opacity||1}}];return f.label&&v.push({type:"symbol",layout:{"text-field":["get",f.label],"text-font":["Open Sans Regular"],"text-size":12,"symbol-placement":"line-center"},paint:{"text-color":"#000","text-halo-color":"#fff","text-halo-width":1.5}}),v}function Fp(f){const v=[{type:"circle",maxzoom:f.icon&&+f.iconZoom||22,paint:{"circle-radius":f.radius||6,"circle-stroke-color":f.stroke||"#ccc","circle-stroke-width":f.width||1,"circle-color":f.color||"blue","circle-opacity":f.opacity||1}}];return f!=null&&f.clusterZoom&&(v.push({type:"circle",filter:["has","point_count"],paint:{"circle-color":["step",["get","point_count"],"#51bbd6",100,"#f1f075",750,"#f28cb1"],"circle-radius":["step",["get","point_count"],20,100,30,750,40]}}),v.push({type:"symbol",filter:["has","point_count"],layout:{"text-field":["get","point_count"],"text-font":["Open Sans Regular"],"text-size":12}})),f.icon&&v.push({type:"symbol",minzoom:+f.iconZoom||16,layout:{"icon-image":f.icon,"icon-allow-overlap":!0}}),f.label&&v.push({type:"symbol",layout:{"text-field":["get",f.label],"text-font":["Open Sans Regular"],"text-size":12,"text-anchor":"top"},paint:{"text-color":"#000","text-halo-color":"#fff","text-halo-width":1.5}}),v}function Op(f){if(!f)return null;const v=f.type||"point";return v==="polygon"?Rp(f):v==="line"?Bp(f):Fp(f)}const Jh=["#69D2E7","yellow","#FE4365","#125B9A","#41B3A2","#D7C3F1","#F1D3CE"],Vp=["ma-star","ma-water","ma-swimming","fa-home","fa-search","fa-trash","fa-check"],Kh={};async function Yh(f,v,k="api"){const P=await fetch(`${k}/gis-layer/${f}/${v}`),{rows:L}=await P.json();return L}async function bc(f,v,k,P){if(!f)return null;const L=JSON.parse(JSON.stringify(f)),Z=L.colorAttr?await Yh(v,L.colorAttr,P):null;Z==null||Z.forEach((c,fe)=>{var me,ve;c.color=c.color||((me=L.colorSet)==null?void 0:me[c.id])||((ve=L.colorSet)==null?void 0:ve[fe])||Jh[fe%Jh.length],c.icon=L.icon?L.icon.split("+")[0]+"+"+c.color.replace("#","")+".png":null});const T=L.iconAttr?await Yh(v,L.iconAttr,P):null;if(T==null||T.forEach((c,fe)=>{var ht,je,Ke,Oe;const me=c.icon||((ht=L.iconSet)==null?void 0:ht[c.id])||((je=L.iconPattern)==null?void 0:je.replace("{id}",c.id))||((Ke=L.iconSet)==null?void 0:Ke[fe])||(L.iconPrefix?null:Vp[fe]);if(!me)return;const ve=c.color||((Oe=L.color)==null?void 0:Oe.replace("#",""))||"red",[le="pin6",oe="m"]=L.icon?L.icon.split("-"):[];c.icon=L.iconPrefix||me!=null&&me.includes("/")?(L.iconPrefix||"")+me:`${le}-${oe}-${me}+${ve}.png`}),L.colorAttr&&Z){const c=["match",["get",L.colorAttr]];Z.filter(fe=>fe.id).forEach(fe=>{c.push(fe.id),c.push(fe.color)}),c.push(L.color||"gray"),L.color=c}if(L.icon&&L.iconAttr&&T){const c=["match",["get",L.iconAttr]];T.filter(fe=>fe.icon).forEach(({id:fe,icon:me})=>{if(L.colorAttr&&Z){c.push(fe);const ve=["match",["get",L.colorAttr]];Z.forEach(le=>{ve.push(le.id);const oe=me.split("+")[0]+"+"+le.color.replace("#","")+".png";ve.push(oe),Vs(oe,k,P)}),ve.push(L.icon),c.push(ve)}else c.push(fe),c.push(me),Vs(me,k,P)}),c.push((L.iconPrefix||"")+L.icon),Vs((L.iconPrefix||"")+L.icon,k,P),L.icon=c}else if(L.icon&&L.colorAttr&&Z){const c=["match",["get",L.colorAttr]];Z.forEach(fe=>{c.push(fe.id),c.push(fe.icon),Vs(fe.icon,k,P)}),c.push(L.icon),Vs(L.icon,k,P),L.icon=c}else L.icon&&await Vs(L.icon,k,P);return Np({style:f,colors:Z,icons:T,map:k,id:v}),Op(L)}async function Vs(f="pin4-sm-mi-plumber+f45942.png",v=null,k){if(Kh[f])return null;Kh[f]=!0;const P=await(v==null?void 0:v.loadImage(f!=null&&f.startsWith("/")||f!=null&&f.includes("//")?f:`${k}/marker_icon/${f.replace(".png","")}.png`));v==null||v.addImage(f,P.data)}function Np({style:f,colors:v,icons:k,map:P,id:L}){P.legend||Object.assign(P,{legend:{}}),window.map||(window.map=P),Object.assign(P.legend,{[L]:{icon:f.icon,colors:v,icons:k,color:f.color||"blue",type:f.type||"point"}})}const Oo={data(){return{layerList:[],activeLayer:""}},computed:{interactiveSources(){return this.layerList.filter(f=>f==null?void 0:f.interactive).map(f=>f.id)}},methods:{moveLayer(f,v=this.map){v.getStyle().layers.forEach(k=>{k.id.match(f)&&v.moveLayer(k.id)})},async setVisible(f,v=!0,k=this.map){if(!f)return;const P=(f==null?void 0:f.id)||f,L=this.layerList.find(T=>T.id===f)||f;if(!(L!=null&&L.id))throw new Error("MixinError: Layer has no id");k.getStyle().layers.filter(T=>T.id.match(P)).forEach(T=>{k.setLayoutProperty(T.id,"visibility",v?"visible":"none")}),v&&await this.addLayer(L)},async addLayer(f,v=this==null?void 0:this.map){var L,Z;const k=this.layerList.find(T=>T.id===f)||f;!this.map.getStyle()||this.map.getStyle().layers.find(T=>T.id===k.id)||(this.layerList.find(T=>T.id===k.id)||this.layerList.push(k),(k.service==="vtile"||k.service==="vector"||(L=k.url)!=null&&L.includes(".vmt"))&&this.addVtileLayer(k,v),k.service==="geojson"&&this.addGeoJsonLayer(k,v),((Z=k.url)!=null&&Z.includes(".png")||["tms","raster"].includes(k.service))&&await this.addRasterLayer(k,v))},async addRasterLayer(f,v=this==null?void 0:this.map){v.getSource(f.id)||(typeof f.bounds=="string"&&Object.assign(f,{bounds:f.bounds.split(",")}),await v.addSource(f.id,{type:"raster",tiles:[`${this.prefix?f==null?void 0:f.url.replace(/(\/api[^\/]*)/,this.prefix):f==null?void 0:f.url}${f!=null&&f.url.includes("?")?"&":"?"}dt=${new Date().toISOString().split("T")[0]}`],tileSize:256,...f.bounds?{bounds:f.bounds.map(k=>k-0)}:{},...f!=null&&f.scheme?{scheme:f==null?void 0:f.scheme}:{}}),await v.addLayer({id:f.id,type:"raster",source:f.id,minzoom:0,maxzoom:(f==null?void 0:f.maxzoom)||22}))},async updateStyle(f,v=this==null?void 0:this.map){const k=f.id;v.getStyle().layers.forEach(async L=>{L.source===k&&v.getLayer(L.id)&&await v.removeLayer(L.id)}),(await bc(f.style,f.source||f.id,v,this.prefix)||f.layers||[]).forEach((L,Z)=>{const T={...L,id:`${f.id}-${Z}`,source:f.id,"source-layer":L["source-layer"]||f.source||f.id,maxzoom:+L.maxzoom||24,minzoom:+L.minzoom||0};v.addLayer(T)})},async addVtileLayer(f,v=this==null?void 0:this.map){var Z;const k=["props","pointZoom","clusterZoom"].filter(T=>f[T]).map(T=>`&${T}=${f[T]}`),P={type:"vector",tiles:[`${(Z=f==null?void 0:f.url)!=null&&Z.startsWith("http")?"":window.location.origin}${f==null?void 0:f.url}${k}`],minzoom:f.minzoom||5,maxzoom:f.maxzoom||24};v.addSource(f.id,P),(f.layers||await bc(f.style,f.source||f.id,v,this.prefix)||[]).forEach((T,c)=>{const fe={...T,id:`${f.id}-${c}`,source:f.id,"source-layer":T["source-layer"]||f.source||f.id,maxzoom:+T.maxzoom||24,minzoom:+T.minzoom||0};v.addLayer(fe)})},async addGeoJsonLayer(f,v=this.map){var L;const k=f.data||((L=f==null?void 0:f.url)!=null&&L.startsWith("http")?"":window.location.origin)+f.url;v.addSource(f.id,{type:"geojson",data:k}),(await bc(f.style,k.source||k.id,v,this.prefix)||f.layers||[]).forEach(Z=>{const T={...Z,source:f.id,id:Z.id||f.id,maxzoom:+Z.maxzoom||24,minzoom:+Z.minzoom||0,type:Z.type||"circle"};v.addLayer(T)})},setLayerData(f,v){this.layerList=this.layerList.map(k=>k.id===f?{...k,...v}:k)},async removeLayer(f,v=this.map){v.getSource(f)&&(await v.getStyle().layers.forEach(async k=>{k.source===f&&await v.removeLayer(k.id)}),v.getSource(f)&&await v.removeSource(f))},async setFilter(f,v){const k=this.layerList.find(L=>L.id===f);await(await this.map.getSource(f)).setTiles([`${window.location.origin}${k.url}${k.url.includes("?")?"&":"?"}filter=${v}${k.props?`&props=${k.props}`:""}`])},async changeBaseLayer(f){f!==this.activeLayer&&(this.activeLayer&&this.map.setLayoutProperty(this.activeLayer,"visibility","none"),await this.setVisible(this.activeLayer,!1),await this.setVisible(f,!0),this.map.getStyle().layers.forEach(v=>{v.source!==f&&v.type!=="background"&&this.map.moveLayer(v.id)}),this.activeLayer=f)},async refreshLayer(f,v=this.map){await v.getStyle().layers.forEach(k=>{k.source===f&&v.removeLayer(k.id)}),v.getSource(f)&&await v.removeSource(f),this.setVisible(f)}}},Fi=(f,v)=>{const k=f.__vccOpts||f;for(const[P,L]of v)k[P]=L;return k},$p={},jp={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"},Up=[N.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 qp(f,v){return N.openBlock(),N.createElementBlock("svg",jp,Up)}const Zp=Fi($p,[["render",qp]]);function Qh(f,v){return function(){return f.apply(v,arguments)}}const{toString:Gp}=Object.prototype,{getPrototypeOf:wc}=Object,sl=(f=>v=>{const k=Gp.call(v);return f[k]||(f[k]=k.slice(8,-1).toLowerCase())})(Object.create(null)),kr=f=>(f=f.toLowerCase(),v=>sl(v)===f),ol=f=>v=>typeof v===f,{isArray:Ns}=Array,Vo=ol("undefined");function Hp(f){return f!==null&&!Vo(f)&&f.constructor!==null&&!Vo(f.constructor)&&Yi(f.constructor.isBuffer)&&f.constructor.isBuffer(f)}const eu=kr("ArrayBuffer");function Xp(f){let v;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?v=ArrayBuffer.isView(f):v=f&&f.buffer&&eu(f.buffer),v}const Wp=ol("string"),Yi=ol("function"),tu=ol("number"),al=f=>f!==null&&typeof f=="object",Jp=f=>f===!0||f===!1,ll=f=>{if(sl(f)!=="object")return!1;const v=wc(f);return(v===null||v===Object.prototype||Object.getPrototypeOf(v)===null)&&!(Symbol.toStringTag in f)&&!(Symbol.iterator in f)},Kp=kr("Date"),Yp=kr("File"),Qp=kr("Blob"),ef=kr("FileList"),tf=f=>al(f)&&Yi(f.pipe),rf=f=>{let v;return f&&(typeof FormData=="function"&&f instanceof FormData||Yi(f.append)&&((v=sl(f))==="formdata"||v==="object"&&Yi(f.toString)&&f.toString()==="[object FormData]"))},nf=kr("URLSearchParams"),[sf,of,af,lf]=["ReadableStream","Request","Response","Headers"].map(kr),cf=f=>f.trim?f.trim():f.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function No(f,v,{allOwnKeys:k=!1}={}){if(f===null||typeof f>"u")return;let P,L;if(typeof f!="object"&&(f=[f]),Ns(f))for(P=0,L=f.length;P<L;P++)v.call(null,f[P],P,f);else{const Z=k?Object.getOwnPropertyNames(f):Object.keys(f),T=Z.length;let c;for(P=0;P<T;P++)c=Z[P],v.call(null,f[c],c,f)}}function iu(f,v){v=v.toLowerCase();const k=Object.keys(f);let P=k.length,L;for(;P-- >0;)if(L=k[P],v===L.toLowerCase())return L;return null}const ts=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,ru=f=>!Vo(f)&&f!==ts;function Sc(){const{caseless:f}=ru(this)&&this||{},v={},k=(P,L)=>{const Z=f&&iu(v,L)||L;ll(v[Z])&&ll(P)?v[Z]=Sc(v[Z],P):ll(P)?v[Z]=Sc({},P):Ns(P)?v[Z]=P.slice():v[Z]=P};for(let P=0,L=arguments.length;P<L;P++)arguments[P]&&No(arguments[P],k);return v}const hf=(f,v,k,{allOwnKeys:P}={})=>(No(v,(L,Z)=>{k&&Yi(L)?f[Z]=Qh(L,k):f[Z]=L},{allOwnKeys:P}),f),uf=f=>(f.charCodeAt(0)===65279&&(f=f.slice(1)),f),df=(f,v,k,P)=>{f.prototype=Object.create(v.prototype,P),f.prototype.constructor=f,Object.defineProperty(f,"super",{value:v.prototype}),k&&Object.assign(f.prototype,k)},pf=(f,v,k,P)=>{let L,Z,T;const c={};if(v=v||{},f==null)return v;do{for(L=Object.getOwnPropertyNames(f),Z=L.length;Z-- >0;)T=L[Z],(!P||P(T,f,v))&&!c[T]&&(v[T]=f[T],c[T]=!0);f=k!==!1&&wc(f)}while(f&&(!k||k(f,v))&&f!==Object.prototype);return v},ff=(f,v,k)=>{f=String(f),(k===void 0||k>f.length)&&(k=f.length),k-=v.length;const P=f.indexOf(v,k);return P!==-1&&P===k},mf=f=>{if(!f)return null;if(Ns(f))return f;let v=f.length;if(!tu(v))return null;const k=new Array(v);for(;v-- >0;)k[v]=f[v];return k},gf=(f=>v=>f&&v instanceof f)(typeof Uint8Array<"u"&&wc(Uint8Array)),_f=(f,v)=>{const P=(f&&f[Symbol.iterator]).call(f);let L;for(;(L=P.next())&&!L.done;){const Z=L.value;v.call(f,Z[0],Z[1])}},yf=(f,v)=>{let k;const P=[];for(;(k=f.exec(v))!==null;)P.push(k);return P},xf=kr("HTMLFormElement"),vf=f=>f.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(k,P,L){return P.toUpperCase()+L}),nu=(({hasOwnProperty:f})=>(v,k)=>f.call(v,k))(Object.prototype),bf=kr("RegExp"),su=(f,v)=>{const k=Object.getOwnPropertyDescriptors(f),P={};No(k,(L,Z)=>{let T;(T=v(L,Z,f))!==!1&&(P[Z]=T||L)}),Object.defineProperties(f,P)},wf=f=>{su(f,(v,k)=>{if(Yi(f)&&["arguments","caller","callee"].indexOf(k)!==-1)return!1;const P=f[k];if(Yi(P)){if(v.enumerable=!1,"writable"in v){v.writable=!1;return}v.set||(v.set=()=>{throw Error("Can not rewrite read-only method '"+k+"'")})}})},Sf=(f,v)=>{const k={},P=L=>{L.forEach(Z=>{k[Z]=!0})};return Ns(f)?P(f):P(String(f).split(v)),k},Tf=()=>{},kf=(f,v)=>f!=null&&Number.isFinite(f=+f)?f:v,Tc="abcdefghijklmnopqrstuvwxyz",ou="0123456789",au={DIGIT:ou,ALPHA:Tc,ALPHA_DIGIT:Tc+Tc.toUpperCase()+ou},If=(f=16,v=au.ALPHA_DIGIT)=>{let k="";const{length:P}=v;for(;f--;)k+=v[Math.random()*P|0];return k};function Cf(f){return!!(f&&Yi(f.append)&&f[Symbol.toStringTag]==="FormData"&&f[Symbol.iterator])}const Ef=f=>{const v=new Array(10),k=(P,L)=>{if(al(P)){if(v.indexOf(P)>=0)return;if(!("toJSON"in P)){v[L]=P;const Z=Ns(P)?[]:{};return No(P,(T,c)=>{const fe=k(T,L+1);!Vo(fe)&&(Z[c]=fe)}),v[L]=void 0,Z}}return P};return k(f,0)},Pf=kr("AsyncFunction"),Af=f=>f&&(al(f)||Yi(f))&&Yi(f.then)&&Yi(f.catch),lu=((f,v)=>f?setImmediate:v?((k,P)=>(ts.addEventListener("message",({source:L,data:Z})=>{L===ts&&Z===k&&P.length&&P.shift()()},!1),L=>{P.push(L),ts.postMessage(k,"*")}))(`axios@${Math.random()}`,[]):k=>setTimeout(k))(typeof setImmediate=="function",Yi(ts.postMessage)),Mf=typeof queueMicrotask<"u"?queueMicrotask.bind(ts):typeof process<"u"&&process.nextTick||lu,ge={isArray:Ns,isArrayBuffer:eu,isBuffer:Hp,isFormData:rf,isArrayBufferView:Xp,isString:Wp,isNumber:tu,isBoolean:Jp,isObject:al,isPlainObject:ll,isReadableStream:sf,isRequest:of,isResponse:af,isHeaders:lf,isUndefined:Vo,isDate:Kp,isFile:Yp,isBlob:Qp,isRegExp:bf,isFunction:Yi,isStream:tf,isURLSearchParams:nf,isTypedArray:gf,isFileList:ef,forEach:No,merge:Sc,extend:hf,trim:cf,stripBOM:uf,inherits:df,toFlatObject:pf,kindOf:sl,kindOfTest:kr,endsWith:ff,toArray:mf,forEachEntry:_f,matchAll:yf,isHTMLForm:xf,hasOwnProperty:nu,hasOwnProp:nu,reduceDescriptors:su,freezeMethods:wf,toObjectSet:Sf,toCamelCase:vf,noop:Tf,toFiniteNumber:kf,findKey:iu,global:ts,isContextDefined:ru,ALPHABET:au,generateString:If,isSpecCompliantForm:Cf,toJSONObject:Ef,isAsyncFn:Pf,isThenable:Af,setImmediate:lu,asap:Mf};function ct(f,v,k,P,L){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=f,this.name="AxiosError",v&&(this.code=v),k&&(this.config=k),P&&(this.request=P),L&&(this.response=L)}ge.inherits(ct,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:ge.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const cu=ct.prototype,hu={};["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(f=>{hu[f]={value:f}}),Object.defineProperties(ct,hu),Object.defineProperty(cu,"isAxiosError",{value:!0}),ct.from=(f,v,k,P,L,Z)=>{const T=Object.create(cu);return ge.toFlatObject(f,T,function(fe){return fe!==Error.prototype},c=>c!=="isAxiosError"),ct.call(T,f.message,v,k,P,L),T.cause=f,T.name=f.name,Z&&Object.assign(T,Z),T};const zf=null;function kc(f){return ge.isPlainObject(f)||ge.isArray(f)}function uu(f){return ge.endsWith(f,"[]")?f.slice(0,-2):f}function du(f,v,k){return f?f.concat(v).map(function(L,Z){return L=uu(L),!k&&Z?"["+L+"]":L}).join(k?".":""):v}function Df(f){return ge.isArray(f)&&!f.some(kc)}const Lf=ge.toFlatObject(ge,{},null,function(v){return/^is[A-Z]/.test(v)});function cl(f,v,k){if(!ge.isObject(f))throw new TypeError("target must be an object");v=v||new FormData,k=ge.toFlatObject(k,{metaTokens:!0,dots:!1,indexes:!1},!1,function(Ke,Oe){return!ge.isUndefined(Oe[Ke])});const P=k.metaTokens,L=k.visitor||ve,Z=k.dots,T=k.indexes,fe=(k.Blob||typeof Blob<"u"&&Blob)&&ge.isSpecCompliantForm(v);if(!ge.isFunction(L))throw new TypeError("visitor must be a function");function me(je){if(je===null)return"";if(ge.isDate(je))return je.toISOString();if(!fe&&ge.isBlob(je))throw new ct("Blob is not supported. Use a Buffer instead.");return ge.isArrayBuffer(je)||ge.isTypedArray(je)?fe&&typeof Blob=="function"?new Blob([je]):Buffer.from(je):je}function ve(je,Ke,Oe){let ft=je;if(je&&!Oe&&typeof je=="object"){if(ge.endsWith(Ke,"{}"))Ke=P?Ke:Ke.slice(0,-2),je=JSON.stringify(je);else if(ge.isArray(je)&&Df(je)||(ge.isFileList(je)||ge.endsWith(Ke,"[]"))&&(ft=ge.toArray(je)))return Ke=uu(Ke),ft.forEach(function(He,Ft){!(ge.isUndefined(He)||He===null)&&v.append(T===!0?du([Ke],Ft,Z):T===null?Ke:Ke+"[]",me(He))}),!1}return kc(je)?!0:(v.append(du(Oe,Ke,Z),me(je)),!1)}const le=[],oe=Object.assign(Lf,{defaultVisitor:ve,convertValue:me,isVisitable:kc});function ht(je,Ke){if(!ge.isUndefined(je)){if(le.indexOf(je)!==-1)throw Error("Circular reference detected in "+Ke.join("."));le.push(je),ge.forEach(je,function(ft,st){(!(ge.isUndefined(ft)||ft===null)&&L.call(v,ft,ge.isString(st)?st.trim():st,Ke,oe))===!0&&ht(ft,Ke?Ke.concat(st):[st])}),le.pop()}}if(!ge.isObject(f))throw new TypeError("data must be an object");return ht(f),v}function pu(f){const v={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(f).replace(/[!'()~]|%20|%00/g,function(P){return v[P]})}function Ic(f,v){this._pairs=[],f&&cl(f,this,v)}const fu=Ic.prototype;fu.append=function(v,k){this._pairs.push([v,k])},fu.toString=function(v){const k=v?function(P){return v.call(this,P,pu)}:pu;return this._pairs.map(function(L){return k(L[0])+"="+k(L[1])},"").join("&")};function Rf(f){return encodeURIComponent(f).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function mu(f,v,k){if(!v)return f;const P=k&&k.encode||Rf,L=k&&k.serialize;let Z;if(L?Z=L(v,k):Z=ge.isURLSearchParams(v)?v.toString():new Ic(v,k).toString(P),Z){const T=f.indexOf("#");T!==-1&&(f=f.slice(0,T)),f+=(f.indexOf("?")===-1?"?":"&")+Z}return f}class gu{constructor(){this.handlers=[]}use(v,k,P){return this.handlers.push({fulfilled:v,rejected:k,synchronous:P?P.synchronous:!1,runWhen:P?P.runWhen:null}),this.handlers.length-1}eject(v){this.handlers[v]&&(this.handlers[v]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(v){ge.forEach(this.handlers,function(P){P!==null&&v(P)})}}const _u={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Bf={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:Ic,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},Cc=typeof window<"u"&&typeof document<"u",Ff=(f=>Cc&&["ReactNative","NativeScript","NS"].indexOf(f)<0)(typeof navigator<"u"&&navigator.product),Of=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Vf=Cc&&window.location.href||"http://localhost",Ir={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Cc,hasStandardBrowserEnv:Ff,hasStandardBrowserWebWorkerEnv:Of,origin:Vf},Symbol.toStringTag,{value:"Module"})),...Bf};function Nf(f,v){return cl(f,new Ir.classes.URLSearchParams,Object.assign({visitor:function(k,P,L,Z){return Ir.isNode&&ge.isBuffer(k)?(this.append(P,k.toString("base64")),!1):Z.defaultVisitor.apply(this,arguments)}},v))}function $f(f){return ge.matchAll(/\w+|\[(\w*)]/g,f).map(v=>v[0]==="[]"?"":v[1]||v[0])}function jf(f){const v={},k=Object.keys(f);let P;const L=k.length;let Z;for(P=0;P<L;P++)Z=k[P],v[Z]=f[Z];return v}function yu(f){function v(k,P,L,Z){let T=k[Z++];if(T==="__proto__")return!0;const c=Number.isFinite(+T),fe=Z>=k.length;return T=!T&&ge.isArray(L)?L.length:T,fe?(ge.hasOwnProp(L,T)?L[T]=[L[T],P]:L[T]=P,!c):((!L[T]||!ge.isObject(L[T]))&&(L[T]=[]),v(k,P,L[T],Z)&&ge.isArray(L[T])&&(L[T]=jf(L[T])),!c)}if(ge.isFormData(f)&&ge.isFunction(f.entries)){const k={};return ge.forEachEntry(f,(P,L)=>{v($f(P),L,k,0)}),k}return null}function Uf(f,v,k){if(ge.isString(f))try{return(v||JSON.parse)(f),ge.trim(f)}catch(P){if(P.name!=="SyntaxError")throw P}return(k||JSON.stringify)(f)}const $o={transitional:_u,adapter:["xhr","http","fetch"],transformRequest:[function(v,k){const P=k.getContentType()||"",L=P.indexOf("application/json")>-1,Z=ge.isObject(v);if(Z&&ge.isHTMLForm(v)&&(v=new FormData(v)),ge.isFormData(v))return L?JSON.stringify(yu(v)):v;if(ge.isArrayBuffer(v)||ge.isBuffer(v)||ge.isStream(v)||ge.isFile(v)||ge.isBlob(v)||ge.isReadableStream(v))return v;if(ge.isArrayBufferView(v))return v.buffer;if(ge.isURLSearchParams(v))return k.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),v.toString();let c;if(Z){if(P.indexOf("application/x-www-form-urlencoded")>-1)return Nf(v,this.formSerializer).toString();if((c=ge.isFileList(v))||P.indexOf("multipart/form-data")>-1){const fe=this.env&&this.env.FormData;return cl(c?{"files[]":v}:v,fe&&new fe,this.formSerializer)}}return Z||L?(k.setContentType("application/json",!1),Uf(v)):v}],transformResponse:[function(v){const k=this.transitional||$o.transitional,P=k&&k.forcedJSONParsing,L=this.responseType==="json";if(ge.isResponse(v)||ge.isReadableStream(v))return v;if(v&&ge.isString(v)&&(P&&!this.responseType||L)){const T=!(k&&k.silentJSONParsing)&&L;try{return JSON.parse(v)}catch(c){if(T)throw c.name==="SyntaxError"?ct.from(c,ct.ERR_BAD_RESPONSE,this,null,this.response):c}}return v}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ir.classes.FormData,Blob:Ir.classes.Blob},validateStatus:function(v){return v>=200&&v<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ge.forEach(["delete","get","head","post","put","patch"],f=>{$o.headers[f]={}});const qf=ge.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"]),Zf=f=>{const v={};let k,P,L;return f&&f.split(`
581
581
  `).forEach(function(T){L=T.indexOf(":"),k=T.substring(0,L).trim().toLowerCase(),P=T.substring(L+1).trim(),!(!k||v[k]&&qf[k])&&(k==="set-cookie"?v[k]?v[k].push(P):v[k]=[P]:v[k]=v[k]?v[k]+", "+P:P)}),v},xu=Symbol("internals");function jo(f){return f&&String(f).trim().toLowerCase()}function hl(f){return f===!1||f==null?f:ge.isArray(f)?f.map(hl):String(f)}function Gf(f){const v=Object.create(null),k=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let P;for(;P=k.exec(f);)v[P[1]]=P[2];return v}const Hf=f=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(f.trim());function Ec(f,v,k,P,L){if(ge.isFunction(P))return P.call(this,v,k);if(L&&(v=k),!!ge.isString(v)){if(ge.isString(P))return v.indexOf(P)!==-1;if(ge.isRegExp(P))return P.test(v)}}function Xf(f){return f.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(v,k,P)=>k.toUpperCase()+P)}function Wf(f,v){const k=ge.toCamelCase(" "+v);["get","set","has"].forEach(P=>{Object.defineProperty(f,P+k,{value:function(L,Z,T){return this[P].call(this,v,L,Z,T)},configurable:!0})})}class Hi{constructor(v){v&&this.set(v)}set(v,k,P){const L=this;function Z(c,fe,me){const ve=jo(fe);if(!ve)throw new Error("header name must be a non-empty string");const le=ge.findKey(L,ve);(!le||L[le]===void 0||me===!0||me===void 0&&L[le]!==!1)&&(L[le||fe]=hl(c))}const T=(c,fe)=>ge.forEach(c,(me,ve)=>Z(me,ve,fe));if(ge.isPlainObject(v)||v instanceof this.constructor)T(v,k);else if(ge.isString(v)&&(v=v.trim())&&!Hf(v))T(Zf(v),k);else if(ge.isHeaders(v))for(const[c,fe]of v.entries())Z(fe,c,P);else v!=null&&Z(k,v,P);return this}get(v,k){if(v=jo(v),v){const P=ge.findKey(this,v);if(P){const L=this[P];if(!k)return L;if(k===!0)return Gf(L);if(ge.isFunction(k))return k.call(this,L,P);if(ge.isRegExp(k))return k.exec(L);throw new TypeError("parser must be boolean|regexp|function")}}}has(v,k){if(v=jo(v),v){const P=ge.findKey(this,v);return!!(P&&this[P]!==void 0&&(!k||Ec(this,this[P],P,k)))}return!1}delete(v,k){const P=this;let L=!1;function Z(T){if(T=jo(T),T){const c=ge.findKey(P,T);c&&(!k||Ec(P,P[c],c,k))&&(delete P[c],L=!0)}}return ge.isArray(v)?v.forEach(Z):Z(v),L}clear(v){const k=Object.keys(this);let P=k.length,L=!1;for(;P--;){const Z=k[P];(!v||Ec(this,this[Z],Z,v,!0))&&(delete this[Z],L=!0)}return L}normalize(v){const k=this,P={};return ge.forEach(this,(L,Z)=>{const T=ge.findKey(P,Z);if(T){k[T]=hl(L),delete k[Z];return}const c=v?Xf(Z):String(Z).trim();c!==Z&&delete k[Z],k[c]=hl(L),P[c]=!0}),this}concat(...v){return this.constructor.concat(this,...v)}toJSON(v){const k=Object.create(null);return ge.forEach(this,(P,L)=>{P!=null&&P!==!1&&(k[L]=v&&ge.isArray(P)?P.join(", "):P)}),k}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([v,k])=>v+": "+k).join(`
582
582
  `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(v){return v instanceof this?v:new this(v)}static concat(v,...k){const P=new this(v);return k.forEach(L=>P.set(L)),P}static accessor(v){const P=(this[xu]=this[xu]={accessors:{}}).accessors,L=this.prototype;function Z(T){const c=jo(T);P[c]||(Wf(L,T),P[c]=!0)}return ge.isArray(v)?v.forEach(Z):Z(v),this}}Hi.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),ge.reduceDescriptors(Hi.prototype,({value:f},v)=>{let k=v[0].toUpperCase()+v.slice(1);return{get:()=>f,set(P){this[k]=P}}}),ge.freezeMethods(Hi);function Pc(f,v){const k=this||$o,P=v||k,L=Hi.from(P.headers);let Z=P.data;return ge.forEach(f,function(c){Z=c.call(k,Z,L.normalize(),v?v.status:void 0)}),L.normalize(),Z}function vu(f){return!!(f&&f.__CANCEL__)}function $s(f,v,k){ct.call(this,f??"canceled",ct.ERR_CANCELED,v,k),this.name="CanceledError"}ge.inherits($s,ct,{__CANCEL__:!0});function bu(f,v,k){const P=k.config.validateStatus;!k.status||!P||P(k.status)?f(k):v(new ct("Request failed with status code "+k.status,[ct.ERR_BAD_REQUEST,ct.ERR_BAD_RESPONSE][Math.floor(k.status/100)-4],k.config,k.request,k))}function Jf(f){const v=/^([-+\w]{1,25})(:?\/\/|:)/.exec(f);return v&&v[1]||""}function Kf(f,v){f=f||10;const k=new Array(f),P=new Array(f);let L=0,Z=0,T;return v=v!==void 0?v:1e3,function(fe){const me=Date.now(),ve=P[Z];T||(T=me),k[L]=fe,P[L]=me;let le=Z,oe=0;for(;le!==L;)oe+=k[le++],le=le%f;if(L=(L+1)%f,L===Z&&(Z=(Z+1)%f),me-T<v)return;const ht=ve&&me-ve;return ht?Math.round(oe*1e3/ht):void 0}}function Yf(f,v){let k=0,P=1e3/v,L,Z;const T=(me,ve=Date.now())=>{k=ve,L=null,Z&&(clearTimeout(Z),Z=null),f.apply(null,me)};return[(...me)=>{const ve=Date.now(),le=ve-k;le>=P?T(me,ve):(L=me,Z||(Z=setTimeout(()=>{Z=null,T(L)},P-le)))},()=>L&&T(L)]}const ul=(f,v,k=3)=>{let P=0;const L=Kf(50,250);return Yf(Z=>{const T=Z.loaded,c=Z.lengthComputable?Z.total:void 0,fe=T-P,me=L(fe),ve=T<=c;P=T;const le={loaded:T,total:c,progress:c?T/c:void 0,bytes:fe,rate:me||void 0,estimated:me&&c&&ve?(c-T)/me:void 0,event:Z,lengthComputable:c!=null,[v?"download":"upload"]:!0};f(le)},k)},wu=(f,v)=>{const k=f!=null;return[P=>v[0]({lengthComputable:k,total:f,loaded:P}),v[1]]},Su=f=>(...v)=>ge.asap(()=>f(...v)),Qf=Ir.hasStandardBrowserEnv?function(){const v=/(msie|trident)/i.test(navigator.userAgent),k=document.createElement("a");let P;function L(Z){let T=Z;return v&&(k.setAttribute("href",T),T=k.href),k.setAttribute("href",T),{href:k.href,protocol:k.protocol?k.protocol.replace(/:$/,""):"",host:k.host,search:k.search?k.search.replace(/^\?/,""):"",hash:k.hash?k.hash.replace(/^#/,""):"",hostname:k.hostname,port:k.port,pathname:k.pathname.charAt(0)==="/"?k.pathname:"/"+k.pathname}}return P=L(window.location.href),function(T){const c=ge.isString(T)?L(T):T;return c.protocol===P.protocol&&c.host===P.host}}():function(){return function(){return!0}}(),em=Ir.hasStandardBrowserEnv?{write(f,v,k,P,L,Z){const T=[f+"="+encodeURIComponent(v)];ge.isNumber(k)&&T.push("expires="+new Date(k).toGMTString()),ge.isString(P)&&T.push("path="+P),ge.isString(L)&&T.push("domain="+L),Z===!0&&T.push("secure"),document.cookie=T.join("; ")},read(f){const v=document.cookie.match(new RegExp("(^|;\\s*)("+f+")=([^;]*)"));return v?decodeURIComponent(v[3]):null},remove(f){this.write(f,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function tm(f){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(f)}function im(f,v){return v?f.replace(/\/?\/$/,"")+"/"+v.replace(/^\/+/,""):f}function Tu(f,v){return f&&!tm(v)?im(f,v):v}const ku=f=>f instanceof Hi?{...f}:f;function is(f,v){v=v||{};const k={};function P(me,ve,le){return ge.isPlainObject(me)&&ge.isPlainObject(ve)?ge.merge.call({caseless:le},me,ve):ge.isPlainObject(ve)?ge.merge({},ve):ge.isArray(ve)?ve.slice():ve}function L(me,ve,le){if(ge.isUndefined(ve)){if(!ge.isUndefined(me))return P(void 0,me,le)}else return P(me,ve,le)}function Z(me,ve){if(!ge.isUndefined(ve))return P(void 0,ve)}function T(me,ve){if(ge.isUndefined(ve)){if(!ge.isUndefined(me))return P(void 0,me)}else return P(void 0,ve)}function c(me,ve,le){if(le in v)return P(me,ve);if(le in f)return P(void 0,me)}const fe={url:Z,method:Z,data:Z,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:(me,ve)=>L(ku(me),ku(ve),!0)};return ge.forEach(Object.keys(Object.assign({},f,v)),function(ve){const le=fe[ve]||L,oe=le(f[ve],v[ve],ve);ge.isUndefined(oe)&&le!==c||(k[ve]=oe)}),k}const Iu=f=>{const v=is({},f);let{data:k,withXSRFToken:P,xsrfHeaderName:L,xsrfCookieName:Z,headers:T,auth:c}=v;v.headers=T=Hi.from(T),v.url=mu(Tu(v.baseURL,v.url),f.params,f.paramsSerializer),c&&T.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):"")));let fe;if(ge.isFormData(k)){if(Ir.hasStandardBrowserEnv||Ir.hasStandardBrowserWebWorkerEnv)T.setContentType(void 0);else if((fe=T.getContentType())!==!1){const[me,...ve]=fe?fe.split(";").map(le=>le.trim()).filter(Boolean):[];T.setContentType([me||"multipart/form-data",...ve].join("; "))}}if(Ir.hasStandardBrowserEnv&&(P&&ge.isFunction(P)&&(P=P(v)),P||P!==!1&&Qf(v.url))){const me=L&&Z&&em.read(Z);me&&T.set(L,me)}return v},rm=typeof XMLHttpRequest<"u"&&function(f){return new Promise(function(k,P){const L=Iu(f);let Z=L.data;const T=Hi.from(L.headers).normalize();let{responseType:c,onUploadProgress:fe,onDownloadProgress:me}=L,ve,le,oe,ht,je;function Ke(){ht&&ht(),je&&je(),L.cancelToken&&L.cancelToken.unsubscribe(ve),L.signal&&L.signal.removeEventListener("abort",ve)}let Oe=new XMLHttpRequest;Oe.open(L.method.toUpperCase(),L.url,!0),Oe.timeout=L.timeout;function ft(){if(!Oe)return;const He=Hi.from("getAllResponseHeaders"in Oe&&Oe.getAllResponseHeaders()),wt={data:!c||c==="text"||c==="json"?Oe.responseText:Oe.response,status:Oe.status,statusText:Oe.statusText,headers:He,config:f,request:Oe};bu(function($t){k($t),Ke()},function($t){P($t),Ke()},wt),Oe=null}"onloadend"in Oe?Oe.onloadend=ft:Oe.onreadystatechange=function(){!Oe||Oe.readyState!==4||Oe.status===0&&!(Oe.responseURL&&Oe.responseURL.indexOf("file:")===0)||setTimeout(ft)},Oe.onabort=function(){Oe&&(P(new ct("Request aborted",ct.ECONNABORTED,f,Oe)),Oe=null)},Oe.onerror=function(){P(new ct("Network Error",ct.ERR_NETWORK,f,Oe)),Oe=null},Oe.ontimeout=function(){let Ft=L.timeout?"timeout of "+L.timeout+"ms exceeded":"timeout exceeded";const wt=L.transitional||_u;L.timeoutErrorMessage&&(Ft=L.timeoutErrorMessage),P(new ct(Ft,wt.clarifyTimeoutError?ct.ETIMEDOUT:ct.ECONNABORTED,f,Oe)),Oe=null},Z===void 0&&T.setContentType(null),"setRequestHeader"in Oe&&ge.forEach(T.toJSON(),function(Ft,wt){Oe.setRequestHeader(wt,Ft)}),ge.isUndefined(L.withCredentials)||(Oe.withCredentials=!!L.withCredentials),c&&c!=="json"&&(Oe.responseType=L.responseType),me&&([oe,je]=ul(me,!0),Oe.addEventListener("progress",oe)),fe&&Oe.upload&&([le,ht]=ul(fe),Oe.upload.addEventListener("progress",le),Oe.upload.addEventListener("loadend",ht)),(L.cancelToken||L.signal)&&(ve=He=>{Oe&&(P(!He||He.type?new $s(null,f,Oe):He),Oe.abort(),Oe=null)},L.cancelToken&&L.cancelToken.subscribe(ve),L.signal&&(L.signal.aborted?ve():L.signal.addEventListener("abort",ve)));const st=Jf(L.url);if(st&&Ir.protocols.indexOf(st)===-1){P(new ct("Unsupported protocol "+st+":",ct.ERR_BAD_REQUEST,f));return}Oe.send(Z||null)})},nm=(f,v)=>{let k=new AbortController,P;const L=function(fe){if(!P){P=!0,T();const me=fe instanceof Error?fe:this.reason;k.abort(me instanceof ct?me:new $s(me instanceof Error?me.message:me))}};let Z=v&&setTimeout(()=>{L(new ct(`timeout ${v} of ms exceeded`,ct.ETIMEDOUT))},v);const T=()=>{f&&(Z&&clearTimeout(Z),Z=null,f.forEach(fe=>{fe&&(fe.removeEventListener?fe.removeEventListener("abort",L):fe.unsubscribe(L))}),f=null)};f.forEach(fe=>fe&&fe.addEventListener&&fe.addEventListener("abort",L));const{signal:c}=k;return c.unsubscribe=T,[c,()=>{Z&&clearTimeout(Z),Z=null}]},sm=function*(f,v){let k=f.byteLength;if(!v||k<v){yield f;return}let P=0,L;for(;P<k;)L=P+v,yield f.slice(P,L),P=L},om=async function*(f,v,k){for await(const P of f)yield*sm(ArrayBuffer.isView(P)?P:await k(String(P)),v)},Cu=(f,v,k,P,L)=>{const Z=om(f,v,L);let T=0,c,fe=me=>{c||(c=!0,P&&P(me))};return new ReadableStream({async pull(me){try{const{done:ve,value:le}=await Z.next();if(ve){fe(),me.close();return}let oe=le.byteLength;if(k){let ht=T+=oe;k(ht)}me.enqueue(new Uint8Array(le))}catch(ve){throw fe(ve),ve}},cancel(me){return fe(me),Z.return()}},{highWaterMark:2})},dl=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",Eu=dl&&typeof ReadableStream=="function",Ac=dl&&(typeof TextEncoder=="function"?(f=>v=>f.encode(v))(new TextEncoder):async f=>new Uint8Array(await new Response(f).arrayBuffer())),Pu=(f,...v)=>{try{return!!f(...v)}catch{return!1}},am=Eu&&Pu(()=>{let f=!1;const v=new Request(Ir.origin,{body:new ReadableStream,method:"POST",get duplex(){return f=!0,"half"}}).headers.has("Content-Type");return f&&!v}),Au=64*1024,Mc=Eu&&Pu(()=>ge.isReadableStream(new Response("").body)),pl={stream:Mc&&(f=>f.body)};dl&&(f=>{["text","arrayBuffer","blob","formData","stream"].forEach(v=>{!pl[v]&&(pl[v]=ge.isFunction(f[v])?k=>k[v]():(k,P)=>{throw new ct(`Response type '${v}' is not supported`,ct.ERR_NOT_SUPPORT,P)})})})(new Response);const lm=async f=>{if(f==null)return 0;if(ge.isBlob(f))return f.size;if(ge.isSpecCompliantForm(f))return(await new Request(f).arrayBuffer()).byteLength;if(ge.isArrayBufferView(f)||ge.isArrayBuffer(f))return f.byteLength;if(ge.isURLSearchParams(f)&&(f=f+""),ge.isString(f))return(await Ac(f)).byteLength},cm=async(f,v)=>{const k=ge.toFiniteNumber(f.getContentLength());return k??lm(v)},zc={http:zf,xhr:rm,fetch:dl&&(async f=>{let{url:v,method:k,data:P,signal:L,cancelToken:Z,timeout:T,onDownloadProgress:c,onUploadProgress:fe,responseType:me,headers:ve,withCredentials:le="same-origin",fetchOptions:oe}=Iu(f);me=me?(me+"").toLowerCase():"text";let[ht,je]=L||Z||T?nm([L,Z],T):[],Ke,Oe;const ft=()=>{!Ke&&setTimeout(()=>{ht&&ht.unsubscribe()}),Ke=!0};let st;try{if(fe&&am&&k!=="get"&&k!=="head"&&(st=await cm(ve,P))!==0){let Xt=new Request(v,{method:"POST",body:P,duplex:"half"}),$t;if(ge.isFormData(P)&&($t=Xt.headers.get("content-type"))&&ve.setContentType($t),Xt.body){const[Vr,bi]=wu(st,ul(Su(fe)));P=Cu(Xt.body,Au,Vr,bi,Ac)}}ge.isString(le)||(le=le?"include":"omit"),Oe=new Request(v,{...oe,signal:ht,method:k.toUpperCase(),headers:ve.normalize().toJSON(),body:P,duplex:"half",credentials:le});let He=await fetch(Oe);const Ft=Mc&&(me==="stream"||me==="response");if(Mc&&(c||Ft)){const Xt={};["status","statusText","headers"].forEach(Nr=>{Xt[Nr]=He[Nr]});const $t=ge.toFiniteNumber(He.headers.get("content-length")),[Vr,bi]=c&&wu($t,ul(Su(c),!0))||[];He=new Response(Cu(He.body,Au,Vr,()=>{bi&&bi(),Ft&&ft()},Ac),Xt)}me=me||"text";let wt=await pl[ge.findKey(pl,me)||"text"](He,f);return!Ft&&ft(),je&&je(),await new Promise((Xt,$t)=>{bu(Xt,$t,{data:wt,headers:Hi.from(He.headers),status:He.status,statusText:He.statusText,config:f,request:Oe})})}catch(He){throw ft(),He&&He.name==="TypeError"&&/fetch/i.test(He.message)?Object.assign(new ct("Network Error",ct.ERR_NETWORK,f,Oe),{cause:He.cause||He}):ct.from(He,He&&He.code,f,Oe)}})};ge.forEach(zc,(f,v)=>{if(f){try{Object.defineProperty(f,"name",{value:v})}catch{}Object.defineProperty(f,"adapterName",{value:v})}});const Mu=f=>`- ${f}`,hm=f=>ge.isFunction(f)||f===null||f===!1,zu={getAdapter:f=>{f=ge.isArray(f)?f:[f];const{length:v}=f;let k,P;const L={};for(let Z=0;Z<v;Z++){k=f[Z];let T;if(P=k,!hm(k)&&(P=zc[(T=String(k)).toLowerCase()],P===void 0))throw new ct(`Unknown adapter '${T}'`);if(P)break;L[T||"#"+Z]=P}if(!P){const Z=Object.entries(L).map(([c,fe])=>`adapter ${c} `+(fe===!1?"is not supported by the environment":"is not available in the build"));let T=v?Z.length>1?`since :
583
583
  `+Z.map(Mu).join(`
584
584
  `):" "+Mu(Z[0]):"as no adapter specified";throw new ct("There is no suitable adapter to dispatch the request "+T,"ERR_NOT_SUPPORT")}return P},adapters:zc};function Dc(f){if(f.cancelToken&&f.cancelToken.throwIfRequested(),f.signal&&f.signal.aborted)throw new $s(null,f)}function Du(f){return Dc(f),f.headers=Hi.from(f.headers),f.data=Pc.call(f,f.transformRequest),["post","put","patch"].indexOf(f.method)!==-1&&f.headers.setContentType("application/x-www-form-urlencoded",!1),zu.getAdapter(f.adapter||$o.adapter)(f).then(function(P){return Dc(f),P.data=Pc.call(f,f.transformResponse,P),P.headers=Hi.from(P.headers),P},function(P){return vu(P)||(Dc(f),P&&P.response&&(P.response.data=Pc.call(f,f.transformResponse,P.response),P.response.headers=Hi.from(P.response.headers))),Promise.reject(P)})}const Lu="1.7.4",Lc={};["object","boolean","number","function","string","symbol"].forEach((f,v)=>{Lc[f]=function(P){return typeof P===f||"a"+(v<1?"n ":" ")+f}});const Ru={};Lc.transitional=function(v,k,P){function L(Z,T){return"[Axios v"+Lu+"] Transitional option '"+Z+"'"+T+(P?". "+P:"")}return(Z,T,c)=>{if(v===!1)throw new ct(L(T," has been removed"+(k?" in "+k:"")),ct.ERR_DEPRECATED);return k&&!Ru[T]&&(Ru[T]=!0,console.warn(L(T," has been deprecated since v"+k+" and will be removed in the near future"))),v?v(Z,T,c):!0}};function um(f,v,k){if(typeof f!="object")throw new ct("options must be an object",ct.ERR_BAD_OPTION_VALUE);const P=Object.keys(f);let L=P.length;for(;L-- >0;){const Z=P[L],T=v[Z];if(T){const c=f[Z],fe=c===void 0||T(c,Z,f);if(fe!==!0)throw new ct("option "+Z+" must be "+fe,ct.ERR_BAD_OPTION_VALUE);continue}if(k!==!0)throw new ct("Unknown option "+Z,ct.ERR_BAD_OPTION)}}const Rc={assertOptions:um,validators:Lc},Cn=Rc.validators;class rs{constructor(v){this.defaults=v,this.interceptors={request:new gu,response:new gu}}async request(v,k){try{return await this._request(v,k)}catch(P){if(P instanceof Error){let L;Error.captureStackTrace?Error.captureStackTrace(L={}):L=new Error;const Z=L.stack?L.stack.replace(/^.+\n/,""):"";try{P.stack?Z&&!String(P.stack).endsWith(Z.replace(/^.+\n.+\n/,""))&&(P.stack+=`
585
- `+Z):P.stack=Z}catch{}}throw P}}_request(v,k){typeof v=="string"?(k=k||{},k.url=v):k=v||{},k=is(this.defaults,k);const{transitional:P,paramsSerializer:L,headers:Z}=k;P!==void 0&&Rc.assertOptions(P,{silentJSONParsing:Cn.transitional(Cn.boolean),forcedJSONParsing:Cn.transitional(Cn.boolean),clarifyTimeoutError:Cn.transitional(Cn.boolean)},!1),L!=null&&(ge.isFunction(L)?k.paramsSerializer={serialize:L}:Rc.assertOptions(L,{encode:Cn.function,serialize:Cn.function},!0)),k.method=(k.method||this.defaults.method||"get").toLowerCase();let T=Z&&ge.merge(Z.common,Z[k.method]);Z&&ge.forEach(["delete","get","head","post","put","patch","common"],je=>{delete Z[je]}),k.headers=Hi.concat(T,Z);const c=[];let fe=!0;this.interceptors.request.forEach(function(Ke){typeof Ke.runWhen=="function"&&Ke.runWhen(k)===!1||(fe=fe&&Ke.synchronous,c.unshift(Ke.fulfilled,Ke.rejected))});const me=[];this.interceptors.response.forEach(function(Ke){me.push(Ke.fulfilled,Ke.rejected)});let ve,le=0,oe;if(!fe){const je=[Du.bind(this),void 0];for(je.unshift.apply(je,c),je.push.apply(je,me),oe=je.length,ve=Promise.resolve(k);le<oe;)ve=ve.then(je[le++],je[le++]);return ve}oe=c.length;let ht=k;for(le=0;le<oe;){const je=c[le++],Ke=c[le++];try{ht=je(ht)}catch(Oe){Ke.call(this,Oe);break}}try{ve=Du.call(this,ht)}catch(je){return Promise.reject(je)}for(le=0,oe=me.length;le<oe;)ve=ve.then(me[le++],me[le++]);return ve}getUri(v){v=is(this.defaults,v);const k=Tu(v.baseURL,v.url);return mu(k,v.params,v.paramsSerializer)}}ge.forEach(["delete","get","head","options"],function(v){rs.prototype[v]=function(k,P){return this.request(is(P||{},{method:v,url:k,data:(P||{}).data}))}}),ge.forEach(["post","put","patch"],function(v){function k(P){return function(Z,T,c){return this.request(is(c||{},{method:v,headers:P?{"Content-Type":"multipart/form-data"}:{},url:Z,data:T}))}}rs.prototype[v]=k(),rs.prototype[v+"Form"]=k(!0)});class Bc{constructor(v){if(typeof v!="function")throw new TypeError("executor must be a function.");let k;this.promise=new Promise(function(Z){k=Z});const P=this;this.promise.then(L=>{if(!P._listeners)return;let Z=P._listeners.length;for(;Z-- >0;)P._listeners[Z](L);P._listeners=null}),this.promise.then=L=>{let Z;const T=new Promise(c=>{P.subscribe(c),Z=c}).then(L);return T.cancel=function(){P.unsubscribe(Z)},T},v(function(Z,T,c){P.reason||(P.reason=new $s(Z,T,c),k(P.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(v){if(this.reason){v(this.reason);return}this._listeners?this._listeners.push(v):this._listeners=[v]}unsubscribe(v){if(!this._listeners)return;const k=this._listeners.indexOf(v);k!==-1&&this._listeners.splice(k,1)}static source(){let v;return{token:new Bc(function(L){v=L}),cancel:v}}}function dm(f){return function(k){return f.apply(null,k)}}function pm(f){return ge.isObject(f)&&f.isAxiosError===!0}const Fc={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(Fc).forEach(([f,v])=>{Fc[v]=f});function Bu(f){const v=new rs(f),k=Qh(rs.prototype.request,v);return ge.extend(k,rs.prototype,v,{allOwnKeys:!0}),ge.extend(k,v,null,{allOwnKeys:!0}),k.create=function(L){return Bu(is(f,L))},k}const Zt=Bu($o);Zt.Axios=rs,Zt.CanceledError=$s,Zt.CancelToken=Bc,Zt.isCancel=vu,Zt.VERSION=Lu,Zt.toFormData=cl,Zt.AxiosError=ct,Zt.Cancel=Zt.CanceledError,Zt.all=function(v){return Promise.all(v)},Zt.spread=dm,Zt.isAxiosError=pm,Zt.mergeConfig=is,Zt.AxiosHeaders=Hi,Zt.formToJSON=f=>yu(ge.isHTMLForm(f)?new FormData(f):f),Zt.getAdapter=zu.getAdapter,Zt.HttpStatusCode=Fc,Zt.default=Zt;const fm=(f,v=300)=>{let k;return function(...L){clearTimeout(k),k=setTimeout(()=>{f.apply(this,L)},v)}};function fl(f,v,k={}){const P={type:"Feature"};return(k.id===0||k.id)&&(P.id=k.id),k.bbox&&(P.bbox=k.bbox),P.properties=v||{},P.geometry=f,P}function Fu(f,v,k={}){if(!f)throw new Error("coordinates is required");if(!Array.isArray(f))throw new Error("coordinates must be an Array");if(f.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!$u(f[0])||!$u(f[1]))throw new Error("coordinates must contain numbers");return fl({type:"Point",coordinates:f},v,k)}function Ou(f,v,k={}){for(const L of f){if(L.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(L[L.length-1].length!==L[0].length)throw new Error("First and last Position are not equivalent.");for(let Z=0;Z<L[L.length-1].length;Z++)if(L[L.length-1][Z]!==L[0][Z])throw new Error("First and last Position are not equivalent.")}return fl({type:"Polygon",coordinates:f},v,k)}function Vu(f,v,k={}){return fl({type:"MultiPoint",coordinates:f},v,k)}function Nu(f,v,k={}){return fl({type:"MultiPolygon",coordinates:f},v,k)}function $u(f){return!isNaN(f)&&f!==null&&!Array.isArray(f)}function Oc(f,v,k){if(f!==null)for(var P,L,Z,T,c,fe,me,ve=0,le=0,oe,ht=f.type,je=ht==="FeatureCollection",Ke=ht==="Feature",Oe=je?f.features.length:1,ft=0;ft<Oe;ft++){me=je?f.features[ft].geometry:Ke?f.geometry:f,oe=me?me.type==="GeometryCollection":!1,c=oe?me.geometries.length:1;for(var st=0;st<c;st++){var He=0,Ft=0;if(T=oe?me.geometries[st]:me,T!==null){fe=T.coordinates;var wt=T.type;switch(ve=k&&(wt==="Polygon"||wt==="MultiPolygon")?1:0,wt){case null:break;case"Point":if(v(fe,le,ft,He,Ft)===!1)return!1;le++,He++;break;case"LineString":case"MultiPoint":for(P=0;P<fe.length;P++){if(v(fe[P],le,ft,He,Ft)===!1)return!1;le++,wt==="MultiPoint"&&He++}wt==="LineString"&&He++;break;case"Polygon":case"MultiLineString":for(P=0;P<fe.length;P++){for(L=0;L<fe[P].length-ve;L++){if(v(fe[P][L],le,ft,He,Ft)===!1)return!1;le++}wt==="MultiLineString"&&He++,wt==="Polygon"&&Ft++}wt==="Polygon"&&He++;break;case"MultiPolygon":for(P=0;P<fe.length;P++){for(Ft=0,L=0;L<fe[P].length;L++){for(Z=0;Z<fe[P][L].length-ve;Z++){if(v(fe[P][L][Z],le,ft,He,Ft)===!1)return!1;le++}Ft++}He++}break;case"GeometryCollection":for(P=0;P<T.geometries.length;P++)if(Oc(T.geometries[P],v,k)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function ju(f,v={}){if(f.bbox!=null&&v.recompute!==!0)return f.bbox;const k=[1/0,1/0,-1/0,-1/0];return Oc(f,P=>{k[0]>P[0]&&(k[0]=P[0]),k[1]>P[1]&&(k[1]=P[1]),k[2]<P[0]&&(k[2]=P[0]),k[3]<P[1]&&(k[3]=P[1])}),k}function Uu(f,v={}){const k=ju(f),P=(k[0]+k[2])/2,L=(k[1]+k[3])/2;return Fu([P,L],v.properties,v)}function mm(f,v={}){let k=0,P=0,L=0;return Oc(f,function(Z){k+=Z[0],P+=Z[1],L++},!0),Fu([k/L,P/L],v.properties)}const gm={mixins:[Oo],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:"&copy; <a href='http://www.openstreetmap.org/copyright'>OpenStreetMap</a>, &copy; <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}]},selectedLayer:{type:String,required:!0}},watch:{map(f){f&&f.on("load",this.handleMapLoad)}},methods:{handleMapLoad(){var f;this.baseLayers.forEach(v=>{this.layerList.push(v)}),this.toggleLayerVisibility((f=this.baseLayers[0])==null?void 0:f.id)},toggleLayerVisibility(f){this.$emit("update:selectedLayer",f),this.changeBaseLayer(f)}}},_m={class:"vs-map-slot-layers z-10 select-none"},ym=["onClick"],xm=["src"];function vm(f,v,k,P,L,Z){return N.openBlock(),N.createElementBlock("div",_m,[(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(k.baseLayers,(T,c)=>(N.openBlock(),N.createElementBlock("div",{key:T.id,class:N.normalizeClass(["vs-map-slot-layers__layer relative",{focused:T.id==k.selectedLayer}]),onClick:fe=>Z.toggleLayerVisibility(T.id)},[N.createElementVNode("img",{src:T.image,class:"vs-map-slot-layers__image"},null,8,xm),N.createElementVNode("div",{class:N.normalizeClass(["absolute py-2 px-4 text-sm text-stone-800 bg-white shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-lg top-[-46px] text-nowrap p-2 hidden whitespace-nowrap",[c===0?"left-[-10px]":"left-[50%] translate-x-[-50%]"]])},N.toDisplayString(T==null?void 0:T.name),3)],10,ym))),128))])}const bm=Fi(gm,[["render",vm],["__scopeId","data-v-8959e540"]]),wm={},Sm={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"},Tm=[N.createElementVNode("path",{d:"M18 6 6 18"},null,-1),N.createElementVNode("path",{d:"m6 6 12 12"},null,-1)];function km(f,v){return N.openBlock(),N.createElementBlock("svg",Sm,Tm)}const ml=Fi(wm,[["render",km]]),Im={},Cm={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Em=[N.createElementVNode("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),N.createElementVNode("path",{d:"M2 17L12 22L22 17",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),N.createElementVNode("path",{d:"M2 12L12 17L22 12",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)];function Pm(f,v){return N.openBlock(),N.createElementBlock("svg",Cm,Em)}const Am={components:{closeIcon:ml,layersIcon:Fi(Im,[["render",Pm]])},mixins:[Oo],props:{layers:{type:Array,default:()=>[]},map:{type:Object,default:null},basemapIds:{type:Array,default:()=>[]}},data(){return{isOpen:!1,selectedLayers:[],mounted:!1}},mounted(){this.mounted=!0},methods:{async handleLayerChange(f,v){await this.setVisible(f,v),v&&this.map.getStyle().layers.filter(L=>!this.basemapIds.includes(L.id)&&L.id!==f.id).map(L=>L.id).forEach(L=>{this.map.getLayer(L)&&this.map.moveLayer(L)})}}},Mm=f=>(N.pushScopeId("data-v-4c33eaa0"),f=f(),N.popScopeId(),f),zm={class:"p-[10px]"},Dm={class:"select-none absolute left-[20px] top-[10px] border bg-white max-w-[250px] p-[10px] rounded-lg z-10"},Lm={class:"flex justify-between items-center border-b pb-[8px] text-[16px]"},Rm=Mm(()=>N.createElementVNode("span",null,"Додаткові шари",-1)),Bm={class:"mt-2 max-h-[300px] overflow-auto [&::-webkit-scrollbar]:h-1.5 [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-gray-300 [&::-webkit-scrollbar-track]:bg-transparent"},Fm=["id","value","onChange"],Om=["for"];function Vm(f,v,k,P,L,Z){const T=N.resolveComponent("layersIcon"),c=N.resolveComponent("VsPopover"),fe=N.resolveComponent("closeIcon");return N.openBlock(),N.createElementBlock(N.Fragment,null,[!L.isOpen&&L.mounted?(N.openBlock(),N.createBlock(c,{key:0,teleport:"body",trigger:"hover",placement:"right",class:"select-none flex absolute left-[20px] top-[10px] border bg-white max-w-[250px] rounded-lg cursor-pointer z-10",onClick:v[0]||(v[0]=me=>L.isOpen=!L.isOpen)},{reference:N.withCtx(()=>[N.createElementVNode("div",zm,[N.createVNode(T,{class:"h-5 w-5"})])]),default:N.withCtx(()=>[N.createTextVNode(" Додаткові шари ")]),_:1})):N.createCommentVNode("",!0),N.withDirectives(N.createElementVNode("div",Dm,[N.createElementVNode("div",Lm,[Rm,L.mounted?(N.openBlock(),N.createBlock(c,{key:0,teleport:"body",trigger:"hover",placement:"bottom",class:"flex"},{reference:N.withCtx(()=>[N.createElementVNode("button",{type:"button",class:"size-6 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:v[1]||(v[1]=me=>L.isOpen=!L.isOpen)},[N.createVNode(fe)])]),default:N.withCtx(()=>[N.createTextVNode(" Приховати панель ")]),_:1})):N.createCommentVNode("",!0)]),N.withDirectives(N.createElementVNode("div",Bm,[(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(k.layers,me=>(N.openBlock(),N.createElementBlock("div",{key:me.id,class:"flex items-center gap-2 text-sm"},[N.createElementVNode("input",{type:"checkbox",id:`layer-${me.id}`,value:me.id,class:"cursor-pointer",onChange:ve=>Z.handleLayerChange(me,ve.target.checked)},null,40,Fm),N.createElementVNode("label",{for:`layer-${me.id}`,class:"cursor-pointer"},N.toDisplayString(me.name),9,Om)]))),128))],512),[[N.vShow,L.isOpen]])],512),[[N.vShow,L.isOpen]])],64)}const Nm=Fi(Am,[["render",Vm],["__scopeId","data-v-4c33eaa0"]]),$m={mixins:[Oo],components:{closeIcon:ml},props:{map:{type:Object,required:!0},compareLayers:{type:Array,default:()=>[]},table:{type:String,default:""},collapsed:{type:Boolean,default:!1}},data(){return{mounted:!1,currentLayer:null}},mounted(){var f,v;this.currentLayer=((v=(f=this.compareLayers)==null?void 0:f[0])==null?void 0:v.id)||null,this.mounted=!0},watch:{async currentLayer(f,v){const k=this.compareLayers.find(L=>L.id===v),P=this.compareLayers.find(L=>L.id===f);k&&await this.setVisible(k,!1,this.map),P&&await this.setVisible(P,!0,this.map),this.map.getStyle().layers.forEach(L=>{L.source===this.table&&this.map.getLayer(L.id)&&this.map.moveLayer(L.id)})}}},jm={class:"absolute w-full top-[10px] right-[50px] shadow-sm bg-white max-w-[250px] p-[10px] rounded-lg z-10 select-none border"},Um={class:"flex items-start justify-between pb-1 border-b"},qm=N.createElementVNode("div",{class:"text-[16px] max-w-[180px]"}," Базові шари порівняльної карти ",-1),Zm={class:"flex gap-2"},Gm=N.createElementVNode("button",{type:"button",class:"size-6 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"}," - ",-1),Hm={class:"pt-1 max-h-[300px] overflow-auto [&::-webkit-scrollbar]:h-1.5 [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-gray-300 [&::-webkit-scrollbar-track]:bg-transparent"},Xm=["id","name","value"],Wm=["for"];function Jm(f,v,k,P,L,Z){const T=N.resolveComponent("VsPopover"),c=N.resolveComponent("closeIcon");return N.withDirectives((N.openBlock(),N.createElementBlock("div",jm,[N.createElementVNode("div",Um,[qm,N.createElementVNode("div",Zm,[L.mounted?(N.openBlock(),N.createBlock(T,{key:0,trigger:"hover",placement:"bottom",teleport:"body",onClick:v[0]||(v[0]=fe=>f.$emit("update:collapsed",!0))},{reference:N.withCtx(()=>[Gm]),default:N.withCtx(()=>[N.createTextVNode(" Згорнути панель ")]),_:1})):N.createCommentVNode("",!0),L.mounted?(N.openBlock(),N.createBlock(T,{key:1,trigger:"hover",placement:"bottom",teleport:"body"},{reference:N.withCtx(()=>[N.createElementVNode("button",{type:"button",class:"size-6 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:v[1]||(v[1]=fe=>f.$emit("close"))},[N.createVNode(c,{class:"cursor-pointer"})])]),default:N.withCtx(()=>[N.createTextVNode(" Приховати панель ")]),_:1})):N.createCommentVNode("",!0)])]),N.createElementVNode("div",Hm,[(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(k.compareLayers,fe=>(N.openBlock(),N.createElementBlock("div",{key:fe.id,class:"flex items-center py-1"},[N.withDirectives(N.createElementVNode("input",{type:"radio",id:fe.id,name:fe.id,value:fe.id,"onUpdate:modelValue":v[2]||(v[2]=me=>L.currentLayer=me),class:"shrink-0 border-gray-200 rounded-full text-blue-600 focus:ring-blue-500 checked:border-blue-500 dark:bg-neutral-800 dark:border-neutral-700 dark:checked:bg-blue-500 dark:checked:border-blue-500 dark:focus:ring-offset-gray-800"},null,8,Xm),[[N.vModelRadio,L.currentLayer]]),N.createElementVNode("label",{for:fe.id,class:"text-[14px] ml-2 cursor-pointer"},N.toDisplayString(fe.name),9,Wm)]))),128))])],512)),[[N.vShow,!k.collapsed]])}const Km=Fi($m,[["render",Jm]]),Ym={},Qm={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},eg=[N.createElementVNode("path",{d:"M18 8L22 12L18 16",stroke:"#333333","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),N.createElementVNode("path",{d:"M6 8L2 12L6 16",stroke:"#333333","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),N.createElementVNode("path",{d:"M2 12H22",stroke:"#333333","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)];function tg(f,v,k,P,L,Z){return N.openBlock(),N.createElementBlock("svg",Qm,eg)}const ig={components:{closeIcon:ml,compareIcon:Fi(Ym,[["render",tg]]),CompareBaseLayers:Km},props:{map:{type:Object},compareLayers:{type:Array},table:{type:String}},data(){return{isOpen:!1,mounted:!1,afterMap:null,compare:null,isOpen:!1,afterMapLoaded:!1,collapsed:!1}},mounted(){this.mounted=!0,window.maplibregl=In,this.loadScripts()},computed:{modalButtonClasses(){return{"!bg-[#F2F2F2]":this.isOpen,"bg-white":!this.isOpen}}},methods:{loadScripts(){const f=document.createElement("link");f.setAttribute("rel","stylesheet"),f.setAttribute("href","https://cdn.jsdelivr.net/npm/@maplibre/maplibre-gl-compare@0.5.0/dist/maplibre-gl-compare.min.css"),document.head.appendChild(f);const v=document.createElement("script");v.setAttribute("src","https://cdn.jsdelivr.net/npm/@maplibre/maplibre-gl-compare@0.5.0/dist/maplibre-gl-compare.min.js"),document.head.appendChild(v)},initCompare(){const f=this.map,v={version:8,glyphs:"https://fonts.openmaptiles.org/{fontstack}/{range}.pbf",sources:{},layers:[]},k=new In.Map({container:"after",style:v,center:f.getCenter(),zoom:f.getZoom(),minZoom:f.getMinZoom()});if(k.addControl(new In.NavigationControl({visualizePitch:!0})),k.on("load",()=>{this.afterMapLoaded=!0,this.syncLayers()}),this.afterMap=k,window.maplibregl&&window.maplibregl.Compare){const P="#comparison-container";this.compare=new window.maplibregl.Compare(f,k,P,{mousemove:!1})}else console.error("Compare is not available on window.maplibregl")},destroyCompare(){this.compare&&(this.compare.remove(),this.compare=null),this.afterMap&&(this.afterMap.remove(),this.afterMap=null),this.isOpen=!1,this.afterMapLoaded=!1},toggleCompare(){if(this.collapsed){this.collapsed=!1;return}this.isOpen=!this.isOpen,this.isOpen?this.$nextTick(()=>{this.initCompare(),this.resizeMaps()}):this.destroyCompare()},resizeMaps(){this.map.resize(),this.afterMap&&this.afterMap.resize()},syncLayers(){if(!this.map||!this.afterMap)return;const f=this.map,v=this.afterMap;f.getSource(this.table)&&(v.getSource(this.table)||v.addSource(this.table,f.getStyle().sources[this.table]));const P=f.getStyle().layers.filter(L=>L.source===this.table);P.length&&P.forEach(L=>{v.getLayer(L.id)||v.addLayer(L)})}}},rg={class:"w-[29px] h-[29px] flex items-center justify-center"},ng={key:2,id:"comparison-container",class:"absolute top-0 right-0 w-full h-full"},sg=[N.createElementVNode("div",{id:"after",class:"map-compare"},null,-1)];function og(f,v,k,P,L,Z){const T=N.resolveComponent("compareIcon"),c=N.resolveComponent("VsPopover"),fe=N.resolveComponent("CompareBaseLayers");return N.openBlock(),N.createElementBlock(N.Fragment,null,[L.mounted?(N.openBlock(),N.createBlock(c,{key:0,teleport:"body",trigger:"hover",placement:"left",class:N.normalizeClass(["flex absolute right-[10px] top-[120px] bg-white max-w-[250px] rounded-lg cursor-pointer z-10",Z.modalButtonClasses]),onClick:Z.toggleCompare,style:{"box-shadow":"0 0 0 2px rgba(0, 0, 0, 0.2)"}},{reference:N.withCtx(()=>[N.createElementVNode("div",rg,[N.createVNode(T,{class:"w-4 h-4"})])]),default:N.withCtx(()=>[N.createTextVNode(" Порівняти шари ")]),_:1},8,["class","onClick"])):N.createCommentVNode("",!0),L.isOpen&&L.afterMapLoaded?(N.openBlock(),N.createBlock(fe,{key:1,table:k.table,map:L.afterMap,compareLayers:k.compareLayers,onClose:Z.destroyCompare,collapsed:L.collapsed,"onUpdate:collapsed":v[0]||(v[0]=me=>L.collapsed=me)},null,8,["table","map","compareLayers","onClose","collapsed"])):N.createCommentVNode("",!0),L.isOpen?(N.openBlock(),N.createElementBlock("div",ng,sg)):N.createCommentVNode("",!0)],64)}const ag=Fi(ig,[["render",og]]),lg={props:["colors","strokes","title"],methods:{capitalizeFirstLetter(f){return f?f.charAt(0).toUpperCase()+f.slice(1):""}}},cg={class:"absolute left-[20px] bottom-[74px] bg-white max-w-[250px] p-[10px] rounded-lg z-10 border"},hg={key:0,class:"mb-[10px] text-[1rem]"},ug={key:1},dg={class:"legend-item flex items-center gap-2"},pg={class:"ml-1 text-[0.875rem]"},fg={class:"legend-item"},mg={key:0,class:"flex justify-start items-center gap-2"},gg={class:"ml-1 text-[0.875rem]"};function _g(f,v,k,P,L,Z){var T;return N.openBlock(),N.createElementBlock("div",cg,[k.title?(N.openBlock(),N.createElementBlock("div",hg,N.toDisplayString(k.title),1)):N.createCommentVNode("",!0),(T=k.strokes)!=null&&T.length?(N.openBlock(),N.createElementBlock("div",ug,[(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(k.strokes,c=>(N.openBlock(),N.createElementBlock("div",dg,[N.createElementVNode("div",{class:"w-[15px] h-[4px]",style:N.normalizeStyle({background:`repeating-linear-gradient(to right, ${c.color}, ${c.color} 5px, transparent 5px, transparent 8px)`})},null,4),N.createElementVNode("div",pg,N.toDisplayString(Z.capitalizeFirstLetter(c.text)),1)]))),256))])):N.createCommentVNode("",!0),(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(k.colors,c=>(N.openBlock(),N.createElementBlock("div",fg,[c.id>0?(N.openBlock(),N.createElementBlock("div",mg,[N.createElementVNode("div",{class:"w-[15px] h-[15px] rounded-[50%] min-w-[15px]",style:N.normalizeStyle({backgroundColor:c.color})},null,4),N.createElementVNode("div",gg,N.toDisplayString(Z.capitalizeFirstLetter(c.text)),1)])):N.createCommentVNode("",!0)]))),256))])}const yg={components:{MapSlotLayers:bm,MapLegend:Fi(lg,[["render",_g]]),AdditionalLayers:Nm,MapCompare:ag},props:{colorAttr:null,strokeAttr:null,zoom:{type:Array,default:()=>8},defaultColor:{type:String,default:"blue"},selectedBaseLayer:{type:String,required:!0},legendname:{type:String,default:()=>""},height:{type:String,default:()=>"100vh"},width:{type:String,default:"100vw"},center:{type:Array,default:[32,49]},maxBounds:{type:Array,default:[[22,44],[40,52]]},table:{type:String,default:""},zoom:{type:[String,Number],default:13},minZoom:{type:[String,Number],default:1},basemap:Array,additionalLayers:Array,filtersParam:{type:String,default:""},row:{type:Object,default:{}},pointZoom:{type:String,default:"12"},legend:{type:Boolean,default:()=>!0},compareLayers:{type:Array,default:()=>[]}},mixins:[Oo],data(){return{map:null,hoverObject:null,popup:null,colors:[]}},async mounted(){var f,v,k,P;try{if(await this.createMap(),(f=this.row)!=null&&f.geom){const{type:L,coordinates:Z}=this.row.geom;let T;switch(L){case"Polygon":T=Ou(Z);break;case"MultiPolygon":T=Nu(Z);break;case"MultiPoint":T=Vu(Z);break;default:(v=this.map)==null||v.fitBounds([Z,Z],{maxZoom:this.zoom,padding:30}),this.isSelectObj=!0;return}const c=Uu(T).geometry.coordinates;(k=this.map)==null||k.fitBounds([c,c],{maxZoom:this.zoom,padding:30})}(P=this.map)==null||P.fitBounds(this.center)}catch{}},watch:{filtersParam(f){this.setFilter(this.table,f)},selectedBaseLayer(f){this.$emit("update:selectedBaseLayer",f)}},computed:{basemapIds(){return this.basemap.map(f=>f==null?void 0:f.id)},allLayers(){return[...this.basemap||[],...this.additionalLayers||[],...this.compareLayers||[]]}},methods:{async getColorStyle(){var f=[["#69D2E7","#A7DBD8","#E0E4CC","#F38630","#FA6900"],["#FE4365","#FC9D9A","#F9CDAD","#C8C8A9","#83AF9B"],["#ECD078","#D95B43","#C02942","#542437","#53777A"]];if(!this.colorAttr)return this.defaultColor;try{const{data:{rows:v}}=await Zt.get(`/api/data/${this.table}/${this.colorAttr}`),k=v.reduce((P,L,Z)=>L!=null&&L.id?[...P,L.id.toString(),L.color||f[0][Z%5]]:P,["match",["get",this.colorAttr]]);return this.colors=[...v],k.push("gray"),k}catch(v){console.log(v)}},async getStrokeStyle(){if(!this.strokeAttr)return"transparent";try{const{data:{rows:f}}=await Zt.get(`/api/data/${this.table}/${this.strokeAttr}`),v=f.reduce((k,P,L)=>P!=null&&P.id?[...k,{id:P.id.toString(),color:P.color||"#000000",dash:P.dash||[2,2],text:P.text||P.id.toString()}]:k,[]);return this.strokes=[...v],["match",["get",this.strokeAttr],...v.flatMap(({id:k,color:P})=>[k,P]),"transparent"]}catch(f){return console.log(f),"transparent"}},async handleMapLoad(){var P,L;this.$emit("map",this.map);const f=await this.getStrokeStyle(),v=await this.getColorStyle(),k=((L=(P=location.search.split("&").find(Z=>Z.includes("filter=")))==null?void 0:P.split("filter="))==null?void 0:L[1])||"";await this.addLayer({id:this.table,service:"vector",url:`/api/vtile/${this.table}/ua/{z}/{x}/{y}.vmt?pointZoom=${this.pointZoom}&dt=${new Date().toISOString()}&filter=${k}`,layers:[{type:"fill","source-layer":this.table,paint:{"fill-color":v,"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":v}},{id:`${this.table}-stroke`,type:"line","source-layer":this.table,filter:["all",["==",["geometry-type"],"Polygon"]],paint:{"line-color":f,"line-width":2.5,"line-dasharray":[2,2]}}]})},async createMap(){const f={version:8,glyphs:"https://cdn.softpro.ua/data/fonts/{fontstack}/{range}.pbf",sources:{},layers:[]};this.map=await new In.Map({container:"maplibre-map",style:f,zoom:this.zoom,center:this.center,minZoom:this.minZoom}),this.$parent.map=this.map,this.map.addControl(new In.NavigationControl({visualizePitch:!0})),this.map.on("load",this.handleMapLoad)}}},xg={class:"vs-map-portal relative z-1 mt-2",id:"mapwrapper"};function vg(f,v,k,P,L,Z){var ve;const T=N.resolveComponent("MapLegend"),c=N.resolveComponent("MapSlotLayers"),fe=N.resolveComponent("MapCompare"),me=N.resolveComponent("AdditionalLayers");return N.openBlock(),N.createElementBlock("div",xg,[N.createElementVNode("div",{id:"maplibre-map",ref:"maplibreMap",class:"w-full",style:N.normalizeStyle({height:k.height})},null,4),N.withDirectives(N.createVNode(T,{colors:L.colors,title:k.legendname},null,8,["colors","title"]),[[N.vShow,k.legend]]),N.createVNode(c,{map:L.map,baseLayers:k.basemap,selectedLayer:k.selectedBaseLayer,"onUpdate:selectedLayer":v[0]||(v[0]=le=>f.$emit("update:selectedBaseLayer",le))},null,8,["map","baseLayers","selectedLayer"]),N.createVNode(fe,{map:L.map,compareLayers:Z.allLayers,table:k.table},null,8,["map","compareLayers","table"]),(ve=k.additionalLayers)!=null&&ve.length?(N.openBlock(),N.createBlock(me,{key:0,map:L.map,layers:k.additionalLayers,basemapIds:Z.basemapIds},null,8,["map","layers","basemapIds"])):N.createCommentVNode("",!0)])}const bg=Fi(yg,[["render",vg]]),wg={},Sg={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"},Tg=[N.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 kg(f,v){return N.openBlock(),N.createElementBlock("svg",Sg,Tg)}const Ig=Fi(wg,[["render",kg]]),Cg={},Eg={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"},Pg=[N.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),N.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),N.createElementVNode("path",{d:"M15 4v16"},null,-1),N.createElementVNode("path",{d:"M9 10l2 2l-2 2"},null,-1)];function Ag(f,v){return N.openBlock(),N.createElementBlock("svg",Eg,Pg)}const Mg=Fi(Cg,[["render",Ag]]),zg={},Dg={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"},Lg=[N.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),N.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),N.createElementVNode("path",{d:"M15 4v16"},null,-1),N.createElementVNode("path",{d:"M10 10l-2 2l2 2"},null,-1)];function Rg(f,v){return N.openBlock(),N.createElementBlock("svg",Dg,Lg)}const Bg=Fi(zg,[["render",Rg]]),Fg={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 f;return!!((f=this.$slots)!=null&&f.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:f}){f==="Escape"&&this.handleClose()},handleClose(){this.$emit("update:visible",!1),this.$emit("onClose")}}},qu=f=>(N.pushScopeId("data-v-37405773"),f=f(),N.popScopeId(),f),Og={class:"vsTailwind ui-dialog__wrapper"},Vg={class:"w-full h-full fixed top-0 start-0 z-[80] bg-black bg-opacity-50"},Ng={class:"py-2.5 px-4 flex justify-between items-center border-b"},$g={class:"font-medium text-gray-800"},jg=[qu(()=>N.createElementVNode("span",{class:"sr-only"},"Close",-1)),qu(()=>N.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"},[N.createElementVNode("path",{d:"M18 6 6 18"}),N.createElementVNode("path",{d:"m6 6 12 12"})],-1))],Ug={class:"ui-dialog__content p-4"},qg={key:0,class:"flex justify-end gap-x-2"};function Zg(f,v,k,P,L,Z){return N.openBlock(),N.createBlock(N.Teleport,{to:"#modal"},[N.createVNode(N.Transition,{name:"fade"},{default:N.withCtx(()=>[N.withDirectives(N.createElementVNode("div",Og,[N.createElementVNode("div",Vg,[N.createVNode(N.Transition,{name:"content",appear:""},{default:N.withCtx(()=>[N.createElementVNode("div",{class:N.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",[Z.checkSize]])},[N.createElementVNode("div",Ng,[N.createElementVNode("h3",$g,N.toDisplayString(k.title),1),N.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:v[0]||(v[0]=(...T)=>Z.handleClose&&Z.handleClose(...T))},jg)]),N.createElementVNode("div",Ug,[N.renderSlot(f.$slots,"default",{},void 0,!0)]),Z.hasSlot?(N.openBlock(),N.createElementBlock("div",qg,[N.renderSlot(f.$slots,"footer",{},void 0,!0)])):N.createCommentVNode("",!0)],2)]),_:3})])],512),[[N.vShow,k.visible]])]),_:3})])}const Gg=Fi(Fg,[["render",Zg],["__scopeId","data-v-37405773"]]),Hg=N.defineComponent({props:{title:{type:String,default:()=>""},table:{type:String,default:()=>""},rows:{type:Object,default:()=>null},initTotal:{type:[Number,String],default:()=>""},colorAttr:{type:String,default:()=>""},strokeAttr:{type:String,default:()=>""},legendname:{type:String,default:()=>""},center:{type:Array},maxBounds:{type:Array,default:()=>[[22,44.4],[40,52.5]]},id:{type:String,default:()=>""},isAutocomplete:{type:Boolean,default:()=>!1},isAddressAutocomplete:{type:Boolean,default:()=>!1},zoom:{type:[Number,String],default:()=>"13"},minZoom:{type:[Number,String],default:()=>"1"},maskForSearch:{type:String,default:()=>null},searchShow:{type:Boolean,default:()=>!0},basemap:{type:Array},additionalLayers:{type:Array},pointZoom:{type:String,default:()=>"12"},legend:{type:Boolean,default:()=>!0},defaultColor:{type:String,default:()=>"blue"},compareLayers:{type:Array,default:()=>[]}},mixins:[Oo],components:{MapPortal:bg,NoData:Zp,FilterIcon:Ig,VisibleMapIcon:Mg,HiddenMapIcon:Bg,CloseIcon:ml,VsDialog:Gg},data(){return{filters:"",search:"",limit:20,polyline:null,filtersParam:"",isSelectObj:!1,selectedId:"",searchRegion:"",searchAddress:"",map:null,selectedBaseLayer:"",marker:null,selectedRow:null,activeFilters:"",isMapVisible:!0,tabsIsVisible:!1,filterUrl:"",currentPage:1,regionOptionGeneral:null,isFilterVisible:!1,tableData:null,hoverData:null,atuData:[],map:null,legendName:null,total:null,filtered:null,filterValues:"",activeFiltersCount:"",visibleTrue:!0,regionSelectValue:null,addressSelectValue:null,currentBbox:null,mountedFilter:{},optionRowsCount:[{value:10,label:"10"},{value:20,label:"20"},{value:30,label:"30"}],handleDebouncedUpdateValue:fm(f=>{this.handleSearchValue(f)},300)}},watch:{map(){this.map.on("mousemove",this.handleMapHover),this.map.on("click",this.handleMapClick),this.$emit("update:map",this.map)},activeFiltersCount(){var f,v;return(v=(f=this.$refs)==null?void 0:f.filter)==null?void 0:v.filteredActiveFiltersLength},activeFilters(){var f,v;return this.isSelectObj&&this.moveToDefaultPage(),(v=(f=this.$refs)==null?void 0:f.filter)==null?void 0:v.activeFilters},isFilterVisible(f){f||this.getData()},async regionSelectValue(f,v){var L,Z;if(!this.regionSelectValue){this.map.removeSource("region-search-id");return}f&&this.selectedId&&this.closeObjCard(),this.polyline=this.regionSelectValue.encoded_geom,this.getData();const k=((L=this.regionSelectValue)==null?void 0:L.geom)||Tr.toGeoJSON(this.regionSelectValue.encoded_geom),P=this.map.getSource("region-search-id");if(this.currentBbox=ju(k),P)P.setData({type:"Feature",geometry:k});else{this.map.addSource("region-search-id",{type:"geojson",data:{type:"Feature",geometry:k}});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"),(Z=this.map)==null||Z.fitBounds(this.currentBbox,{zoom:this.setAtuZoom,padding:20}),this.getData()},async addressSelectValue(f,v){this.addressSelectValue&&(f&&this.selectedId&&this.closeObjCard(),this.getData())}},created(){this.legendName,this.tableData=this.rows,this.total=this.initTotal,this.id&&(this.selectedRow=this.rows[0],this.selectedId=this.id,this.isSelectObj=!0)},mounted(){this.rows||this.getData();const v=new URLSearchParams(window.location.search).get("filter"),k=v==null?void 0:v.split("|");k==null||k.forEach(L=>{const[Z,T]=L.split("=");T!=null&&T.includes(",")?this.mountedFilter[Z]=T==null?void 0:T.split(","):this.mountedFilter[Z]=T});const P=new URLSearchParams(window.location.search);this.currentPage=P.get("page")||1,this.getFilter()},updated(){this.checkFilterLength()},computed:{setAtuZoom(){var f,v,k;return((f=this.regionSelectValue)==null?void 0:f.id)==="UA80000000000093317"||((v=this.regionSelectValue)==null?void 0:v.id)==="UA85000000000065278"?10:((k=this.regionSelectValue)==null?void 0:k.region)===""?7.5:11}},methods:{async getData(){try{const f={search:this.search||null,limit:this.limit,page:this.currentPage,polyline:this.polyline};f.filter=this.filtersParam;const{data:v}=await Zt.get(`/api/data/${this.table}`,{params:f});this.tableData=v==null?void 0:v.rows,this.total=v.filtered,this.filtered=v.filtered}catch(f){console.error(f.message)}},moveToDefaultPage(){var P;const f=new URLSearchParams(window.location.search);f.delete("id");const k=`${window.location.pathname}?${f.toString()}`;(P=this.map)==null||P.fitBounds(this.maxBounds,{}),window.history.pushState({},"",k),this.isSelectObj=!1},regionFullName(f){return f.region?`${f.text} / ${f.region}`:f.text},getLabelById(f){const v=this.filters.find(k=>k.id===f);return v?v.label:f},getOptionsLabelById(f,v){if(Array.isArray(v)){const k=this.filters.find(P=>P.id===f);return k!=null&&k.options?k==null?void 0:k.options.filter(P=>v.includes(P.id)).map(P=>P.text).join(", "):v==null?void 0:v.length}else return v},async clearFilter(f){var v,k;(k=(v=this.$refs)==null?void 0:v.filter)==null||k.clearFilter(f),await this.updateTableAndMap(),await this.getData()},handlePageChange(f){this.currentPage=f;const v=new URL(window.location.href),k=new URLSearchParams(window.location.search);k.set("page",f),v.search=decodeURI(k.toString()),window.history.pushState({},"",v),this.getData()},async getFilter(){var f;try{const{data:v}=await Zt.get(`/api/filter/${this.table}`);this.filters=(f=v==null?void 0:v.list)==null?void 0:f.map(k=>({...k,label:(k==null?void 0:k.label)||(k==null?void 0:k.ua),id:(k==null?void 0:k.id)||(k==null?void 0:k.name)}))}catch(v){console.error(v.message)}},async handleSearchValue(f){this.search=f,await this.getData()},closeObjCard(){var P;const f=new URLSearchParams(window.location.search);f.delete("id"),this.deletePulsePoint(),this.deleteHighlighPolygon();const k=`${window.location.pathname}?${f.toString()}`;(this.currentBbox||this.center)&&((P=this.map)==null||P.fitBounds(this.currentBbox||[this.center,this.center],{maxZoom:this.zoom})),window.history.pushState({},"",k),this.isSelectObj=!1,this.selectedRow=null,this.getData()},async handleSearchRegionValue(f){var k;const v=this.map.getLayer("region-search-id");this.searchRegion=f,f===""&&v?((k=this.map)==null||k.fitBounds(this.maxBounds,{}),this.currentBbox=null,this.polyline=null,this.map.removeLayer("region-search-id"),this.getData()):f===""&&this.getData()},async handleSearchAddressValue(f){var k;const v=this.map.getLayer("address-search-id");this.searchAddress=f,f===""&&v?((k=this.map)==null||k.fitBounds(this.maxBounds,{}),this.currentBbox=null,this.polyline=null,this.map.removeLayer("address-search-id"),this.getData()):f===""&&this.getData()},handleFilterChange(f){this.$emit("update:filterState",f),this.currentPage=f.state.page||1,this.filterUrl=f.url==="no-url"?null:f.url.split("|").filter(v=>!v.includes("page=")).join("|")},async updateTableAndMap(){var f,v;this.selectedRow||(this.filtersParam=this.filterUrl,this.activeFilters=(v=(f=this.$refs)==null?void 0:f.filter)==null?void 0:v.activeFilters,this.isFilterVisible=!1,this.getData())},handleFilterSubmit(){var f;this.isSelectObj="",this.selectedId="",this.selectedId=!1,(f=this.map)==null||f.fitBounds(this.maxBounds,{}),this.isFilterVisible=!1},toggleMapVisible(){this.isMapVisible=!this.isMapVisible},checkUrl(f=!0){const v=new URLSearchParams(window.location.search);v.has("id")?(this.isSelectObj=!0,this.isMapVisible=f,this.selectedId=v.get("id")):(this.isSelectObj=!1,this.selectedId="")},changeLimit(f){this.limit=f,this.currentPage=1,this.getData()},filterModalClose(){this.isFilterVisible=!1},resetFilters(){this.$refs.filter&&(this.$refs.filter.clearAll(),this.search="",this.isFilterVisible=!1,this.filtersParam="",this.polyline=null,this.regionSelectValue=null,this.addressSelectValue=null,this.currentBbox=null,this.activeFilters=null,this.tabsIsVisible=!1,this.handleSearchRegionValue(""),this.handleSearchAddressValue(""))},checkFilterLength(){var v,k;const f=(k=(v=this.$refs)==null?void 0:v.filter)==null?void 0:k.filteredActiveFiltersLength;f!==this.previousLength&&(this.previousLength=f,this.activeFiltersCount=f)},async handleMapClick(f){var Z,T,c,fe,me,ve,le,oe;const v=this.map.queryRenderedFeatures(f.point);if((v==null?void 0:v.length)<1)return;const k=window.location.pathname,P=new URLSearchParams(window.location.search);P.set("id",`${(Z=v[0])==null?void 0:Z.properties.id}`),this.getObjectData((c=(T=v[0])==null?void 0:T.properties)==null?void 0:c.id);const L=`${k}?${P.toString()}`;window.history.pushState({},"",L),this.isSelectObj=!0,f.lngLat&&((oe=this.map)==null||oe.fitBounds([[(fe=f.lngLat)==null?void 0:fe.lng,(me=f.lngLat)==null?void 0:me.lat],[(ve=f.lngLat)==null?void 0:ve.lng,(le=f.lngLat)==null?void 0:le.lat]],{padding:30})),this.checkUrl()},async getObjectData(f){var v,k;try{const{data:P}=await Zt.get(`/api/data/${this.table}/${f}`);this.selectRow((v=P==null?void 0:P.rows)==null?void 0:v[0]),((k=P==null?void 0:P.rows)==null?void 0:k.lenght)<1&&this.deletePulsePoint()}catch(P){console.error(P.message)}},async selectRow(f,v=!0){var c,fe,me;this.isMapVisible=v;const P=await(await fetch(`/api/data/${this.table}/${f.id}`)).json();this.selectedRow=((c=P==null?void 0:P.rows)==null?void 0:c[0])||f;const L=window.location.pathname,Z=new URLSearchParams(window.location.search);Z.set("id",`${f.id}`);const T=`${L}?${Z.toString()}`;if(window.history.pushState({},"",T),this.checkUrl(v),f!=null&&f.geom){const{type:ve,coordinates:le}=f.geom;let oe;switch(ve){case"Polygon":oe=Ou(le);break;case"MultiPolygon":oe=Nu(le);break;case"MultiPoint":oe=Vu(le);break;default:(fe=this.map)==null||fe.fitBounds([le,le],{maxZoom:15,padding:30}),this.isSelectObj=!0;return}const ht=Uu(oe).geometry.coordinates;(me=this.map)==null||me.fitBounds([ht,ht],{maxZoom:15,padding:30})}this.isSelectObj=!0},deletePulsePoint(){this.marker&&this.marker.remove()},addPulsePoint(f){this.deletePulsePoint();const v=document.createElement("div");v.className="gps-marker",v.style.width="10px",v.style.height="10px",v.style.position="relative";const k=document.createElement("div");k.className="gps-wave",v.appendChild(k),this.marker=new In.Marker({element:v,anchor:"center"}).setLngLat(f).addTo(this.map)},deleteHighlighPolygon(){var f,v,k;(f=this.map)!=null&&f.getLayer("highlighted-polygon")&&((v=this.map)==null||v.removeLayer("highlighted-polygon"),(k=this.map)==null||k.removeSource("highlighted-polygon"))},highlightPolygon(f){var v,k,P,L,Z,T;this.deletePulsePoint(),this.deleteHighlighPolygon(),(L=this.map)==null||L.addSource("highlighted-polygon",{type:"geojson",data:{geometry:{type:(v=f==null?void 0:f.geom)==null?void 0:v.type,coordinates:(k=f==null?void 0:f.geom)==null?void 0:k.coordinates},type:"Feature",properties:{id:f==null?void 0:f.id,name:f==null?void 0:f.name,category:f==null?void 0:f.id},id:f==null?void 0:f.id,layer:{id:"site.rest_zone.table-0",type:"fill",source:"site.rest_zone.table",sourceLayer:"site.rest_zone.table",filter:["all",["==",["geometry-type"],(P=f==null?void 0:f.geom)==null?void 0:P.type]],paint:{"fill-color":"orange","fill-opacity":.5},layout:{}},source:"site.rest_zone.table",sourceLayer:"site.rest_zone.table",state:{hover:!0},table:"site.rest_zone.table"}}),(Z=this.map)==null||Z.addLayer({id:"highlighted-polygon",type:"fill",source:"highlighted-polygon",layout:{},minzoom:12,maxzoom:0,paint:{"fill-color":"orange","fill-opacity":.6}}),(T=this.map)==null||T.moveLayer("highlighted-polygon")},async handleMapHover(f){var L,Z,T;this.hoverObject&&(this.map.setFeatureState(this.hoverObject,{hover:!1}),this.hoverObject=null),this.popup||(this.popup=new In.Popup({maxWidth:"400px",closeButton:!1,closeOnClick:!1}));const v=this.map.queryRenderedFeatures(f.point);if(this.map.getCanvas().style.cursor="pointer",!(v!=null&&v.length)||((L=v==null?void 0:v[0])==null?void 0:L.source)==="region-search-id"){this.map.getCanvas().style.cursor="",this.popup.remove();return}const k=v[0].geometry.coordinates.slice();v[0].source==="highlighted-polygon"&&v[1]?this.hoverData=(Z=v[1])==null?void 0:Z.properties:this.hoverData=(T=v[0])==null?void 0:T.properties;const P={source:v[0].source,sourceLayer:v[0].sourceLayer,id:v[0].id};if(P.source!=="region-search-id"){for(this.map.setFeatureState(P,{hover:!0}),this.hoverObject=P;Math.abs(f.lngLat.lng-k[0])>180;)k[0]+=f.lngLat.lng>k[0]?360:-360;this.popup.setLngLat(f.lngLat).setHTML(this.$refs.popup.innerHTML).addTo(this.map)}},removeSelectedBaseLayer(){this.selectedBaseLayer=""},addGeomMarker(f){if(!this.map||!f)return;this.marker&&this.marker.remove();let v;(f==null?void 0:f.type)==="Point"?v=f.coordinates:v=mm(f).geometry.coordinates,this.marker=new In.Marker({color:"green"}).setLngLat(v).addTo(this.map),this.map.setCenter(v)}}}),Xg={class:"ml-3 pt-[20px]"},Wg={class:"w-full gap-5 flex justify-between mb-[6px] pr-3"},Jg={class:"flex items-center gap-2 max-h-[38px] pt-[4px]"},Kg={class:"custom-filter-list"},Yg={key:0,class:"font-medium text-[10px] min-w-[16px] py-0.5 px-[5px] bg-gray-800 text-white leading-3 rounded-full"},Qg=["title"],e_=N.createElementVNode("span",{class:"sr-only"},"Відкрити мапу",-1),t_={class:"flex"},i_={class:"py-[15px] pb-[24px] pl-2"},r_={class:"font-bold text-2xl mr-[10px]"},n_={class:"text-sm text-stone-500 font-medium"},s_=N.createElementVNode("span",{class:"text-sm text-stone-500 font-medium"}," об'єктів",-1),o_={class:"wrapperTable flex flex-col",style:{height:"calc(100vh - 302px)"}},a_={key:0,class:"flex gap-x-2 flex-wrap"},l_={class:"font-medium"},c_=N.createElementVNode("span",{class:"h-3 mx-2 border-s border-gray-200"},null,-1),h_={class:"text-gray-500"},u_=["onClick"],d_={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"},p_=N.createElementVNode("span",{class:"font-medium"}," Очистити ",-1),f_={key:2,class:"text-center py-28"},m_=N.createElementVNode("h2",{class:"font-medium text-base text-gray-500 rounded-xl"}," За вашим запитом даних не знайдено! ",-1),g_=N.createElementVNode("p",{class:"font-normal text-sm text-gray-500 rounded-xl"}," Введіть, будь ласка, інші значення для пошуку. ",-1),__={key:0},y_={key:1,class:"my-5 pr-2"},x_={class:"flex justify-between"},v_={class:"w-2/4"},b_={class:"map-section relative"},w_={ref:"popup",style:{display:"none"}};function S_(f,v,k,P,L,Z){var Oe,ft;const T=N.resolveComponent("VsTextMask"),c=N.resolveComponent("vs-text"),fe=N.resolveComponent("FilterIcon"),me=N.resolveComponent("VsFilterList"),ve=N.resolveComponent("VisibleMapIcon"),le=N.resolveComponent("HiddenMapIcon"),oe=N.resolveComponent("CloseIcon"),ht=N.resolveComponent("NoData"),je=N.resolveComponent("VsPagination"),Ke=N.resolveComponent("MapPortal");return N.openBlock(),N.createElementBlock("section",Xg,[N.createElementVNode("div",null,[N.createElementVNode("div",Wg,[N.createElementVNode("div",Jg,[f.maskForSearch?(N.openBlock(),N.createBlock(T,{key:0,"model-value":f.search,"onUpdate:modelValue":f.handleDebouncedUpdateValue,class:"w-full table-interface-search",placeholder:"Пошук",mask:f.maskForSearch,icon:"search",iconPosition:"left",clearable:"",style:{height:"38px","min-width":"300px","max-width":"300px"},ref:"searchInput"},null,8,["model-value","onUpdate:modelValue","mask"])):f.searchShow?(N.openBlock(),N.createBlock(c,{key:1,"model-value":f.search,"onUpdate:modelValue":f.handleDebouncedUpdateValue,class:"[&>input]:py-[7px] [&>input]:max-h-[38px] [&>input]:w-[220px] [&>input]:ps-10 [&>input]:pe-8 [&>input]:block [&>input]:w-full [&>input]:bg-gray-100 [&>input]:border-transparent [&>input]:rounded-lg [&>input]:text-sm [&>input]:focus:bg-white [&>input]:focus:border-blue-500 [&>input]:focus:ring-blue-500 [&>input]:disabled:opacity-50 [&>input]:disabled:pointer-events-none [&>input]:dark:bg-neutral-700 [&>input]:dark:border-transparent [&>input]:dark:text-neutral-400 [&>input]:dark:placeholder:text-neutral-400 dark:focus:bg-neutral-800 dark:focus:ring-neutral-600",placeholder:"Пошук",icon:"search","icon-position":"left",clearable:"",style:{height:"38px"},ref:"searchInput"},null,8,["model-value","onUpdate:modelValue"])):N.createCommentVNode("",!0),N.createElementVNode("div",Kg,[f.filters?(N.openBlock(),N.createBlock(me,{key:0,ref:"filter",modelValue:f.mountedFilter,"onUpdate:modelValue":v[0]||(v[0]=st=>f.mountedFilter=st),scheme:f.filters,isDialog:(Oe=f.filters)==null?void 0:Oe.some(st=>!(st!=null&&st.inline)),"apply-vue-router":"",history:"",view:"plain",clearable:!1,name:"filter",onFilterChange:v[1]||(v[1]=async st=>{await f.handleFilterChange(st),await f.updateTableAndMap()})},{button:N.withCtx(({visible:st})=>[N.createElementVNode("button",{type:"button",class:N.normalizeClass(["py-2 px-2.5 h-[40px] inline-flex items-center gap-x-1.5 text-sm font-medium rounded-lg bg-white text-gray-800 hover:bg-gray-50 focus:outline-none focus:bg-gray-50",[st?"border border-blue-600 border-2":"border border-gray-200"]])},[N.createVNode(fe),N.createTextVNode(" Фільтри "),f.activeFiltersCount>=1?(N.openBlock(),N.createElementBlock("span",Yg,N.toDisplayString(f.activeFiltersCount),1)):N.createCommentVNode("",!0)],2)]),_:1},8,["modelValue","scheme","isDialog"])):N.createCommentVNode("",!0)])]),N.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:f.isMapVisible?"Приховати карту":"Показати карту",onClick:v[2]||(v[2]=(...st)=>f.toggleMapVisible&&f.toggleMapVisible(...st))},[f.isMapVisible?(N.openBlock(),N.createBlock(ve,{key:0})):(N.openBlock(),N.createBlock(le,{key:1})),e_],8,Qg)]),N.createElementVNode("div",t_,[N.createElementVNode("div",{class:N.normalizeClass(["relative overflow-hidden",f.isMapVisible?"w-2/4 mr-0":"w-full mr-3",f.isSelectObj?"hidden":""])},[N.createElementVNode("h1",i_,[N.createElementVNode("span",r_,N.toDisplayString(f.title),1),N.createElementVNode("span",n_,N.toDisplayString(f.total),1),s_]),N.createElementVNode("div",o_,[f.activeFilters?(N.openBlock(),N.createElementBlock("div",a_,[(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(f.activeFilters,(st,He,Ft)=>(N.openBlock(),N.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:Ft},[N.createElementVNode("span",l_,N.toDisplayString(f.getLabelById(He)),1),c_,N.createElementVNode("span",h_,N.toDisplayString(f.getOptionsLabelById(He,st)),1),N.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:wt=>f.clearFilter(He)},[N.createVNode(oe)],8,u_)]))),128)),((ft=Object.keys(f.activeFilters))==null?void 0:ft.length)>=2?(N.openBlock(),N.createElementBlock("span",d_,[p_,N.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:v[3]||(v[3]=st=>f.mountedFilter={})},[N.createVNode(oe)])])):N.createCommentVNode("",!0)])):N.createCommentVNode("",!0),f.total>=1?N.renderSlot(f.$slots,"table",{key:1,rows:f.tableData,map:f.map,marker:f.marker,selectRow:f.selectRow,getData:f.getData,addGeomMarker:f.addGeomMarker,isMapVisible:f.isMapVisible}):(N.openBlock(),N.createElementBlock("div",f_,[N.createVNode(ht),m_,g_,N.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:v[4]||(v[4]=(...st)=>f.resetFilters&&f.resetFilters(...st))}," Очистити дані пошуку ")]))]),f.total>=1?(N.openBlock(),N.createElementBlock("hr",__)):N.createCommentVNode("",!0),f.total>=1?(N.openBlock(),N.createElementBlock("div",y_,[N.createElementVNode("div",x_,[N.createVNode(je,{total:f.total,maxPages:7,defaultPage:f.currentPage,pageSize:f.limit,goTo:!1,size:"medium",onPageChange:f.handlePageChange,backgroundColor:"#e5e7eb",borderedCellSelected:!0,pageSizes:[10,20,30],onPageSizeChange:f.changeLimit},null,8,["total","defaultPage","pageSize","onPageChange","onPageSizeChange"])])])):N.createCommentVNode("",!0)],2),f.isSelectObj?(N.openBlock(),N.createElementBlock("div",{key:0,class:N.normalizeClass(f.isMapVisible?"w-2/4 mr-0 pb-5":"w-full pb-5 mr-3"),style:{height:"calc(100vh - 152px)"}},[N.renderSlot(f.$slots,"details",{table:f.table,selectedId:f.selectedId,selectedRow:f.selectedRow,map:f.map,closeObjCard:f.closeObjCard,isMapVisible:f.isMapVisible})],2)):N.createCommentVNode("",!0),N.withDirectives(N.createElementVNode("div",v_,[N.createElementVNode("section",b_,[N.renderSlot(f.$slots,"default",{map:f.map,removeSelectedBaseLayer:f.removeSelectedBaseLayer,selectedBaseLayer:f.selectedBaseLayer}),N.createVNode(Ke,{height:"calc(100vh - 152px)",width:"w-2/4",table:f.table,filtersParam:f.filtersParam,row:f.selectedRow,legendname:f.legendname,legend:f.legend,compareLayers:f.compareLayers,colorAttr:f.colorAttr,strokeAttr:f.strokeAttr,maxBounds:f.maxBounds,center:f.center,zoom:f.zoom,minZoom:f.minZoom,basemap:f.basemap,additionalLayers:f.additionalLayers,pointZoom:f.pointZoom,defaultColor:f.defaultColor,onMap:v[5]||(v[5]=st=>f.map=st),selectedBaseLayer:f.selectedBaseLayer,"onUpdate:selectedBaseLayer":v[6]||(v[6]=st=>f.selectedBaseLayer=st)},null,8,["table","filtersParam","row","legendname","legend","compareLayers","colorAttr","strokeAttr","maxBounds","center","zoom","minZoom","basemap","additionalLayers","pointZoom","defaultColor","selectedBaseLayer"])])],512),[[N.vShow,f.isMapVisible]])]),N.createElementVNode("div",w_,[N.renderSlot(f.$slots,"popup",{data:f.hoverData})],512)])])}const Zu=Fi(Hg,[["render",S_]]),Gu={install:f=>{f.component("VsPartsMap",Zu)},components:{VsPartsMap:Zu}};return typeof window<"u"&&(window.PartsMap=Gu),Gu});
585
+ `+Z):P.stack=Z}catch{}}throw P}}_request(v,k){typeof v=="string"?(k=k||{},k.url=v):k=v||{},k=is(this.defaults,k);const{transitional:P,paramsSerializer:L,headers:Z}=k;P!==void 0&&Rc.assertOptions(P,{silentJSONParsing:Cn.transitional(Cn.boolean),forcedJSONParsing:Cn.transitional(Cn.boolean),clarifyTimeoutError:Cn.transitional(Cn.boolean)},!1),L!=null&&(ge.isFunction(L)?k.paramsSerializer={serialize:L}:Rc.assertOptions(L,{encode:Cn.function,serialize:Cn.function},!0)),k.method=(k.method||this.defaults.method||"get").toLowerCase();let T=Z&&ge.merge(Z.common,Z[k.method]);Z&&ge.forEach(["delete","get","head","post","put","patch","common"],je=>{delete Z[je]}),k.headers=Hi.concat(T,Z);const c=[];let fe=!0;this.interceptors.request.forEach(function(Ke){typeof Ke.runWhen=="function"&&Ke.runWhen(k)===!1||(fe=fe&&Ke.synchronous,c.unshift(Ke.fulfilled,Ke.rejected))});const me=[];this.interceptors.response.forEach(function(Ke){me.push(Ke.fulfilled,Ke.rejected)});let ve,le=0,oe;if(!fe){const je=[Du.bind(this),void 0];for(je.unshift.apply(je,c),je.push.apply(je,me),oe=je.length,ve=Promise.resolve(k);le<oe;)ve=ve.then(je[le++],je[le++]);return ve}oe=c.length;let ht=k;for(le=0;le<oe;){const je=c[le++],Ke=c[le++];try{ht=je(ht)}catch(Oe){Ke.call(this,Oe);break}}try{ve=Du.call(this,ht)}catch(je){return Promise.reject(je)}for(le=0,oe=me.length;le<oe;)ve=ve.then(me[le++],me[le++]);return ve}getUri(v){v=is(this.defaults,v);const k=Tu(v.baseURL,v.url);return mu(k,v.params,v.paramsSerializer)}}ge.forEach(["delete","get","head","options"],function(v){rs.prototype[v]=function(k,P){return this.request(is(P||{},{method:v,url:k,data:(P||{}).data}))}}),ge.forEach(["post","put","patch"],function(v){function k(P){return function(Z,T,c){return this.request(is(c||{},{method:v,headers:P?{"Content-Type":"multipart/form-data"}:{},url:Z,data:T}))}}rs.prototype[v]=k(),rs.prototype[v+"Form"]=k(!0)});class Bc{constructor(v){if(typeof v!="function")throw new TypeError("executor must be a function.");let k;this.promise=new Promise(function(Z){k=Z});const P=this;this.promise.then(L=>{if(!P._listeners)return;let Z=P._listeners.length;for(;Z-- >0;)P._listeners[Z](L);P._listeners=null}),this.promise.then=L=>{let Z;const T=new Promise(c=>{P.subscribe(c),Z=c}).then(L);return T.cancel=function(){P.unsubscribe(Z)},T},v(function(Z,T,c){P.reason||(P.reason=new $s(Z,T,c),k(P.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(v){if(this.reason){v(this.reason);return}this._listeners?this._listeners.push(v):this._listeners=[v]}unsubscribe(v){if(!this._listeners)return;const k=this._listeners.indexOf(v);k!==-1&&this._listeners.splice(k,1)}static source(){let v;return{token:new Bc(function(L){v=L}),cancel:v}}}function dm(f){return function(k){return f.apply(null,k)}}function pm(f){return ge.isObject(f)&&f.isAxiosError===!0}const Fc={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(Fc).forEach(([f,v])=>{Fc[v]=f});function Bu(f){const v=new rs(f),k=Qh(rs.prototype.request,v);return ge.extend(k,rs.prototype,v,{allOwnKeys:!0}),ge.extend(k,v,null,{allOwnKeys:!0}),k.create=function(L){return Bu(is(f,L))},k}const Zt=Bu($o);Zt.Axios=rs,Zt.CanceledError=$s,Zt.CancelToken=Bc,Zt.isCancel=vu,Zt.VERSION=Lu,Zt.toFormData=cl,Zt.AxiosError=ct,Zt.Cancel=Zt.CanceledError,Zt.all=function(v){return Promise.all(v)},Zt.spread=dm,Zt.isAxiosError=pm,Zt.mergeConfig=is,Zt.AxiosHeaders=Hi,Zt.formToJSON=f=>yu(ge.isHTMLForm(f)?new FormData(f):f),Zt.getAdapter=zu.getAdapter,Zt.HttpStatusCode=Fc,Zt.default=Zt;const fm=(f,v=300)=>{let k;return function(...L){clearTimeout(k),k=setTimeout(()=>{f.apply(this,L)},v)}};function fl(f,v,k={}){const P={type:"Feature"};return(k.id===0||k.id)&&(P.id=k.id),k.bbox&&(P.bbox=k.bbox),P.properties=v||{},P.geometry=f,P}function Fu(f,v,k={}){if(!f)throw new Error("coordinates is required");if(!Array.isArray(f))throw new Error("coordinates must be an Array");if(f.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!$u(f[0])||!$u(f[1]))throw new Error("coordinates must contain numbers");return fl({type:"Point",coordinates:f},v,k)}function Ou(f,v,k={}){for(const L of f){if(L.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(L[L.length-1].length!==L[0].length)throw new Error("First and last Position are not equivalent.");for(let Z=0;Z<L[L.length-1].length;Z++)if(L[L.length-1][Z]!==L[0][Z])throw new Error("First and last Position are not equivalent.")}return fl({type:"Polygon",coordinates:f},v,k)}function Vu(f,v,k={}){return fl({type:"MultiPoint",coordinates:f},v,k)}function Nu(f,v,k={}){return fl({type:"MultiPolygon",coordinates:f},v,k)}function $u(f){return!isNaN(f)&&f!==null&&!Array.isArray(f)}function Oc(f,v,k){if(f!==null)for(var P,L,Z,T,c,fe,me,ve=0,le=0,oe,ht=f.type,je=ht==="FeatureCollection",Ke=ht==="Feature",Oe=je?f.features.length:1,ft=0;ft<Oe;ft++){me=je?f.features[ft].geometry:Ke?f.geometry:f,oe=me?me.type==="GeometryCollection":!1,c=oe?me.geometries.length:1;for(var st=0;st<c;st++){var He=0,Ft=0;if(T=oe?me.geometries[st]:me,T!==null){fe=T.coordinates;var wt=T.type;switch(ve=k&&(wt==="Polygon"||wt==="MultiPolygon")?1:0,wt){case null:break;case"Point":if(v(fe,le,ft,He,Ft)===!1)return!1;le++,He++;break;case"LineString":case"MultiPoint":for(P=0;P<fe.length;P++){if(v(fe[P],le,ft,He,Ft)===!1)return!1;le++,wt==="MultiPoint"&&He++}wt==="LineString"&&He++;break;case"Polygon":case"MultiLineString":for(P=0;P<fe.length;P++){for(L=0;L<fe[P].length-ve;L++){if(v(fe[P][L],le,ft,He,Ft)===!1)return!1;le++}wt==="MultiLineString"&&He++,wt==="Polygon"&&Ft++}wt==="Polygon"&&He++;break;case"MultiPolygon":for(P=0;P<fe.length;P++){for(Ft=0,L=0;L<fe[P].length;L++){for(Z=0;Z<fe[P][L].length-ve;Z++){if(v(fe[P][L][Z],le,ft,He,Ft)===!1)return!1;le++}Ft++}He++}break;case"GeometryCollection":for(P=0;P<T.geometries.length;P++)if(Oc(T.geometries[P],v,k)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function ju(f,v={}){if(f.bbox!=null&&v.recompute!==!0)return f.bbox;const k=[1/0,1/0,-1/0,-1/0];return Oc(f,P=>{k[0]>P[0]&&(k[0]=P[0]),k[1]>P[1]&&(k[1]=P[1]),k[2]<P[0]&&(k[2]=P[0]),k[3]<P[1]&&(k[3]=P[1])}),k}function Uu(f,v={}){const k=ju(f),P=(k[0]+k[2])/2,L=(k[1]+k[3])/2;return Fu([P,L],v.properties,v)}function mm(f,v={}){let k=0,P=0,L=0;return Oc(f,function(Z){k+=Z[0],P+=Z[1],L++},!0),Fu([k/L,P/L],v.properties)}const gm={mixins:[Oo],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:"&copy; <a href='http://www.openstreetmap.org/copyright'>OpenStreetMap</a>, &copy; <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}]},selectedLayer:{type:String,required:!0}},watch:{map(f){f&&f.on("load",this.handleMapLoad)}},methods:{handleMapLoad(){var f;this.baseLayers.forEach(v=>{this.layerList.push(v)}),this.toggleLayerVisibility((f=this.baseLayers[0])==null?void 0:f.id)},toggleLayerVisibility(f){this.$emit("update:selectedLayer",f),this.changeBaseLayer(f)}}},_m={class:"vs-map-slot-layers z-10 select-none"},ym=["onClick"],xm=["src"];function vm(f,v,k,P,L,Z){return N.openBlock(),N.createElementBlock("div",_m,[(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(k.baseLayers,(T,c)=>(N.openBlock(),N.createElementBlock("div",{key:T.id,class:N.normalizeClass(["vs-map-slot-layers__layer relative",{focused:T.id==k.selectedLayer}]),onClick:fe=>Z.toggleLayerVisibility(T.id)},[N.createElementVNode("img",{src:T.image,class:"vs-map-slot-layers__image"},null,8,xm),N.createElementVNode("div",{class:N.normalizeClass(["absolute py-2 px-4 text-sm text-stone-800 bg-white shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-lg top-[-46px] text-nowrap p-2 hidden whitespace-nowrap",[c===0?"left-[-10px]":"left-[50%] translate-x-[-50%]"]])},N.toDisplayString(T==null?void 0:T.name),3)],10,ym))),128))])}const bm=Fi(gm,[["render",vm],["__scopeId","data-v-8959e540"]]),wm={},Sm={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"},Tm=[N.createElementVNode("path",{d:"M18 6 6 18"},null,-1),N.createElementVNode("path",{d:"m6 6 12 12"},null,-1)];function km(f,v){return N.openBlock(),N.createElementBlock("svg",Sm,Tm)}const ml=Fi(wm,[["render",km]]),Im={},Cm={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Em=[N.createElementVNode("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),N.createElementVNode("path",{d:"M2 17L12 22L22 17",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),N.createElementVNode("path",{d:"M2 12L12 17L22 12",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)];function Pm(f,v){return N.openBlock(),N.createElementBlock("svg",Cm,Em)}const Am={components:{closeIcon:ml,layersIcon:Fi(Im,[["render",Pm]])},mixins:[Oo],props:{layers:{type:Array,default:()=>[]},map:{type:Object,default:null},basemapIds:{type:Array,default:()=>[]}},data(){return{isOpen:!1,selectedLayers:[],mounted:!1}},mounted(){this.mounted=!0},methods:{async handleLayerChange(f,v){await this.setVisible(f,v),v&&this.map.getStyle().layers.filter(L=>!this.basemapIds.includes(L.id)&&L.id!==f.id).map(L=>L.id).forEach(L=>{this.map.getLayer(L)&&this.map.moveLayer(L)})}}},Mm=f=>(N.pushScopeId("data-v-4c33eaa0"),f=f(),N.popScopeId(),f),zm={class:"p-[10px]"},Dm={class:"select-none absolute left-[20px] top-[10px] border bg-white max-w-[250px] p-[10px] rounded-lg z-10"},Lm={class:"flex justify-between items-center border-b pb-[8px] text-[16px]"},Rm=Mm(()=>N.createElementVNode("span",null,"Додаткові шари",-1)),Bm={class:"mt-2 max-h-[300px] overflow-auto [&::-webkit-scrollbar]:h-1.5 [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-gray-300 [&::-webkit-scrollbar-track]:bg-transparent"},Fm=["id","value","onChange"],Om=["for"];function Vm(f,v,k,P,L,Z){const T=N.resolveComponent("layersIcon"),c=N.resolveComponent("VsPopover"),fe=N.resolveComponent("closeIcon");return N.openBlock(),N.createElementBlock(N.Fragment,null,[!L.isOpen&&L.mounted?(N.openBlock(),N.createBlock(c,{key:0,teleport:"body",trigger:"hover",placement:"right",class:"select-none flex absolute left-[20px] top-[10px] border bg-white max-w-[250px] rounded-lg cursor-pointer z-10",onClick:v[0]||(v[0]=me=>L.isOpen=!L.isOpen)},{reference:N.withCtx(()=>[N.createElementVNode("div",zm,[N.createVNode(T,{class:"h-5 w-5"})])]),default:N.withCtx(()=>[N.createTextVNode(" Додаткові шари ")]),_:1})):N.createCommentVNode("",!0),N.withDirectives(N.createElementVNode("div",Dm,[N.createElementVNode("div",Lm,[Rm,L.mounted?(N.openBlock(),N.createBlock(c,{key:0,teleport:"body",trigger:"hover",placement:"bottom",class:"flex"},{reference:N.withCtx(()=>[N.createElementVNode("button",{type:"button",class:"size-6 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:v[1]||(v[1]=me=>L.isOpen=!L.isOpen)},[N.createVNode(fe)])]),default:N.withCtx(()=>[N.createTextVNode(" Приховати панель ")]),_:1})):N.createCommentVNode("",!0)]),N.withDirectives(N.createElementVNode("div",Bm,[(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(k.layers,me=>(N.openBlock(),N.createElementBlock("div",{key:me.id,class:"flex items-center gap-2 text-sm"},[N.createElementVNode("input",{type:"checkbox",id:`layer-${me.id}`,value:me.id,class:"cursor-pointer",onChange:ve=>Z.handleLayerChange(me,ve.target.checked)},null,40,Fm),N.createElementVNode("label",{for:`layer-${me.id}`,class:"cursor-pointer"},N.toDisplayString(me.name),9,Om)]))),128))],512),[[N.vShow,L.isOpen]])],512),[[N.vShow,L.isOpen]])],64)}const Nm=Fi(Am,[["render",Vm],["__scopeId","data-v-4c33eaa0"]]),$m={mixins:[Oo],components:{closeIcon:ml},props:{map:{type:Object,required:!0},compareLayers:{type:Array,default:()=>[]},table:{type:String,default:""},collapsed:{type:Boolean,default:!1}},data(){return{mounted:!1,currentLayer:null}},mounted(){var f,v;this.currentLayer=((v=(f=this.compareLayers)==null?void 0:f[0])==null?void 0:v.id)||null,this.mounted=!0},watch:{async currentLayer(f,v){const k=this.compareLayers.find(L=>L.id===v),P=this.compareLayers.find(L=>L.id===f);k&&await this.setVisible(k,!1,this.map),P&&await this.setVisible(P,!0,this.map),this.map.getStyle().layers.forEach(L=>{L.source===this.table&&this.map.getLayer(L.id)&&this.map.moveLayer(L.id)})}}},jm={class:"absolute w-full top-[10px] right-[50px] shadow-sm bg-white max-w-[250px] p-[10px] rounded-lg z-10 select-none border"},Um={class:"flex items-start justify-between pb-1 border-b"},qm=N.createElementVNode("div",{class:"text-[16px] max-w-[180px]"}," Базові шари порівняльної карти ",-1),Zm={class:"flex gap-2"},Gm=N.createElementVNode("button",{type:"button",class:"size-6 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"}," - ",-1),Hm={class:"pt-1 max-h-[300px] overflow-auto [&::-webkit-scrollbar]:h-1.5 [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-gray-300 [&::-webkit-scrollbar-track]:bg-transparent"},Xm=["id","name","value"],Wm=["for"];function Jm(f,v,k,P,L,Z){const T=N.resolveComponent("VsPopover"),c=N.resolveComponent("closeIcon");return N.withDirectives((N.openBlock(),N.createElementBlock("div",jm,[N.createElementVNode("div",Um,[qm,N.createElementVNode("div",Zm,[L.mounted?(N.openBlock(),N.createBlock(T,{key:0,trigger:"hover",placement:"bottom",teleport:"body",onClick:v[0]||(v[0]=fe=>f.$emit("update:collapsed",!0))},{reference:N.withCtx(()=>[Gm]),default:N.withCtx(()=>[N.createTextVNode(" Згорнути панель ")]),_:1})):N.createCommentVNode("",!0),L.mounted?(N.openBlock(),N.createBlock(T,{key:1,trigger:"hover",placement:"bottom",teleport:"body"},{reference:N.withCtx(()=>[N.createElementVNode("button",{type:"button",class:"size-6 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:v[1]||(v[1]=fe=>f.$emit("close"))},[N.createVNode(c,{class:"cursor-pointer"})])]),default:N.withCtx(()=>[N.createTextVNode(" Приховати панель ")]),_:1})):N.createCommentVNode("",!0)])]),N.createElementVNode("div",Hm,[(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(k.compareLayers,fe=>(N.openBlock(),N.createElementBlock("div",{key:fe.id,class:"flex items-center py-1"},[N.withDirectives(N.createElementVNode("input",{type:"radio",id:fe.id,name:fe.id,value:fe.id,"onUpdate:modelValue":v[2]||(v[2]=me=>L.currentLayer=me),class:"shrink-0 border-gray-200 rounded-full text-blue-600 focus:ring-blue-500 checked:border-blue-500 dark:bg-neutral-800 dark:border-neutral-700 dark:checked:bg-blue-500 dark:checked:border-blue-500 dark:focus:ring-offset-gray-800"},null,8,Xm),[[N.vModelRadio,L.currentLayer]]),N.createElementVNode("label",{for:fe.id,class:"text-[14px] ml-2 cursor-pointer"},N.toDisplayString(fe.name),9,Wm)]))),128))])],512)),[[N.vShow,!k.collapsed]])}const Km=Fi($m,[["render",Jm]]),Ym={},Qm={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},eg=[N.createElementVNode("path",{d:"M18 8L22 12L18 16",stroke:"#333333","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),N.createElementVNode("path",{d:"M6 8L2 12L6 16",stroke:"#333333","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),N.createElementVNode("path",{d:"M2 12H22",stroke:"#333333","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)];function tg(f,v,k,P,L,Z){return N.openBlock(),N.createElementBlock("svg",Qm,eg)}const ig={components:{closeIcon:ml,compareIcon:Fi(Ym,[["render",tg]]),CompareBaseLayers:Km},props:{map:{type:Object},compareLayers:{type:Array},table:{type:String}},data(){return{isOpen:!1,mounted:!1,afterMap:null,compare:null,isOpen:!1,afterMapLoaded:!1,collapsed:!1}},mounted(){this.mounted=!0,window.maplibregl=In,this.loadScripts()},computed:{modalButtonClasses(){return{"!bg-[#F2F2F2]":this.isOpen,"bg-white":!this.isOpen}}},methods:{loadScripts(){const f=document.createElement("link");f.setAttribute("rel","stylesheet"),f.setAttribute("href","https://cdn.jsdelivr.net/npm/@maplibre/maplibre-gl-compare@0.5.0/dist/maplibre-gl-compare.min.css"),document.head.appendChild(f);const v=document.createElement("script");v.setAttribute("src","https://cdn.jsdelivr.net/npm/@maplibre/maplibre-gl-compare@0.5.0/dist/maplibre-gl-compare.min.js"),document.head.appendChild(v)},initCompare(){const f=this.map,v={version:8,glyphs:"https://fonts.openmaptiles.org/{fontstack}/{range}.pbf",sources:{},layers:[]},k=new In.Map({container:"after",style:v,center:f.getCenter(),zoom:f.getZoom(),minZoom:f.getMinZoom()});if(k.addControl(new In.NavigationControl({visualizePitch:!0})),k.on("load",()=>{this.afterMapLoaded=!0,this.syncLayers()}),this.afterMap=k,window.maplibregl&&window.maplibregl.Compare){const P="#comparison-container";this.compare=new window.maplibregl.Compare(f,k,P,{mousemove:!1})}else console.error("Compare is not available on window.maplibregl")},destroyCompare(){this.compare&&(this.compare.remove(),this.compare=null),this.afterMap&&(this.afterMap.remove(),this.afterMap=null),this.isOpen=!1,this.afterMapLoaded=!1},toggleCompare(){if(this.collapsed){this.collapsed=!1;return}this.isOpen=!this.isOpen,this.isOpen?this.$nextTick(()=>{this.initCompare(),this.resizeMaps()}):this.destroyCompare()},resizeMaps(){this.map.resize(),this.afterMap&&this.afterMap.resize()},syncLayers(){if(!this.map||!this.afterMap)return;const f=this.map,v=this.afterMap;f.getSource(this.table)&&(v.getSource(this.table)||v.addSource(this.table,f.getStyle().sources[this.table]));const P=f.getStyle().layers.filter(L=>L.source===this.table);P.length&&P.forEach(L=>{v.getLayer(L.id)||v.addLayer(L)})}}},rg={class:"w-[29px] h-[29px] flex items-center justify-center"},ng={key:2,id:"comparison-container",class:"absolute top-0 right-0 w-full h-full"},sg=[N.createElementVNode("div",{id:"after",class:"map-compare"},null,-1)];function og(f,v,k,P,L,Z){const T=N.resolveComponent("compareIcon"),c=N.resolveComponent("VsPopover"),fe=N.resolveComponent("CompareBaseLayers");return N.openBlock(),N.createElementBlock(N.Fragment,null,[L.mounted?(N.openBlock(),N.createBlock(c,{key:0,teleport:"body",trigger:"hover",placement:"left",class:N.normalizeClass(["flex absolute right-[10px] top-[120px] bg-white max-w-[250px] rounded-lg cursor-pointer z-10",Z.modalButtonClasses]),onClick:Z.toggleCompare,style:{"box-shadow":"0 0 0 2px rgba(0, 0, 0, 0.2)"}},{reference:N.withCtx(()=>[N.createElementVNode("div",rg,[N.createVNode(T,{class:"w-4 h-4"})])]),default:N.withCtx(()=>[N.createTextVNode(" Порівняти шари ")]),_:1},8,["class","onClick"])):N.createCommentVNode("",!0),L.isOpen&&L.afterMapLoaded?(N.openBlock(),N.createBlock(fe,{key:1,table:k.table,map:L.afterMap,compareLayers:k.compareLayers,onClose:Z.destroyCompare,collapsed:L.collapsed,"onUpdate:collapsed":v[0]||(v[0]=me=>L.collapsed=me)},null,8,["table","map","compareLayers","onClose","collapsed"])):N.createCommentVNode("",!0),L.isOpen?(N.openBlock(),N.createElementBlock("div",ng,sg)):N.createCommentVNode("",!0)],64)}const ag=Fi(ig,[["render",og]]),lg={props:["colors","strokes","title"],methods:{capitalizeFirstLetter(f){return f?f.charAt(0).toUpperCase()+f.slice(1):""}}},cg={class:"absolute left-[20px] bottom-[74px] bg-white max-w-[250px] p-[10px] rounded-lg z-10 border"},hg={key:0,class:"mb-[10px] text-[1rem]"},ug={key:1},dg={class:"legend-item flex items-center gap-2"},pg={class:"ml-1 text-[0.875rem]"},fg={class:"legend-item"},mg={key:0,class:"flex justify-start items-center gap-2"},gg={class:"ml-1 text-[0.875rem]"};function _g(f,v,k,P,L,Z){var T;return N.openBlock(),N.createElementBlock("div",cg,[k.title?(N.openBlock(),N.createElementBlock("div",hg,N.toDisplayString(k.title),1)):N.createCommentVNode("",!0),(T=k.strokes)!=null&&T.length?(N.openBlock(),N.createElementBlock("div",ug,[(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(k.strokes,c=>(N.openBlock(),N.createElementBlock("div",dg,[N.createElementVNode("div",{class:"w-[15px] h-[4px]",style:N.normalizeStyle({background:`repeating-linear-gradient(to right, ${c.color}, ${c.color} 5px, transparent 5px, transparent 8px)`})},null,4),N.createElementVNode("div",pg,N.toDisplayString(Z.capitalizeFirstLetter(c.text)),1)]))),256))])):N.createCommentVNode("",!0),(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(k.colors,c=>(N.openBlock(),N.createElementBlock("div",fg,[c.id>0?(N.openBlock(),N.createElementBlock("div",mg,[N.createElementVNode("div",{class:"w-[15px] h-[15px] rounded-[50%] min-w-[15px]",style:N.normalizeStyle({backgroundColor:c.color})},null,4),N.createElementVNode("div",gg,N.toDisplayString(Z.capitalizeFirstLetter(c.text)),1)])):N.createCommentVNode("",!0)]))),256))])}const yg={components:{MapSlotLayers:bm,MapLegend:Fi(lg,[["render",_g]]),AdditionalLayers:Nm,MapCompare:ag},props:{colorAttr:null,strokeAttr:null,zoom:{type:Array,default:()=>8},defaultColor:{type:String,default:"blue"},selectedBaseLayer:{type:String,required:!0},legendname:{type:String,default:()=>""},height:{type:String,default:()=>"100vh"},width:{type:String,default:"100vw"},center:{type:Array,default:[32,49]},maxBounds:{type:Array,default:[[22,44],[40,52]]},table:{type:String,default:""},zoom:{type:[String,Number],default:13},minZoom:{type:[String,Number],default:1},basemap:Array,additionalLayers:Array,filtersParam:{type:String,default:""},row:{type:Object,default:{}},pointZoom:{type:String,default:"12"},legend:{type:Boolean,default:()=>!0},compareLayers:{type:Array,default:()=>[]}},mixins:[Oo],data(){return{map:null,hoverObject:null,popup:null,colors:[]}},async mounted(){var f,v,k,P;try{if(await this.createMap(),(f=this.row)!=null&&f.geom){const{type:L,coordinates:Z}=this.row.geom;let T;switch(L){case"Polygon":T=Ou(Z);break;case"MultiPolygon":T=Nu(Z);break;case"MultiPoint":T=Vu(Z);break;default:(v=this.map)==null||v.fitBounds([Z,Z],{maxZoom:this.zoom,padding:30}),this.isSelectObj=!0;return}const c=Uu(T).geometry.coordinates;(k=this.map)==null||k.fitBounds([c,c],{maxZoom:this.zoom,padding:30})}(P=this.map)==null||P.fitBounds(this.center)}catch{}},watch:{filtersParam(f){this.setFilter(this.table,f)},selectedBaseLayer(f){this.$emit("update:selectedBaseLayer",f)}},computed:{basemapIds(){return this.basemap.map(f=>f==null?void 0:f.id)},allLayers(){return[...this.basemap||[],...this.additionalLayers||[],...this.compareLayers||[]]}},methods:{async getColorStyle(){var f=[["#69D2E7","#A7DBD8","#E0E4CC","#F38630","#FA6900"],["#FE4365","#FC9D9A","#F9CDAD","#C8C8A9","#83AF9B"],["#ECD078","#D95B43","#C02942","#542437","#53777A"]];if(!this.colorAttr)return this.defaultColor;try{const{data:{rows:v}}=await Zt.get(`/api/data/${this.table}/${this.colorAttr}`),k=v.reduce((P,L,Z)=>L!=null&&L.id?[...P,L.id.toString(),L.color||f[0][Z%5]]:P,["match",["get",this.colorAttr]]);return this.colors=[...v],k.push("gray"),k}catch(v){console.log(v)}},async getStrokeStyle(){if(!this.strokeAttr)return"transparent";try{const{data:{rows:f}}=await Zt.get(`/api/data/${this.table}/${this.strokeAttr}`),v=f.reduce((k,P,L)=>P!=null&&P.id?[...k,{id:P.id.toString(),color:P.color||"#000000",dash:P.dash||[2,2],text:P.text||P.id.toString()}]:k,[]);return this.strokes=[...v],["match",["get",this.strokeAttr],...v.flatMap(({id:k,color:P})=>[k,P]),"transparent"]}catch(f){return console.log(f),"transparent"}},async handleMapLoad(){var P,L;this.$emit("map",this.map);const f=await this.getStrokeStyle(),v=await this.getColorStyle(),k=((L=(P=location.search.split("&").find(Z=>Z.includes("filter=")))==null?void 0:P.split("filter="))==null?void 0:L[1])||"";await this.addLayer({id:this.table,service:"vector",url:`/api/vtile/${this.table}/ua/{z}/{x}/{y}.vmt?pointZoom=${this.pointZoom}&dt=${new Date().toISOString()}${k?`&filter=${k}`:""}`,layers:[{type:"fill","source-layer":this.table,paint:{"fill-color":v,"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":v}},{id:`${this.table}-stroke`,type:"line","source-layer":this.table,filter:["all",["==",["geometry-type"],"Polygon"]],paint:{"line-color":f,"line-width":2.5,"line-dasharray":[2,2]}}]})},async createMap(){const f={version:8,glyphs:"https://cdn.softpro.ua/data/fonts/{fontstack}/{range}.pbf",sources:{},layers:[]};this.map=await new In.Map({container:"maplibre-map",style:f,zoom:this.zoom,center:this.center,minZoom:this.minZoom}),this.$parent.map=this.map,this.map.addControl(new In.NavigationControl({visualizePitch:!0})),this.map.on("load",this.handleMapLoad)}}},xg={class:"vs-map-portal relative z-1 mt-2",id:"mapwrapper"};function vg(f,v,k,P,L,Z){var ve;const T=N.resolveComponent("MapLegend"),c=N.resolveComponent("MapSlotLayers"),fe=N.resolveComponent("MapCompare"),me=N.resolveComponent("AdditionalLayers");return N.openBlock(),N.createElementBlock("div",xg,[N.createElementVNode("div",{id:"maplibre-map",ref:"maplibreMap",class:"w-full",style:N.normalizeStyle({height:k.height})},null,4),N.withDirectives(N.createVNode(T,{colors:L.colors,title:k.legendname},null,8,["colors","title"]),[[N.vShow,k.legend]]),N.createVNode(c,{map:L.map,baseLayers:k.basemap,selectedLayer:k.selectedBaseLayer,"onUpdate:selectedLayer":v[0]||(v[0]=le=>f.$emit("update:selectedBaseLayer",le))},null,8,["map","baseLayers","selectedLayer"]),N.createVNode(fe,{map:L.map,compareLayers:Z.allLayers,table:k.table},null,8,["map","compareLayers","table"]),(ve=k.additionalLayers)!=null&&ve.length?(N.openBlock(),N.createBlock(me,{key:0,map:L.map,layers:k.additionalLayers,basemapIds:Z.basemapIds},null,8,["map","layers","basemapIds"])):N.createCommentVNode("",!0)])}const bg=Fi(yg,[["render",vg]]),wg={},Sg={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"},Tg=[N.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 kg(f,v){return N.openBlock(),N.createElementBlock("svg",Sg,Tg)}const Ig=Fi(wg,[["render",kg]]),Cg={},Eg={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"},Pg=[N.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),N.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),N.createElementVNode("path",{d:"M15 4v16"},null,-1),N.createElementVNode("path",{d:"M9 10l2 2l-2 2"},null,-1)];function Ag(f,v){return N.openBlock(),N.createElementBlock("svg",Eg,Pg)}const Mg=Fi(Cg,[["render",Ag]]),zg={},Dg={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"},Lg=[N.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),N.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),N.createElementVNode("path",{d:"M15 4v16"},null,-1),N.createElementVNode("path",{d:"M10 10l-2 2l2 2"},null,-1)];function Rg(f,v){return N.openBlock(),N.createElementBlock("svg",Dg,Lg)}const Bg=Fi(zg,[["render",Rg]]),Fg={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 f;return!!((f=this.$slots)!=null&&f.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:f}){f==="Escape"&&this.handleClose()},handleClose(){this.$emit("update:visible",!1),this.$emit("onClose")}}},qu=f=>(N.pushScopeId("data-v-37405773"),f=f(),N.popScopeId(),f),Og={class:"vsTailwind ui-dialog__wrapper"},Vg={class:"w-full h-full fixed top-0 start-0 z-[80] bg-black bg-opacity-50"},Ng={class:"py-2.5 px-4 flex justify-between items-center border-b"},$g={class:"font-medium text-gray-800"},jg=[qu(()=>N.createElementVNode("span",{class:"sr-only"},"Close",-1)),qu(()=>N.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"},[N.createElementVNode("path",{d:"M18 6 6 18"}),N.createElementVNode("path",{d:"m6 6 12 12"})],-1))],Ug={class:"ui-dialog__content p-4"},qg={key:0,class:"flex justify-end gap-x-2"};function Zg(f,v,k,P,L,Z){return N.openBlock(),N.createBlock(N.Teleport,{to:"#modal"},[N.createVNode(N.Transition,{name:"fade"},{default:N.withCtx(()=>[N.withDirectives(N.createElementVNode("div",Og,[N.createElementVNode("div",Vg,[N.createVNode(N.Transition,{name:"content",appear:""},{default:N.withCtx(()=>[N.createElementVNode("div",{class:N.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",[Z.checkSize]])},[N.createElementVNode("div",Ng,[N.createElementVNode("h3",$g,N.toDisplayString(k.title),1),N.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:v[0]||(v[0]=(...T)=>Z.handleClose&&Z.handleClose(...T))},jg)]),N.createElementVNode("div",Ug,[N.renderSlot(f.$slots,"default",{},void 0,!0)]),Z.hasSlot?(N.openBlock(),N.createElementBlock("div",qg,[N.renderSlot(f.$slots,"footer",{},void 0,!0)])):N.createCommentVNode("",!0)],2)]),_:3})])],512),[[N.vShow,k.visible]])]),_:3})])}const Gg=Fi(Fg,[["render",Zg],["__scopeId","data-v-37405773"]]),Hg=N.defineComponent({props:{title:{type:String,default:()=>""},table:{type:String,default:()=>""},rows:{type:Object,default:()=>null},initTotal:{type:[Number,String],default:()=>""},colorAttr:{type:String,default:()=>""},strokeAttr:{type:String,default:()=>""},legendname:{type:String,default:()=>""},center:{type:Array},maxBounds:{type:Array,default:()=>[[22,44.4],[40,52.5]]},id:{type:String,default:()=>""},isAutocomplete:{type:Boolean,default:()=>!1},isAddressAutocomplete:{type:Boolean,default:()=>!1},zoom:{type:[Number,String],default:()=>"13"},minZoom:{type:[Number,String],default:()=>"1"},maskForSearch:{type:String,default:()=>null},searchShow:{type:Boolean,default:()=>!0},basemap:{type:Array},additionalLayers:{type:Array},pointZoom:{type:String,default:()=>"12"},legend:{type:Boolean,default:()=>!0},defaultColor:{type:String,default:()=>"blue"},compareLayers:{type:Array,default:()=>[]}},mixins:[Oo],components:{MapPortal:bg,NoData:Zp,FilterIcon:Ig,VisibleMapIcon:Mg,HiddenMapIcon:Bg,CloseIcon:ml,VsDialog:Gg},data(){return{filters:"",search:"",limit:20,polyline:null,filtersParam:"",isSelectObj:!1,selectedId:"",searchRegion:"",searchAddress:"",map:null,selectedBaseLayer:"",marker:null,selectedRow:null,activeFilters:"",isMapVisible:!0,tabsIsVisible:!1,filterUrl:"",currentPage:1,regionOptionGeneral:null,isFilterVisible:!1,tableData:null,hoverData:null,atuData:[],map:null,legendName:null,total:null,filtered:null,filterValues:"",activeFiltersCount:"",visibleTrue:!0,regionSelectValue:null,addressSelectValue:null,currentBbox:null,mountedFilter:{},optionRowsCount:[{value:10,label:"10"},{value:20,label:"20"},{value:30,label:"30"}],handleDebouncedUpdateValue:fm(f=>{this.handleSearchValue(f)},300)}},watch:{map(){this.map.on("mousemove",this.handleMapHover),this.map.on("click",this.handleMapClick),this.$emit("update:map",this.map)},activeFiltersCount(){var f,v;return(v=(f=this.$refs)==null?void 0:f.filter)==null?void 0:v.filteredActiveFiltersLength},activeFilters(){var f,v;return this.isSelectObj&&this.moveToDefaultPage(),(v=(f=this.$refs)==null?void 0:f.filter)==null?void 0:v.activeFilters},isFilterVisible(f){f||this.getData()},async regionSelectValue(f,v){var L,Z;if(!this.regionSelectValue){this.map.removeSource("region-search-id");return}f&&this.selectedId&&this.closeObjCard(),this.polyline=this.regionSelectValue.encoded_geom,this.getData();const k=((L=this.regionSelectValue)==null?void 0:L.geom)||Tr.toGeoJSON(this.regionSelectValue.encoded_geom),P=this.map.getSource("region-search-id");if(this.currentBbox=ju(k),P)P.setData({type:"Feature",geometry:k});else{this.map.addSource("region-search-id",{type:"geojson",data:{type:"Feature",geometry:k}});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"),(Z=this.map)==null||Z.fitBounds(this.currentBbox,{zoom:this.setAtuZoom,padding:20}),this.getData()},async addressSelectValue(f,v){this.addressSelectValue&&(f&&this.selectedId&&this.closeObjCard(),this.getData())}},created(){this.legendName,this.tableData=this.rows,this.total=this.initTotal,this.id&&(this.selectedRow=this.rows[0],this.selectedId=this.id,this.isSelectObj=!0)},mounted(){this.rows||this.getData();const v=new URLSearchParams(window.location.search).get("filter"),k=v==null?void 0:v.split("|");k==null||k.forEach(L=>{const[Z,T]=L.split("=");T!=null&&T.includes(",")?this.mountedFilter[Z]=T==null?void 0:T.split(","):this.mountedFilter[Z]=T});const P=new URLSearchParams(window.location.search);this.currentPage=P.get("page")||1,this.getFilter()},updated(){this.checkFilterLength()},computed:{setAtuZoom(){var f,v,k;return((f=this.regionSelectValue)==null?void 0:f.id)==="UA80000000000093317"||((v=this.regionSelectValue)==null?void 0:v.id)==="UA85000000000065278"?10:((k=this.regionSelectValue)==null?void 0:k.region)===""?7.5:11}},methods:{async getData(){try{const f={search:this.search||null,limit:this.limit,page:this.currentPage,polyline:this.polyline};f.filter=this.filtersParam;const{data:v}=await Zt.get(`/api/data/${this.table}`,{params:f});this.tableData=v==null?void 0:v.rows,this.total=v.filtered,this.filtered=v.filtered}catch(f){console.error(f.message)}},moveToDefaultPage(){var P;const f=new URLSearchParams(window.location.search);f.delete("id");const k=`${window.location.pathname}?${f.toString()}`;(P=this.map)==null||P.fitBounds(this.maxBounds,{}),window.history.pushState({},"",k),this.isSelectObj=!1},regionFullName(f){return f.region?`${f.text} / ${f.region}`:f.text},getLabelById(f){const v=this.filters.find(k=>k.id===f);return v?v.label:f},getOptionsLabelById(f,v){if(Array.isArray(v)){const k=this.filters.find(P=>P.id===f);return k!=null&&k.options?k==null?void 0:k.options.filter(P=>v.includes(P.id)).map(P=>P.text).join(", "):v==null?void 0:v.length}else return v},async clearFilter(f){var v,k;(k=(v=this.$refs)==null?void 0:v.filter)==null||k.clearFilter(f),await this.updateTableAndMap(),await this.getData()},handlePageChange(f){this.currentPage=f;const v=new URL(window.location.href),k=new URLSearchParams(window.location.search);k.set("page",f),v.search=decodeURI(k.toString()),window.history.pushState({},"",v),this.getData()},async getFilter(){var f;try{const{data:v}=await Zt.get(`/api/filter/${this.table}`);this.filters=(f=v==null?void 0:v.list)==null?void 0:f.map(k=>({...k,label:(k==null?void 0:k.label)||(k==null?void 0:k.ua),id:(k==null?void 0:k.id)||(k==null?void 0:k.name)}))}catch(v){console.error(v.message)}},async handleSearchValue(f){this.search=f,await this.getData()},closeObjCard(){var P;const f=new URLSearchParams(window.location.search);f.delete("id"),this.deletePulsePoint(),this.deleteHighlighPolygon();const k=`${window.location.pathname}?${f.toString()}`;(this.currentBbox||this.center)&&((P=this.map)==null||P.fitBounds(this.currentBbox||[this.center,this.center],{maxZoom:this.zoom})),window.history.pushState({},"",k),this.isSelectObj=!1,this.selectedRow=null,this.getData()},async handleSearchRegionValue(f){var k;const v=this.map.getLayer("region-search-id");this.searchRegion=f,f===""&&v?((k=this.map)==null||k.fitBounds(this.maxBounds,{}),this.currentBbox=null,this.polyline=null,this.map.removeLayer("region-search-id"),this.getData()):f===""&&this.getData()},async handleSearchAddressValue(f){var k;const v=this.map.getLayer("address-search-id");this.searchAddress=f,f===""&&v?((k=this.map)==null||k.fitBounds(this.maxBounds,{}),this.currentBbox=null,this.polyline=null,this.map.removeLayer("address-search-id"),this.getData()):f===""&&this.getData()},handleFilterChange(f){this.$emit("update:filterState",f),this.currentPage=f.state.page||1,this.filterUrl=f.url==="no-url"?null:f.url.split("|").filter(v=>!v.includes("page=")).join("|")},async updateTableAndMap(){var f,v;this.selectedRow||(this.filtersParam=this.filterUrl,this.activeFilters=(v=(f=this.$refs)==null?void 0:f.filter)==null?void 0:v.activeFilters,this.isFilterVisible=!1,this.getData())},handleFilterSubmit(){var f;this.isSelectObj="",this.selectedId="",this.selectedId=!1,(f=this.map)==null||f.fitBounds(this.maxBounds,{}),this.isFilterVisible=!1},toggleMapVisible(){this.isMapVisible=!this.isMapVisible},checkUrl(f=!0){const v=new URLSearchParams(window.location.search);v.has("id")?(this.isSelectObj=!0,this.isMapVisible=f,this.selectedId=v.get("id")):(this.isSelectObj=!1,this.selectedId="")},changeLimit(f){this.limit=f,this.currentPage=1,this.getData()},filterModalClose(){this.isFilterVisible=!1},resetFilters(){this.$refs.filter&&(this.$refs.filter.clearAll(),this.search="",this.isFilterVisible=!1,this.filtersParam="",this.polyline=null,this.regionSelectValue=null,this.addressSelectValue=null,this.currentBbox=null,this.activeFilters=null,this.tabsIsVisible=!1,this.handleSearchRegionValue(""),this.handleSearchAddressValue(""))},checkFilterLength(){var v,k;const f=(k=(v=this.$refs)==null?void 0:v.filter)==null?void 0:k.filteredActiveFiltersLength;f!==this.previousLength&&(this.previousLength=f,this.activeFiltersCount=f)},async handleMapClick(f){var Z,T,c,fe,me,ve,le,oe;const v=this.map.queryRenderedFeatures(f.point);if((v==null?void 0:v.length)<1)return;const k=window.location.pathname,P=new URLSearchParams(window.location.search);P.set("id",`${(Z=v[0])==null?void 0:Z.properties.id}`),this.getObjectData((c=(T=v[0])==null?void 0:T.properties)==null?void 0:c.id);const L=`${k}?${P.toString()}`;window.history.pushState({},"",L),this.isSelectObj=!0,f.lngLat&&((oe=this.map)==null||oe.fitBounds([[(fe=f.lngLat)==null?void 0:fe.lng,(me=f.lngLat)==null?void 0:me.lat],[(ve=f.lngLat)==null?void 0:ve.lng,(le=f.lngLat)==null?void 0:le.lat]],{padding:30})),this.checkUrl()},async getObjectData(f){var v,k;try{const{data:P}=await Zt.get(`/api/data/${this.table}/${f}`);this.selectRow((v=P==null?void 0:P.rows)==null?void 0:v[0]),((k=P==null?void 0:P.rows)==null?void 0:k.lenght)<1&&this.deletePulsePoint()}catch(P){console.error(P.message)}},async selectRow(f,v=!0){var c,fe,me;this.isMapVisible=v;const P=await(await fetch(`/api/data/${this.table}/${f.id}`)).json();this.selectedRow=((c=P==null?void 0:P.rows)==null?void 0:c[0])||f;const L=window.location.pathname,Z=new URLSearchParams(window.location.search);Z.set("id",`${f.id}`);const T=`${L}?${Z.toString()}`;if(window.history.pushState({},"",T),this.checkUrl(v),f!=null&&f.geom){const{type:ve,coordinates:le}=f.geom;let oe;switch(ve){case"Polygon":oe=Ou(le);break;case"MultiPolygon":oe=Nu(le);break;case"MultiPoint":oe=Vu(le);break;default:(fe=this.map)==null||fe.fitBounds([le,le],{maxZoom:15,padding:30}),this.isSelectObj=!0;return}const ht=Uu(oe).geometry.coordinates;(me=this.map)==null||me.fitBounds([ht,ht],{maxZoom:15,padding:30})}this.isSelectObj=!0},deletePulsePoint(){this.marker&&this.marker.remove()},addPulsePoint(f){this.deletePulsePoint();const v=document.createElement("div");v.className="gps-marker",v.style.width="10px",v.style.height="10px",v.style.position="relative";const k=document.createElement("div");k.className="gps-wave",v.appendChild(k),this.marker=new In.Marker({element:v,anchor:"center"}).setLngLat(f).addTo(this.map)},deleteHighlighPolygon(){var f,v,k;(f=this.map)!=null&&f.getLayer("highlighted-polygon")&&((v=this.map)==null||v.removeLayer("highlighted-polygon"),(k=this.map)==null||k.removeSource("highlighted-polygon"))},highlightPolygon(f){var v,k,P,L,Z,T;this.deletePulsePoint(),this.deleteHighlighPolygon(),(L=this.map)==null||L.addSource("highlighted-polygon",{type:"geojson",data:{geometry:{type:(v=f==null?void 0:f.geom)==null?void 0:v.type,coordinates:(k=f==null?void 0:f.geom)==null?void 0:k.coordinates},type:"Feature",properties:{id:f==null?void 0:f.id,name:f==null?void 0:f.name,category:f==null?void 0:f.id},id:f==null?void 0:f.id,layer:{id:"site.rest_zone.table-0",type:"fill",source:"site.rest_zone.table",sourceLayer:"site.rest_zone.table",filter:["all",["==",["geometry-type"],(P=f==null?void 0:f.geom)==null?void 0:P.type]],paint:{"fill-color":"orange","fill-opacity":.5},layout:{}},source:"site.rest_zone.table",sourceLayer:"site.rest_zone.table",state:{hover:!0},table:"site.rest_zone.table"}}),(Z=this.map)==null||Z.addLayer({id:"highlighted-polygon",type:"fill",source:"highlighted-polygon",layout:{},minzoom:12,maxzoom:0,paint:{"fill-color":"orange","fill-opacity":.6}}),(T=this.map)==null||T.moveLayer("highlighted-polygon")},async handleMapHover(f){var L,Z,T;this.hoverObject&&(this.map.setFeatureState(this.hoverObject,{hover:!1}),this.hoverObject=null),this.popup||(this.popup=new In.Popup({maxWidth:"400px",closeButton:!1,closeOnClick:!1}));const v=this.map.queryRenderedFeatures(f.point);if(this.map.getCanvas().style.cursor="pointer",!(v!=null&&v.length)||((L=v==null?void 0:v[0])==null?void 0:L.source)==="region-search-id"){this.map.getCanvas().style.cursor="",this.popup.remove();return}const k=v[0].geometry.coordinates.slice();v[0].source==="highlighted-polygon"&&v[1]?this.hoverData=(Z=v[1])==null?void 0:Z.properties:this.hoverData=(T=v[0])==null?void 0:T.properties;const P={source:v[0].source,sourceLayer:v[0].sourceLayer,id:v[0].id};if(P.source!=="region-search-id"){for(this.map.setFeatureState(P,{hover:!0}),this.hoverObject=P;Math.abs(f.lngLat.lng-k[0])>180;)k[0]+=f.lngLat.lng>k[0]?360:-360;this.popup.setLngLat(f.lngLat).setHTML(this.$refs.popup.innerHTML).addTo(this.map)}},removeSelectedBaseLayer(){this.selectedBaseLayer=""},addGeomMarker(f){if(!this.map||!f)return;this.marker&&this.marker.remove();let v;(f==null?void 0:f.type)==="Point"?v=f.coordinates:v=mm(f).geometry.coordinates,this.marker=new In.Marker({color:"green"}).setLngLat(v).addTo(this.map),this.map.setCenter(v)}}}),Xg={class:"ml-3 pt-[20px]"},Wg={class:"w-full gap-5 flex justify-between mb-[6px] pr-3"},Jg={class:"flex items-center gap-2 max-h-[38px] pt-[4px]"},Kg={class:"custom-filter-list"},Yg={key:0,class:"font-medium text-[10px] min-w-[16px] py-0.5 px-[5px] bg-gray-800 text-white leading-3 rounded-full"},Qg=["title"],e_=N.createElementVNode("span",{class:"sr-only"},"Відкрити мапу",-1),t_={class:"flex"},i_={class:"py-[15px] pb-[24px] pl-2"},r_={class:"font-bold text-2xl mr-[10px]"},n_={class:"text-sm text-stone-500 font-medium"},s_=N.createElementVNode("span",{class:"text-sm text-stone-500 font-medium"}," об'єктів",-1),o_={class:"wrapperTable flex flex-col",style:{height:"calc(100vh - 302px)"}},a_={key:0,class:"flex gap-x-2 flex-wrap"},l_={class:"font-medium"},c_=N.createElementVNode("span",{class:"h-3 mx-2 border-s border-gray-200"},null,-1),h_={class:"text-gray-500"},u_=["onClick"],d_={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"},p_=N.createElementVNode("span",{class:"font-medium"}," Очистити ",-1),f_={key:2,class:"text-center py-28"},m_=N.createElementVNode("h2",{class:"font-medium text-base text-gray-500 rounded-xl"}," За вашим запитом даних не знайдено! ",-1),g_=N.createElementVNode("p",{class:"font-normal text-sm text-gray-500 rounded-xl"}," Введіть, будь ласка, інші значення для пошуку. ",-1),__={key:0},y_={key:1,class:"my-5 pr-2"},x_={class:"flex justify-between"},v_={class:"w-2/4"},b_={class:"map-section relative"},w_={ref:"popup",style:{display:"none"}};function S_(f,v,k,P,L,Z){var Oe,ft;const T=N.resolveComponent("VsTextMask"),c=N.resolveComponent("vs-text"),fe=N.resolveComponent("FilterIcon"),me=N.resolveComponent("VsFilterList"),ve=N.resolveComponent("VisibleMapIcon"),le=N.resolveComponent("HiddenMapIcon"),oe=N.resolveComponent("CloseIcon"),ht=N.resolveComponent("NoData"),je=N.resolveComponent("VsPagination"),Ke=N.resolveComponent("MapPortal");return N.openBlock(),N.createElementBlock("section",Xg,[N.createElementVNode("div",null,[N.createElementVNode("div",Wg,[N.createElementVNode("div",Jg,[f.maskForSearch?(N.openBlock(),N.createBlock(T,{key:0,"model-value":f.search,"onUpdate:modelValue":f.handleDebouncedUpdateValue,class:"w-full table-interface-search",placeholder:"Пошук",mask:f.maskForSearch,icon:"search",iconPosition:"left",clearable:"",style:{height:"38px","min-width":"300px","max-width":"300px"},ref:"searchInput"},null,8,["model-value","onUpdate:modelValue","mask"])):f.searchShow?(N.openBlock(),N.createBlock(c,{key:1,"model-value":f.search,"onUpdate:modelValue":f.handleDebouncedUpdateValue,class:"[&>input]:py-[7px] [&>input]:max-h-[38px] [&>input]:w-[220px] [&>input]:ps-10 [&>input]:pe-8 [&>input]:block [&>input]:w-full [&>input]:bg-gray-100 [&>input]:border-transparent [&>input]:rounded-lg [&>input]:text-sm [&>input]:focus:bg-white [&>input]:focus:border-blue-500 [&>input]:focus:ring-blue-500 [&>input]:disabled:opacity-50 [&>input]:disabled:pointer-events-none [&>input]:dark:bg-neutral-700 [&>input]:dark:border-transparent [&>input]:dark:text-neutral-400 [&>input]:dark:placeholder:text-neutral-400 dark:focus:bg-neutral-800 dark:focus:ring-neutral-600",placeholder:"Пошук",icon:"search","icon-position":"left",clearable:"",style:{height:"38px"},ref:"searchInput"},null,8,["model-value","onUpdate:modelValue"])):N.createCommentVNode("",!0),N.createElementVNode("div",Kg,[f.filters?(N.openBlock(),N.createBlock(me,{key:0,ref:"filter",modelValue:f.mountedFilter,"onUpdate:modelValue":v[0]||(v[0]=st=>f.mountedFilter=st),scheme:f.filters,isDialog:(Oe=f.filters)==null?void 0:Oe.some(st=>!(st!=null&&st.inline)),"apply-vue-router":"",history:"",view:"plain",clearable:!1,name:"filter",onFilterChange:v[1]||(v[1]=async st=>{await f.handleFilterChange(st),await f.updateTableAndMap()})},{button:N.withCtx(({visible:st})=>[N.createElementVNode("button",{type:"button",class:N.normalizeClass(["py-2 px-2.5 h-[40px] inline-flex items-center gap-x-1.5 text-sm font-medium rounded-lg bg-white text-gray-800 hover:bg-gray-50 focus:outline-none focus:bg-gray-50",[st?"border border-blue-600 border-2":"border border-gray-200"]])},[N.createVNode(fe),N.createTextVNode(" Фільтри "),f.activeFiltersCount>=1?(N.openBlock(),N.createElementBlock("span",Yg,N.toDisplayString(f.activeFiltersCount),1)):N.createCommentVNode("",!0)],2)]),_:1},8,["modelValue","scheme","isDialog"])):N.createCommentVNode("",!0)])]),N.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:f.isMapVisible?"Приховати карту":"Показати карту",onClick:v[2]||(v[2]=(...st)=>f.toggleMapVisible&&f.toggleMapVisible(...st))},[f.isMapVisible?(N.openBlock(),N.createBlock(ve,{key:0})):(N.openBlock(),N.createBlock(le,{key:1})),e_],8,Qg)]),N.createElementVNode("div",t_,[N.createElementVNode("div",{class:N.normalizeClass(["relative overflow-hidden",f.isMapVisible?"w-2/4 mr-0":"w-full mr-3",f.isSelectObj?"hidden":""])},[N.createElementVNode("h1",i_,[N.createElementVNode("span",r_,N.toDisplayString(f.title),1),N.createElementVNode("span",n_,N.toDisplayString(f.total),1),s_]),N.createElementVNode("div",o_,[f.activeFilters?(N.openBlock(),N.createElementBlock("div",a_,[(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(f.activeFilters,(st,He,Ft)=>(N.openBlock(),N.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:Ft},[N.createElementVNode("span",l_,N.toDisplayString(f.getLabelById(He)),1),c_,N.createElementVNode("span",h_,N.toDisplayString(f.getOptionsLabelById(He,st)),1),N.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:wt=>f.clearFilter(He)},[N.createVNode(oe)],8,u_)]))),128)),((ft=Object.keys(f.activeFilters))==null?void 0:ft.length)>=2?(N.openBlock(),N.createElementBlock("span",d_,[p_,N.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:v[3]||(v[3]=st=>f.mountedFilter={})},[N.createVNode(oe)])])):N.createCommentVNode("",!0)])):N.createCommentVNode("",!0),f.total>=1?N.renderSlot(f.$slots,"table",{key:1,rows:f.tableData,map:f.map,marker:f.marker,selectRow:f.selectRow,getData:f.getData,addGeomMarker:f.addGeomMarker,isMapVisible:f.isMapVisible}):(N.openBlock(),N.createElementBlock("div",f_,[N.createVNode(ht),m_,g_,N.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:v[4]||(v[4]=(...st)=>f.resetFilters&&f.resetFilters(...st))}," Очистити дані пошуку ")]))]),f.total>=1?(N.openBlock(),N.createElementBlock("hr",__)):N.createCommentVNode("",!0),f.total>=1?(N.openBlock(),N.createElementBlock("div",y_,[N.createElementVNode("div",x_,[N.createVNode(je,{total:f.total,maxPages:7,defaultPage:f.currentPage,pageSize:f.limit,goTo:!1,size:"medium",onPageChange:f.handlePageChange,backgroundColor:"#e5e7eb",borderedCellSelected:!0,pageSizes:[10,20,30],onPageSizeChange:f.changeLimit},null,8,["total","defaultPage","pageSize","onPageChange","onPageSizeChange"])])])):N.createCommentVNode("",!0)],2),f.isSelectObj?(N.openBlock(),N.createElementBlock("div",{key:0,class:N.normalizeClass(f.isMapVisible?"w-2/4 mr-0 pb-5":"w-full pb-5 mr-3"),style:{height:"calc(100vh - 152px)"}},[N.renderSlot(f.$slots,"details",{table:f.table,selectedId:f.selectedId,selectedRow:f.selectedRow,map:f.map,closeObjCard:f.closeObjCard,isMapVisible:f.isMapVisible})],2)):N.createCommentVNode("",!0),N.withDirectives(N.createElementVNode("div",v_,[N.createElementVNode("section",b_,[N.renderSlot(f.$slots,"default",{map:f.map,removeSelectedBaseLayer:f.removeSelectedBaseLayer,selectedBaseLayer:f.selectedBaseLayer}),N.createVNode(Ke,{height:"calc(100vh - 152px)",width:"w-2/4",table:f.table,filtersParam:f.filtersParam,row:f.selectedRow,legendname:f.legendname,legend:f.legend,compareLayers:f.compareLayers,colorAttr:f.colorAttr,strokeAttr:f.strokeAttr,maxBounds:f.maxBounds,center:f.center,zoom:f.zoom,minZoom:f.minZoom,basemap:f.basemap,additionalLayers:f.additionalLayers,pointZoom:f.pointZoom,defaultColor:f.defaultColor,onMap:v[5]||(v[5]=st=>f.map=st),selectedBaseLayer:f.selectedBaseLayer,"onUpdate:selectedBaseLayer":v[6]||(v[6]=st=>f.selectedBaseLayer=st)},null,8,["table","filtersParam","row","legendname","legend","compareLayers","colorAttr","strokeAttr","maxBounds","center","zoom","minZoom","basemap","additionalLayers","pointZoom","defaultColor","selectedBaseLayer"])])],512),[[N.vShow,f.isMapVisible]])]),N.createElementVNode("div",w_,[N.renderSlot(f.$slots,"popup",{data:f.hoverData})],512)])])}const Zu=Fi(Hg,[["render",S_]]),Gu={install:f=>{f.component("VsPartsMap",Zu)},components:{VsPartsMap:Zu}};return typeof window<"u"&&(window.PartsMap=Gu),Gu});