@opengis/admin 0.4.23 → 0.4.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +97 -97
- package/dist/{add-page-8ASRlQMS.js → add-page-BnuV3GUq.js} +1 -1
- package/dist/{admin-interface-BEb1DlT2.js → admin-interface-BNHfUVVd.js} +2 -2
- package/dist/{admin-view-BcWfEfRW.js → admin-view-BzRj8tla.js} +1 -1
- package/dist/admin.js +1 -1
- package/dist/admin.umd.cjs +2 -2
- package/dist/assets/logo.svg +41 -41
- package/dist/{card-view-BbzJnvoN.js → card-view-fMATCpvv.js} +1 -1
- package/dist/{edit-page-NFAOI00G.js → edit-page-CfwKksUs.js} +1 -1
- package/dist/{import-file-DJR1XXLF.js → import-file-BJlu2-xP.js} +8 -8
- package/dist/{profile-page-CBSCi6Db.js → profile-page-C5_ZayhZ.js} +1 -1
- package/dist/style.css +1 -1
- package/module/settings/card/admin.accounts.table/index.yml +7 -7
- package/module/settings/card/admin.accounts.table/rules.hbs +18 -18
- package/module/settings/card/admin.accounts.table/users.hbs +13 -13
- package/module/settings/card/admin.routes.table/groups.hbs +11 -11
- package/module/settings/card/admin.routes.table/users.hbs +16 -16
- package/module/settings/cls/core.actions.json +17 -17
- package/module/settings/cls/core.scope.json +13 -13
- package/module/settings/cls/properties.site_status.json +13 -13
- package/module/settings/cls/properties.widget_status.json +13 -13
- package/module/settings/cls/yes_no.json +11 -11
- package/module/settings/form/admin.accounts.form.json +13 -13
- package/module/settings/form/admin.properties.form.json +15 -15
- package/module/settings/form/admin.roles.form.json +21 -21
- package/module/settings/form/admin.user_properties.form.json +15 -15
- package/module/settings/form/admin.user_roles_card.form.json +13 -13
- package/module/settings/interface/admin.properties.json +4 -4
- package/module/settings/interface/admin.roles.json +4 -4
- package/module/settings/interface/admin.routes.json +4 -4
- package/module/settings/interface/admin.users.json +4 -4
- package/module/settings/select/core.routes.sql +1 -1
- package/module/settings/select/core.user_mentioned.sql +1 -1
- package/module/settings/select/core.user_uid.sql +1 -1
- package/module/settings/table/admin.properties.table.json +39 -39
- package/module/settings/table/admin.user_properties.table.json +34 -34
- package/package.json +1 -1
- package/server/helpers/core/coalesce.js +7 -7
- package/server/helpers/core/select.js +48 -48
- package/server/helpers/core/token.js +18 -18
- package/server/helpers/list/buttonHelper.js +21 -21
- package/server/helpers/list/utils/button.js +5 -5
- package/server/helpers/temp/contentList.js +58 -58
- package/server/helpers/temp/ifCond.js +101 -101
- package/server/helpers/utils/button.js +5 -5
- package/server/helpers/utils/mdToHTML.js +17 -17
- package/server/plugins/cron.js +10 -10
- package/server/plugins/docs.js +28 -28
- package/server/routes/calendar/controllers/calendar.data.js +124 -124
- package/server/routes/calendar/index.mjs +7 -7
- package/server/routes/notifications/controllers/readNotifications.js +18 -18
- package/server/routes/notifications/controllers/testEmail.js +35 -35
- package/server/routes/notifications/controllers/userNotifications.js +53 -53
- package/server/routes/notifications/hook/onWidgetSet.js +56 -56
- package/server/routes/notifications/index.mjs +26 -26
- package/server/routes/root.mjs +3 -3
- package/server/routes/user/controllers/user.cls.id.js +14 -14
- package/server/routes/user/controllers/user.cls.js +72 -72
- package/server/routes/user/controllers/user.info.js +17 -17
- package/server/templates/cls/itree.recrzone_category.json +73 -73
- package/server/templates/cls/test.json +9 -9
- package/server/templates/form/admin.user_cls.data.form.json +49 -49
- package/server/templates/form/admin.user_group_rel.form.json +21 -21
- package/server/templates/form/form-user-pass.json +10 -10
- package/server/templates/form/form-user_group.json +39 -39
- package/server/templates/form/form-users.json +156 -156
- package/server/templates/form/user_group_access.form.json +22 -22
- package/server/templates/select/account_id.json +2 -2
- package/server/templates/table/gis.dataset.table.json +43 -43
- package/server/templates/table/management.user_group.table.json +112 -112
- package/server/templates/table/management.users.table.json +126 -126
- package/server/utils/addNotification.js +21 -21
- package/server/utils/sendNotification.js +89 -89
package/dist/admin.umd.cjs
CHANGED
@@ -617,7 +617,7 @@ uniform ${O} ${L} u_${G};
|
|
617
617
|
#endif
|
618
618
|
`}),staticAttributes:m,staticUniforms:A}}class Fd{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(i,h,m,g,_,A,M,P,V){this.context=i;let O=this.boundPaintVertexBuffers.length!==g.length;for(let L=0;!O&&L<g.length;L++)this.boundPaintVertexBuffers[L]!==g[L]&&(O=!0);!this.vao||this.boundProgram!==h||this.boundLayoutVertexBuffer!==m||O||this.boundIndexBuffer!==_||this.boundVertexOffset!==A||this.boundDynamicVertexBuffer!==M||this.boundDynamicVertexBuffer2!==P||this.boundDynamicVertexBuffer3!==V?this.freshBind(h,m,g,_,A,M,P,V):(i.bindVertexArray.set(this.vao),M&&M.bind(),_&&_.dynamicDraw&&_.bind(),P&&P.bind(),V&&V.bind())}freshBind(i,h,m,g,_,A,M,P){const V=i.numAttributes,O=this.context,L=O.gl;this.vao&&this.destroy(),this.vao=O.createVertexArray(),O.bindVertexArray.set(this.vao),this.boundProgram=i,this.boundLayoutVertexBuffer=h,this.boundPaintVertexBuffers=m,this.boundIndexBuffer=g,this.boundVertexOffset=_,this.boundDynamicVertexBuffer=A,this.boundDynamicVertexBuffer2=M,this.boundDynamicVertexBuffer3=P,h.enableAttributes(L,i);for(const G of m)G.enableAttributes(L,i);A&&A.enableAttributes(L,i),M&&M.enableAttributes(L,i),P&&P.enableAttributes(L,i),h.bind(),h.setVertexAttribPointers(L,i,_);for(const G of m)G.bind(),G.setVertexAttribPointers(L,i,_);A&&(A.bind(),A.setVertexAttribPointers(L,i,_)),g&&g.bind(),M&&(M.bind(),M.setVertexAttribPointers(L,i,_)),P&&(P.bind(),P.setVertexAttribPointers(L,i,_)),O.currentNumAttributes=V}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}const $d=(x,i,h,m,g)=>({u_matrix:x,u_texture:0,u_ele_delta:i,u_fog_matrix:h,u_fog_color:m?m.properties.get("fog-color"):c.aM.white,u_fog_ground_blend:m?m.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:m?m.calculateFogBlendOpacity(g):0,u_horizon_color:m?m.properties.get("horizon-color"):c.aM.white,u_horizon_fog_blend:m?m.properties.get("horizon-fog-blend"):1});function Ho(x){const i=[];for(let h=0;h<x.length;h++){if(x[h]===null)continue;const m=x[h].split(" ");i.push(m.pop())}return i}class jd{constructor(i,h,m,g,_,A){const M=i.gl;this.program=M.createProgram();const P=Ho(h.staticAttributes),V=m?m.getBinderAttributes():[],O=P.concat(V),L=Bs.prelude.staticUniforms?Ho(Bs.prelude.staticUniforms):[],G=h.staticUniforms?Ho(h.staticUniforms):[],K=m?m.getBinderUniforms():[],ee=L.concat(G).concat(K),ie=[];for(const we of ee)ie.indexOf(we)<0&&ie.push(we);const ae=m?m.defines():[];_&&ae.push("#define OVERDRAW_INSPECTOR;"),A&&ae.push("#define TERRAIN3D;");const ce=ae.concat(Bs.prelude.fragmentSource,h.fragmentSource).join(`
|
619
619
|
`),he=ae.concat(Bs.prelude.vertexSource,h.vertexSource).join(`
|
620
|
-
`),te=M.createShader(M.FRAGMENT_SHADER);if(M.isContextLost())return void(this.failedToCreate=!0);if(M.shaderSource(te,ce),M.compileShader(te),!M.getShaderParameter(te,M.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${M.getShaderInfoLog(te)}`);M.attachShader(this.program,te);const ge=M.createShader(M.VERTEX_SHADER);if(M.isContextLost())return void(this.failedToCreate=!0);if(M.shaderSource(ge,he),M.compileShader(ge),!M.getShaderParameter(ge,M.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${M.getShaderInfoLog(ge)}`);M.attachShader(this.program,ge),this.attributes={};const _e={};this.numAttributes=O.length;for(let we=0;we<this.numAttributes;we++)O[we]&&(M.bindAttribLocation(this.program,we,O[we]),this.attributes[O[we]]=we);if(M.linkProgram(this.program),!M.getProgramParameter(this.program,M.LINK_STATUS))throw new Error(`Program failed to link: ${M.getProgramInfoLog(this.program)}`);M.deleteShader(ge),M.deleteShader(te);for(let we=0;we<ie.length;we++){const Ne=ie[we];if(Ne&&!_e[Ne]){const $e=M.getUniformLocation(this.program,Ne);$e&&(_e[Ne]=$e)}}this.fixedUniforms=g(i,_e),this.terrainUniforms=((we,Ne)=>({u_depth:new c.aH(we,Ne.u_depth),u_terrain:new c.aH(we,Ne.u_terrain),u_terrain_dim:new c.aI(we,Ne.u_terrain_dim),u_terrain_matrix:new c.aJ(we,Ne.u_terrain_matrix),u_terrain_unpack:new c.aK(we,Ne.u_terrain_unpack),u_terrain_exaggeration:new c.aI(we,Ne.u_terrain_exaggeration)}))(i,_e),this.binderUniforms=m?m.getUniforms(i,_e):[]}draw(i,h,m,g,_,A,M,P,V,O,L,G,K,ee,ie,ae,ce,he){const te=i.gl;if(this.failedToCreate)return;if(i.program.set(this.program),i.setDepthMode(m),i.setStencilMode(g),i.setColorMode(_),i.setCullFace(A),P){i.activeTexture.set(te.TEXTURE2),te.bindTexture(te.TEXTURE_2D,P.depthTexture),i.activeTexture.set(te.TEXTURE3),te.bindTexture(te.TEXTURE_2D,P.texture);for(const _e in this.terrainUniforms)this.terrainUniforms[_e].set(P[_e])}for(const _e in this.fixedUniforms)this.fixedUniforms[_e].set(M[_e]);ie&&ie.setUniforms(i,this.binderUniforms,K,{zoom:ee});let ge=0;switch(h){case te.LINES:ge=2;break;case te.TRIANGLES:ge=3;break;case te.LINE_STRIP:ge=1}for(const _e of G.get()){const we=_e.vaos||(_e.vaos={});(we[V]||(we[V]=new Fd)).bind(i,this,O,ie?ie.getPaintVertexBuffers():[],L,_e.vertexOffset,ae,ce,he),te.drawElements(h,_e.primitiveLength*ge,te.UNSIGNED_SHORT,_e.primitiveOffset*ge*2)}}}function ec(x,i,h){const m=1/Zt(h,1,i.transform.tileZoom),g=Math.pow(2,h.tileID.overscaledZ),_=h.tileSize*Math.pow(2,i.transform.tileZoom)/g,A=_*(h.tileID.canonical.x+h.tileID.wrap*g),M=_*h.tileID.canonical.y;return{u_image:0,u_texsize:h.imageAtlasTexture.size,u_scale:[m,x.fromScale,x.toScale],u_fade:x.t,u_pixel_coord_upper:[A>>16,M>>16],u_pixel_coord_lower:[65535&A,65535&M]}}const qa=(x,i,h,m)=>{const g=i.style.light,_=g.properties.get("position"),A=[_.x,_.y,_.z],M=function(){var V=new c.A(9);return c.A!=Float32Array&&(V[1]=0,V[2]=0,V[3]=0,V[5]=0,V[6]=0,V[7]=0),V[0]=1,V[4]=1,V[8]=1,V}();g.properties.get("anchor")==="viewport"&&function(V,O){var L=Math.sin(O),G=Math.cos(O);V[0]=G,V[1]=L,V[2]=0,V[3]=-L,V[4]=G,V[5]=0,V[6]=0,V[7]=0,V[8]=1}(M,-i.transform.angle),function(V,O,L){var G=O[0],K=O[1],ee=O[2];V[0]=G*L[0]+K*L[3]+ee*L[6],V[1]=G*L[1]+K*L[4]+ee*L[7],V[2]=G*L[2]+K*L[5]+ee*L[8]}(A,A,M);const P=g.properties.get("color");return{u_matrix:x,u_lightpos:A,u_lightintensity:g.properties.get("intensity"),u_lightcolor:[P.r,P.g,P.b],u_vertical_gradient:+h,u_opacity:m}},tc=(x,i,h,m,g,_,A)=>c.e(qa(x,i,h,m),ec(_,i,A),{u_height_factor:-Math.pow(2,g.overscaledZ)/A.tileSize/8}),Wo=x=>({u_matrix:x}),Pp=(x,i,h,m)=>c.e(Wo(x),ec(h,i,m)),Oy=(x,i)=>({u_matrix:x,u_world:i}),Rp=(x,i,h,m,g)=>c.e(Pp(x,i,h,m),{u_world:g}),Ly=(x,i,h,m)=>{const g=x.transform;let _,A;if(m.paint.get("circle-pitch-alignment")==="map"){const M=Zt(h,1,g.zoom);_=!0,A=[M,M]}else _=!1,A=g.pixelsToGLUnits;return{u_camera_to_center_distance:g.cameraToCenterDistance,u_scale_with_map:+(m.paint.get("circle-pitch-scale")==="map"),u_matrix:x.translatePosMatrix(i.posMatrix,h,m.paint.get("circle-translate"),m.paint.get("circle-translate-anchor")),u_pitch_with_map:+_,u_device_pixel_ratio:x.pixelRatio,u_extrude_scale:A}},uo=(x,i,h)=>({u_matrix:x,u_inv_matrix:i,u_camera_to_center_distance:h.cameraToCenterDistance,u_viewport_size:[h.width,h.height]}),Ga=(x,i,h=1)=>({u_matrix:x,u_color:i,u_overlay:0,u_overlay_scale:h}),Wr=x=>({u_matrix:x}),qr=(x,i,h,m)=>({u_matrix:x,u_extrude_scale:Zt(i,1,h),u_intensity:m}),nc=(x,i,h,m)=>{const g=c.H();c.aP(g,0,x.width,x.height,0,0,1);const _=x.context.gl;return{u_matrix:g,u_world:[_.drawingBufferWidth,_.drawingBufferHeight],u_image:h,u_color_ramp:m,u_opacity:i.paint.get("heatmap-opacity")}};function rc(x,i){const h=Math.pow(2,i.canonical.z),m=i.canonical.y;return[new c.Z(0,m/h).toLngLat().lat,new c.Z(0,(m+1)/h).toLngLat().lat]}const ic=(x,i,h,m)=>{const g=x.transform;return{u_matrix:Vp(x,i,h,m),u_ratio:1/Zt(i,1,g.zoom),u_device_pixel_ratio:x.pixelRatio,u_units_to_pixels:[1/g.pixelsToGLUnits[0],1/g.pixelsToGLUnits[1]]}},Np=(x,i,h,m,g)=>c.e(ic(x,i,h,g),{u_image:0,u_image_height:m}),qo=(x,i,h,m,g)=>{const _=x.transform,A=Bp(i,_);return{u_matrix:Vp(x,i,h,g),u_texsize:i.imageAtlasTexture.size,u_ratio:1/Zt(i,1,_.zoom),u_device_pixel_ratio:x.pixelRatio,u_image:0,u_scale:[A,m.fromScale,m.toScale],u_fade:m.t,u_units_to_pixels:[1/_.pixelsToGLUnits[0],1/_.pixelsToGLUnits[1]]}},Fy=(x,i,h,m,g,_)=>{const A=x.lineAtlas,M=Bp(i,x.transform),P=h.layout.get("line-cap")==="round",V=A.getDash(m.from,P),O=A.getDash(m.to,P),L=V.width*g.fromScale,G=O.width*g.toScale;return c.e(ic(x,i,h,_),{u_patternscale_a:[M/L,-V.height/2],u_patternscale_b:[M/G,-O.height/2],u_sdfgamma:A.width/(256*Math.min(L,G)*x.pixelRatio)/2,u_image:0,u_tex_y_a:V.y,u_tex_y_b:O.y,u_mix:g.t})};function Bp(x,i){return 1/Zt(x,1,i.tileZoom)}function Vp(x,i,h,m){return x.translatePosMatrix(m?m.posMatrix:i.tileID.posMatrix,i,h.paint.get("line-translate"),h.paint.get("line-translate-anchor"))}const $y=(x,i,h,m,g)=>{return{u_matrix:x,u_tl_parent:i,u_scale_parent:h,u_buffer_scale:1,u_fade_t:m.mix,u_opacity:m.opacity*g.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:g.paint.get("raster-brightness-min"),u_brightness_high:g.paint.get("raster-brightness-max"),u_saturation_factor:(A=g.paint.get("raster-saturation"),A>0?1-1/(1.001-A):-A),u_contrast_factor:(_=g.paint.get("raster-contrast"),_>0?1/(1-_):1+_),u_spin_weights:jy(g.paint.get("raster-hue-rotate"))};var _,A};function jy(x){x*=Math.PI/180;const i=Math.sin(x),h=Math.cos(x);return[(2*h+1)/3,(-Math.sqrt(3)*i-h+1)/3,(Math.sqrt(3)*i-h+1)/3]}const zp=(x,i,h,m,g,_,A,M,P,V,O,L,G,K)=>{const ee=A.transform;return{u_is_size_zoom_constant:+(x==="constant"||x==="source"),u_is_size_feature_constant:+(x==="constant"||x==="camera"),u_size_t:i?i.uSizeT:0,u_size:i?i.uSize:0,u_camera_to_center_distance:ee.cameraToCenterDistance,u_pitch:ee.pitch/360*2*Math.PI,u_rotate_symbol:+h,u_aspect_ratio:ee.width/ee.height,u_fade_change:A.options.fadeDuration?A.symbolFadeChange:1,u_matrix:M,u_label_plane_matrix:P,u_coord_matrix:V,u_is_text:+L,u_pitch_with_map:+m,u_is_along_line:g,u_is_variable_anchor:_,u_texsize:G,u_texture:0,u_translation:O,u_pitched_scale:K}},Za=(x,i,h,m,g,_,A,M,P,V,O,L,G,K,ee)=>{const ie=A.transform;return c.e(zp(x,i,h,m,g,_,A,M,P,V,O,L,G,ee),{u_gamma_scale:m?Math.cos(ie._pitch)*ie.cameraToCenterDistance:1,u_device_pixel_ratio:A.pixelRatio,u_is_halo:1})},Ud=(x,i,h,m,g,_,A,M,P,V,O,L,G,K)=>c.e(Za(x,i,h,m,g,_,A,M,P,V,O,!0,L,!0,K),{u_texsize_icon:G,u_texture_icon:1}),sc=(x,i,h)=>({u_matrix:x,u_opacity:i,u_color:h}),Hd=(x,i,h,m,g,_)=>c.e(function(A,M,P,V){const O=P.imageManager.getPattern(A.from.toString()),L=P.imageManager.getPattern(A.to.toString()),{width:G,height:K}=P.imageManager.getPixelSize(),ee=Math.pow(2,V.tileID.overscaledZ),ie=V.tileSize*Math.pow(2,P.transform.tileZoom)/ee,ae=ie*(V.tileID.canonical.x+V.tileID.wrap*ee),ce=ie*V.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:O.tl,u_pattern_br_a:O.br,u_pattern_tl_b:L.tl,u_pattern_br_b:L.br,u_texsize:[G,K],u_mix:M.t,u_pattern_size_a:O.displaySize,u_pattern_size_b:L.displaySize,u_scale_a:M.fromScale,u_scale_b:M.toScale,u_tile_units_to_pixels:1/Zt(V,1,P.transform.tileZoom),u_pixel_coord_upper:[ae>>16,ce>>16],u_pixel_coord_lower:[65535&ae,65535&ce]}}(m,_,h,g),{u_matrix:x,u_opacity:i}),Wd={fillExtrusion:(x,i)=>({u_matrix:new c.aJ(x,i.u_matrix),u_lightpos:new c.aN(x,i.u_lightpos),u_lightintensity:new c.aI(x,i.u_lightintensity),u_lightcolor:new c.aN(x,i.u_lightcolor),u_vertical_gradient:new c.aI(x,i.u_vertical_gradient),u_opacity:new c.aI(x,i.u_opacity)}),fillExtrusionPattern:(x,i)=>({u_matrix:new c.aJ(x,i.u_matrix),u_lightpos:new c.aN(x,i.u_lightpos),u_lightintensity:new c.aI(x,i.u_lightintensity),u_lightcolor:new c.aN(x,i.u_lightcolor),u_vertical_gradient:new c.aI(x,i.u_vertical_gradient),u_height_factor:new c.aI(x,i.u_height_factor),u_image:new c.aH(x,i.u_image),u_texsize:new c.aO(x,i.u_texsize),u_pixel_coord_upper:new c.aO(x,i.u_pixel_coord_upper),u_pixel_coord_lower:new c.aO(x,i.u_pixel_coord_lower),u_scale:new c.aN(x,i.u_scale),u_fade:new c.aI(x,i.u_fade),u_opacity:new c.aI(x,i.u_opacity)}),fill:(x,i)=>({u_matrix:new c.aJ(x,i.u_matrix)}),fillPattern:(x,i)=>({u_matrix:new c.aJ(x,i.u_matrix),u_image:new c.aH(x,i.u_image),u_texsize:new c.aO(x,i.u_texsize),u_pixel_coord_upper:new c.aO(x,i.u_pixel_coord_upper),u_pixel_coord_lower:new c.aO(x,i.u_pixel_coord_lower),u_scale:new c.aN(x,i.u_scale),u_fade:new c.aI(x,i.u_fade)}),fillOutline:(x,i)=>({u_matrix:new c.aJ(x,i.u_matrix),u_world:new c.aO(x,i.u_world)}),fillOutlinePattern:(x,i)=>({u_matrix:new c.aJ(x,i.u_matrix),u_world:new c.aO(x,i.u_world),u_image:new c.aH(x,i.u_image),u_texsize:new c.aO(x,i.u_texsize),u_pixel_coord_upper:new c.aO(x,i.u_pixel_coord_upper),u_pixel_coord_lower:new c.aO(x,i.u_pixel_coord_lower),u_scale:new c.aN(x,i.u_scale),u_fade:new c.aI(x,i.u_fade)}),circle:(x,i)=>({u_camera_to_center_distance:new c.aI(x,i.u_camera_to_center_distance),u_scale_with_map:new c.aH(x,i.u_scale_with_map),u_pitch_with_map:new c.aH(x,i.u_pitch_with_map),u_extrude_scale:new c.aO(x,i.u_extrude_scale),u_device_pixel_ratio:new c.aI(x,i.u_device_pixel_ratio),u_matrix:new c.aJ(x,i.u_matrix)}),collisionBox:(x,i)=>({u_matrix:new c.aJ(x,i.u_matrix),u_pixel_extrude_scale:new c.aO(x,i.u_pixel_extrude_scale)}),collisionCircle:(x,i)=>({u_matrix:new c.aJ(x,i.u_matrix),u_inv_matrix:new c.aJ(x,i.u_inv_matrix),u_camera_to_center_distance:new c.aI(x,i.u_camera_to_center_distance),u_viewport_size:new c.aO(x,i.u_viewport_size)}),debug:(x,i)=>({u_color:new c.aL(x,i.u_color),u_matrix:new c.aJ(x,i.u_matrix),u_overlay:new c.aH(x,i.u_overlay),u_overlay_scale:new c.aI(x,i.u_overlay_scale)}),clippingMask:(x,i)=>({u_matrix:new c.aJ(x,i.u_matrix)}),heatmap:(x,i)=>({u_extrude_scale:new c.aI(x,i.u_extrude_scale),u_intensity:new c.aI(x,i.u_intensity),u_matrix:new c.aJ(x,i.u_matrix)}),heatmapTexture:(x,i)=>({u_matrix:new c.aJ(x,i.u_matrix),u_world:new c.aO(x,i.u_world),u_image:new c.aH(x,i.u_image),u_color_ramp:new c.aH(x,i.u_color_ramp),u_opacity:new c.aI(x,i.u_opacity)}),hillshade:(x,i)=>({u_matrix:new c.aJ(x,i.u_matrix),u_image:new c.aH(x,i.u_image),u_latrange:new c.aO(x,i.u_latrange),u_light:new c.aO(x,i.u_light),u_shadow:new c.aL(x,i.u_shadow),u_highlight:new c.aL(x,i.u_highlight),u_accent:new c.aL(x,i.u_accent)}),hillshadePrepare:(x,i)=>({u_matrix:new c.aJ(x,i.u_matrix),u_image:new c.aH(x,i.u_image),u_dimension:new c.aO(x,i.u_dimension),u_zoom:new c.aI(x,i.u_zoom),u_unpack:new c.aK(x,i.u_unpack)}),line:(x,i)=>({u_matrix:new c.aJ(x,i.u_matrix),u_ratio:new c.aI(x,i.u_ratio),u_device_pixel_ratio:new c.aI(x,i.u_device_pixel_ratio),u_units_to_pixels:new c.aO(x,i.u_units_to_pixels)}),lineGradient:(x,i)=>({u_matrix:new c.aJ(x,i.u_matrix),u_ratio:new c.aI(x,i.u_ratio),u_device_pixel_ratio:new c.aI(x,i.u_device_pixel_ratio),u_units_to_pixels:new c.aO(x,i.u_units_to_pixels),u_image:new c.aH(x,i.u_image),u_image_height:new c.aI(x,i.u_image_height)}),linePattern:(x,i)=>({u_matrix:new c.aJ(x,i.u_matrix),u_texsize:new c.aO(x,i.u_texsize),u_ratio:new c.aI(x,i.u_ratio),u_device_pixel_ratio:new c.aI(x,i.u_device_pixel_ratio),u_image:new c.aH(x,i.u_image),u_units_to_pixels:new c.aO(x,i.u_units_to_pixels),u_scale:new c.aN(x,i.u_scale),u_fade:new c.aI(x,i.u_fade)}),lineSDF:(x,i)=>({u_matrix:new c.aJ(x,i.u_matrix),u_ratio:new c.aI(x,i.u_ratio),u_device_pixel_ratio:new c.aI(x,i.u_device_pixel_ratio),u_units_to_pixels:new c.aO(x,i.u_units_to_pixels),u_patternscale_a:new c.aO(x,i.u_patternscale_a),u_patternscale_b:new c.aO(x,i.u_patternscale_b),u_sdfgamma:new c.aI(x,i.u_sdfgamma),u_image:new c.aH(x,i.u_image),u_tex_y_a:new c.aI(x,i.u_tex_y_a),u_tex_y_b:new c.aI(x,i.u_tex_y_b),u_mix:new c.aI(x,i.u_mix)}),raster:(x,i)=>({u_matrix:new c.aJ(x,i.u_matrix),u_tl_parent:new c.aO(x,i.u_tl_parent),u_scale_parent:new c.aI(x,i.u_scale_parent),u_buffer_scale:new c.aI(x,i.u_buffer_scale),u_fade_t:new c.aI(x,i.u_fade_t),u_opacity:new c.aI(x,i.u_opacity),u_image0:new c.aH(x,i.u_image0),u_image1:new c.aH(x,i.u_image1),u_brightness_low:new c.aI(x,i.u_brightness_low),u_brightness_high:new c.aI(x,i.u_brightness_high),u_saturation_factor:new c.aI(x,i.u_saturation_factor),u_contrast_factor:new c.aI(x,i.u_contrast_factor),u_spin_weights:new c.aN(x,i.u_spin_weights)}),symbolIcon:(x,i)=>({u_is_size_zoom_constant:new c.aH(x,i.u_is_size_zoom_constant),u_is_size_feature_constant:new c.aH(x,i.u_is_size_feature_constant),u_size_t:new c.aI(x,i.u_size_t),u_size:new c.aI(x,i.u_size),u_camera_to_center_distance:new c.aI(x,i.u_camera_to_center_distance),u_pitch:new c.aI(x,i.u_pitch),u_rotate_symbol:new c.aH(x,i.u_rotate_symbol),u_aspect_ratio:new c.aI(x,i.u_aspect_ratio),u_fade_change:new c.aI(x,i.u_fade_change),u_matrix:new c.aJ(x,i.u_matrix),u_label_plane_matrix:new c.aJ(x,i.u_label_plane_matrix),u_coord_matrix:new c.aJ(x,i.u_coord_matrix),u_is_text:new c.aH(x,i.u_is_text),u_pitch_with_map:new c.aH(x,i.u_pitch_with_map),u_is_along_line:new c.aH(x,i.u_is_along_line),u_is_variable_anchor:new c.aH(x,i.u_is_variable_anchor),u_texsize:new c.aO(x,i.u_texsize),u_texture:new c.aH(x,i.u_texture),u_translation:new c.aO(x,i.u_translation),u_pitched_scale:new c.aI(x,i.u_pitched_scale)}),symbolSDF:(x,i)=>({u_is_size_zoom_constant:new c.aH(x,i.u_is_size_zoom_constant),u_is_size_feature_constant:new c.aH(x,i.u_is_size_feature_constant),u_size_t:new c.aI(x,i.u_size_t),u_size:new c.aI(x,i.u_size),u_camera_to_center_distance:new c.aI(x,i.u_camera_to_center_distance),u_pitch:new c.aI(x,i.u_pitch),u_rotate_symbol:new c.aH(x,i.u_rotate_symbol),u_aspect_ratio:new c.aI(x,i.u_aspect_ratio),u_fade_change:new c.aI(x,i.u_fade_change),u_matrix:new c.aJ(x,i.u_matrix),u_label_plane_matrix:new c.aJ(x,i.u_label_plane_matrix),u_coord_matrix:new c.aJ(x,i.u_coord_matrix),u_is_text:new c.aH(x,i.u_is_text),u_pitch_with_map:new c.aH(x,i.u_pitch_with_map),u_is_along_line:new c.aH(x,i.u_is_along_line),u_is_variable_anchor:new c.aH(x,i.u_is_variable_anchor),u_texsize:new c.aO(x,i.u_texsize),u_texture:new c.aH(x,i.u_texture),u_gamma_scale:new c.aI(x,i.u_gamma_scale),u_device_pixel_ratio:new c.aI(x,i.u_device_pixel_ratio),u_is_halo:new c.aH(x,i.u_is_halo),u_translation:new c.aO(x,i.u_translation),u_pitched_scale:new c.aI(x,i.u_pitched_scale)}),symbolTextAndIcon:(x,i)=>({u_is_size_zoom_constant:new c.aH(x,i.u_is_size_zoom_constant),u_is_size_feature_constant:new c.aH(x,i.u_is_size_feature_constant),u_size_t:new c.aI(x,i.u_size_t),u_size:new c.aI(x,i.u_size),u_camera_to_center_distance:new c.aI(x,i.u_camera_to_center_distance),u_pitch:new c.aI(x,i.u_pitch),u_rotate_symbol:new c.aH(x,i.u_rotate_symbol),u_aspect_ratio:new c.aI(x,i.u_aspect_ratio),u_fade_change:new c.aI(x,i.u_fade_change),u_matrix:new c.aJ(x,i.u_matrix),u_label_plane_matrix:new c.aJ(x,i.u_label_plane_matrix),u_coord_matrix:new c.aJ(x,i.u_coord_matrix),u_is_text:new c.aH(x,i.u_is_text),u_pitch_with_map:new c.aH(x,i.u_pitch_with_map),u_is_along_line:new c.aH(x,i.u_is_along_line),u_is_variable_anchor:new c.aH(x,i.u_is_variable_anchor),u_texsize:new c.aO(x,i.u_texsize),u_texsize_icon:new c.aO(x,i.u_texsize_icon),u_texture:new c.aH(x,i.u_texture),u_texture_icon:new c.aH(x,i.u_texture_icon),u_gamma_scale:new c.aI(x,i.u_gamma_scale),u_device_pixel_ratio:new c.aI(x,i.u_device_pixel_ratio),u_is_halo:new c.aH(x,i.u_is_halo),u_translation:new c.aO(x,i.u_translation),u_pitched_scale:new c.aI(x,i.u_pitched_scale)}),background:(x,i)=>({u_matrix:new c.aJ(x,i.u_matrix),u_opacity:new c.aI(x,i.u_opacity),u_color:new c.aL(x,i.u_color)}),backgroundPattern:(x,i)=>({u_matrix:new c.aJ(x,i.u_matrix),u_opacity:new c.aI(x,i.u_opacity),u_image:new c.aH(x,i.u_image),u_pattern_tl_a:new c.aO(x,i.u_pattern_tl_a),u_pattern_br_a:new c.aO(x,i.u_pattern_br_a),u_pattern_tl_b:new c.aO(x,i.u_pattern_tl_b),u_pattern_br_b:new c.aO(x,i.u_pattern_br_b),u_texsize:new c.aO(x,i.u_texsize),u_mix:new c.aI(x,i.u_mix),u_pattern_size_a:new c.aO(x,i.u_pattern_size_a),u_pattern_size_b:new c.aO(x,i.u_pattern_size_b),u_scale_a:new c.aI(x,i.u_scale_a),u_scale_b:new c.aI(x,i.u_scale_b),u_pixel_coord_upper:new c.aO(x,i.u_pixel_coord_upper),u_pixel_coord_lower:new c.aO(x,i.u_pixel_coord_lower),u_tile_units_to_pixels:new c.aI(x,i.u_tile_units_to_pixels)}),terrain:(x,i)=>({u_matrix:new c.aJ(x,i.u_matrix),u_texture:new c.aH(x,i.u_texture),u_ele_delta:new c.aI(x,i.u_ele_delta),u_fog_matrix:new c.aJ(x,i.u_fog_matrix),u_fog_color:new c.aL(x,i.u_fog_color),u_fog_ground_blend:new c.aI(x,i.u_fog_ground_blend),u_fog_ground_blend_opacity:new c.aI(x,i.u_fog_ground_blend_opacity),u_horizon_color:new c.aL(x,i.u_horizon_color),u_horizon_fog_blend:new c.aI(x,i.u_horizon_fog_blend)}),terrainDepth:(x,i)=>({u_matrix:new c.aJ(x,i.u_matrix),u_ele_delta:new c.aI(x,i.u_ele_delta)}),terrainCoords:(x,i)=>({u_matrix:new c.aJ(x,i.u_matrix),u_texture:new c.aH(x,i.u_texture),u_terrain_coords_id:new c.aI(x,i.u_terrain_coords_id),u_ele_delta:new c.aI(x,i.u_ele_delta)}),sky:(x,i)=>({u_sky_color:new c.aL(x,i.u_sky_color),u_horizon_color:new c.aL(x,i.u_horizon_color),u_horizon:new c.aI(x,i.u_horizon),u_sky_horizon_blend:new c.aI(x,i.u_sky_horizon_blend)})};class es{constructor(i,h,m){this.context=i;const g=i.gl;this.buffer=g.createBuffer(),this.dynamicDraw=!!m,this.context.unbindVAO(),i.bindElementBuffer.set(this.buffer),g.bufferData(g.ELEMENT_ARRAY_BUFFER,h.arrayBuffer,this.dynamicDraw?g.DYNAMIC_DRAW:g.STATIC_DRAW),this.dynamicDraw||delete h.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(i){const h=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),h.bufferSubData(h.ELEMENT_ARRAY_BUFFER,0,i.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Uy={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class qd{constructor(i,h,m,g){this.length=h.length,this.attributes=m,this.itemSize=h.bytesPerElement,this.dynamicDraw=g,this.context=i;const _=i.gl;this.buffer=_.createBuffer(),i.bindVertexBuffer.set(this.buffer),_.bufferData(_.ARRAY_BUFFER,h.arrayBuffer,this.dynamicDraw?_.DYNAMIC_DRAW:_.STATIC_DRAW),this.dynamicDraw||delete h.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(i){if(i.length!==this.length)throw new Error(`Length of new data is ${i.length}, which doesn't match current length of ${this.length}`);const h=this.context.gl;this.bind(),h.bufferSubData(h.ARRAY_BUFFER,0,i.arrayBuffer)}enableAttributes(i,h){for(let m=0;m<this.attributes.length;m++){const g=h.attributes[this.attributes[m].name];g!==void 0&&i.enableVertexAttribArray(g)}}setVertexAttribPointers(i,h,m){for(let g=0;g<this.attributes.length;g++){const _=this.attributes[g],A=h.attributes[_.name];A!==void 0&&i.vertexAttribPointer(A,_.components,i[Uy[_.type]],!1,this.itemSize,_.offset+this.itemSize*(m||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const ho=new WeakMap;function Vs(x){var i;if(ho.has(x))return ho.get(x);{const h=(i=x.getParameter(x.VERSION))===null||i===void 0?void 0:i.startsWith("WebGL 2.0");return ho.set(x,h),h}}class fn{constructor(i){this.gl=i.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(i){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class oc extends fn{getDefault(){return c.aM.transparent}set(i){const h=this.current;(i.r!==h.r||i.g!==h.g||i.b!==h.b||i.a!==h.a||this.dirty)&&(this.gl.clearColor(i.r,i.g,i.b,i.a),this.current=i,this.dirty=!1)}}class Hy extends fn{getDefault(){return 1}set(i){(i!==this.current||this.dirty)&&(this.gl.clearDepth(i),this.current=i,this.dirty=!1)}}class Go extends fn{getDefault(){return 0}set(i){(i!==this.current||this.dirty)&&(this.gl.clearStencil(i),this.current=i,this.dirty=!1)}}class Wy extends fn{getDefault(){return[!0,!0,!0,!0]}set(i){const h=this.current;(i[0]!==h[0]||i[1]!==h[1]||i[2]!==h[2]||i[3]!==h[3]||this.dirty)&&(this.gl.colorMask(i[0],i[1],i[2],i[3]),this.current=i,this.dirty=!1)}}class Op extends fn{getDefault(){return!0}set(i){(i!==this.current||this.dirty)&&(this.gl.depthMask(i),this.current=i,this.dirty=!1)}}class qy extends fn{getDefault(){return 255}set(i){(i!==this.current||this.dirty)&&(this.gl.stencilMask(i),this.current=i,this.dirty=!1)}}class Lp extends fn{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(i){const h=this.current;(i.func!==h.func||i.ref!==h.ref||i.mask!==h.mask||this.dirty)&&(this.gl.stencilFunc(i.func,i.ref,i.mask),this.current=i,this.dirty=!1)}}class Gd extends fn{getDefault(){const i=this.gl;return[i.KEEP,i.KEEP,i.KEEP]}set(i){const h=this.current;(i[0]!==h[0]||i[1]!==h[1]||i[2]!==h[2]||this.dirty)&&(this.gl.stencilOp(i[0],i[1],i[2]),this.current=i,this.dirty=!1)}}class Fp extends fn{getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;const h=this.gl;i?h.enable(h.STENCIL_TEST):h.disable(h.STENCIL_TEST),this.current=i,this.dirty=!1}}class $p extends fn{getDefault(){return[0,1]}set(i){const h=this.current;(i[0]!==h[0]||i[1]!==h[1]||this.dirty)&&(this.gl.depthRange(i[0],i[1]),this.current=i,this.dirty=!1)}}class jp extends fn{getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;const h=this.gl;i?h.enable(h.DEPTH_TEST):h.disable(h.DEPTH_TEST),this.current=i,this.dirty=!1}}class Up extends fn{getDefault(){return this.gl.LESS}set(i){(i!==this.current||this.dirty)&&(this.gl.depthFunc(i),this.current=i,this.dirty=!1)}}class po extends fn{getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;const h=this.gl;i?h.enable(h.BLEND):h.disable(h.BLEND),this.current=i,this.dirty=!1}}class Hp extends fn{getDefault(){const i=this.gl;return[i.ONE,i.ZERO]}set(i){const h=this.current;(i[0]!==h[0]||i[1]!==h[1]||this.dirty)&&(this.gl.blendFunc(i[0],i[1]),this.current=i,this.dirty=!1)}}class Gy extends fn{getDefault(){return c.aM.transparent}set(i){const h=this.current;(i.r!==h.r||i.g!==h.g||i.b!==h.b||i.a!==h.a||this.dirty)&&(this.gl.blendColor(i.r,i.g,i.b,i.a),this.current=i,this.dirty=!1)}}class Wp extends fn{getDefault(){return this.gl.FUNC_ADD}set(i){(i!==this.current||this.dirty)&&(this.gl.blendEquation(i),this.current=i,this.dirty=!1)}}class Ya extends fn{getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;const h=this.gl;i?h.enable(h.CULL_FACE):h.disable(h.CULL_FACE),this.current=i,this.dirty=!1}}class Zy extends fn{getDefault(){return this.gl.BACK}set(i){(i!==this.current||this.dirty)&&(this.gl.cullFace(i),this.current=i,this.dirty=!1)}}class ac extends fn{getDefault(){return this.gl.CCW}set(i){(i!==this.current||this.dirty)&&(this.gl.frontFace(i),this.current=i,this.dirty=!1)}}class Yy extends fn{getDefault(){return null}set(i){(i!==this.current||this.dirty)&&(this.gl.useProgram(i),this.current=i,this.dirty=!1)}}class Xy extends fn{getDefault(){return this.gl.TEXTURE0}set(i){(i!==this.current||this.dirty)&&(this.gl.activeTexture(i),this.current=i,this.dirty=!1)}}class qp extends fn{getDefault(){const i=this.gl;return[0,0,i.drawingBufferWidth,i.drawingBufferHeight]}set(i){const h=this.current;(i[0]!==h[0]||i[1]!==h[1]||i[2]!==h[2]||i[3]!==h[3]||this.dirty)&&(this.gl.viewport(i[0],i[1],i[2],i[3]),this.current=i,this.dirty=!1)}}class Gp extends fn{getDefault(){return null}set(i){if(i===this.current&&!this.dirty)return;const h=this.gl;h.bindFramebuffer(h.FRAMEBUFFER,i),this.current=i,this.dirty=!1}}class Zp extends fn{getDefault(){return null}set(i){if(i===this.current&&!this.dirty)return;const h=this.gl;h.bindRenderbuffer(h.RENDERBUFFER,i),this.current=i,this.dirty=!1}}class Zd extends fn{getDefault(){return null}set(i){if(i===this.current&&!this.dirty)return;const h=this.gl;h.bindTexture(h.TEXTURE_2D,i),this.current=i,this.dirty=!1}}class Yp extends fn{getDefault(){return null}set(i){if(i===this.current&&!this.dirty)return;const h=this.gl;h.bindBuffer(h.ARRAY_BUFFER,i),this.current=i,this.dirty=!1}}class lc extends fn{getDefault(){return null}set(i){const h=this.gl;h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,i),this.current=i,this.dirty=!1}}class gs extends fn{getDefault(){return null}set(i){var h;if(i===this.current&&!this.dirty)return;const m=this.gl;Vs(m)?m.bindVertexArray(i):(h=m.getExtension("OES_vertex_array_object"))===null||h===void 0||h.bindVertexArrayOES(i),this.current=i,this.dirty=!1}}class Yd extends fn{getDefault(){return 4}set(i){if(i===this.current&&!this.dirty)return;const h=this.gl;h.pixelStorei(h.UNPACK_ALIGNMENT,i),this.current=i,this.dirty=!1}}class Xd extends fn{getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;const h=this.gl;h.pixelStorei(h.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i),this.current=i,this.dirty=!1}}class Kd extends fn{getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;const h=this.gl;h.pixelStorei(h.UNPACK_FLIP_Y_WEBGL,i),this.current=i,this.dirty=!1}}class cc extends fn{constructor(i,h){super(i),this.context=i,this.parent=h}getDefault(){return null}}class Jd extends cc{setDirty(){this.dirty=!0}set(i){if(i===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const h=this.gl;h.framebufferTexture2D(h.FRAMEBUFFER,h.COLOR_ATTACHMENT0,h.TEXTURE_2D,i,0),this.current=i,this.dirty=!1}}class fo extends cc{set(i){if(i===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const h=this.gl;h.framebufferRenderbuffer(h.FRAMEBUFFER,h.DEPTH_ATTACHMENT,h.RENDERBUFFER,i),this.current=i,this.dirty=!1}}class Qd extends cc{set(i){if(i===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const h=this.gl;h.framebufferRenderbuffer(h.FRAMEBUFFER,h.DEPTH_STENCIL_ATTACHMENT,h.RENDERBUFFER,i),this.current=i,this.dirty=!1}}class Ky{constructor(i,h,m,g,_){this.context=i,this.width=h,this.height=m;const A=i.gl,M=this.framebuffer=A.createFramebuffer();if(this.colorAttachment=new Jd(i,M),g)this.depthAttachment=_?new Qd(i,M):new fo(i,M);else if(_)throw new Error("Stencil cannot be set without depth");if(A.checkFramebufferStatus(A.FRAMEBUFFER)!==A.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer is not complete")}destroy(){const i=this.context.gl,h=this.colorAttachment.get();if(h&&i.deleteTexture(h),this.depthAttachment){const m=this.depthAttachment.get();m&&i.deleteRenderbuffer(m)}i.deleteFramebuffer(this.framebuffer)}}class er{constructor(i,h,m){this.blendFunction=i,this.blendColor=h,this.mask=m}}er.Replace=[1,0],er.disabled=new er(er.Replace,c.aM.transparent,[!1,!1,!1,!1]),er.unblended=new er(er.Replace,c.aM.transparent,[!0,!0,!0,!0]),er.alphaBlended=new er([1,771],c.aM.transparent,[!0,!0,!0,!0]);class Jy{constructor(i){var h,m;if(this.gl=i,this.clearColor=new oc(this),this.clearDepth=new Hy(this),this.clearStencil=new Go(this),this.colorMask=new Wy(this),this.depthMask=new Op(this),this.stencilMask=new qy(this),this.stencilFunc=new Lp(this),this.stencilOp=new Gd(this),this.stencilTest=new Fp(this),this.depthRange=new $p(this),this.depthTest=new jp(this),this.depthFunc=new Up(this),this.blend=new po(this),this.blendFunc=new Hp(this),this.blendColor=new Gy(this),this.blendEquation=new Wp(this),this.cullFace=new Ya(this),this.cullFaceSide=new Zy(this),this.frontFace=new ac(this),this.program=new Yy(this),this.activeTexture=new Xy(this),this.viewport=new qp(this),this.bindFramebuffer=new Gp(this),this.bindRenderbuffer=new Zp(this),this.bindTexture=new Zd(this),this.bindVertexBuffer=new Yp(this),this.bindElementBuffer=new lc(this),this.bindVertexArray=new gs(this),this.pixelStoreUnpack=new Yd(this),this.pixelStoreUnpackPremultiplyAlpha=new Xd(this),this.pixelStoreUnpackFlipY=new Kd(this),this.extTextureFilterAnisotropic=i.getExtension("EXT_texture_filter_anisotropic")||i.getExtension("MOZ_EXT_texture_filter_anisotropic")||i.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=i.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=i.getParameter(i.MAX_TEXTURE_SIZE),Vs(i)){this.HALF_FLOAT=i.HALF_FLOAT;const g=i.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(h=i.RGBA16F)!==null&&h!==void 0?h:g==null?void 0:g.RGBA16F_EXT,this.RGB16F=(m=i.RGB16F)!==null&&m!==void 0?m:g==null?void 0:g.RGB16F_EXT,i.getExtension("EXT_color_buffer_float")}else{i.getExtension("EXT_color_buffer_half_float"),i.getExtension("OES_texture_half_float_linear");const g=i.getExtension("OES_texture_half_float");this.HALF_FLOAT=g==null?void 0:g.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(i,h){return new es(this,i,h)}createVertexBuffer(i,h,m){return new qd(this,i,h,m)}createRenderbuffer(i,h,m){const g=this.gl,_=g.createRenderbuffer();return this.bindRenderbuffer.set(_),g.renderbufferStorage(g.RENDERBUFFER,i,h,m),this.bindRenderbuffer.set(null),_}createFramebuffer(i,h,m,g){return new Ky(this,i,h,m,g)}clear({color:i,depth:h,stencil:m}){const g=this.gl;let _=0;i&&(_|=g.COLOR_BUFFER_BIT,this.clearColor.set(i),this.colorMask.set([!0,!0,!0,!0])),h!==void 0&&(_|=g.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(h),this.depthMask.set(!0)),m!==void 0&&(_|=g.STENCIL_BUFFER_BIT,this.clearStencil.set(m),this.stencilMask.set(255)),g.clear(_)}setCullFace(i){i.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(i.mode),this.frontFace.set(i.frontFace))}setDepthMode(i){i.func!==this.gl.ALWAYS||i.mask?(this.depthTest.set(!0),this.depthFunc.set(i.func),this.depthMask.set(i.mask),this.depthRange.set(i.range)):this.depthTest.set(!1)}setStencilMode(i){i.test.func!==this.gl.ALWAYS||i.mask?(this.stencilTest.set(!0),this.stencilMask.set(i.mask),this.stencilOp.set([i.fail,i.depthFail,i.pass]),this.stencilFunc.set({func:i.test.func,ref:i.ref,mask:i.test.mask})):this.stencilTest.set(!1)}setColorMode(i){c.aE(i.blendFunction,er.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(i.blendFunction),this.blendColor.set(i.blendColor)),this.colorMask.set(i.mask)}createVertexArray(){var i;return Vs(this.gl)?this.gl.createVertexArray():(i=this.gl.getExtension("OES_vertex_array_object"))===null||i===void 0?void 0:i.createVertexArrayOES()}deleteVertexArray(i){var h;return Vs(this.gl)?this.gl.deleteVertexArray(i):(h=this.gl.getExtension("OES_vertex_array_object"))===null||h===void 0?void 0:h.deleteVertexArrayOES(i)}unbindVAO(){this.bindVertexArray.set(null)}}class Ht{constructor(i,h,m){this.func=i,this.mask=h,this.range=m}}Ht.ReadOnly=!1,Ht.ReadWrite=!0,Ht.disabled=new Ht(519,Ht.ReadOnly,[0,1]);const dc=7680;class Pn{constructor(i,h,m,g,_,A){this.test=i,this.ref=h,this.mask=m,this.fail=g,this.depthFail=_,this.pass=A}}Pn.disabled=new Pn({func:519,mask:0},0,0,dc,dc,dc);class Cn{constructor(i,h,m){this.enable=i,this.mode=h,this.frontFace=m}}let mo;function Xa(x,i,h,m,g){const _=x.context,A=_.gl,M=x.useProgram("collisionBox"),P=[];let V=0,O=0;for(let ce=0;ce<m.length;ce++){const he=m[ce],te=i.getTile(he).getBucket(h);if(!te)continue;const ge=g?te.textCollisionBox:te.iconCollisionBox,_e=te.collisionCircleArray;if(_e.length>0){const we=c.H();c.aQ(we,te.placementInvProjMatrix,x.transform.glCoordMatrix),c.aQ(we,we,te.placementViewportMatrix),P.push({circleArray:_e,circleOffset:O,transform:he.posMatrix,invTransform:we,coord:he}),V+=_e.length/4,O=V}ge&&M.draw(_,A.LINES,Ht.disabled,Pn.disabled,x.colorModeForRenderPass(),Cn.disabled,{u_matrix:he.posMatrix,u_pixel_extrude_scale:[1/(L=x.transform).width,1/L.height]},x.style.map.terrain&&x.style.map.terrain.getTerrainData(he),h.id,ge.layoutVertexBuffer,ge.indexBuffer,ge.segments,null,x.transform.zoom,null,null,ge.collisionVertexBuffer)}var L;if(!g||!P.length)return;const G=x.useProgram("collisionCircle"),K=new c.aR;K.resize(4*V),K._trim();let ee=0;for(const ce of P)for(let he=0;he<ce.circleArray.length/4;he++){const te=4*he,ge=ce.circleArray[te+0],_e=ce.circleArray[te+1],we=ce.circleArray[te+2],Ne=ce.circleArray[te+3];K.emplace(ee++,ge,_e,we,Ne,0),K.emplace(ee++,ge,_e,we,Ne,1),K.emplace(ee++,ge,_e,we,Ne,2),K.emplace(ee++,ge,_e,we,Ne,3)}(!mo||mo.length<2*V)&&(mo=function(ce){const he=2*ce,te=new c.aT;te.resize(he),te._trim();for(let ge=0;ge<he;ge++){const _e=6*ge;te.uint16[_e+0]=4*ge+0,te.uint16[_e+1]=4*ge+1,te.uint16[_e+2]=4*ge+2,te.uint16[_e+3]=4*ge+2,te.uint16[_e+4]=4*ge+3,te.uint16[_e+5]=4*ge+0}return te}(V));const ie=_.createIndexBuffer(mo,!0),ae=_.createVertexBuffer(K,c.aS.members,!0);for(const ce of P){const he=uo(ce.transform,ce.invTransform,x.transform);G.draw(_,A.TRIANGLES,Ht.disabled,Pn.disabled,x.colorModeForRenderPass(),Cn.disabled,he,x.style.map.terrain&&x.style.map.terrain.getTerrainData(ce.coord),h.id,ae,ie,c.a0.simpleSegment(0,2*ce.circleOffset,ce.circleArray.length,ce.circleArray.length/2),null,x.transform.zoom,null,null,null)}ae.destroy(),ie.destroy()}Cn.disabled=new Cn(!1,1029,2305),Cn.backCCW=new Cn(!0,1029,2305);const Ka=c.an(new Float32Array(16));function eu(x,i,h,m,g,_){const{horizontalAlign:A,verticalAlign:M}=c.au(x);return new c.P((-(A-.5)*i/g+m[0])*_,(-(M-.5)*h/g+m[1])*_)}function go(x,i,h,m,g,_){const A=i.tileAnchorPoint.add(new c.P(i.translation[0],i.translation[1]));if(i.pitchWithMap){let M=m.mult(_);h||(M=M.rotate(-g));const P=A.add(M);return se(P.x,P.y,i.labelPlaneMatrix,i.getElevation).point}if(h){const M=Me(i.tileAnchorPoint.x+1,i.tileAnchorPoint.y,i).point.sub(x),P=Math.atan(M.y/M.x)+(M.x<0?Math.PI:0);return x.add(m.rotate(P))}return x.add(m)}function Zo(x,i,h,m,g,_,A,M,P,V,O,L,G,K){const ee=x.text.placedSymbolArray,ie=x.text.dynamicLayoutVertexArray,ae=x.icon.dynamicLayoutVertexArray,ce={};ie.clear();for(let he=0;he<ee.length;he++){const te=ee.get(he),ge=te.hidden||!te.crossTileID||x.allowVerticalPlacement&&!te.placedOrientation?null:m[te.crossTileID];if(ge){const _e=new c.P(te.anchorX,te.anchorY),we={getElevation:K,width:g.width,height:g.height,labelPlaneMatrix:_,pitchWithMap:h,projection:O,tileAnchorPoint:_e,translation:L,unwrappedTileID:G},Ne=h?se(_e.x,_e.y,A,K):Me(_e.x,_e.y,we),$e=H(g.cameraToCenterDistance,Ne.signedDistanceFromCamera);let Qe=c.ai(x.textSizeData,P,te)*$e/c.ap;h&&(Qe*=x.tilePixelRatio/M);const{width:at,height:Ge,anchor:qe,textOffset:mt,textBoxScale:Rt}=ge,Ye=eu(qe,at,Ge,mt,Rt,Qe),it=O.getPitchedTextCorrection(g,_e.add(new c.P(L[0],L[1])),G),Mt=go(Ne.point,we,i,Ye,g.angle,it),Ln=x.allowVerticalPlacement&&te.placedOrientation===c.ah.vertical?Math.PI/2:0;for(let Lt=0;Lt<te.numGlyphs;Lt++)c.aj(ie,Mt,Ln);V&&te.associatedIconIndex>=0&&(ce[te.associatedIconIndex]={shiftedAnchor:Mt,angle:Ln})}else kt(te.numGlyphs,ie)}if(V){ae.clear();const he=x.icon.placedSymbolArray;for(let te=0;te<he.length;te++){const ge=he.get(te);if(ge.hidden)kt(ge.numGlyphs,ae);else{const _e=ce[te];if(_e)for(let we=0;we<ge.numGlyphs;we++)c.aj(ae,_e.shiftedAnchor,_e.angle);else kt(ge.numGlyphs,ae)}}x.icon.dynamicLayoutVertexBuffer.updateData(ae)}x.text.dynamicLayoutVertexBuffer.updateData(ie)}function bi(x,i,h){return h.iconsInText&&i?"symbolTextAndIcon":x?"symbolSDF":"symbolIcon"}function tu(x,i,h,m,g,_,A,M,P,V,O,L){const G=x.context,K=G.gl,ee=x.transform,ie=lo(),ae=M==="map",ce=P==="map",he=M!=="viewport"&&h.layout.get("symbol-placement")!=="point",te=ae&&!ce&&!he,ge=!ce&&he,_e=!h.layout.get("symbol-sort-key").isConstant();let we=!1;const Ne=x.depthModeForSublayer(0,Ht.ReadOnly),$e=h._unevaluatedLayout.hasValue("text-variable-anchor")||h._unevaluatedLayout.hasValue("text-variable-anchor-offset"),Qe=[],at=ie.getCircleRadiusCorrection(ee);for(const Ge of m){const qe=i.getTile(Ge),mt=qe.getBucket(h);if(!mt)continue;const Rt=g?mt.text:mt.icon;if(!Rt||!Rt.segments.get().length||!Rt.hasVisibleVertices)continue;const Ye=Rt.programConfigurations.get(h.id),it=g||mt.sdfIcons,Mt=g?mt.textSizeData:mt.iconSizeData,Ln=ce||ee.pitch!==0,Lt=x.useProgram(bi(it,g,mt),Ye),Yt=c.ag(Mt,ee.zoom),Fn=x.style.map.terrain&&x.style.map.terrain.getTerrainData(Ge);let Tr,Li,$n,Gr,Br=[0,0],Ar=null;if(g)Li=qe.glyphAtlasTexture,$n=K.LINEAR,Tr=qe.glyphAtlasTexture.size,mt.iconsInText&&(Br=qe.imageAtlasTexture.size,Ar=qe.imageAtlasTexture,Gr=Ln||x.options.rotating||x.options.zooming||Mt.kind==="composite"||Mt.kind==="camera"?K.LINEAR:K.NEAREST);else{const Kt=h.layout.get("icon-size").constantOr(0)!==1||mt.iconsNeedLinear;Li=qe.imageAtlasTexture,$n=it||x.options.rotating||x.options.zooming||Kt||Ln?K.LINEAR:K.NEAREST,Tr=qe.imageAtlasTexture.size}const Vr=Zt(qe,1,x.transform.zoom),rs=ge?Ge.posMatrix:Ka,ca=Ns(rs,ce,ae,x.transform,Vr),Dc=Qi(rs,ce,ae,x.transform,Vr),da=Qi(Ge.posMatrix,ce,ae,x.transform,Vr),wi=ie.translatePosition(x.transform,qe,_,A),Mc=$e&&mt.hasTextData(),Su=h.layout.get("icon-text-fit")!=="none"&&Mc&&mt.hasIconData();if(he){const Kt=x.style.map.terrain?(ua,ha)=>x.style.map.terrain.getElevation(Ge,ua,ha):null,vo=h.layout.get("text-rotation-alignment")==="map";X(mt,Ge.posMatrix,x,g,ca,da,ce,V,vo,ie,Ge.toUnwrapped(),ee.width,ee.height,wi,Kt)}const ki=Ge.posMatrix,Ei=g&&$e||Su,zs=he||Ei?Ka:ca,Fi=Dc,wr=it&&h.paint.get(g?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let Dr;Dr=it?mt.iconsInText?Ud(Mt.kind,Yt,te,ce,he,Ei,x,ki,zs,Fi,wi,Tr,Br,at):Za(Mt.kind,Yt,te,ce,he,Ei,x,ki,zs,Fi,wi,g,Tr,!0,at):zp(Mt.kind,Yt,te,ce,he,Ei,x,ki,zs,Fi,wi,g,Tr,at);const li={program:Lt,buffers:Rt,uniformValues:Dr,atlasTexture:Li,atlasTextureIcon:Ar,atlasInterpolation:$n,atlasInterpolationIcon:Gr,isSDF:it,hasHalo:wr};if(_e&&mt.canOverlap){we=!0;const Kt=Rt.segments.get();for(const vo of Kt)Qe.push({segments:new c.a0([vo]),sortKey:vo.sortKey,state:li,terrainData:Fn})}else Qe.push({segments:Rt.segments,sortKey:0,state:li,terrainData:Fn})}we&&Qe.sort((Ge,qe)=>Ge.sortKey-qe.sortKey);for(const Ge of Qe){const qe=Ge.state;if(G.activeTexture.set(K.TEXTURE0),qe.atlasTexture.bind(qe.atlasInterpolation,K.CLAMP_TO_EDGE),qe.atlasTextureIcon&&(G.activeTexture.set(K.TEXTURE1),qe.atlasTextureIcon&&qe.atlasTextureIcon.bind(qe.atlasInterpolationIcon,K.CLAMP_TO_EDGE)),qe.isSDF){const mt=qe.uniformValues;qe.hasHalo&&(mt.u_is_halo=1,nu(qe.buffers,Ge.segments,h,x,qe.program,Ne,O,L,mt,Ge.terrainData)),mt.u_is_halo=0}nu(qe.buffers,Ge.segments,h,x,qe.program,Ne,O,L,qe.uniformValues,Ge.terrainData)}}function nu(x,i,h,m,g,_,A,M,P,V){const O=m.context;g.draw(O,O.gl.TRIANGLES,_,A,M,Cn.disabled,P,V,h.id,x.layoutVertexBuffer,x.indexBuffer,i,h.paint,m.transform.zoom,x.programConfigurations.get(h.id),x.dynamicLayoutVertexBuffer,x.opacityVertexBuffer)}function ru(x,i,h,m){const g=x.context,_=g.gl,A=Pn.disabled,M=new er([_.ONE,_.ONE],c.aM.transparent,[!0,!0,!0,!0]),P=i.getBucket(h);if(!P)return;const V=m.key;let O=h.heatmapFbos.get(V);O||(O=Ja(g,i.tileSize,i.tileSize),h.heatmapFbos.set(V,O)),g.bindFramebuffer.set(O.framebuffer),g.viewport.set([0,0,i.tileSize,i.tileSize]),g.clear({color:c.aM.transparent});const L=P.programConfigurations.get(h.id),G=x.useProgram("heatmap",L),K=x.style.map.terrain.getTerrainData(m);G.draw(g,_.TRIANGLES,Ht.disabled,A,M,Cn.disabled,qr(m.posMatrix,i,x.transform.zoom,h.paint.get("heatmap-intensity")),K,h.id,P.layoutVertexBuffer,P.indexBuffer,P.segments,h.paint,x.transform.zoom,L)}function yo(x,i,h){const m=x.context,g=m.gl;m.setColorMode(x.colorModeForRenderPass());const _=Qa(m,i),A=h.key,M=i.heatmapFbos.get(A);M&&(m.activeTexture.set(g.TEXTURE0),g.bindTexture(g.TEXTURE_2D,M.colorAttachment.get()),m.activeTexture.set(g.TEXTURE1),_.bind(g.LINEAR,g.CLAMP_TO_EDGE),x.useProgram("heatmapTexture").draw(m,g.TRIANGLES,Ht.disabled,Pn.disabled,x.colorModeForRenderPass(),Cn.disabled,nc(x,i,0,1),null,i.id,x.rasterBoundsBuffer,x.quadTriangleIndexBuffer,x.rasterBoundsSegments,i.paint,x.transform.zoom),M.destroy(),i.heatmapFbos.delete(A))}function Ja(x,i,h){var m,g;const _=x.gl,A=_.createTexture();_.bindTexture(_.TEXTURE_2D,A),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_WRAP_S,_.CLAMP_TO_EDGE),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_WRAP_T,_.CLAMP_TO_EDGE),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_MIN_FILTER,_.LINEAR),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_MAG_FILTER,_.LINEAR);const M=(m=x.HALF_FLOAT)!==null&&m!==void 0?m:_.UNSIGNED_BYTE,P=(g=x.RGBA16F)!==null&&g!==void 0?g:_.RGBA;_.texImage2D(_.TEXTURE_2D,0,P,i,h,0,_.RGBA,M,null);const V=x.createFramebuffer(i,h,!1,!1);return V.colorAttachment.set(A),V}function Qa(x,i){return i.colorRampTexture||(i.colorRampTexture=new tt(x,i.colorRamp,x.gl.RGBA)),i.colorRampTexture}function Yo(x,i,h,m,g){if(!h||!m||!m.imageAtlas)return;const _=m.imageAtlas.patternPositions;let A=_[h.to.toString()],M=_[h.from.toString()];if(!A&&M&&(A=M),!M&&A&&(M=A),!A||!M){const P=g.getPaintProperty(i);A=_[P],M=_[P]}A&&M&&x.setConstantPatternPositions(A,M)}function el(x,i,h,m,g,_,A){const M=x.context.gl,P="fill-pattern",V=h.paint.get(P),O=V&&V.constantOr(1),L=h.getCrossfadeParameters();let G,K,ee,ie,ae;A?(K=O&&!h.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",G=M.LINES):(K=O?"fillPattern":"fill",G=M.TRIANGLES);const ce=V.constantOr(null);for(const he of m){const te=i.getTile(he);if(O&&!te.patternsLoaded())continue;const ge=te.getBucket(h);if(!ge)continue;const _e=ge.programConfigurations.get(h.id),we=x.useProgram(K,_e),Ne=x.style.map.terrain&&x.style.map.terrain.getTerrainData(he);O&&(x.context.activeTexture.set(M.TEXTURE0),te.imageAtlasTexture.bind(M.LINEAR,M.CLAMP_TO_EDGE),_e.updatePaintBuffers(L)),Yo(_e,P,ce,te,h);const $e=Ne?he:null,Qe=x.translatePosMatrix($e?$e.posMatrix:he.posMatrix,te,h.paint.get("fill-translate"),h.paint.get("fill-translate-anchor"));if(A){ie=ge.indexBuffer2,ae=ge.segments2;const at=[M.drawingBufferWidth,M.drawingBufferHeight];ee=K==="fillOutlinePattern"&&O?Rp(Qe,x,L,te,at):Oy(Qe,at)}else ie=ge.indexBuffer,ae=ge.segments,ee=O?Pp(Qe,x,L,te):Wo(Qe);we.draw(x.context,G,g,x.stencilModeForClipping(he),_,Cn.disabled,ee,Ne,h.id,ge.layoutVertexBuffer,ie,ae,h.paint,x.transform.zoom,_e)}}function uc(x,i,h,m,g,_,A){const M=x.context,P=M.gl,V="fill-extrusion-pattern",O=h.paint.get(V),L=O.constantOr(1),G=h.getCrossfadeParameters(),K=h.paint.get("fill-extrusion-opacity"),ee=O.constantOr(null);for(const ie of m){const ae=i.getTile(ie),ce=ae.getBucket(h);if(!ce)continue;const he=x.style.map.terrain&&x.style.map.terrain.getTerrainData(ie),te=ce.programConfigurations.get(h.id),ge=x.useProgram(L?"fillExtrusionPattern":"fillExtrusion",te);L&&(x.context.activeTexture.set(P.TEXTURE0),ae.imageAtlasTexture.bind(P.LINEAR,P.CLAMP_TO_EDGE),te.updatePaintBuffers(G)),Yo(te,V,ee,ae,h);const _e=x.translatePosMatrix(ie.posMatrix,ae,h.paint.get("fill-extrusion-translate"),h.paint.get("fill-extrusion-translate-anchor")),we=h.paint.get("fill-extrusion-vertical-gradient"),Ne=L?tc(_e,x,we,K,ie,G,ae):qa(_e,x,we,K);ge.draw(M,M.gl.TRIANGLES,g,_,A,Cn.backCCW,Ne,he,h.id,ce.layoutVertexBuffer,ce.indexBuffer,ce.segments,h.paint,x.transform.zoom,te,x.style.map.terrain&&ce.centroidVertexBuffer)}}function Xo(x,i,h,m,g,_,A){const M=x.context,P=M.gl,V=h.fbo;if(!V)return;const O=x.useProgram("hillshade"),L=x.style.map.terrain&&x.style.map.terrain.getTerrainData(i);M.activeTexture.set(P.TEXTURE0),P.bindTexture(P.TEXTURE_2D,V.colorAttachment.get()),O.draw(M,P.TRIANGLES,g,_,A,Cn.disabled,((G,K,ee,ie)=>{const ae=ee.paint.get("hillshade-shadow-color"),ce=ee.paint.get("hillshade-highlight-color"),he=ee.paint.get("hillshade-accent-color");let te=ee.paint.get("hillshade-illumination-direction")*(Math.PI/180);ee.paint.get("hillshade-illumination-anchor")==="viewport"&&(te-=G.transform.angle);const ge=!G.options.moving;return{u_matrix:ie?ie.posMatrix:G.transform.calculatePosMatrix(K.tileID.toUnwrapped(),ge),u_image:0,u_latrange:rc(0,K.tileID),u_light:[ee.paint.get("hillshade-exaggeration"),te],u_shadow:ae,u_highlight:ce,u_accent:he}})(x,h,m,L?i:null),L,m.id,x.rasterBoundsBuffer,x.quadTriangleIndexBuffer,x.rasterBoundsSegments)}function Ko(x,i,h,m,g,_){const A=x.context,M=A.gl,P=i.dem;if(P&&P.data){const V=P.dim,O=P.stride,L=P.getPixels();if(A.activeTexture.set(M.TEXTURE1),A.pixelStoreUnpackPremultiplyAlpha.set(!1),i.demTexture=i.demTexture||x.getTileTexture(O),i.demTexture){const K=i.demTexture;K.update(L,{premultiply:!1}),K.bind(M.NEAREST,M.CLAMP_TO_EDGE)}else i.demTexture=new tt(A,L,M.RGBA,{premultiply:!1}),i.demTexture.bind(M.NEAREST,M.CLAMP_TO_EDGE);A.activeTexture.set(M.TEXTURE0);let G=i.fbo;if(!G){const K=new tt(A,{width:V,height:V,data:null},M.RGBA);K.bind(M.LINEAR,M.CLAMP_TO_EDGE),G=i.fbo=A.createFramebuffer(V,V,!0,!1),G.colorAttachment.set(K.texture)}A.bindFramebuffer.set(G.framebuffer),A.viewport.set([0,0,V,V]),x.useProgram("hillshadePrepare").draw(A,M.TRIANGLES,m,g,_,Cn.disabled,((K,ee)=>{const ie=ee.stride,ae=c.H();return c.aP(ae,0,c.X,-c.X,0,0,1),c.J(ae,ae,[0,-c.X,0]),{u_matrix:ae,u_image:1,u_dimension:[ie,ie],u_zoom:K.overscaledZ,u_unpack:ee.getUnpackVector()}})(i.tileID,P),null,h.id,x.rasterBoundsBuffer,x.quadTriangleIndexBuffer,x.rasterBoundsSegments),i.needsHillshadePrepare=!1}}function Xp(x,i,h,m,g,_){const A=m.paint.get("raster-fade-duration");if(!_&&A>0){const M=C.now(),P=(M-x.timeAdded)/A,V=i?(M-i.timeAdded)/A:-1,O=h.getSource(),L=g.coveringZoomLevel({tileSize:O.tileSize,roundZoom:O.roundZoom}),G=!i||Math.abs(i.tileID.overscaledZ-L)>Math.abs(x.tileID.overscaledZ-L),K=G&&x.refreshedUponExpiration?1:c.ac(G?P:1-V,0,1);return x.refreshedUponExpiration&&P>=1&&(x.refreshedUponExpiration=!1),i?{opacity:1,mix:1-K}:{opacity:K,mix:0}}return{opacity:1,mix:0}}const iu=new c.aM(1,0,0,1),rn=new c.aM(0,1,0,1),hc=new c.aM(0,0,1,1),Qy=new c.aM(1,0,1,1),Kp=new c.aM(0,1,1,1);function Jo(x,i,h,m){pc(x,0,i+h/2,x.transform.width,h,m)}function Jp(x,i,h,m){pc(x,i-h/2,0,h,x.transform.height,m)}function pc(x,i,h,m,g,_){const A=x.context,M=A.gl;M.enable(M.SCISSOR_TEST),M.scissor(i*x.pixelRatio,h*x.pixelRatio,m*x.pixelRatio,g*x.pixelRatio),A.clear({color:_}),M.disable(M.SCISSOR_TEST)}function Qp(x,i,h){const m=x.context,g=m.gl,_=h.posMatrix,A=x.useProgram("debug"),M=Ht.disabled,P=Pn.disabled,V=x.colorModeForRenderPass(),O="$debug",L=x.style.map.terrain&&x.style.map.terrain.getTerrainData(h);m.activeTexture.set(g.TEXTURE0);const G=i.getTileByID(h.key).latestRawTileData,K=Math.floor((G&&G.byteLength||0)/1024),ee=i.getTile(h).tileSize,ie=512/Math.min(ee,512)*(h.overscaledZ/x.transform.zoom)*.5;let ae=h.canonical.toString();h.overscaledZ!==h.canonical.z&&(ae+=` => ${h.overscaledZ}`),function(ce,he){ce.initDebugOverlayCanvas();const te=ce.debugOverlayCanvas,ge=ce.context.gl,_e=ce.debugOverlayCanvas.getContext("2d");_e.clearRect(0,0,te.width,te.height),_e.shadowColor="white",_e.shadowBlur=2,_e.lineWidth=1.5,_e.strokeStyle="white",_e.textBaseline="top",_e.font="bold 36px Open Sans, sans-serif",_e.fillText(he,5,5),_e.strokeText(he,5,5),ce.debugOverlayTexture.update(te),ce.debugOverlayTexture.bind(ge.LINEAR,ge.CLAMP_TO_EDGE)}(x,`${ae} ${K}kB`),A.draw(m,g.TRIANGLES,M,P,er.alphaBlended,Cn.disabled,Ga(_,c.aM.transparent,ie),null,O,x.debugBuffer,x.quadTriangleIndexBuffer,x.debugSegments),A.draw(m,g.LINE_STRIP,M,P,V,Cn.disabled,Ga(_,c.aM.red),L,O,x.debugBuffer,x.tileBorderIndexBuffer,x.debugSegments)}function ef(x,i,h){const m=x.context,g=m.gl,_=x.colorModeForRenderPass(),A=new Ht(g.LEQUAL,Ht.ReadWrite,x.depthRangeFor3D),M=x.useProgram("terrain"),P=i.getTerrainMesh();m.bindFramebuffer.set(null),m.viewport.set([0,0,x.width,x.height]);for(const V of h){const O=x.renderToTexture.getTexture(V),L=i.getTerrainData(V.tileID);m.activeTexture.set(g.TEXTURE0),g.bindTexture(g.TEXTURE_2D,O.texture);const G=x.transform.calculatePosMatrix(V.tileID.toUnwrapped()),K=i.getMeshFrameDelta(x.transform.zoom),ee=x.transform.calculateFogMatrix(V.tileID.toUnwrapped()),ie=$d(G,K,ee,x.style.sky,x.transform.pitch);M.draw(m,g.TRIANGLES,A,Pn.disabled,_,Cn.backCCW,ie,L,"terrain",P.vertexBuffer,P.indexBuffer,P.segments)}}class fc{constructor(i,h,m){this.vertexBuffer=i,this.indexBuffer=h,this.segments=m}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}class mc{constructor(i,h){this.context=new Jy(i),this.transform=h,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:c.an(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=At.maxUnderzooming+At.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Ld}resize(i,h,m){if(this.width=Math.floor(i*m),this.height=Math.floor(h*m),this.pixelRatio=m,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const g of this.style._order)this.style._layers[g].resize()}setup(){const i=this.context,h=new c.aX;h.emplaceBack(0,0),h.emplaceBack(c.X,0),h.emplaceBack(0,c.X),h.emplaceBack(c.X,c.X),this.tileExtentBuffer=i.createVertexBuffer(h,co.members),this.tileExtentSegments=c.a0.simpleSegment(0,0,4,2);const m=new c.aX;m.emplaceBack(0,0),m.emplaceBack(c.X,0),m.emplaceBack(0,c.X),m.emplaceBack(c.X,c.X),this.debugBuffer=i.createVertexBuffer(m,co.members),this.debugSegments=c.a0.simpleSegment(0,0,4,5);const g=new c.$;g.emplaceBack(0,0,0,0),g.emplaceBack(c.X,0,c.X,0),g.emplaceBack(0,c.X,0,c.X),g.emplaceBack(c.X,c.X,c.X,c.X),this.rasterBoundsBuffer=i.createVertexBuffer(g,ut.members),this.rasterBoundsSegments=c.a0.simpleSegment(0,0,4,2);const _=new c.aX;_.emplaceBack(0,0),_.emplaceBack(1,0),_.emplaceBack(0,1),_.emplaceBack(1,1),this.viewportBuffer=i.createVertexBuffer(_,co.members),this.viewportSegments=c.a0.simpleSegment(0,0,4,2);const A=new c.aZ;A.emplaceBack(0),A.emplaceBack(1),A.emplaceBack(3),A.emplaceBack(2),A.emplaceBack(0),this.tileBorderIndexBuffer=i.createIndexBuffer(A);const M=new c.aY;M.emplaceBack(0,1,2),M.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=i.createIndexBuffer(M);const P=this.context.gl;this.stencilClearMode=new Pn({func:P.ALWAYS,mask:0},0,255,P.ZERO,P.ZERO,P.ZERO)}clearStencil(){const i=this.context,h=i.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const m=c.H();c.aP(m,0,this.width,this.height,0,0,1),c.K(m,m,[h.drawingBufferWidth,h.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(i,h.TRIANGLES,Ht.disabled,this.stencilClearMode,er.disabled,Cn.disabled,Wr(m),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(i,h){if(this.currentStencilSource===i.source||!i.isTileClipped()||!h||!h.length)return;this.currentStencilSource=i.source;const m=this.context,g=m.gl;this.nextStencilID+h.length>256&&this.clearStencil(),m.setColorMode(er.disabled),m.setDepthMode(Ht.disabled);const _=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const A of h){const M=this._tileClippingMaskIDs[A.key]=this.nextStencilID++,P=this.style.map.terrain&&this.style.map.terrain.getTerrainData(A);_.draw(m,g.TRIANGLES,Ht.disabled,new Pn({func:g.ALWAYS,mask:0},M,255,g.KEEP,g.KEEP,g.REPLACE),er.disabled,Cn.disabled,Wr(A.posMatrix),P,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const i=this.nextStencilID++,h=this.context.gl;return new Pn({func:h.NOTEQUAL,mask:255},i,255,h.KEEP,h.KEEP,h.REPLACE)}stencilModeForClipping(i){const h=this.context.gl;return new Pn({func:h.EQUAL,mask:255},this._tileClippingMaskIDs[i.key],0,h.KEEP,h.KEEP,h.REPLACE)}stencilConfigForOverlap(i){const h=this.context.gl,m=i.sort((A,M)=>M.overscaledZ-A.overscaledZ),g=m[m.length-1].overscaledZ,_=m[0].overscaledZ-g+1;if(_>1){this.currentStencilSource=void 0,this.nextStencilID+_>256&&this.clearStencil();const A={};for(let M=0;M<_;M++)A[M+g]=new Pn({func:h.GEQUAL,mask:255},M+this.nextStencilID,255,h.KEEP,h.KEEP,h.REPLACE);return this.nextStencilID+=_,[A,m]}return[{[g]:Pn.disabled},m]}colorModeForRenderPass(){const i=this.context.gl;return this._showOverdrawInspector?new er([i.CONSTANT_COLOR,i.ONE],new c.aM(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?er.unblended:er.alphaBlended}depthModeForSublayer(i,h,m){if(!this.opaquePassEnabledForLayer())return Ht.disabled;const g=1-((1+this.currentLayer)*this.numSublayers+i)*this.depthEpsilon;return new Ht(m||this.context.gl.LEQUAL,h,[g,g])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(i,h){this.style=i,this.options=h,this.lineAtlas=i.lineAtlas,this.imageManager=i.imageManager,this.glyphManager=i.glyphManager,this.symbolFadeChange=i.placement.symbolFadeChange(C.now()),this.imageManager.beginFrame();const m=this.style._order,g=this.style.sourceCaches,_={},A={},M={};for(const P in g){const V=g[P];V.used&&V.prepare(this.context),_[P]=V.getVisibleCoordinates(),A[P]=_[P].slice().reverse(),M[P]=V.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let P=0;P<m.length;P++)if(this.style._layers[m[P]].is3D()){this.opaquePassCutoff=P;break}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const P of m){const V=this.style._layers[P];if(!V.hasOffscreenPass()||V.isHidden(this.transform.zoom))continue;const O=A[V.source];(V.type==="custom"||O.length)&&this.renderLayer(this,g[V.source],V,O)}if(this.context.bindFramebuffer.set(null),this.context.clear({color:h.showOverdrawInspector?c.aM.black:c.aM.transparent,depth:1}),this.clearStencil(),this.style.sky&&function(P,V){const O=P.context,L=O.gl,G=((ce,he,te)=>({u_sky_color:ce.properties.get("sky-color"),u_horizon_color:ce.properties.get("horizon-color"),u_horizon:(he.height/2+he.getHorizon())*te,u_sky_horizon_blend:ce.properties.get("sky-horizon-blend")*he.height/2*te}))(V,P.style.map.transform,P.pixelRatio),K=new Ht(L.LEQUAL,Ht.ReadWrite,[0,1]),ee=Pn.disabled,ie=P.colorModeForRenderPass(),ae=P.useProgram("sky");if(!V.mesh){const ce=new c.aX;ce.emplaceBack(-1,-1),ce.emplaceBack(1,-1),ce.emplaceBack(1,1),ce.emplaceBack(-1,1);const he=new c.aY;he.emplaceBack(0,1,2),he.emplaceBack(0,2,3),V.mesh=new fc(O.createVertexBuffer(ce,co.members),O.createIndexBuffer(he),c.a0.simpleSegment(0,0,ce.length,he.length))}ae.draw(O,L.TRIANGLES,K,ee,ie,Cn.disabled,G,void 0,"sky",V.mesh.vertexBuffer,V.mesh.indexBuffer,V.mesh.segments)}(this,this.style.sky),this._showOverdrawInspector=h.showOverdrawInspector,this.depthRangeFor3D=[0,1-(i._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=m.length-1;this.currentLayer>=0;this.currentLayer--){const P=this.style._layers[m[this.currentLayer]],V=g[P.source],O=_[P.source];this._renderTileClippingMasks(P,O),this.renderLayer(this,V,P,O)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<m.length;this.currentLayer++){const P=this.style._layers[m[this.currentLayer]],V=g[P.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(P))continue;const O=(P.type==="symbol"?M:A)[P.source];this._renderTileClippingMasks(P,_[P.source]),this.renderLayer(this,V,P,O)}if(this.options.showTileBoundaries){const P=function(V,O){let L=null;const G=Object.values(V._layers).flatMap(ae=>ae.source&&!ae.isHidden(O)?[V.sourceCaches[ae.source]]:[]),K=G.filter(ae=>ae.getSource().type==="vector"),ee=G.filter(ae=>ae.getSource().type!=="vector"),ie=ae=>{(!L||L.getSource().maxzoom<ae.getSource().maxzoom)&&(L=ae)};return K.forEach(ae=>ie(ae)),L||ee.forEach(ae=>ie(ae)),L}(this.style,this.transform.zoom);P&&function(V,O,L){for(let G=0;G<L.length;G++)Qp(V,O,L[G])}(this,P,P.getVisibleCoordinates())}this.options.showPadding&&function(P){const V=P.transform.padding;Jo(P,P.transform.height-(V.top||0),3,iu),Jo(P,V.bottom||0,3,rn),Jp(P,V.left||0,3,hc),Jp(P,P.transform.width-(V.right||0),3,Qy);const O=P.transform.centerPoint;(function(L,G,K,ee){pc(L,G-1,K-10,2,20,ee),pc(L,G-10,K-1,20,2,ee)})(P,O.x,P.transform.height-O.y,Kp)}(this),this.context.setDefault()}maybeDrawDepthAndCoords(i){if(!this.style||!this.style.map||!this.style.map.terrain)return;const h=this.terrainFacilitator.matrix,m=this.transform.modelViewProjectionMatrix;let g=this.terrainFacilitator.dirty;g||(g=i?!c.a_(h,m):!c.a$(h,m)),g||(g=this.style.map.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime).length>0),g&&(c.b0(h,m),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(_,A){const M=_.context,P=M.gl,V=er.unblended,O=new Ht(P.LEQUAL,Ht.ReadWrite,[0,1]),L=A.getTerrainMesh(),G=A.sourceCache.getRenderableTiles(),K=_.useProgram("terrainDepth");M.bindFramebuffer.set(A.getFramebuffer("depth").framebuffer),M.viewport.set([0,0,_.width/devicePixelRatio,_.height/devicePixelRatio]),M.clear({color:c.aM.transparent,depth:1});for(const ee of G){const ie=A.getTerrainData(ee.tileID),ae={u_matrix:_.transform.calculatePosMatrix(ee.tileID.toUnwrapped()),u_ele_delta:A.getMeshFrameDelta(_.transform.zoom)};K.draw(M,P.TRIANGLES,O,Pn.disabled,V,Cn.backCCW,ae,ie,"terrain",L.vertexBuffer,L.indexBuffer,L.segments)}M.bindFramebuffer.set(null),M.viewport.set([0,0,_.width,_.height])}(this,this.style.map.terrain),function(_,A){const M=_.context,P=M.gl,V=er.unblended,O=new Ht(P.LEQUAL,Ht.ReadWrite,[0,1]),L=A.getTerrainMesh(),G=A.getCoordsTexture(),K=A.sourceCache.getRenderableTiles(),ee=_.useProgram("terrainCoords");M.bindFramebuffer.set(A.getFramebuffer("coords").framebuffer),M.viewport.set([0,0,_.width/devicePixelRatio,_.height/devicePixelRatio]),M.clear({color:c.aM.transparent,depth:1}),A.coordsIndex=[];for(const ie of K){const ae=A.getTerrainData(ie.tileID);M.activeTexture.set(P.TEXTURE0),P.bindTexture(P.TEXTURE_2D,G.texture);const ce={u_matrix:_.transform.calculatePosMatrix(ie.tileID.toUnwrapped()),u_terrain_coords_id:(255-A.coordsIndex.length)/255,u_texture:0,u_ele_delta:A.getMeshFrameDelta(_.transform.zoom)};ee.draw(M,P.TRIANGLES,O,Pn.disabled,V,Cn.backCCW,ce,ae,"terrain",L.vertexBuffer,L.indexBuffer,L.segments),A.coordsIndex.push(ie.tileID.key)}M.bindFramebuffer.set(null),M.viewport.set([0,0,_.width,_.height])}(this,this.style.map.terrain))}renderLayer(i,h,m,g){if(!m.isHidden(this.transform.zoom)&&(m.type==="background"||m.type==="custom"||(g||[]).length))switch(this.id=m.id,m.type){case"symbol":(function(_,A,M,P,V){if(_.renderPass!=="translucent")return;const O=Pn.disabled,L=_.colorModeForRenderPass();(M._unevaluatedLayout.hasValue("text-variable-anchor")||M._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(G,K,ee,ie,ae,ce,he,te,ge){const _e=K.transform,we=lo(),Ne=ae==="map",$e=ce==="map";for(const Qe of G){const at=ie.getTile(Qe),Ge=at.getBucket(ee);if(!Ge||!Ge.text||!Ge.text.segments.get().length)continue;const qe=c.ag(Ge.textSizeData,_e.zoom),mt=Zt(at,1,K.transform.zoom),Rt=Ns(Qe.posMatrix,$e,Ne,K.transform,mt),Ye=ee.layout.get("icon-text-fit")!=="none"&&Ge.hasIconData();if(qe){const it=Math.pow(2,_e.zoom-at.tileID.overscaledZ),Mt=K.style.map.terrain?(Lt,Yt)=>K.style.map.terrain.getElevation(Qe,Lt,Yt):null,Ln=we.translatePosition(_e,at,he,te);Zo(Ge,Ne,$e,ge,_e,Rt,Qe.posMatrix,it,qe,Ye,we,Ln,Qe.toUnwrapped(),Mt)}}}(P,_,M,A,M.layout.get("text-rotation-alignment"),M.layout.get("text-pitch-alignment"),M.paint.get("text-translate"),M.paint.get("text-translate-anchor"),V),M.paint.get("icon-opacity").constantOr(1)!==0&&tu(_,A,M,P,!1,M.paint.get("icon-translate"),M.paint.get("icon-translate-anchor"),M.layout.get("icon-rotation-alignment"),M.layout.get("icon-pitch-alignment"),M.layout.get("icon-keep-upright"),O,L),M.paint.get("text-opacity").constantOr(1)!==0&&tu(_,A,M,P,!0,M.paint.get("text-translate"),M.paint.get("text-translate-anchor"),M.layout.get("text-rotation-alignment"),M.layout.get("text-pitch-alignment"),M.layout.get("text-keep-upright"),O,L),A.map.showCollisionBoxes&&(Xa(_,A,M,P,!0),Xa(_,A,M,P,!1))})(i,h,m,g,this.style.placement.variableOffsets);break;case"circle":(function(_,A,M,P){if(_.renderPass!=="translucent")return;const V=M.paint.get("circle-opacity"),O=M.paint.get("circle-stroke-width"),L=M.paint.get("circle-stroke-opacity"),G=!M.layout.get("circle-sort-key").isConstant();if(V.constantOr(1)===0&&(O.constantOr(1)===0||L.constantOr(1)===0))return;const K=_.context,ee=K.gl,ie=_.depthModeForSublayer(0,Ht.ReadOnly),ae=Pn.disabled,ce=_.colorModeForRenderPass(),he=[];for(let te=0;te<P.length;te++){const ge=P[te],_e=A.getTile(ge),we=_e.getBucket(M);if(!we)continue;const Ne=we.programConfigurations.get(M.id),$e=_.useProgram("circle",Ne),Qe=we.layoutVertexBuffer,at=we.indexBuffer,Ge=_.style.map.terrain&&_.style.map.terrain.getTerrainData(ge),qe={programConfiguration:Ne,program:$e,layoutVertexBuffer:Qe,indexBuffer:at,uniformValues:Ly(_,ge,_e,M),terrainData:Ge};if(G){const mt=we.segments.get();for(const Rt of mt)he.push({segments:new c.a0([Rt]),sortKey:Rt.sortKey,state:qe})}else he.push({segments:we.segments,sortKey:0,state:qe})}G&&he.sort((te,ge)=>te.sortKey-ge.sortKey);for(const te of he){const{programConfiguration:ge,program:_e,layoutVertexBuffer:we,indexBuffer:Ne,uniformValues:$e,terrainData:Qe}=te.state;_e.draw(K,ee.TRIANGLES,ie,ae,ce,Cn.disabled,$e,Qe,M.id,we,Ne,te.segments,M.paint,_.transform.zoom,ge)}})(i,h,m,g);break;case"heatmap":(function(_,A,M,P){if(M.paint.get("heatmap-opacity")===0)return;const V=_.context;if(_.style.map.terrain){for(const O of P){const L=A.getTile(O);A.hasRenderableParent(O)||(_.renderPass==="offscreen"?ru(_,L,M,O):_.renderPass==="translucent"&&yo(_,M,O))}V.viewport.set([0,0,_.width,_.height])}else _.renderPass==="offscreen"?function(O,L,G,K){const ee=O.context,ie=ee.gl,ae=Pn.disabled,ce=new er([ie.ONE,ie.ONE],c.aM.transparent,[!0,!0,!0,!0]);(function(he,te,ge){const _e=he.gl;he.activeTexture.set(_e.TEXTURE1),he.viewport.set([0,0,te.width/4,te.height/4]);let we=ge.heatmapFbos.get(c.aU);we?(_e.bindTexture(_e.TEXTURE_2D,we.colorAttachment.get()),he.bindFramebuffer.set(we.framebuffer)):(we=Ja(he,te.width/4,te.height/4),ge.heatmapFbos.set(c.aU,we))})(ee,O,G),ee.clear({color:c.aM.transparent});for(let he=0;he<K.length;he++){const te=K[he];if(L.hasRenderableParent(te))continue;const ge=L.getTile(te),_e=ge.getBucket(G);if(!_e)continue;const we=_e.programConfigurations.get(G.id),Ne=O.useProgram("heatmap",we),{zoom:$e}=O.transform;Ne.draw(ee,ie.TRIANGLES,Ht.disabled,ae,ce,Cn.disabled,qr(te.posMatrix,ge,$e,G.paint.get("heatmap-intensity")),null,G.id,_e.layoutVertexBuffer,_e.indexBuffer,_e.segments,G.paint,O.transform.zoom,we)}ee.viewport.set([0,0,O.width,O.height])}(_,A,M,P):_.renderPass==="translucent"&&function(O,L){const G=O.context,K=G.gl;G.setColorMode(O.colorModeForRenderPass());const ee=L.heatmapFbos.get(c.aU);ee&&(G.activeTexture.set(K.TEXTURE0),K.bindTexture(K.TEXTURE_2D,ee.colorAttachment.get()),G.activeTexture.set(K.TEXTURE1),Qa(G,L).bind(K.LINEAR,K.CLAMP_TO_EDGE),O.useProgram("heatmapTexture").draw(G,K.TRIANGLES,Ht.disabled,Pn.disabled,O.colorModeForRenderPass(),Cn.disabled,nc(O,L,0,1),null,L.id,O.viewportBuffer,O.quadTriangleIndexBuffer,O.viewportSegments,L.paint,O.transform.zoom))}(_,M)})(i,h,m,g);break;case"line":(function(_,A,M,P){if(_.renderPass!=="translucent")return;const V=M.paint.get("line-opacity"),O=M.paint.get("line-width");if(V.constantOr(1)===0||O.constantOr(1)===0)return;const L=_.depthModeForSublayer(0,Ht.ReadOnly),G=_.colorModeForRenderPass(),K=M.paint.get("line-dasharray"),ee=M.paint.get("line-pattern"),ie=ee.constantOr(1),ae=M.paint.get("line-gradient"),ce=M.getCrossfadeParameters(),he=ie?"linePattern":K?"lineSDF":ae?"lineGradient":"line",te=_.context,ge=te.gl;let _e=!0;for(const we of P){const Ne=A.getTile(we);if(ie&&!Ne.patternsLoaded())continue;const $e=Ne.getBucket(M);if(!$e)continue;const Qe=$e.programConfigurations.get(M.id),at=_.context.program.get(),Ge=_.useProgram(he,Qe),qe=_e||Ge.program!==at,mt=_.style.map.terrain&&_.style.map.terrain.getTerrainData(we),Rt=ee.constantOr(null);if(Rt&&Ne.imageAtlas){const Mt=Ne.imageAtlas,Ln=Mt.patternPositions[Rt.to.toString()],Lt=Mt.patternPositions[Rt.from.toString()];Ln&&Lt&&Qe.setConstantPatternPositions(Ln,Lt)}const Ye=mt?we:null,it=ie?qo(_,Ne,M,ce,Ye):K?Fy(_,Ne,M,K,ce,Ye):ae?Np(_,Ne,M,$e.lineClipsArray.length,Ye):ic(_,Ne,M,Ye);if(ie)te.activeTexture.set(ge.TEXTURE0),Ne.imageAtlasTexture.bind(ge.LINEAR,ge.CLAMP_TO_EDGE),Qe.updatePaintBuffers(ce);else if(K&&(qe||_.lineAtlas.dirty))te.activeTexture.set(ge.TEXTURE0),_.lineAtlas.bind(te);else if(ae){const Mt=$e.gradients[M.id];let Ln=Mt.texture;if(M.gradientVersion!==Mt.version){let Lt=256;if(M.stepInterpolant){const Yt=A.getSource().maxzoom,Fn=we.canonical.z===Yt?Math.ceil(1<<_.transform.maxZoom-we.canonical.z):1;Lt=c.ac(c.aV($e.maxLineLength/c.X*1024*Fn),256,te.maxTextureSize)}Mt.gradient=c.aW({expression:M.gradientExpression(),evaluationKey:"lineProgress",resolution:Lt,image:Mt.gradient||void 0,clips:$e.lineClipsArray}),Mt.texture?Mt.texture.update(Mt.gradient):Mt.texture=new tt(te,Mt.gradient,ge.RGBA),Mt.version=M.gradientVersion,Ln=Mt.texture}te.activeTexture.set(ge.TEXTURE0),Ln.bind(M.stepInterpolant?ge.NEAREST:ge.LINEAR,ge.CLAMP_TO_EDGE)}Ge.draw(te,ge.TRIANGLES,L,_.stencilModeForClipping(we),G,Cn.disabled,it,mt,M.id,$e.layoutVertexBuffer,$e.indexBuffer,$e.segments,M.paint,_.transform.zoom,Qe,$e.layoutVertexBuffer2),_e=!1}})(i,h,m,g);break;case"fill":(function(_,A,M,P){const V=M.paint.get("fill-color"),O=M.paint.get("fill-opacity");if(O.constantOr(1)===0)return;const L=_.colorModeForRenderPass(),G=M.paint.get("fill-pattern"),K=_.opaquePassEnabledForLayer()&&!G.constantOr(1)&&V.constantOr(c.aM.transparent).a===1&&O.constantOr(0)===1?"opaque":"translucent";if(_.renderPass===K){const ee=_.depthModeForSublayer(1,_.renderPass==="opaque"?Ht.ReadWrite:Ht.ReadOnly);el(_,A,M,P,ee,L,!1)}if(_.renderPass==="translucent"&&M.paint.get("fill-antialias")){const ee=_.depthModeForSublayer(M.getPaintProperty("fill-outline-color")?2:0,Ht.ReadOnly);el(_,A,M,P,ee,L,!0)}})(i,h,m,g);break;case"fill-extrusion":(function(_,A,M,P){const V=M.paint.get("fill-extrusion-opacity");if(V!==0&&_.renderPass==="translucent"){const O=new Ht(_.context.gl.LEQUAL,Ht.ReadWrite,_.depthRangeFor3D);if(V!==1||M.paint.get("fill-extrusion-pattern").constantOr(1))uc(_,A,M,P,O,Pn.disabled,er.disabled),uc(_,A,M,P,O,_.stencilModeFor3D(),_.colorModeForRenderPass());else{const L=_.colorModeForRenderPass();uc(_,A,M,P,O,Pn.disabled,L)}}})(i,h,m,g);break;case"hillshade":(function(_,A,M,P){if(_.renderPass!=="offscreen"&&_.renderPass!=="translucent")return;const V=_.context,O=_.depthModeForSublayer(0,Ht.ReadOnly),L=_.colorModeForRenderPass(),[G,K]=_.renderPass==="translucent"?_.stencilConfigForOverlap(P):[{},P];for(const ee of K){const ie=A.getTile(ee);ie.needsHillshadePrepare!==void 0&&ie.needsHillshadePrepare&&_.renderPass==="offscreen"?Ko(_,ie,M,O,Pn.disabled,L):_.renderPass==="translucent"&&Xo(_,ee,ie,M,O,G[ee.overscaledZ],L)}V.viewport.set([0,0,_.width,_.height])})(i,h,m,g);break;case"raster":(function(_,A,M,P){if(_.renderPass!=="translucent"||M.paint.get("raster-opacity")===0||!P.length)return;const V=_.context,O=V.gl,L=A.getSource(),G=_.useProgram("raster"),K=_.colorModeForRenderPass(),[ee,ie]=L instanceof Cr?[{},P]:_.stencilConfigForOverlap(P),ae=ie[ie.length-1].overscaledZ,ce=!_.options.moving;for(const he of ie){const te=_.depthModeForSublayer(he.overscaledZ-ae,M.paint.get("raster-opacity")===1?Ht.ReadWrite:Ht.ReadOnly,O.LESS),ge=A.getTile(he);ge.registerFadeDuration(M.paint.get("raster-fade-duration"));const _e=A.findLoadedParent(he,0),we=A.findLoadedSibling(he),Ne=Xp(ge,_e||we||null,A,M,_.transform,_.style.map.terrain);let $e,Qe;const at=M.paint.get("raster-resampling")==="nearest"?O.NEAREST:O.LINEAR;V.activeTexture.set(O.TEXTURE0),ge.texture.bind(at,O.CLAMP_TO_EDGE,O.LINEAR_MIPMAP_NEAREST),V.activeTexture.set(O.TEXTURE1),_e?(_e.texture.bind(at,O.CLAMP_TO_EDGE,O.LINEAR_MIPMAP_NEAREST),$e=Math.pow(2,_e.tileID.overscaledZ-ge.tileID.overscaledZ),Qe=[ge.tileID.canonical.x*$e%1,ge.tileID.canonical.y*$e%1]):ge.texture.bind(at,O.CLAMP_TO_EDGE,O.LINEAR_MIPMAP_NEAREST),ge.texture.useMipmap&&V.extTextureFilterAnisotropic&&_.transform.pitch>20&&O.texParameterf(O.TEXTURE_2D,V.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,V.extTextureFilterAnisotropicMax);const Ge=_.style.map.terrain&&_.style.map.terrain.getTerrainData(he),qe=Ge?he:null,mt=qe?qe.posMatrix:_.transform.calculatePosMatrix(he.toUnwrapped(),ce),Rt=$y(mt,Qe||[0,0],$e||1,Ne,M);L instanceof Cr?G.draw(V,O.TRIANGLES,te,Pn.disabled,K,Cn.disabled,Rt,Ge,M.id,L.boundsBuffer,_.quadTriangleIndexBuffer,L.boundsSegments):G.draw(V,O.TRIANGLES,te,ee[he.overscaledZ],K,Cn.disabled,Rt,Ge,M.id,_.rasterBoundsBuffer,_.quadTriangleIndexBuffer,_.rasterBoundsSegments)}})(i,h,m,g);break;case"background":(function(_,A,M,P){const V=M.paint.get("background-color"),O=M.paint.get("background-opacity");if(O===0)return;const L=_.context,G=L.gl,K=_.transform,ee=K.tileSize,ie=M.paint.get("background-pattern");if(_.isPatternMissing(ie))return;const ae=!ie&&V.a===1&&O===1&&_.opaquePassEnabledForLayer()?"opaque":"translucent";if(_.renderPass!==ae)return;const ce=Pn.disabled,he=_.depthModeForSublayer(0,ae==="opaque"?Ht.ReadWrite:Ht.ReadOnly),te=_.colorModeForRenderPass(),ge=_.useProgram(ie?"backgroundPattern":"background"),_e=P||K.coveringTiles({tileSize:ee,terrain:_.style.map.terrain});ie&&(L.activeTexture.set(G.TEXTURE0),_.imageManager.bind(_.context));const we=M.getCrossfadeParameters();for(const Ne of _e){const $e=P?Ne.posMatrix:_.transform.calculatePosMatrix(Ne.toUnwrapped()),Qe=ie?Hd($e,O,_,ie,{tileID:Ne,tileSize:ee},we):sc($e,O,V),at=_.style.map.terrain&&_.style.map.terrain.getTerrainData(Ne);ge.draw(L,G.TRIANGLES,he,ce,te,Cn.disabled,Qe,at,M.id,_.tileExtentBuffer,_.quadTriangleIndexBuffer,_.tileExtentSegments)}})(i,0,m,g);break;case"custom":(function(_,A,M){const P=_.context,V=M.implementation;if(_.renderPass==="offscreen"){const O=V.prerender;O&&(_.setCustomLayerDefaults(),P.setColorMode(_.colorModeForRenderPass()),O.call(V,P.gl,_.transform.customLayerMatrix()),P.setDirty(),_.setBaseState())}else if(_.renderPass==="translucent"){_.setCustomLayerDefaults(),P.setColorMode(_.colorModeForRenderPass()),P.setStencilMode(Pn.disabled);const O=V.renderingMode==="3d"?new Ht(_.context.gl.LEQUAL,Ht.ReadWrite,_.depthRangeFor3D):_.depthModeForSublayer(0,Ht.ReadOnly);P.setDepthMode(O),V.render(P.gl,_.transform.customLayerMatrix(),{farZ:_.transform.farZ,nearZ:_.transform.nearZ,fov:_.transform._fov,modelViewProjectionMatrix:_.transform.modelViewProjectionMatrix,projectionMatrix:_.transform.projectionMatrix}),P.setDirty(),_.setBaseState(),P.bindFramebuffer.set(null)}})(i,0,m)}}translatePosMatrix(i,h,m,g,_){if(!m[0]&&!m[1])return i;const A=_?g==="map"?this.transform.angle:0:g==="viewport"?-this.transform.angle:0;if(A){const V=Math.sin(A),O=Math.cos(A);m=[m[0]*O-m[1]*V,m[0]*V+m[1]*O]}const M=[_?m[0]:Zt(h,m[0],this.transform.zoom),_?m[1]:Zt(h,m[1],this.transform.zoom),0],P=new Float32Array(16);return c.J(P,i,M),P}saveTileTexture(i){const h=this._tileTextures[i.size[0]];h?h.push(i):this._tileTextures[i.size[0]]=[i]}getTileTexture(i){const h=this._tileTextures[i];return h&&h.length>0?h.pop():null}isPatternMissing(i){if(!i)return!1;if(!i.from||!i.to)return!0;const h=this.imageManager.getPattern(i.from.toString()),m=this.imageManager.getPattern(i.to.toString());return!h||!m}useProgram(i,h){this.cache=this.cache||{};const m=i+(h?h.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[m]||(this.cache[m]=new jd(this.context,Bs[i],h,Wd[i],this._showOverdrawInspector,this.style.map.terrain)),this.cache[m]}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 i=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(i.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new tt(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:i,drawingBufferHeight:h}=this.context.gl;return this.width!==i||this.height!==h}}class Qo{constructor(i,h){this.points=i,this.planes=h}static fromInvProjectionMatrix(i,h,m){const g=Math.pow(2,m),_=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(M=>{const P=1/(M=c.af([],M,i))[3]/h*g;return c.b1(M,M,[P,P,1/M[3],P])}),A=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(M=>{const P=function(G,K){var ee=K[0],ie=K[1],ae=K[2],ce=ee*ee+ie*ie+ae*ae;return ce>0&&(ce=1/Math.sqrt(ce)),G[0]=K[0]*ce,G[1]=K[1]*ce,G[2]=K[2]*ce,G}([],function(G,K,ee){var ie=K[0],ae=K[1],ce=K[2],he=ee[0],te=ee[1],ge=ee[2];return G[0]=ae*ge-ce*te,G[1]=ce*he-ie*ge,G[2]=ie*te-ae*he,G}([],Ee([],_[M[0]],_[M[1]]),Ee([],_[M[2]],_[M[1]]))),V=-((O=P)[0]*(L=_[M[1]])[0]+O[1]*L[1]+O[2]*L[2]);var O,L;return P.concat(V)});return new Qo(_,A)}}class ea{constructor(i,h){this.min=i,this.max=h,this.center=function(m,g,_){return m[0]=.5*g[0],m[1]=.5*g[1],m[2]=.5*g[2],m}([],function(m,g,_){return m[0]=g[0]+_[0],m[1]=g[1]+_[1],m[2]=g[2]+_[2],m}([],this.min,this.max))}quadrant(i){const h=[i%2==0,i<2],m=ke(this.min),g=ke(this.max);for(let _=0;_<h.length;_++)m[_]=h[_]?this.min[_]:this.center[_],g[_]=h[_]?this.center[_]:this.max[_];return g[2]=this.max[2],new ea(m,g)}distanceX(i){return Math.max(Math.min(this.max[0],i[0]),this.min[0])-i[0]}distanceY(i){return Math.max(Math.min(this.max[1],i[1]),this.min[1])-i[1]}intersects(i){const h=[[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 m=!0;for(let g=0;g<i.planes.length;g++){const _=i.planes[g];let A=0;for(let M=0;M<h.length;M++)c.b2(_,h[M])>=0&&A++;if(A===0)return 0;A!==h.length&&(m=!1)}if(m)return 2;for(let g=0;g<3;g++){let _=Number.MAX_VALUE,A=-Number.MAX_VALUE;for(let M=0;M<i.points.length;M++){const P=i.points[M][g]-this.min[g];_=Math.min(_,P),A=Math.max(A,P)}if(A<0||_>this.max[g]-this.min[g])return 0}return 1}}class ta{constructor(i=0,h=0,m=0,g=0){if(isNaN(i)||i<0||isNaN(h)||h<0||isNaN(m)||m<0||isNaN(g)||g<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=i,this.bottom=h,this.left=m,this.right=g}interpolate(i,h,m){return h.top!=null&&i.top!=null&&(this.top=c.y.number(i.top,h.top,m)),h.bottom!=null&&i.bottom!=null&&(this.bottom=c.y.number(i.bottom,h.bottom,m)),h.left!=null&&i.left!=null&&(this.left=c.y.number(i.left,h.left,m)),h.right!=null&&i.right!=null&&(this.right=c.y.number(i.right,h.right,m)),this}getCenter(i,h){const m=c.ac((this.left+i-this.right)/2,0,i),g=c.ac((this.top+h-this.bottom)/2,0,h);return new c.P(m,g)}equals(i){return this.top===i.top&&this.bottom===i.bottom&&this.left===i.left&&this.right===i.right}clone(){return new ta(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const su=85.051129;class na{constructor(i,h,m,g,_){this.tileSize=512,this._renderWorldCopies=_===void 0||!!_,this._minZoom=i||0,this._maxZoom=h||22,this._minPitch=m??0,this._maxPitch=g??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 ta,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={},this.minElevationForCurrentTile=0}clone(){const i=new na(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return i.apply(this),i}apply(i){this.tileSize=i.tileSize,this.latRange=i.latRange,this.lngRange=i.lngRange,this.width=i.width,this.height=i.height,this._center=i._center,this._elevation=i._elevation,this.minElevationForCurrentTile=i.minElevationForCurrentTile,this.zoom=i.zoom,this.angle=i.angle,this._fov=i._fov,this._pitch=i._pitch,this._unmodified=i._unmodified,this._edgeInsets=i._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(i){this._minZoom!==i&&(this._minZoom=i,this.zoom=Math.max(this.zoom,i))}get maxZoom(){return this._maxZoom}set maxZoom(i){this._maxZoom!==i&&(this._maxZoom=i,this.zoom=Math.min(this.zoom,i))}get minPitch(){return this._minPitch}set minPitch(i){this._minPitch!==i&&(this._minPitch=i,this.pitch=Math.max(this.pitch,i))}get maxPitch(){return this._maxPitch}set maxPitch(i){this._maxPitch!==i&&(this._maxPitch=i,this.pitch=Math.min(this.pitch,i))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(i){i===void 0?i=!0:i===null&&(i=!1),this._renderWorldCopies=i}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new c.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(i){const h=-c.b3(i,-180,180)*Math.PI/180;this.angle!==h&&(this._unmodified=!1,this.angle=h,this._calcMatrices(),this.rotationMatrix=function(){var m=new c.A(4);return c.A!=Float32Array&&(m[1]=0,m[2]=0),m[0]=1,m[3]=1,m}(),function(m,g,_){var A=g[0],M=g[1],P=g[2],V=g[3],O=Math.sin(_),L=Math.cos(_);m[0]=A*L+P*O,m[1]=M*L+V*O,m[2]=A*-O+P*L,m[3]=M*-O+V*L}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(i){const h=c.ac(i,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==h&&(this._unmodified=!1,this._pitch=h,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(i){i=Math.max(.01,Math.min(60,i)),this._fov!==i&&(this._unmodified=!1,this._fov=i/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(i){const h=Math.min(Math.max(i,this.minZoom),this.maxZoom);this._zoom!==h&&(this._unmodified=!1,this._zoom=h,this.tileZoom=Math.max(0,Math.floor(h)),this.scale=this.zoomScale(h),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(i){i.lat===this._center.lat&&i.lng===this._center.lng||(this._unmodified=!1,this._center=i,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(i){i!==this._elevation&&(this._elevation=i,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(i){this._edgeInsets.equals(i)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,i,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(i){return this._edgeInsets.equals(i)}interpolatePadding(i,h,m){this._unmodified=!1,this._edgeInsets.interpolate(i,h,m),this._constrain(),this._calcMatrices()}coveringZoomLevel(i){const h=(i.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/i.tileSize));return Math.max(0,h)}getVisibleUnwrappedCoordinates(i){const h=[new c.b4(0,i)];if(this._renderWorldCopies){const m=this.pointCoordinate(new c.P(0,0)),g=this.pointCoordinate(new c.P(this.width,0)),_=this.pointCoordinate(new c.P(this.width,this.height)),A=this.pointCoordinate(new c.P(0,this.height)),M=Math.floor(Math.min(m.x,g.x,_.x,A.x)),P=Math.floor(Math.max(m.x,g.x,_.x,A.x)),V=1;for(let O=M-V;O<=P+V;O++)O!==0&&h.push(new c.b4(O,i))}return h}coveringTiles(i){var h,m;let g=this.coveringZoomLevel(i);const _=g;if(i.minzoom!==void 0&&g<i.minzoom)return[];i.maxzoom!==void 0&&g>i.maxzoom&&(g=i.maxzoom);const A=this.pointCoordinate(this.getCameraPoint()),M=c.Z.fromLngLat(this.center),P=Math.pow(2,g),V=[P*A.x,P*A.y,0],O=[P*M.x,P*M.y,0],L=Qo.fromInvProjectionMatrix(this.invModelViewProjectionMatrix,this.worldSize,g);let G=i.minzoom||0;!i.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(G=g);const K=i.terrain?2/Math.min(this.tileSize,i.tileSize)*this.tileSize:3,ee=te=>({aabb:new ea([te*P,0,0],[(te+1)*P,P,0]),zoom:0,x:0,y:0,wrap:te,fullyVisible:!1}),ie=[],ae=[],ce=g,he=i.reparseOverscaled?_:g;if(this._renderWorldCopies)for(let te=1;te<=3;te++)ie.push(ee(-te)),ie.push(ee(te));for(ie.push(ee(0));ie.length>0;){const te=ie.pop(),ge=te.x,_e=te.y;let we=te.fullyVisible;if(!we){const Ge=te.aabb.intersects(L);if(Ge===0)continue;we=Ge===2}const Ne=i.terrain?V:O,$e=te.aabb.distanceX(Ne),Qe=te.aabb.distanceY(Ne),at=Math.max(Math.abs($e),Math.abs(Qe));if(te.zoom===ce||at>K+(1<<ce-te.zoom)-2&&te.zoom>=G){const Ge=ce-te.zoom,qe=V[0]-.5-(ge<<Ge),mt=V[1]-.5-(_e<<Ge);ae.push({tileID:new c.S(te.zoom===ce?he:te.zoom,te.wrap,te.zoom,ge,_e),distanceSq:Ve([O[0]-.5-ge,O[1]-.5-_e]),tileDistanceToCamera:Math.sqrt(qe*qe+mt*mt)})}else for(let Ge=0;Ge<4;Ge++){const qe=(ge<<1)+Ge%2,mt=(_e<<1)+(Ge>>1),Rt=te.zoom+1;let Ye=te.aabb.quadrant(Ge);if(i.terrain){const it=new c.S(Rt,te.wrap,Rt,qe,mt),Mt=i.terrain.getMinMaxElevation(it),Ln=(h=Mt.minElevation)!==null&&h!==void 0?h:this.elevation,Lt=(m=Mt.maxElevation)!==null&&m!==void 0?m:this.elevation;Ye=new ea([Ye.min[0],Ye.min[1],Ln],[Ye.max[0],Ye.max[1],Lt])}ie.push({aabb:Ye,zoom:Rt,x:qe,y:mt,wrap:te.wrap,fullyVisible:we})}}return ae.sort((te,ge)=>te.distanceSq-ge.distanceSq).map(te=>te.tileID)}resize(i,h){this.width=i,this.height=h,this.pixelsToGLUnits=[2/i,-2/h],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(i){return Math.pow(2,i)}scaleZoom(i){return Math.log(i)/Math.LN2}project(i){const h=c.ac(i.lat,-85.051129,su);return new c.P(c.O(i.lng)*this.worldSize,c.Q(h)*this.worldSize)}unproject(i){return new c.Z(i.x/this.worldSize,i.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(i){const h=this.elevation,m=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,g=this.pointLocation(this.centerPoint,i),_=i.getElevationForLngLatZoom(g,this.tileZoom);if(!(this.elevation-_))return;const A=m+h-_,M=Math.cos(this._pitch)*this.cameraToCenterDistance/A/c.b5(1,g.lat),P=this.scaleZoom(M/this.tileSize);this._elevation=_,this._center=g,this.zoom=P}setLocationAtPoint(i,h){const m=this.pointCoordinate(h),g=this.pointCoordinate(this.centerPoint),_=this.locationCoordinate(i),A=new c.Z(_.x-(m.x-g.x),_.y-(m.y-g.y));this.center=this.coordinateLocation(A),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(i,h){return h?this.coordinatePoint(this.locationCoordinate(i),h.getElevationForLngLatZoom(i,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(i))}pointLocation(i,h){return this.coordinateLocation(this.pointCoordinate(i,h))}locationCoordinate(i){return c.Z.fromLngLat(i)}coordinateLocation(i){return i&&i.toLngLat()}pointCoordinate(i,h){if(h){const G=h.pointCoordinate(i);if(G!=null)return G}const m=[i.x,i.y,0,1],g=[i.x,i.y,1,1];c.af(m,m,this.pixelMatrixInverse),c.af(g,g,this.pixelMatrixInverse);const _=m[3],A=g[3],M=m[1]/_,P=g[1]/A,V=m[2]/_,O=g[2]/A,L=V===O?0:(0-V)/(O-V);return new c.Z(c.y.number(m[0]/_,g[0]/A,L)/this.worldSize,c.y.number(M,P,L)/this.worldSize)}coordinatePoint(i,h=0,m=this.pixelMatrix){const g=[i.x*this.worldSize,i.y*this.worldSize,h,1];return c.af(g,g,m),new c.P(g[0]/g[3],g[1]/g[3])}getBounds(){const i=Math.max(0,this.height/2-this.getHorizon());return new Ce().extend(this.pointLocation(new c.P(0,i))).extend(this.pointLocation(new c.P(this.width,i))).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 Ce([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(i){i?(this.lngRange=[i.getWest(),i.getEast()],this.latRange=[i.getSouth(),i.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-85.051129,su])}calculateTileMatrix(i){const h=i.canonical,m=this.worldSize/this.zoomScale(h.z),g=h.x+Math.pow(2,h.z)*i.wrap,_=c.an(new Float64Array(16));return c.J(_,_,[g*m,h.y*m,0]),c.K(_,_,[m/c.X,m/c.X,1]),_}calculatePosMatrix(i,h=!1){const m=i.key,g=h?this._alignedPosMatrixCache:this._posMatrixCache;if(g[m])return g[m];const _=this.calculateTileMatrix(i);return c.L(_,h?this.alignedModelViewProjectionMatrix:this.modelViewProjectionMatrix,_),g[m]=new Float32Array(_),g[m]}calculateFogMatrix(i){const h=i.key,m=this._fogMatrixCache;if(m[h])return m[h];const g=this.calculateTileMatrix(i);return c.L(g,this.fogMatrix,g),m[h]=new Float32Array(g),m[h]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(i,h){h=c.ac(+h,this.minZoom,this.maxZoom);const m={center:new c.N(i.lng,i.lat),zoom:h};let g=this.lngRange;if(!this._renderWorldCopies&&g===null){const te=179.9999999999;g=[-te,te]}const _=this.tileSize*this.zoomScale(m.zoom);let A=0,M=_,P=0,V=_,O=0,L=0;const{x:G,y:K}=this.size;if(this.latRange){const te=this.latRange;A=c.Q(te[1])*_,M=c.Q(te[0])*_,M-A<K&&(O=K/(M-A))}g&&(P=c.b3(c.O(g[0])*_,0,_),V=c.b3(c.O(g[1])*_,0,_),V<P&&(V+=_),V-P<G&&(L=G/(V-P)));const{x:ee,y:ie}=this.project.call({worldSize:_},i);let ae,ce;const he=Math.max(L||0,O||0);if(he){const te=new c.P(L?(V+P)/2:ee,O?(M+A)/2:ie);return m.center=this.unproject.call({worldSize:_},te).wrap(),m.zoom+=this.scaleZoom(he),m}if(this.latRange){const te=K/2;ie-te<A&&(ce=A+te),ie+te>M&&(ce=M-te)}if(g){const te=(P+V)/2;let ge=ee;this._renderWorldCopies&&(ge=c.b3(ee,te-_/2,te+_/2));const _e=G/2;ge-_e<P&&(ae=P+_e),ge+_e>V&&(ae=V-_e)}if(ae!==void 0||ce!==void 0){const te=new c.P(ae??ee,ce??ie);m.center=this.unproject.call({worldSize:_},te).wrap()}return m}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const i=this._unmodified,{center:h,zoom:m}=this.getConstrained(this.center,this.zoom);this.center=h,this.zoom=m,this._unmodified=i,this._constraining=!1}_calcMatrices(){if(!this.height)return;const i=this.centerOffset,h=this.point.x,m=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=c.b5(1,this.center.lat)*this.worldSize;let g=c.an(new Float64Array(16));c.K(g,g,[this.width/2,-this.height/2,1]),c.J(g,g,[1,-1,0]),this.labelPlaneMatrix=g,g=c.an(new Float64Array(16)),c.K(g,g,[1,-1,1]),c.J(g,g,[-1,-1,0]),c.K(g,g,[2/this.width,2/this.height,1]),this.glCoordMatrix=g;const _=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),A=Math.min(this.elevation,this.minElevationForCurrentTile),M=_-A*this._pixelPerMeter/Math.cos(this._pitch),P=A<0?M:_,V=Math.PI/2+this._pitch,O=this._fov*(.5+i.y/this.height),L=Math.sin(O)*P/Math.sin(c.ac(Math.PI-V-O,.01,Math.PI-.01)),G=this.getHorizon(),K=2*Math.atan(G/this.cameraToCenterDistance)*(.5+i.y/(2*G)),ee=Math.sin(K)*P/Math.sin(c.ac(Math.PI-V-K,.01,Math.PI-.01)),ie=Math.min(L,ee);this.farZ=1.01*(Math.cos(Math.PI/2-this._pitch)*ie+P),this.nearZ=this.height/50,g=new Float64Array(16),c.b6(g,this._fov,this.width/this.height,this.nearZ,this.farZ),g[8]=2*-i.x/this.width,g[9]=2*i.y/this.height,this.projectionMatrix=c.ae(g),c.K(g,g,[1,-1,1]),c.J(g,g,[0,0,-this.cameraToCenterDistance]),c.b7(g,g,this._pitch),c.ad(g,g,this.angle),c.J(g,g,[-h,-m,0]),this.mercatorMatrix=c.K([],g,[this.worldSize,this.worldSize,this.worldSize]),c.K(g,g,[1,1,this._pixelPerMeter]),this.pixelMatrix=c.L(new Float64Array(16),this.labelPlaneMatrix,g),c.J(g,g,[0,0,-this.elevation]),this.modelViewProjectionMatrix=g,this.invModelViewProjectionMatrix=c.as([],g),this.fogMatrix=new Float64Array(16),c.b6(this.fogMatrix,this._fov,this.width/this.height,_,this.farZ),this.fogMatrix[8]=2*-i.x/this.width,this.fogMatrix[9]=2*i.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.ad(this.fogMatrix,this.fogMatrix,this.angle),c.J(this.fogMatrix,this.fogMatrix,[-h,-m,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,g);const ae=this.width%2/2,ce=this.height%2/2,he=Math.cos(this.angle),te=Math.sin(this.angle),ge=h-Math.round(h)+he*ae+te*ce,_e=m-Math.round(m)+he*ce+te*ae,we=new Float64Array(g);if(c.J(we,we,[ge>.5?ge-1:ge,_e>.5?_e-1:_e,0]),this.alignedModelViewProjectionMatrix=we,g=c.as(new Float64Array(16),this.pixelMatrix),!g)throw new Error("failed to invert matrix");this.pixelMatrixInverse=g,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const i=this.pointCoordinate(new c.P(0,0)),h=[i.x*this.worldSize,i.y*this.worldSize,0,1];return c.af(h,h,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const i=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new c.P(0,i))}getCameraQueryGeometry(i){const h=this.getCameraPoint();if(i.length===1)return[i[0],h];{let m=h.x,g=h.y,_=h.x,A=h.y;for(const M of i)m=Math.min(m,M.x),g=Math.min(g,M.y),_=Math.max(_,M.x),A=Math.max(A,M.y);return[new c.P(m,g),new c.P(_,g),new c.P(_,A),new c.P(m,A),new c.P(m,g)]}}lngLatToCameraDepth(i,h){const m=this.locationCoordinate(i),g=[m.x*this.worldSize,m.y*this.worldSize,h,1];return c.af(g,g,this.modelViewProjectionMatrix),g[2]/g[3]}}function tl(x,i){let h,m=!1,g=null,_=null;const A=()=>{g=null,m&&(x.apply(_,h),g=setTimeout(A,i),m=!1)};return(...M)=>(m=!0,_=this,h=M,g||A(),g)}class gc{constructor(i){this._getCurrentHash=()=>{const h=window.location.hash.replace("#","");if(this._hashName){let m;return h.split("&").map(g=>g.split("=")).forEach(g=>{g[0]===this._hashName&&(m=g)}),(m&&m[1]||"").split("/")}return h.split("/")},this._onHashChange=()=>{const h=this._getCurrentHash();if(h.length>=3&&!h.some(m=>isNaN(m))){const m=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(h[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+h[2],+h[1]],zoom:+h[0],bearing:m,pitch:+(h[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const h=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,h)},this._removeHash=()=>{const h=this._getCurrentHash();if(h.length===0)return;const m=h.join("/");let g=m;g.split("&").length>0&&(g=g.split("&")[0]),this._hashName&&(g=`${this._hashName}=${m}`);let _=window.location.hash.replace(g,"");_.startsWith("#&")?_=_.slice(0,1)+_.slice(2):_==="#"&&(_="");let A=window.location.href.replace(/(#.+)?$/,_);A=A.replace("&&","&"),window.history.replaceState(window.history.state,null,A)},this._updateHash=tl(this._updateHashUnthrottled,300),this._hashName=i&&encodeURIComponent(i)}addTo(i){return this._map=i,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(i){const h=this._map.getCenter(),m=Math.round(100*this._map.getZoom())/100,g=Math.ceil((m*Math.LN2+Math.log(512/360/.5))/Math.LN10),_=Math.pow(10,g),A=Math.round(h.lng*_)/_,M=Math.round(h.lat*_)/_,P=this._map.getBearing(),V=this._map.getPitch();let O="";if(O+=i?`/${A}/${M}/${m}`:`${m}/${M}/${A}`,(P||V)&&(O+="/"+Math.round(10*P)/10),V&&(O+=`/${Math.round(V)}`),this._hashName){const L=this._hashName;let G=!1;const K=window.location.hash.slice(1).split("&").map(ee=>{const ie=ee.split("=")[0];return ie===L?(G=!0,`${ie}=${O}`):ee}).filter(ee=>ee);return G||K.push(`${L}=${O}`),`#${K.join("&")}`}return`#${O}`}}const yc={linearity:.3,easing:c.b8(0,0,.3,1)},ou=c.e({deceleration:2500,maxSpeed:1400},yc),e0=c.e({deceleration:20,maxSpeed:1400},yc),tf=c.e({deceleration:1e3,maxSpeed:360},yc),_c=c.e({deceleration:1e3,maxSpeed:90},yc);class au{constructor(i){this._map=i,this.clear()}clear(){this._inertiaBuffer=[]}record(i){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:C.now(),settings:i})}_drainInertiaBuffer(){const i=this._inertiaBuffer,h=C.now();for(;i.length>0&&h-i[0].time>160;)i.shift()}_onMoveEnd(i){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const h={zoom:0,bearing:0,pitch:0,pan:new c.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:_}of this._inertiaBuffer)h.zoom+=_.zoomDelta||0,h.bearing+=_.bearingDelta||0,h.pitch+=_.pitchDelta||0,_.panDelta&&h.pan._add(_.panDelta),_.around&&(h.around=_.around),_.pinchAround&&(h.pinchAround=_.pinchAround);const m=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,g={};if(h.pan.mag()){const _=rl(h.pan.mag(),m,c.e({},ou,i||{}));g.offset=h.pan.mult(_.amount/h.pan.mag()),g.center=this._map.transform.center,nl(g,_)}if(h.zoom){const _=rl(h.zoom,m,e0);g.zoom=this._map.transform.zoom+_.amount,nl(g,_)}if(h.bearing){const _=rl(h.bearing,m,tf);g.bearing=this._map.transform.bearing+c.ac(_.amount,-179,179),nl(g,_)}if(h.pitch){const _=rl(h.pitch,m,_c);g.pitch=this._map.transform.pitch+_.amount,nl(g,_)}if(g.zoom||g.bearing){const _=h.pinchAround===void 0?h.around:h.pinchAround;g.around=_?this._map.unproject(_):this._map.getCenter()}return this.clear(),c.e(g,{noMoveStart:!0})}}function nl(x,i){(!x.duration||x.duration<i.duration)&&(x.duration=i.duration,x.easing=i.easing)}function rl(x,i,h){const{maxSpeed:m,linearity:g,deceleration:_}=h,A=c.ac(x*g/(i/1e3),-m,m),M=Math.abs(A)/(_*g);return{easing:h.easing,duration:1e3*M,amount:A*(M/2)}}class Sr extends c.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(i,h,m,g={}){const _=T.mousePos(h.getCanvas(),m),A=h.unproject(_);super(i,c.e({point:_,lngLat:A,originalEvent:m},g)),this._defaultPrevented=!1,this.target=h}}class _o extends c.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(i,h,m){const g=i==="touchend"?m.changedTouches:m.touches,_=T.touchPos(h.getCanvasContainer(),g),A=_.map(P=>h.unproject(P)),M=_.reduce((P,V,O,L)=>P.add(V.div(L.length)),new c.P(0,0));super(i,{points:_,point:M,lngLats:A,lngLat:h.unproject(M),originalEvent:m}),this._defaultPrevented=!1}}class nf extends c.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(i,h,m){super(i,{originalEvent:m}),this._defaultPrevented=!1}}class rf{constructor(i,h){this._map=i,this._clickTolerance=h.clickTolerance}reset(){delete this._mousedownPos}wheel(i){return this._firePreventable(new nf(i.type,this._map,i))}mousedown(i,h){return this._mousedownPos=h,this._firePreventable(new Sr(i.type,this._map,i))}mouseup(i){this._map.fire(new Sr(i.type,this._map,i))}click(i,h){this._mousedownPos&&this._mousedownPos.dist(h)>=this._clickTolerance||this._map.fire(new Sr(i.type,this._map,i))}dblclick(i){return this._firePreventable(new Sr(i.type,this._map,i))}mouseover(i){this._map.fire(new Sr(i.type,this._map,i))}mouseout(i){this._map.fire(new Sr(i.type,this._map,i))}touchstart(i){return this._firePreventable(new _o(i.type,this._map,i))}touchmove(i){this._map.fire(new _o(i.type,this._map,i))}touchend(i){this._map.fire(new _o(i.type,this._map,i))}touchcancel(i){this._map.fire(new _o(i.type,this._map,i))}_firePreventable(i){if(this._map.fire(i),i.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class tr{constructor(i){this._map=i}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(i){this._map.fire(new Sr(i.type,this._map,i))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Sr("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(i){this._delayContextMenu?this._contextMenuEvent=i:this._ignoreContextMenu||this._map.fire(new Sr(i.type,this._map,i)),this._map.listens("contextmenu")&&i.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class zi{constructor(i){this._map=i}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(i){return this.transform.pointLocation(c.P.convert(i),this._map.terrain)}}class oi{constructor(i,h){this._map=i,this._tr=new zi(i),this._el=i.getCanvasContainer(),this._container=i.getContainer(),this._clickTolerance=h.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(i,h){this.isEnabled()&&i.shiftKey&&i.button===0&&(T.disableDrag(),this._startPos=this._lastPos=h,this._active=!0)}mousemoveWindow(i,h){if(!this._active)return;const m=h;if(this._lastPos.equals(m)||!this._box&&m.dist(this._startPos)<this._clickTolerance)return;const g=this._startPos;this._lastPos=m,this._box||(this._box=T.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",i));const _=Math.min(g.x,m.x),A=Math.max(g.x,m.x),M=Math.min(g.y,m.y),P=Math.max(g.y,m.y);T.setTransform(this._box,`translate(${_}px,${M}px)`),this._box.style.width=A-_+"px",this._box.style.height=P-M+"px"}mouseupWindow(i,h){if(!this._active||i.button!==0)return;const m=this._startPos,g=h;if(this.reset(),T.suppressClick(),m.x!==g.x||m.y!==g.y)return this._map.fire(new c.k("boxzoomend",{originalEvent:i})),{cameraAnimation:_=>_.fitScreenCoordinates(m,g,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",i)}keydown(i){this._active&&i.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",i))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(T.remove(this._box),this._box=null),T.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(i,h){return this._map.fire(new c.k(i,{originalEvent:h}))}}function il(x,i){if(x.length!==i.length)throw new Error(`The number of touches and points are not equal - touches ${x.length}, points ${i.length}`);const h={};for(let m=0;m<x.length;m++)h[x[m].identifier]=i[m];return h}class lu{constructor(i){this.reset(),this.numTouches=i.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(i,h,m){(this.centroid||m.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=i.timeStamp),m.length===this.numTouches&&(this.centroid=function(g){const _=new c.P(0,0);for(const A of g)_._add(A);return _.div(g.length)}(h),this.touches=il(m,h)))}touchmove(i,h,m){if(this.aborted||!this.centroid)return;const g=il(m,h);for(const _ in this.touches){const A=g[_];(!A||A.dist(this.touches[_])>30)&&(this.aborted=!0)}}touchend(i,h,m){if((!this.centroid||i.timeStamp-this.startTime>500)&&(this.aborted=!0),m.length===0){const g=!this.aborted&&this.centroid;if(this.reset(),g)return g}}}class bc{constructor(i){this.singleTap=new lu(i),this.numTaps=i.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(i,h,m){this.singleTap.touchstart(i,h,m)}touchmove(i,h,m){this.singleTap.touchmove(i,h,m)}touchend(i,h,m){const g=this.singleTap.touchend(i,h,m);if(g){const _=i.timeStamp-this.lastTime<500,A=!this.lastTap||this.lastTap.dist(g)<30;if(_&&A||this.reset(),this.count++,this.lastTime=i.timeStamp,this.lastTap=g,this.count===this.numTaps)return this.reset(),g}}}class ra{constructor(i){this._tr=new zi(i),this._zoomIn=new bc({numTouches:1,numTaps:2}),this._zoomOut=new bc({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(i,h,m){this._zoomIn.touchstart(i,h,m),this._zoomOut.touchstart(i,h,m)}touchmove(i,h,m){this._zoomIn.touchmove(i,h,m),this._zoomOut.touchmove(i,h,m)}touchend(i,h,m){const g=this._zoomIn.touchend(i,h,m),_=this._zoomOut.touchend(i,h,m),A=this._tr;return g?(this._active=!0,i.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:M=>M.easeTo({duration:300,zoom:A.zoom+1,around:A.unproject(g)},{originalEvent:i})}):_?(this._active=!0,i.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:M=>M.easeTo({duration:300,zoom:A.zoom-1,around:A.unproject(_)},{originalEvent:i})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class ys{constructor(i){this._enabled=!!i.enable,this._moveStateManager=i.moveStateManager,this._clickTolerance=i.clickTolerance||1,this._moveFunction=i.move,this._activateOnStart=!!i.activateOnStart,i.assignEvents(this),this.reset()}reset(i){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(i)}_move(...i){const h=this._moveFunction(...i);if(h.bearingDelta||h.pitchDelta||h.around||h.panDelta)return this._active=!0,h}dragStart(i,h){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(i)&&(this._moveStateManager.startMove(i),this._lastPoint=h.length?h[0]:h,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(i,h){if(!this.isEnabled())return;const m=this._lastPoint;if(!m)return;if(i.preventDefault(),!this._moveStateManager.isValidMoveEvent(i))return void this.reset(i);const g=h.length?h[0]:h;return!this._moved&&g.dist(m)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=g,this._move(m,g))}dragEnd(i){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(i)&&(this._moved&&T.suppressClick(),this.reset(i))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}const cu={0:1,2:2};class xc{constructor(i){this._correctEvent=i.checkCorrectEvent}startMove(i){const h=T.mouseButton(i);this._eventButton=h}endMove(i){delete this._eventButton}isValidStartEvent(i){return this._correctEvent(i)}isValidMoveEvent(i){return!function(h,m){const g=cu[m];return h.buttons===void 0||(h.buttons&g)!==g}(i,this._eventButton)}isValidEndEvent(i){return T.mouseButton(i)===this._eventButton}}class du{constructor(){this._firstTouch=void 0}_isOneFingerTouch(i){return i.targetTouches.length===1}_isSameTouchEvent(i){return i.targetTouches[0].identifier===this._firstTouch}startMove(i){this._firstTouch=i.targetTouches[0].identifier}endMove(i){delete this._firstTouch}isValidStartEvent(i){return this._isOneFingerTouch(i)}isValidMoveEvent(i){return this._isOneFingerTouch(i)&&this._isSameTouchEvent(i)}isValidEndEvent(i){return this._isOneFingerTouch(i)&&this._isSameTouchEvent(i)}}const vc=x=>{x.mousedown=x.dragStart,x.mousemoveWindow=x.dragMove,x.mouseup=x.dragEnd,x.contextmenu=i=>{i.preventDefault()}},uu=({enable:x,clickTolerance:i,bearingDegreesPerPixelMoved:h=.8})=>{const m=new xc({checkCorrectEvent:g=>T.mouseButton(g)===0&&g.ctrlKey||T.mouseButton(g)===2});return new ys({clickTolerance:i,move:(g,_)=>({bearingDelta:(_.x-g.x)*h}),moveStateManager:m,enable:x,assignEvents:vc})},hu=({enable:x,clickTolerance:i,pitchDegreesPerPixelMoved:h=-.5})=>{const m=new xc({checkCorrectEvent:g=>T.mouseButton(g)===0&&g.ctrlKey||T.mouseButton(g)===2});return new ys({clickTolerance:i,move:(g,_)=>({pitchDelta:(_.y-g.y)*h}),moveStateManager:m,enable:x,assignEvents:vc})};class bo{constructor(i,h){this._clickTolerance=i.clickTolerance||1,this._map=h,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new c.P(0,0)}_shouldBePrevented(i){return i<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(i,h,m){return this._calculateTransform(i,h,m)}touchmove(i,h,m){if(this._active){if(!this._shouldBePrevented(m.length))return i.preventDefault(),this._calculateTransform(i,h,m);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",i)}}touchend(i,h,m){this._calculateTransform(i,h,m),this._active&&this._shouldBePrevented(m.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(i,h,m){m.length>0&&(this._active=!0);const g=il(m,h),_=new c.P(0,0),A=new c.P(0,0);let M=0;for(const V in g){const O=g[V],L=this._touches[V];L&&(_._add(O),A._add(O.sub(L)),M++,g[V]=O)}if(this._touches=g,this._shouldBePrevented(M)||!A.mag())return;const P=A.div(M);return this._sum._add(P),this._sum.mag()<this._clickTolerance?void 0:{around:_.div(M),panDelta:P}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class wc{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(i,h,m){this._firstTwoTouches||m.length<2||(this._firstTwoTouches=[m[0].identifier,m[1].identifier],this._start([h[0],h[1]]))}touchmove(i,h,m){if(!this._firstTwoTouches)return;i.preventDefault();const[g,_]=this._firstTwoTouches,A=sl(m,h,g),M=sl(m,h,_);if(!A||!M)return;const P=this._aroundCenter?null:A.add(M).div(2);return this._move([A,M],P,i)}touchend(i,h,m){if(!this._firstTwoTouches)return;const[g,_]=this._firstTwoTouches,A=sl(m,h,g),M=sl(m,h,_);A&&M||(this._active&&T.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(i){this._enabled=!0,this._aroundCenter=!!i&&i.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function sl(x,i,h){for(let m=0;m<x.length;m++)if(x[m].identifier===h)return i[m]}function pu(x,i){return Math.log(x/i)/Math.LN2}class fu extends wc{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(i){this._startDistance=this._distance=i[0].dist(i[1])}_move(i,h){const m=this._distance;if(this._distance=i[0].dist(i[1]),this._active||!(Math.abs(pu(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:pu(this._distance,m),pinchAround:h}}}function mu(x,i){return 180*x.angleWith(i)/Math.PI}class gu extends wc{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(i){this._startVector=this._vector=i[0].sub(i[1]),this._minDiameter=i[0].dist(i[1])}_move(i,h,m){const g=this._vector;if(this._vector=i[0].sub(i[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:mu(this._vector,g),pinchAround:h}}_isBelowThreshold(i){this._minDiameter=Math.min(this._minDiameter,i.mag());const h=25/(Math.PI*this._minDiameter)*360,m=mu(i,this._startVector);return Math.abs(m)<h}}function kc(x){return Math.abs(x.y)>Math.abs(x.x)}class ol extends wc{constructor(i){super(),this._currentTouchCount=0,this._map=i}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(i,h,m){super.touchstart(i,h,m),this._currentTouchCount=m.length}_start(i){this._lastPoints=i,kc(i[0].sub(i[1]))&&(this._valid=!1)}_move(i,h,m){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const g=i[0].sub(this._lastPoints[0]),_=i[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(g,_,m.timeStamp),this._valid?(this._lastPoints=i,this._active=!0,{pitchDelta:(g.y+_.y)/2*-.5}):void 0}gestureBeginsVertically(i,h,m){if(this._valid!==void 0)return this._valid;const g=i.mag()>=2,_=h.mag()>=2;if(!g&&!_)return;if(!g||!_)return this._firstMove===void 0&&(this._firstMove=m),m-this._firstMove<100&&void 0;const A=i.y>0==h.y>0;return kc(i)&&kc(h)&&A}}const sf={panStep:100,bearingStep:15,pitchStep:10};class xi{constructor(i){this._tr=new zi(i);const h=sf;this._panStep=h.panStep,this._bearingStep=h.bearingStep,this._pitchStep=h.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(i){if(i.altKey||i.ctrlKey||i.metaKey)return;let h=0,m=0,g=0,_=0,A=0;switch(i.keyCode){case 61:case 107:case 171:case 187:h=1;break;case 189:case 109:case 173:h=-1;break;case 37:i.shiftKey?m=-1:(i.preventDefault(),_=-1);break;case 39:i.shiftKey?m=1:(i.preventDefault(),_=1);break;case 38:i.shiftKey?g=1:(i.preventDefault(),A=-1);break;case 40:i.shiftKey?g=-1:(i.preventDefault(),A=1);break;default:return}return this._rotationDisabled&&(m=0,g=0),{cameraAnimation:M=>{const P=this._tr;M.easeTo({duration:300,easeId:"keyboardHandler",easing:ts,zoom:h?Math.round(P.zoom)+h*(i.shiftKey?2:1):P.zoom,bearing:P.bearing+m*this._bearingStep,pitch:P.pitch+g*this._pitchStep,offset:[-_*this._panStep,-A*this._panStep],center:P.center},{originalEvent:i})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function ts(x){return x*(2-x)}const yu=4.000244140625;class Oi{constructor(i,h){this._onTimeout=m=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(m)},this._map=i,this._tr=new zi(i),this._triggerRenderFrame=h,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(i){this._defaultZoomRate=i}setWheelZoomRate(i){this._wheelZoomRate=i}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(i){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!i&&i.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(i){return!!this._map.cooperativeGestures.isEnabled()&&!(i.ctrlKey||this._map.cooperativeGestures.isBypassed(i))}wheel(i){if(!this.isEnabled())return;if(this._shouldBePrevented(i))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",i);let h=i.deltaMode===WheelEvent.DOM_DELTA_LINE?40*i.deltaY:i.deltaY;const m=C.now(),g=m-(this._lastWheelEventTime||0);this._lastWheelEventTime=m,h!==0&&h%yu==0?this._type="wheel":h!==0&&Math.abs(h)<4?this._type="trackpad":g>400?(this._type=null,this._lastValue=h,this._timeout=setTimeout(this._onTimeout,40,i)):this._type||(this._type=Math.abs(g*h)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,h+=this._lastValue)),i.shiftKey&&h&&(h/=4),this._type&&(this._lastWheelEvent=i,this._delta-=h,this._active||this._start(i)),i.preventDefault()}_start(i){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const h=T.mousePos(this._map.getCanvas(),i),m=this._tr;this._around=h.y>m.transform.height/2-m.transform.getHorizon()?c.N.convert(this._aroundCenter?m.center:m.unproject(h)):c.N.convert(m.center),this._aroundPoint=m.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const i=this._tr.transform;if(this._delta!==0){const P=this._type==="wheel"&&Math.abs(this._delta)>yu?this._wheelZoomRate:this._defaultZoomRate;let V=2/(1+Math.exp(-Math.abs(this._delta*P)));this._delta<0&&V!==0&&(V=1/V);const O=typeof this._targetZoom=="number"?i.zoomScale(this._targetZoom):i.scale;this._targetZoom=Math.min(i.maxZoom,Math.max(i.minZoom,i.scaleZoom(O*V))),this._type==="wheel"&&(this._startZoom=i.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const h=typeof this._targetZoom=="number"?this._targetZoom:i.zoom,m=this._startZoom,g=this._easing;let _,A=!1;const M=C.now()-this._lastWheelEventTime;if(this._type==="wheel"&&m&&g&&M){const P=Math.min(M/200,1),V=g(P);_=c.y.number(m,h,V),P<1?this._frameId||(this._frameId=!0):A=!0}else _=h,A=!0;return this._active=!0,A&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!A,zoomDelta:_-i.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(i){let h=c.b9;if(this._prevEase){const m=this._prevEase,g=(C.now()-m.start)/m.duration,_=m.easing(g+.01)-m.easing(g),A=.27/Math.sqrt(_*_+1e-4)*.01,M=Math.sqrt(.0729-A*A);h=c.b8(A,M,.25,1)}return this._prevEase={start:C.now(),duration:i,easing:h},h}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class xo{constructor(i,h){this._clickZoom=i,this._tapZoom=h}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 t0{constructor(i){this._tr=new zi(i),this.reset()}reset(){this._active=!1}dblclick(i,h){return i.preventDefault(),{cameraAnimation:m=>{m.easeTo({duration:300,zoom:this._tr.zoom+(i.shiftKey?-1:1),around:this._tr.unproject(h)},{originalEvent:i})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class n0{constructor(){this._tap=new bc({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(i,h,m){if(!this._swipePoint)if(this._tapTime){const g=h[0],_=i.timeStamp-this._tapTime<500,A=this._tapPoint.dist(g)<30;_&&A?m.length>0&&(this._swipePoint=g,this._swipeTouch=m[0].identifier):this.reset()}else this._tap.touchstart(i,h,m)}touchmove(i,h,m){if(this._tapTime){if(this._swipePoint){if(m[0].identifier!==this._swipeTouch)return;const g=h[0],_=g.y-this._swipePoint.y;return this._swipePoint=g,i.preventDefault(),this._active=!0,{zoomDelta:_/128}}}else this._tap.touchmove(i,h,m)}touchend(i,h,m){if(this._tapTime)this._swipePoint&&m.length===0&&this.reset();else{const g=this._tap.touchend(i,h,m);g&&(this._tapTime=i.timeStamp,this._tapPoint=g)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class of{constructor(i,h,m){this._el=i,this._mousePan=h,this._touchPan=m}enable(i){this._inertiaOptions=i||{},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 af{constructor(i,h,m){this._pitchWithRotate=i.pitchWithRotate,this._mouseRotate=h,this._mousePitch=m}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 _u{constructor(i,h,m,g){this._el=i,this._touchZoom=h,this._touchRotate=m,this._tapDragZoom=g,this._rotationDisabled=!1,this._enabled=!0}enable(i){this._touchZoom.enable(i),this._rotationDisabled||this._touchRotate.enable(i),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}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 ia{constructor(i,h){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=i,this._options=h,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const i=this._map.getCanvasContainer();i.classList.add("maplibregl-cooperative-gestures"),this._container=T.create("div","maplibregl-cooperative-gesture-screen",i);let h=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(h=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const m=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),g=document.createElement("div");g.className="maplibregl-desktop-message",g.textContent=h,this._container.appendChild(g);const _=document.createElement("div");_.className="maplibregl-mobile-message",_.textContent=m,this._container.appendChild(_),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(T.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(i){return i[this._bypassKey]}notifyGestureBlocked(i,h){this._enabled&&(this._map.fire(new c.k("cooperativegestureprevented",{gestureType:i,originalEvent:h})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const vi=x=>x.zoom||x.drag||x.pitch||x.rotate;class dt extends c.k{}function Ec(x){return x.panDelta&&x.panDelta.mag()||x.zoomDelta||x.bearingDelta||x.pitchDelta}class bu{constructor(i,h){this.handleWindowEvent=g=>{this.handleEvent(g,`${g.type}Window`)},this.handleEvent=(g,_)=>{if(g.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const A=g.type==="renderFrame"?void 0:g,M={needsRenderFrame:!1},P={},V={},O=g.touches,L=O?this._getMapTouches(O):void 0,G=L?T.touchPos(this._map.getCanvas(),L):T.mousePos(this._map.getCanvas(),g);for(const{handlerName:ie,handler:ae,allowed:ce}of this._handlers){if(!ae.isEnabled())continue;let he;this._blockedByActive(V,ce,ie)?ae.reset():ae[_||g.type]&&(he=ae[_||g.type](g,G,L),this.mergeHandlerResult(M,P,he,ie,A),he&&he.needsRenderFrame&&this._triggerRenderFrame()),(he||ae.isActive())&&(V[ie]=ae)}const K={};for(const ie in this._previousActiveHandlers)V[ie]||(K[ie]=A);this._previousActiveHandlers=V,(Object.keys(K).length||Ec(M))&&(this._changes.push([M,P,K]),this._triggerRenderFrame()),(Object.keys(V).length||Ec(M))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:ee}=M;ee&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],ee(this._map))},this._map=i,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new au(i),this._bearingSnap=h.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(h);const m=this._el;this._listeners=[[m,"touchstart",{passive:!0}],[m,"touchmove",{passive:!1}],[m,"touchend",void 0],[m,"touchcancel",void 0],[m,"mousedown",void 0],[m,"mousemove",void 0],[m,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[m,"mouseover",void 0],[m,"mouseout",void 0],[m,"dblclick",void 0],[m,"click",void 0],[m,"keydown",{capture:!1}],[m,"keyup",void 0],[m,"wheel",{passive:!1}],[m,"contextmenu",void 0],[window,"blur",void 0]];for(const[g,_,A]of this._listeners)T.addEventListener(g,_,g===document?this.handleWindowEvent:this.handleEvent,A)}destroy(){for(const[i,h,m]of this._listeners)T.removeEventListener(i,h,i===document?this.handleWindowEvent:this.handleEvent,m)}_addDefaultHandlers(i){const h=this._map,m=h.getCanvasContainer();this._add("mapEvent",new rf(h,i));const g=h.boxZoom=new oi(h,i);this._add("boxZoom",g),i.interactive&&i.boxZoom&&g.enable();const _=h.cooperativeGestures=new ia(h,i.cooperativeGestures);this._add("cooperativeGestures",_),i.cooperativeGestures&&_.enable();const A=new ra(h),M=new t0(h);h.doubleClickZoom=new xo(M,A),this._add("tapZoom",A),this._add("clickZoom",M),i.interactive&&i.doubleClickZoom&&h.doubleClickZoom.enable();const P=new n0;this._add("tapDragZoom",P);const V=h.touchPitch=new ol(h);this._add("touchPitch",V),i.interactive&&i.touchPitch&&h.touchPitch.enable(i.touchPitch);const O=uu(i),L=hu(i);h.dragRotate=new af(i,O,L),this._add("mouseRotate",O,["mousePitch"]),this._add("mousePitch",L,["mouseRotate"]),i.interactive&&i.dragRotate&&h.dragRotate.enable();const G=(({enable:he,clickTolerance:te})=>{const ge=new xc({checkCorrectEvent:_e=>T.mouseButton(_e)===0&&!_e.ctrlKey});return new ys({clickTolerance:te,move:(_e,we)=>({around:we,panDelta:we.sub(_e)}),activateOnStart:!0,moveStateManager:ge,enable:he,assignEvents:vc})})(i),K=new bo(i,h);h.dragPan=new of(m,G,K),this._add("mousePan",G),this._add("touchPan",K,["touchZoom","touchRotate"]),i.interactive&&i.dragPan&&h.dragPan.enable(i.dragPan);const ee=new gu,ie=new fu;h.touchZoomRotate=new _u(m,ie,ee,P),this._add("touchRotate",ee,["touchPan","touchZoom"]),this._add("touchZoom",ie,["touchPan","touchRotate"]),i.interactive&&i.touchZoomRotate&&h.touchZoomRotate.enable(i.touchZoomRotate);const ae=h.scrollZoom=new Oi(h,()=>this._triggerRenderFrame());this._add("scrollZoom",ae,["mousePan"]),i.interactive&&i.scrollZoom&&h.scrollZoom.enable(i.scrollZoom);const ce=h.keyboard=new xi(h);this._add("keyboard",ce),i.interactive&&i.keyboard&&h.keyboard.enable(),this._add("blockableMapEvent",new tr(h))}_add(i,h,m){this._handlers.push({handlerName:i,handler:h,allowed:m}),this._handlersById[i]=h}stop(i){if(!this._updatingCamera){for(const{handler:h}of this._handlers)h.reset();this._inertia.clear(),this._fireEvents({},{},i),this._changes=[]}}isActive(){for(const{handler:i}of this._handlers)if(i.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!vi(this._eventsInProgress)||this.isZooming()}_blockedByActive(i,h,m){for(const g in i)if(g!==m&&(!h||h.indexOf(g)<0))return!0;return!1}_getMapTouches(i){const h=[];for(const m of i)this._el.contains(m.target)&&h.push(m);return h}mergeHandlerResult(i,h,m,g,_){if(!m)return;c.e(i,m);const A={handlerName:g,originalEvent:m.originalEvent||_};m.zoomDelta!==void 0&&(h.zoom=A),m.panDelta!==void 0&&(h.drag=A),m.pitchDelta!==void 0&&(h.pitch=A),m.bearingDelta!==void 0&&(h.rotate=A)}_applyChanges(){const i={},h={},m={};for(const[g,_,A]of this._changes)g.panDelta&&(i.panDelta=(i.panDelta||new c.P(0,0))._add(g.panDelta)),g.zoomDelta&&(i.zoomDelta=(i.zoomDelta||0)+g.zoomDelta),g.bearingDelta&&(i.bearingDelta=(i.bearingDelta||0)+g.bearingDelta),g.pitchDelta&&(i.pitchDelta=(i.pitchDelta||0)+g.pitchDelta),g.around!==void 0&&(i.around=g.around),g.pinchAround!==void 0&&(i.pinchAround=g.pinchAround),g.noInertia&&(i.noInertia=g.noInertia),c.e(h,_),c.e(m,A);this._updateMapTransform(i,h,m),this._changes=[]}_updateMapTransform(i,h,m){const g=this._map,_=g._getTransformForUpdate(),A=g.terrain;if(!(Ec(i)||A&&this._terrainMovement))return this._fireEvents(h,m,!0);let{panDelta:M,zoomDelta:P,bearingDelta:V,pitchDelta:O,around:L,pinchAround:G}=i;G!==void 0&&(L=G),g._stop(!0),L=L||g.transform.centerPoint;const K=_.pointLocation(M?L.sub(M):L);V&&(_.bearing+=V),O&&(_.pitch+=O),P&&(_.zoom+=P),A?this._terrainMovement||!h.drag&&!h.zoom?h.drag&&this._terrainMovement?_.center=_.pointLocation(_.centerPoint.sub(M)):_.setLocationAtPoint(K,L):(this._terrainMovement=!0,this._map._elevationFreeze=!0,_.setLocationAtPoint(K,L)):_.setLocationAtPoint(K,L),g._applyUpdatedTransform(_),this._map._update(),i.noInertia||this._inertia.record(i),this._fireEvents(h,m,!0)}_fireEvents(i,h,m){const g=vi(this._eventsInProgress),_=vi(i),A={};for(const L in i){const{originalEvent:G}=i[L];this._eventsInProgress[L]||(A[`${L}start`]=G),this._eventsInProgress[L]=i[L]}!g&&_&&this._fireEvent("movestart",_.originalEvent);for(const L in A)this._fireEvent(L,A[L]);_&&this._fireEvent("move",_.originalEvent);for(const L in i){const{originalEvent:G}=i[L];this._fireEvent(L,G)}const M={};let P;for(const L in this._eventsInProgress){const{handlerName:G,originalEvent:K}=this._eventsInProgress[L];this._handlersById[G].isActive()||(delete this._eventsInProgress[L],P=h[G]||K,M[`${L}end`]=P)}for(const L in M)this._fireEvent(L,M[L]);const V=vi(this._eventsInProgress),O=(g||_)&&!V;if(O&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const L=this._map._getTransformForUpdate();L.recalculateZoom(this._map.terrain),this._map._applyUpdatedTransform(L)}if(m&&O){this._updatingCamera=!0;const L=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),G=K=>K!==0&&-this._bearingSnap<K&&K<this._bearingSnap;!L||!L.essential&&C.prefersReducedMotion?(this._map.fire(new c.k("moveend",{originalEvent:P})),G(this._map.getBearing())&&this._map.resetNorth()):(G(L.bearing||this._map.getBearing())&&(L.bearing=0),L.freezeElevation=!0,this._map.easeTo(L,{originalEvent:P})),this._updatingCamera=!1}}_fireEvent(i,h){this._map.fire(new c.k(i,h?{originalEvent:h}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(i=>{delete this._frameId,this.handleEvent(new dt("renderFrame",{timeStamp:i})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class lf extends c.E{constructor(i,h){super(),this._renderFrameCallback=()=>{const m=Math.min((C.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(m)),m<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=i,this._bearingSnap=h.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new c.N(this.transform.center.lng,this.transform.center.lat)}setCenter(i,h){return this.jumpTo({center:i},h)}panBy(i,h,m){return i=c.P.convert(i).mult(-1),this.panTo(this.transform.center,c.e({offset:i},h),m)}panTo(i,h,m){return this.easeTo(c.e({center:i},h),m)}getZoom(){return this.transform.zoom}setZoom(i,h){return this.jumpTo({zoom:i},h),this}zoomTo(i,h,m){return this.easeTo(c.e({zoom:i},h),m)}zoomIn(i,h){return this.zoomTo(this.getZoom()+1,i,h),this}zoomOut(i,h){return this.zoomTo(this.getZoom()-1,i,h),this}getBearing(){return this.transform.bearing}setBearing(i,h){return this.jumpTo({bearing:i},h),this}getPadding(){return this.transform.padding}setPadding(i,h){return this.jumpTo({padding:i},h),this}rotateTo(i,h,m){return this.easeTo(c.e({bearing:i},h),m)}resetNorth(i,h){return this.rotateTo(0,c.e({duration:1e3},i),h),this}resetNorthPitch(i,h){return this.easeTo(c.e({bearing:0,pitch:0,duration:1e3},i),h),this}snapToNorth(i,h){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(i,h):this}getPitch(){return this.transform.pitch}setPitch(i,h){return this.jumpTo({pitch:i},h),this}cameraForBounds(i,h){i=Ce.convert(i).adjustAntiMeridian();const m=h&&h.bearing||0;return this._cameraForBoxAndBearing(i.getNorthWest(),i.getSouthEast(),m,h)}_cameraForBoxAndBearing(i,h,m,g){const _={top:0,bottom:0,right:0,left:0};if(typeof(g=c.e({padding:_,offset:[0,0],maxZoom:this.transform.maxZoom},g)).padding=="number"){const Ge=g.padding;g.padding={top:Ge,bottom:Ge,right:Ge,left:Ge}}g.padding=c.e(_,g.padding);const A=this.transform,M=A.padding,P=new Ce(i,h),V=A.project(P.getNorthWest()),O=A.project(P.getNorthEast()),L=A.project(P.getSouthEast()),G=A.project(P.getSouthWest()),K=c.ba(-m),ee=V.rotate(K),ie=O.rotate(K),ae=L.rotate(K),ce=G.rotate(K),he=new c.P(Math.max(ee.x,ie.x,ce.x,ae.x),Math.max(ee.y,ie.y,ce.y,ae.y)),te=new c.P(Math.min(ee.x,ie.x,ce.x,ae.x),Math.min(ee.y,ie.y,ce.y,ae.y)),ge=he.sub(te),_e=(A.width-(M.left+M.right+g.padding.left+g.padding.right))/ge.x,we=(A.height-(M.top+M.bottom+g.padding.top+g.padding.bottom))/ge.y;if(we<0||_e<0)return void c.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");const Ne=Math.min(A.scaleZoom(A.scale*Math.min(_e,we)),g.maxZoom),$e=c.P.convert(g.offset),Qe=new c.P((g.padding.left-g.padding.right)/2,(g.padding.top-g.padding.bottom)/2).rotate(c.ba(m)),at=$e.add(Qe).mult(A.scale/A.zoomScale(Ne));return{center:A.unproject(V.add(L).div(2).sub(at)),zoom:Ne,bearing:m}}fitBounds(i,h,m){return this._fitInternal(this.cameraForBounds(i,h),h,m)}fitScreenCoordinates(i,h,m,g,_){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(c.P.convert(i)),this.transform.pointLocation(c.P.convert(h)),m,g),g,_)}_fitInternal(i,h,m){return i?(delete(h=c.e(i,h)).padding,h.linear?this.easeTo(h,m):this.flyTo(h,m)):this}jumpTo(i,h){this.stop();const m=this._getTransformForUpdate();let g=!1,_=!1,A=!1;return"zoom"in i&&m.zoom!==+i.zoom&&(g=!0,m.zoom=+i.zoom),i.center!==void 0&&(m.center=c.N.convert(i.center)),"bearing"in i&&m.bearing!==+i.bearing&&(_=!0,m.bearing=+i.bearing),"pitch"in i&&m.pitch!==+i.pitch&&(A=!0,m.pitch=+i.pitch),i.padding==null||m.isPaddingEqual(i.padding)||(m.padding=i.padding),this._applyUpdatedTransform(m),this.fire(new c.k("movestart",h)).fire(new c.k("move",h)),g&&this.fire(new c.k("zoomstart",h)).fire(new c.k("zoom",h)).fire(new c.k("zoomend",h)),_&&this.fire(new c.k("rotatestart",h)).fire(new c.k("rotate",h)).fire(new c.k("rotateend",h)),A&&this.fire(new c.k("pitchstart",h)).fire(new c.k("pitch",h)).fire(new c.k("pitchend",h)),this.fire(new c.k("moveend",h))}calculateCameraOptionsFromTo(i,h,m,g=0){const _=c.Z.fromLngLat(i,h),A=c.Z.fromLngLat(m,g),M=A.x-_.x,P=A.y-_.y,V=A.z-_.z,O=Math.hypot(M,P,V);if(O===0)throw new Error("Can't calculate camera options with same From and To");const L=Math.hypot(M,P),G=this.transform.scaleZoom(this.transform.cameraToCenterDistance/O/this.transform.tileSize),K=180*Math.atan2(M,-P)/Math.PI;let ee=180*Math.acos(L/O)/Math.PI;return ee=V<0?90-ee:90+ee,{center:A.toLngLat(),zoom:G,pitch:ee,bearing:K}}easeTo(i,h){var m;this._stop(!1,i.easeId),((i=c.e({offset:[0,0],duration:500,easing:c.b9},i)).animate===!1||!i.essential&&C.prefersReducedMotion)&&(i.duration=0);const g=this._getTransformForUpdate(),_=g.zoom,A=g.bearing,M=g.pitch,P=g.padding,V="bearing"in i?this._normalizeBearing(i.bearing,A):A,O="pitch"in i?+i.pitch:M,L="padding"in i?i.padding:g.padding,G=c.P.convert(i.offset);let K=g.centerPoint.add(G);const ee=g.pointLocation(K),{center:ie,zoom:ae}=g.getConstrained(c.N.convert(i.center||ee),(m=i.zoom)!==null&&m!==void 0?m:_);this._normalizeCenter(ie,g);const ce=g.project(ee),he=g.project(ie).sub(ce),te=g.zoomScale(ae-_);let ge,_e;i.around&&(ge=c.N.convert(i.around),_e=g.locationPoint(ge));const we={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||ae!==_,this._rotating=this._rotating||A!==V,this._pitching=this._pitching||O!==M,this._padding=!g.isPaddingEqual(L),this._easeId=i.easeId,this._prepareEase(h,i.noMoveStart,we),this.terrain&&this._prepareElevation(ie),this._ease(Ne=>{if(this._zooming&&(g.zoom=c.y.number(_,ae,Ne)),this._rotating&&(g.bearing=c.y.number(A,V,Ne)),this._pitching&&(g.pitch=c.y.number(M,O,Ne)),this._padding&&(g.interpolatePadding(P,L,Ne),K=g.centerPoint.add(G)),this.terrain&&!i.freezeElevation&&this._updateElevation(Ne),ge)g.setLocationAtPoint(ge,_e);else{const $e=g.zoomScale(g.zoom-_),Qe=ae>_?Math.min(2,te):Math.max(.5,te),at=Math.pow(Qe,1-Ne),Ge=g.unproject(ce.add(he.mult(Ne*at)).mult($e));g.setLocationAtPoint(g.renderWorldCopies?Ge.wrap():Ge,K)}this._applyUpdatedTransform(g),this._fireMoveEvents(h)},Ne=>{this.terrain&&i.freezeElevation&&this._finalizeElevation(),this._afterEase(h,Ne)},i),this}_prepareEase(i,h,m={}){this._moving=!0,h||m.moving||this.fire(new c.k("movestart",i)),this._zooming&&!m.zooming&&this.fire(new c.k("zoomstart",i)),this._rotating&&!m.rotating&&this.fire(new c.k("rotatestart",i)),this._pitching&&!m.pitching&&this.fire(new c.k("pitchstart",i))}_prepareElevation(i){this._elevationCenter=i,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(i,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(i){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const h=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(i<1&&h!==this._elevationTarget){const m=this._elevationTarget-this._elevationStart;this._elevationStart+=i*(m-(h-(m*i+this._elevationStart))/(1-i)),this._elevationTarget=h}this.transform.elevation=c.y.number(this._elevationStart,this._elevationTarget,i)}_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(i){const h=i.getCameraPosition(),m=this.terrain.getElevationForLngLatZoom(h.lngLat,i.zoom);if(h.altitude<m){const g=this.calculateCameraOptionsFromTo(h.lngLat,m,i.center,i.elevation);return{pitch:g.pitch,zoom:g.zoom}}return{}}_applyUpdatedTransform(i){const h=[];if(this.terrain&&h.push(g=>this._elevateCameraIfInsideTerrain(g)),this.transformCameraUpdate&&h.push(g=>this.transformCameraUpdate(g)),!h.length)return;const m=i.clone();for(const g of h){const _=m.clone(),{center:A,zoom:M,pitch:P,bearing:V,elevation:O}=g(_);A&&(_.center=A),M!==void 0&&(_.zoom=M),P!==void 0&&(_.pitch=P),V!==void 0&&(_.bearing=V),O!==void 0&&(_.elevation=O),m.apply(_)}this.transform.apply(m)}_fireMoveEvents(i){this.fire(new c.k("move",i)),this._zooming&&this.fire(new c.k("zoom",i)),this._rotating&&this.fire(new c.k("rotate",i)),this._pitching&&this.fire(new c.k("pitch",i))}_afterEase(i,h){if(this._easeId&&h&&this._easeId===h)return;delete this._easeId;const m=this._zooming,g=this._rotating,_=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,m&&this.fire(new c.k("zoomend",i)),g&&this.fire(new c.k("rotateend",i)),_&&this.fire(new c.k("pitchend",i)),this.fire(new c.k("moveend",i))}flyTo(i,h){var m;if(!i.essential&&C.prefersReducedMotion){const it=c.M(i,["center","zoom","bearing","pitch","around"]);return this.jumpTo(it,h)}this.stop(),i=c.e({offset:[0,0],speed:1.2,curve:1.42,easing:c.b9},i);const g=this._getTransformForUpdate(),_=g.zoom,A=g.bearing,M=g.pitch,P=g.padding,V="bearing"in i?this._normalizeBearing(i.bearing,A):A,O="pitch"in i?+i.pitch:M,L="padding"in i?i.padding:g.padding,G=c.P.convert(i.offset);let K=g.centerPoint.add(G);const ee=g.pointLocation(K),{center:ie,zoom:ae}=g.getConstrained(c.N.convert(i.center||ee),(m=i.zoom)!==null&&m!==void 0?m:_);this._normalizeCenter(ie,g);const ce=g.zoomScale(ae-_),he=g.project(ee),te=g.project(ie).sub(he);let ge=i.curve;const _e=Math.max(g.width,g.height),we=_e/ce,Ne=te.mag();if("minZoom"in i){const it=c.ac(Math.min(i.minZoom,_,ae),g.minZoom,g.maxZoom),Mt=_e/g.zoomScale(it-_);ge=Math.sqrt(Mt/Ne*2)}const $e=ge*ge;function Qe(it){const Mt=(we*we-_e*_e+(it?-1:1)*$e*$e*Ne*Ne)/(2*(it?we:_e)*$e*Ne);return Math.log(Math.sqrt(Mt*Mt+1)-Mt)}function at(it){return(Math.exp(it)-Math.exp(-it))/2}function Ge(it){return(Math.exp(it)+Math.exp(-it))/2}const qe=Qe(!1);let mt=function(it){return Ge(qe)/Ge(qe+ge*it)},Rt=function(it){return _e*((Ge(qe)*(at(Mt=qe+ge*it)/Ge(Mt))-at(qe))/$e)/Ne;var Mt},Ye=(Qe(!0)-qe)/ge;if(Math.abs(Ne)<1e-6||!isFinite(Ye)){if(Math.abs(_e-we)<1e-6)return this.easeTo(i,h);const it=we<_e?-1:1;Ye=Math.abs(Math.log(we/_e))/ge,Rt=()=>0,mt=Mt=>Math.exp(it*ge*Mt)}return i.duration="duration"in i?+i.duration:1e3*Ye/("screenSpeed"in i?+i.screenSpeed/ge:+i.speed),i.maxDuration&&i.duration>i.maxDuration&&(i.duration=0),this._zooming=!0,this._rotating=A!==V,this._pitching=O!==M,this._padding=!g.isPaddingEqual(L),this._prepareEase(h,!1),this.terrain&&this._prepareElevation(ie),this._ease(it=>{const Mt=it*Ye,Ln=1/mt(Mt);g.zoom=it===1?ae:_+g.scaleZoom(Ln),this._rotating&&(g.bearing=c.y.number(A,V,it)),this._pitching&&(g.pitch=c.y.number(M,O,it)),this._padding&&(g.interpolatePadding(P,L,it),K=g.centerPoint.add(G)),this.terrain&&!i.freezeElevation&&this._updateElevation(it);const Lt=it===1?ie:g.unproject(he.add(te.mult(Rt(Mt))).mult(Ln));g.setLocationAtPoint(g.renderWorldCopies?Lt.wrap():Lt,K),this._applyUpdatedTransform(g),this._fireMoveEvents(h)},()=>{this.terrain&&i.freezeElevation&&this._finalizeElevation(),this._afterEase(h)},i),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(i,h){var m;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const g=this._onEaseEnd;delete this._onEaseEnd,g.call(this,h)}return i||(m=this.handlers)===null||m===void 0||m.stop(!1),this}_ease(i,h,m){m.animate===!1||m.duration===0?(i(1),h()):(this._easeStart=C.now(),this._easeOptions=m,this._onEaseFrame=i,this._onEaseEnd=h,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(i,h){i=c.b3(i,-180,180);const m=Math.abs(i-h);return Math.abs(i-360-h)<m&&(i-=360),Math.abs(i+360-h)<m&&(i+=360),i}_normalizeCenter(i,h){if(!h.renderWorldCopies||h.lngRange)return;const m=i.lng-h.center.lng;i.lng+=m>180?-360:m<-180?360:0}queryTerrainElevation(i){return this.terrain?this.terrain.getElevationForLngLatZoom(c.N.convert(i),this.transform.tileZoom)-this.transform.elevation:null}}const sa={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class oa{constructor(i=sa){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=h=>{!h||h.sourceDataType!=="metadata"&&h.sourceDataType!=="visibility"&&h.dataType!=="style"&&h.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=i}getDefaultPosition(){return"bottom-right"}onAdd(i){return this._map=i,this._compact=this.options.compact,this._container=T.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=T.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=T.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(){T.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(i,h){const m=this._map._getUIString(`AttributionControl.${h}`);i.title=m,i.setAttribute("aria-label",m)}_updateAttributions(){if(!this._map.style)return;let i=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?i=i.concat(this.options.customAttribution.map(g=>typeof g!="string"?"":g)):typeof this.options.customAttribution=="string"&&i.push(this.options.customAttribution)),this._map.style.stylesheet){const g=this._map.style.stylesheet;this.styleOwner=g.owner,this.styleId=g.id}const h=this._map.style.sourceCaches;for(const g in h){const _=h[g];if(_.used||_.usedForTerrain){const A=_.getSource();A.attribution&&i.indexOf(A.attribution)<0&&i.push(A.attribution)}}i=i.filter(g=>String(g).trim()),i.sort((g,_)=>g.length-_.length),i=i.filter((g,_)=>{for(let A=_+1;A<i.length;A++)if(i[A].indexOf(g)>=0)return!1;return!0});const m=i.join(" | ");m!==this._attribHTML&&(this._attribHTML=m,i.length?(this._innerContainer.innerHTML=m,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class xu{constructor(i={}){this._updateCompact=()=>{const h=this._container.children;if(h.length){const m=h[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&m.classList.add("maplibregl-compact"):m.classList.remove("maplibregl-compact")}},this.options=i}getDefaultPosition(){return"bottom-left"}onAdd(i){this._map=i,this._compact=this.options&&this.options.compact,this._container=T.create("div","maplibregl-ctrl");const h=T.create("a","maplibregl-ctrl-logo");return h.target="_blank",h.rel="noopener nofollow",h.href="https://maplibre.org/",h.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),h.setAttribute("rel","noopener nofollow"),this._container.appendChild(h),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){T.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class Xt{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(i){const h=++this._id;return this._queue.push({callback:i,id:h,cancelled:!1}),h}remove(i){const h=this._currentlyRunning,m=h?this._queue.concat(h):this._queue;for(const g of m)if(g.id===i)return void(g.cancelled=!0)}run(i=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const h=this._currentlyRunning=this._queue;this._queue=[];for(const m of h)if(!m.cancelled&&(m.callback(i),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var vu=c.Y([{name:"a_pos3d",type:"Int16",components:3}]);class r0 extends c.E{constructor(i){super(),this.sourceCache=i,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,i.usedForTerrain=!0,i.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(i,h){this.sourceCache.update(i,h),this._renderableTilesKeys=[];const m={};for(const g of i.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:h}))m[g.key]=!0,this._renderableTilesKeys.push(g.key),this._tiles[g.key]||(g.posMatrix=new Float64Array(16),c.aP(g.posMatrix,0,c.X,0,c.X,0,1),this._tiles[g.key]=new Pi(g,this.tileSize));for(const g in this._tiles)m[g]||delete this._tiles[g]}freeRtt(i){for(const h in this._tiles){const m=this._tiles[h];(!i||m.tileID.equals(i)||m.tileID.isChildOf(i)||i.isChildOf(m.tileID))&&(m.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(i=>this.getTileByID(i))}getTileByID(i){return this._tiles[i]}getTerrainCoords(i){const h={};for(const m of this._renderableTilesKeys){const g=this._tiles[m].tileID;if(g.canonical.equals(i.canonical)){const _=i.clone();_.posMatrix=new Float64Array(16),c.aP(_.posMatrix,0,c.X,0,c.X,0,1),h[m]=_}else if(g.canonical.isChildOf(i.canonical)){const _=i.clone();_.posMatrix=new Float64Array(16);const A=g.canonical.z-i.canonical.z,M=g.canonical.x-(g.canonical.x>>A<<A),P=g.canonical.y-(g.canonical.y>>A<<A),V=c.X>>A;c.aP(_.posMatrix,0,V,0,V,0,1),c.J(_.posMatrix,_.posMatrix,[-M*V,-P*V,0]),h[m]=_}else if(i.canonical.isChildOf(g.canonical)){const _=i.clone();_.posMatrix=new Float64Array(16);const A=i.canonical.z-g.canonical.z,M=i.canonical.x-(i.canonical.x>>A<<A),P=i.canonical.y-(i.canonical.y>>A<<A),V=c.X>>A;c.aP(_.posMatrix,0,c.X,0,c.X,0,1),c.J(_.posMatrix,_.posMatrix,[M*V,P*V,0]),c.K(_.posMatrix,_.posMatrix,[1/2**A,1/2**A,0]),h[m]=_}}return h}getSourceTile(i,h){const m=this.sourceCache._source;let g=i.overscaledZ-this.deltaZoom;if(g>m.maxzoom&&(g=m.maxzoom),g<m.minzoom)return null;this._sourceTileCache[i.key]||(this._sourceTileCache[i.key]=i.scaledTo(g).key);let _=this.sourceCache.getTileByID(this._sourceTileCache[i.key]);if((!_||!_.dem)&&h)for(;g>=m.minzoom&&(!_||!_.dem);)_=this.sourceCache.getTileByID(i.scaledTo(g--).key);return _}tilesAfterTime(i=Date.now()){return Object.values(this._tiles).filter(h=>h.timeAdded>=i)}}class wu{constructor(i,h,m){this.painter=i,this.sourceCache=new r0(h),this.options=m,this.exaggeration=typeof m.exaggeration=="number"?m.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(i,h,m,g=c.X){var _;if(!(h>=0&&h<g&&m>=0&&m<g))return 0;const A=this.getTerrainData(i),M=(_=A.tile)===null||_===void 0?void 0:_.dem;if(!M)return 0;const P=function(ee,ie,ae){var ce=ie[0],he=ie[1];return ee[0]=ae[0]*ce+ae[4]*he+ae[12],ee[1]=ae[1]*ce+ae[5]*he+ae[13],ee}([],[h/g*c.X,m/g*c.X],A.u_terrain_matrix),V=[P[0]*M.dim,P[1]*M.dim],O=Math.floor(V[0]),L=Math.floor(V[1]),G=V[0]-O,K=V[1]-L;return M.get(O,L)*(1-G)*(1-K)+M.get(O+1,L)*G*(1-K)+M.get(O,L+1)*(1-G)*K+M.get(O+1,L+1)*G*K}getElevationForLngLatZoom(i,h){if(!c.bb(h,i.wrap()))return 0;const{tileID:m,mercatorX:g,mercatorY:_}=this._getOverscaledTileIDFromLngLatZoom(i,h);return this.getElevation(m,g%c.X,_%c.X,c.X)}getElevation(i,h,m,g=c.X){return this.getDEMElevation(i,h,m,g)*this.exaggeration}getTerrainData(i){if(!this._emptyDemTexture){const g=this.painter.context,_=new c.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new tt(g,_,g.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new tt(g,new c.R({width:1,height:1}),g.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(g.gl.NEAREST,g.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=c.an([])}const h=this.sourceCache.getSourceTile(i,!0);if(h&&h.dem&&(!h.demTexture||h.needsTerrainPrepare)){const g=this.painter.context;h.demTexture=this.painter.getTileTexture(h.dem.stride),h.demTexture?h.demTexture.update(h.dem.getPixels(),{premultiply:!1}):h.demTexture=new tt(g,h.dem.getPixels(),g.gl.RGBA,{premultiply:!1}),h.demTexture.bind(g.gl.NEAREST,g.gl.CLAMP_TO_EDGE),h.needsTerrainPrepare=!1}const m=h&&h+h.tileID.key+i.key;if(m&&!this._demMatrixCache[m]){const g=this.sourceCache.sourceCache._source.maxzoom;let _=i.canonical.z-h.tileID.canonical.z;i.overscaledZ>i.canonical.z&&(i.canonical.z>=g?_=i.canonical.z-g:c.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const A=i.canonical.x-(i.canonical.x>>_<<_),M=i.canonical.y-(i.canonical.y>>_<<_),P=c.bc(new Float64Array(16),[1/(c.X<<_),1/(c.X<<_),0]);c.J(P,P,[A*c.X,M*c.X,0]),this._demMatrixCache[i.key]={matrix:P,coord:i}}return{u_depth:2,u_terrain:3,u_terrain_dim:h&&h.dem&&h.dem.dim||1,u_terrain_matrix:m?this._demMatrixCache[i.key].matrix:this._emptyDemMatrix,u_terrain_unpack:h&&h.dem&&h.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(h&&h.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:h}}getFramebuffer(i){const h=this.painter,m=h.width/devicePixelRatio,g=h.height/devicePixelRatio;return!this._fbo||this._fbo.width===m&&this._fbo.height===g||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new tt(h.context,{width:m,height:g,data:null},h.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(h.context.gl.NEAREST,h.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new tt(h.context,{width:m,height:g,data:null},h.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(h.context.gl.NEAREST,h.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=h.context.createFramebuffer(m,g,!0,!1),this._fbo.depthAttachment.set(h.context.createRenderbuffer(h.context.gl.DEPTH_COMPONENT16,m,g))),this._fbo.colorAttachment.set(i==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const i=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const h=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let _=0,A=0;_<this._coordsTextureSize;_++)for(let M=0;M<this._coordsTextureSize;M++,A+=4)h[A+0]=255&M,h[A+1]=255&_,h[A+2]=M>>8<<4|_>>8,h[A+3]=0;const m=new c.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(h.buffer)),g=new tt(i,m,i.gl.RGBA,{premultiply:!1});return g.bind(i.gl.NEAREST,i.gl.CLAMP_TO_EDGE),this._coordsTexture=g,g}pointCoordinate(i){this.painter.maybeDrawDepthAndCoords(!0);const h=new Uint8Array(4),m=this.painter.context,g=m.gl,_=Math.round(i.x*this.painter.pixelRatio/devicePixelRatio),A=Math.round(i.y*this.painter.pixelRatio/devicePixelRatio),M=Math.round(this.painter.height/devicePixelRatio);m.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),g.readPixels(_,M-A-1,1,1,g.RGBA,g.UNSIGNED_BYTE,h),m.bindFramebuffer.set(null);const P=h[0]+(h[2]>>4<<8),V=h[1]+((15&h[2])<<8),O=this.coordsIndex[255-h[3]],L=O&&this.sourceCache.getTileByID(O);if(!L)return null;const G=this._coordsTextureSize,K=(1<<L.tileID.canonical.z)*G;return new c.Z((L.tileID.canonical.x*G+P)/K+L.tileID.wrap,(L.tileID.canonical.y*G+V)/K,this.getElevation(L.tileID,P,V,G))}depthAtPoint(i){const h=new Uint8Array(4),m=this.painter.context,g=m.gl;return m.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),g.readPixels(i.x,this.painter.height/devicePixelRatio-i.y-1,1,1,g.RGBA,g.UNSIGNED_BYTE,h),m.bindFramebuffer.set(null),(h[0]/16777216+h[1]/65536+h[2]/256+h[3])/256}getTerrainMesh(){if(this._mesh)return this._mesh;const i=this.painter.context,h=new c.bd,m=new c.aY,g=this.meshSize,_=c.X/g,A=g*g;for(let L=0;L<=g;L++)for(let G=0;G<=g;G++)h.emplaceBack(G*_,L*_,0);for(let L=0;L<A;L+=g+1)for(let G=0;G<g;G++)m.emplaceBack(G+L,g+G+L+1,g+G+L+2),m.emplaceBack(G+L,g+G+L+2,G+L+1);const M=h.length,P=M+2*(g+1);for(const L of[0,1])for(let G=0;G<=g;G++)for(const K of[0,1])h.emplaceBack(G*_,L*c.X,K);for(let L=0;L<2*g;L+=2)m.emplaceBack(P+L,P+L+1,P+L+3),m.emplaceBack(P+L,P+L+3,P+L+2),m.emplaceBack(M+L,M+L+3,M+L+1),m.emplaceBack(M+L,M+L+2,M+L+3);const V=h.length,O=V+2*(g+1);for(const L of[0,1])for(let G=0;G<=g;G++)for(const K of[0,1])h.emplaceBack(L*c.X,G*_,K);for(let L=0;L<2*g;L+=2)m.emplaceBack(V+L,V+L+1,V+L+3),m.emplaceBack(V+L,V+L+3,V+L+2),m.emplaceBack(O+L,O+L+3,O+L+1),m.emplaceBack(O+L,O+L+2,O+L+3);return this._mesh=new fc(i.createVertexBuffer(h,vu.members),i.createIndexBuffer(m),c.a0.simpleSegment(0,0,h.length,m.length)),this._mesh}getMeshFrameDelta(i){return 2*Math.PI*c.be/Math.pow(2,i)/5}getMinTileElevationForLngLatZoom(i,h){var m;const{tileID:g}=this._getOverscaledTileIDFromLngLatZoom(i,h);return(m=this.getMinMaxElevation(g).minElevation)!==null&&m!==void 0?m:0}getMinMaxElevation(i){const h=this.getTerrainData(i).tile,m={minElevation:null,maxElevation:null};return h&&h.dem&&(m.minElevation=h.dem.min*this.exaggeration,m.maxElevation=h.dem.max*this.exaggeration),m}_getOverscaledTileIDFromLngLatZoom(i,h){const m=c.Z.fromLngLat(i.wrap()),g=(1<<h)*c.X,_=m.x*g,A=m.y*g,M=Math.floor(_/c.X),P=Math.floor(A/c.X);return{tileID:new c.S(h,0,h,M,P),mercatorX:_,mercatorY:A}}}class i0{constructor(i,h,m){this._context=i,this._size=h,this._tileSize=m,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const i of this._objects)i.texture.destroy(),i.fbo.destroy()}_createObject(i){const h=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),m=new tt(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return m.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),h.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),h.colorAttachment.set(m.texture),{id:i,fbo:h,texture:m,stamp:-1,inUse:!1}}getObjectForId(i){return this._objects[i]}useObject(i){i.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(h=>i.id!==h),this._recentlyUsed.push(i.id)}stampObject(i){i.stamp=++this._stamp}getOrCreateFreeObject(){for(const h of this._recentlyUsed)if(!this._objects[h].inUse)return this._objects[h];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const i=this._createObject(this._objects.length);return this._objects.push(i),i}freeObject(i){i.inUse=!1}freeAllObjects(){for(const i of this._objects)this.freeObject(i)}isFull(){return!(this._objects.length<this._size)&&this._objects.some(i=>!i.inUse)===!1}}const aa={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class cf{constructor(i,h){this.painter=i,this.terrain=h,this.pool=new i0(i.context,30,h.sourceCache.tileSize*h.qualityFactor)}destruct(){this.pool.destruct()}getTexture(i){return this.pool.getObjectForId(i.rtt[this._stacks.length-1].id).texture}prepareForRender(i,h){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=i._order.filter(m=>!i._layers[m].isHidden(h)),this._coordsDescendingInv={};for(const m in i.sourceCaches){this._coordsDescendingInv[m]={};const g=i.sourceCaches[m].getVisibleCoordinates();for(const _ of g){const A=this.terrain.sourceCache.getTerrainCoords(_);for(const M in A)this._coordsDescendingInv[m][M]||(this._coordsDescendingInv[m][M]=[]),this._coordsDescendingInv[m][M].push(A[M])}}this._coordsDescendingInvStr={};for(const m of i._order){const g=i._layers[m],_=g.source;if(aa[g.type]&&!this._coordsDescendingInvStr[_]){this._coordsDescendingInvStr[_]={};for(const A in this._coordsDescendingInv[_])this._coordsDescendingInvStr[_][A]=this._coordsDescendingInv[_][A].map(M=>M.key).sort().join()}}for(const m of this._renderableTiles)for(const g in this._coordsDescendingInvStr){const _=this._coordsDescendingInvStr[g][m.tileID.key];_&&_!==m.rttCoords[g]&&(m.rtt=[])}}renderLayer(i){if(i.isHidden(this.painter.transform.zoom))return!1;const h=i.type,m=this.painter,g=this._renderableLayerIds[this._renderableLayerIds.length-1]===i.id;if(aa[h]&&(this._prevType&&aa[this._prevType]||this._stacks.push([]),this._prevType=h,this._stacks[this._stacks.length-1].push(i.id),!g))return!0;if(aa[this._prevType]||aa[h]&&g){this._prevType=h;const _=this._stacks.length-1,A=this._stacks[_]||[];for(const M of this._renderableTiles){if(this.pool.isFull()&&(ef(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(M),M.rtt[_]){const V=this.pool.getObjectForId(M.rtt[_].id);if(V.stamp===M.rtt[_].stamp){this.pool.useObject(V);continue}}const P=this.pool.getOrCreateFreeObject();this.pool.useObject(P),this.pool.stampObject(P),M.rtt[_]={id:P.id,stamp:P.stamp},m.context.bindFramebuffer.set(P.fbo.framebuffer),m.context.clear({color:c.aM.transparent,stencil:0}),m.currentStencilSource=void 0;for(let V=0;V<A.length;V++){const O=m.style._layers[A[V]],L=O.source?this._coordsDescendingInv[O.source][M.tileID.key]:[M.tileID];m.context.viewport.set([0,0,P.fbo.width,P.fbo.height]),m._renderTileClippingMasks(O,L),m.renderLayer(m,m.style.sourceCaches[O.source],O,L),O.source&&(M.rttCoords[O.source]=this._coordsDescendingInvStr[O.source][M.tileID.key])}}return ef(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects(),aa[h]}return!1}}const ku={"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"},df=b,s0={hash:!1,interactive:!0,bearingSnap:7,attributionControl:sa,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},Eu=x=>{x.touchstart=x.dragStart,x.touchmoveWindow=x.dragMove,x.touchend=x.dragEnd},o0={showCompass:!0,showZoom:!0,visualizePitch:!1};class a0{constructor(i,h,m=!1){this.mousedown=A=>{this.startMouse(c.e({},A,{ctrlKey:!0,preventDefault:()=>A.preventDefault()}),T.mousePos(this.element,A)),T.addEventListener(window,"mousemove",this.mousemove),T.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=A=>{this.moveMouse(A,T.mousePos(this.element,A))},this.mouseup=A=>{this.mouseRotate.dragEnd(A),this.mousePitch&&this.mousePitch.dragEnd(A),this.offTemp()},this.touchstart=A=>{A.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=T.touchPos(this.element,A.targetTouches)[0],this.startTouch(A,this._startPos),T.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),T.addEventListener(window,"touchend",this.touchend))},this.touchmove=A=>{A.targetTouches.length!==1?this.reset():(this._lastPos=T.touchPos(this.element,A.targetTouches)[0],this.moveTouch(A,this._lastPos))},this.touchend=A=>{A.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 g=i.dragRotate._mouseRotate.getClickTolerance(),_=i.dragRotate._mousePitch.getClickTolerance();this.element=h,this.mouseRotate=uu({clickTolerance:g,enable:!0}),this.touchRotate=(({enable:A,clickTolerance:M,bearingDegreesPerPixelMoved:P=.8})=>{const V=new du;return new ys({clickTolerance:M,move:(O,L)=>({bearingDelta:(L.x-O.x)*P}),moveStateManager:V,enable:A,assignEvents:Eu})})({clickTolerance:g,enable:!0}),this.map=i,m&&(this.mousePitch=hu({clickTolerance:_,enable:!0}),this.touchPitch=(({enable:A,clickTolerance:M,pitchDegreesPerPixelMoved:P=-.5})=>{const V=new du;return new ys({clickTolerance:M,move:(O,L)=>({pitchDelta:(L.y-O.y)*P}),moveStateManager:V,enable:A,assignEvents:Eu})})({clickTolerance:_,enable:!0})),T.addEventListener(h,"mousedown",this.mousedown),T.addEventListener(h,"touchstart",this.touchstart,{passive:!1}),T.addEventListener(h,"touchcancel",this.reset)}startMouse(i,h){this.mouseRotate.dragStart(i,h),this.mousePitch&&this.mousePitch.dragStart(i,h),T.disableDrag()}startTouch(i,h){this.touchRotate.dragStart(i,h),this.touchPitch&&this.touchPitch.dragStart(i,h),T.disableDrag()}moveMouse(i,h){const m=this.map,{bearingDelta:g}=this.mouseRotate.dragMove(i,h)||{};if(g&&m.setBearing(m.getBearing()+g),this.mousePitch){const{pitchDelta:_}=this.mousePitch.dragMove(i,h)||{};_&&m.setPitch(m.getPitch()+_)}}moveTouch(i,h){const m=this.map,{bearingDelta:g}=this.touchRotate.dragMove(i,h)||{};if(g&&m.setBearing(m.getBearing()+g),this.touchPitch){const{pitchDelta:_}=this.touchPitch.dragMove(i,h)||{};_&&m.setPitch(m.getPitch()+_)}}off(){const i=this.element;T.removeEventListener(i,"mousedown",this.mousedown),T.removeEventListener(i,"touchstart",this.touchstart,{passive:!1}),T.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),T.removeEventListener(window,"touchend",this.touchend),T.removeEventListener(i,"touchcancel",this.reset),this.offTemp()}offTemp(){T.enableDrag(),T.removeEventListener(window,"mousemove",this.mousemove),T.removeEventListener(window,"mouseup",this.mouseup),T.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),T.removeEventListener(window,"touchend",this.touchend)}}let ai;function On(x,i,h){const m=new c.N(x.lng,x.lat);if(x=new c.N(x.lng,x.lat),i){const g=new c.N(x.lng-360,x.lat),_=new c.N(x.lng+360,x.lat),A=h.locationPoint(x).distSqr(i);h.locationPoint(g).distSqr(i)<A?x=g:h.locationPoint(_).distSqr(i)<A&&(x=_)}for(;Math.abs(x.lng-h.center.lng)>180;){const g=h.locationPoint(x);if(g.x>=0&&g.y>=0&&g.x<=h.width&&g.y<=h.height)break;x.lng>h.center.lng?x.lng-=360:x.lng+=360}return x.lng!==m.lng&&h.locationPoint(x).y>h.height/2-h.getHorizon()?x:m}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 Cc(x,i,h){const m=x.classList;for(const g in la)m.remove(`maplibregl-${h}-anchor-${g}`);m.add(`maplibregl-${h}-anchor-${i}`)}class Sc extends c.E{constructor(i){if(super(),this._onKeyPress=h=>{const m=h.code,g=h.charCode||h.keyCode;m!=="Space"&&m!=="Enter"&&g!==32&&g!==13||this.togglePopup()},this._onMapClick=h=>{const m=h.originalEvent.target,g=this._element;this._popup&&(m===g||g.contains(m))&&this.togglePopup()},this._update=h=>{var m;if(!this._map)return;const g=this._map.loaded()&&!this._map.isMoving();((h==null?void 0:h.type)==="terrain"||(h==null?void 0:h.type)==="render"&&!g)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?On(this._lngLat,this._flatPos,this._map.transform):(m=this._lngLat)===null||m===void 0?void 0:m.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 _="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?_=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(_=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let A="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?A="rotateX(0deg)":this._pitchAlignment==="map"&&(A=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||h&&h.type!=="moveend"||(this._pos=this._pos.round()),T.setTransform(this._element,`${la[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${A} ${_}`),C.frameAsync(new AbortController).then(()=>{this._updateOpacity(h&&h.type==="moveend")}).catch(()=>{})},this._onMove=h=>{if(!this._isDragging){const m=this._clickTolerance||this._map._clickTolerance;this._isDragging=h.point.dist(this._pointerdownPos)>=m}this._isDragging&&(this._pos=h.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=h=>{this._element.contains(h.originalEvent.target)&&(h.preventDefault(),this._positionDelta=h.point.sub(this._pos).add(this._offset),this._pointerdownPos=h.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=i&&i.anchor||"center",this._color=i&&i.color||"#3FB1CE",this._scale=i&&i.scale||1,this._draggable=i&&i.draggable||!1,this._clickTolerance=i&&i.clickTolerance||0,this._subpixelPositioning=i&&i.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=i&&i.rotation||0,this._rotationAlignment=i&&i.rotationAlignment||"auto",this._pitchAlignment=i&&i.pitchAlignment&&i.pitchAlignment!=="auto"?i.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(i==null?void 0:i.opacity,i==null?void 0:i.opacityWhenCovered),i&&i.element)this._element=i.element,this._offset=c.P.convert(i&&i.offset||[0,0]);else{this._defaultMarker=!0,this._element=T.create("div");const h=T.createNS("http://www.w3.org/2000/svg","svg"),m=41,g=27;h.setAttributeNS(null,"display","block"),h.setAttributeNS(null,"height",`${m}px`),h.setAttributeNS(null,"width",`${g}px`),h.setAttributeNS(null,"viewBox",`0 0 ${g} ${m}`);const _=T.createNS("http://www.w3.org/2000/svg","g");_.setAttributeNS(null,"stroke","none"),_.setAttributeNS(null,"stroke-width","1"),_.setAttributeNS(null,"fill","none"),_.setAttributeNS(null,"fill-rule","evenodd");const A=T.createNS("http://www.w3.org/2000/svg","g");A.setAttributeNS(null,"fill-rule","nonzero");const M=T.createNS("http://www.w3.org/2000/svg","g");M.setAttributeNS(null,"transform","translate(3.0, 29.0)"),M.setAttributeNS(null,"fill","#000000");const P=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const ce of P){const he=T.createNS("http://www.w3.org/2000/svg","ellipse");he.setAttributeNS(null,"opacity","0.04"),he.setAttributeNS(null,"cx","10.5"),he.setAttributeNS(null,"cy","5.80029008"),he.setAttributeNS(null,"rx",ce.rx),he.setAttributeNS(null,"ry",ce.ry),M.appendChild(he)}const V=T.createNS("http://www.w3.org/2000/svg","g");V.setAttributeNS(null,"fill",this._color);const O=T.createNS("http://www.w3.org/2000/svg","path");O.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"),V.appendChild(O);const L=T.createNS("http://www.w3.org/2000/svg","g");L.setAttributeNS(null,"opacity","0.25"),L.setAttributeNS(null,"fill","#000000");const G=T.createNS("http://www.w3.org/2000/svg","path");G.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"),L.appendChild(G);const K=T.createNS("http://www.w3.org/2000/svg","g");K.setAttributeNS(null,"transform","translate(6.0, 7.0)"),K.setAttributeNS(null,"fill","#FFFFFF");const ee=T.createNS("http://www.w3.org/2000/svg","g");ee.setAttributeNS(null,"transform","translate(8.0, 8.0)");const ie=T.createNS("http://www.w3.org/2000/svg","circle");ie.setAttributeNS(null,"fill","#000000"),ie.setAttributeNS(null,"opacity","0.25"),ie.setAttributeNS(null,"cx","5.5"),ie.setAttributeNS(null,"cy","5.5"),ie.setAttributeNS(null,"r","5.4999962");const ae=T.createNS("http://www.w3.org/2000/svg","circle");ae.setAttributeNS(null,"fill","#FFFFFF"),ae.setAttributeNS(null,"cx","5.5"),ae.setAttributeNS(null,"cy","5.5"),ae.setAttributeNS(null,"r","5.4999962"),ee.appendChild(ie),ee.appendChild(ae),A.appendChild(M),A.appendChild(V),A.appendChild(L),A.appendChild(K),A.appendChild(ee),h.appendChild(A),h.setAttributeNS(null,"height",m*this._scale+"px"),h.setAttributeNS(null,"width",g*this._scale+"px"),this._element.appendChild(h),this._offset=c.P.convert(i&&i.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",h=>{h.preventDefault()}),this._element.addEventListener("mousedown",h=>{h.preventDefault()}),Cc(this._element,this._anchor,"marker"),i&&i.className)for(const h of i.className.split(" "))this._element.classList.add(h);this._popup=null}addTo(i){return this.remove(),this._map=i,this._element.setAttribute("aria-label",i._getUIString("Marker.Title")),i.getCanvasContainer().appendChild(this._element),i.on("move",this._update),i.on("moveend",this._update),i.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),T.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(i){return this._lngLat=c.N.convert(i),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(i){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),i){if(!("offset"in i.options)){const g=Math.abs(13.5)/Math.SQRT2;i.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[g,-1*(38.1-13.5+g)],"bottom-right":[-g,-1*(38.1-13.5+g)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=i,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(i){return this._subpixelPositioning=i,this}getPopup(){return this._popup}togglePopup(){const i=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:i?(i.isOpen()?i.remove():(i.setLngLat(this._lngLat),i.addTo(this._map)),this):this}_updateOpacity(i=!1){var h,m;if(!(!((h=this._map)===null||h===void 0)&&h.terrain))return void(this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity));if(i)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const g=this._map,_=g.terrain.depthAtPoint(this._pos),A=g.terrain.getElevationForLngLatZoom(this._lngLat,g.transform.tileZoom);if(g.transform.lngLatToCameraDepth(this._lngLat,A)-_<.006)return void(this._element.style.opacity=this._opacity);const M=-this._offset.y/g.transform._pixelPerMeter,P=Math.sin(g.getPitch()*Math.PI/180)*M,V=g.terrain.depthAtPoint(new c.P(this._pos.x,this._pos.y-this._offset.y)),O=g.transform.lngLatToCameraDepth(this._lngLat,A+P)-V>.006;!((m=this._popup)===null||m===void 0)&&m.isOpen()&&O&&this._popup.remove(),this._element.style.opacity=O?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(i){return this._offset=c.P.convert(i),this._update(),this}addClassName(i){this._element.classList.add(i)}removeClassName(i){this._element.classList.remove(i)}toggleClassName(i){return this._element.classList.toggle(i)}setDraggable(i){return this._draggable=!!i,this._map&&(i?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(i){return this._rotation=i||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(i){return this._rotationAlignment=i||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(i){return this._pitchAlignment=i&&i!=="auto"?i:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(i,h){return i===void 0&&h===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),i!==void 0&&(this._opacity=i),h!==void 0&&(this._opacityWhenCovered=h),this._map&&this._updateOpacity(!0),this}}const uf={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let al=0,ll=!1;const ns={maxWidth:100,unit:"metric"};function cl(x,i,h){const m=h&&h.maxWidth||100,g=x._container.clientHeight/2,_=x.unproject([0,g]),A=x.unproject([m,g]),M=_.distanceTo(A);if(h&&h.unit==="imperial"){const P=3.2808*M;P>5280?ft(i,m,P/5280,x._getUIString("ScaleControl.Miles")):ft(i,m,P,x._getUIString("ScaleControl.Feet"))}else h&&h.unit==="nautical"?ft(i,m,M/1852,x._getUIString("ScaleControl.NauticalMiles")):M>=1e3?ft(i,m,M/1e3,x._getUIString("ScaleControl.Kilometers")):ft(i,m,M,x._getUIString("ScaleControl.Meters"))}function ft(x,i,h,m){const g=function(_){const A=Math.pow(10,`${Math.floor(_)}`.length-1);let M=_/A;return M=M>=10?10:M>=5?5:M>=3?3:M>=2?2:M>=1?1:function(P){const V=Math.pow(10,Math.ceil(-Math.log(P)/Math.LN10));return Math.round(P*V)/V}(M),A*M}(h);x.style.width=i*(g/h)+"px",x.innerHTML=`${g} ${m}`}const St={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},Tc=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Ac(x){if(x){if(typeof x=="number"){const i=Math.round(Math.abs(x)/Math.SQRT2);return{center:new c.P(0,0),top:new c.P(0,x),"top-left":new c.P(i,i),"top-right":new c.P(-i,i),bottom:new c.P(0,-x),"bottom-left":new c.P(i,-i),"bottom-right":new c.P(-i,-i),left:new c.P(x,0),right:new c.P(-x,0)}}if(x instanceof c.P||Array.isArray(x)){const i=c.P.convert(x);return{center:i,top:i,"top-left":i,"top-right":i,bottom:i,"bottom-left":i,"bottom-right":i,left:i,right:i}}return{center:c.P.convert(x.center||[0,0]),top:c.P.convert(x.top||[0,0]),"top-left":c.P.convert(x["top-left"]||[0,0]),"top-right":c.P.convert(x["top-right"]||[0,0]),bottom:c.P.convert(x.bottom||[0,0]),"bottom-left":c.P.convert(x["bottom-left"]||[0,0]),"bottom-right":c.P.convert(x["bottom-right"]||[0,0]),left:c.P.convert(x.left||[0,0]),right:c.P.convert(x.right||[0,0])}}return Ac(new c.P(0,0))}const Cu=b;p.AJAXError=c.bh,p.Evented=c.E,p.LngLat=c.N,p.MercatorCoordinate=c.Z,p.Point=c.P,p.addProtocol=c.bi,p.config=c.a,p.removeProtocol=c.bj,p.AttributionControl=oa,p.BoxZoomHandler=oi,p.CanvasSource=br,p.CooperativeGesturesHandler=ia,p.DoubleClickZoomHandler=xo,p.DragPanHandler=of,p.DragRotateHandler=af,p.EdgeInsets=ta,p.FullscreenControl=class extends c.E{constructor(x={}){super(),this._onFullscreenChange=()=>{var i;let h=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((i=h==null?void 0:h.shadowRoot)===null||i===void 0)&&i.fullscreenElement;)h=h.shadowRoot.fullscreenElement;h===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,x&&x.container&&(x.container instanceof HTMLElement?this._container=x.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(x){return this._map=x,this._container||(this._container=this._map.getContainer()),this._controlContainer=T.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){T.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const x=this._fullscreenButton=T.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);T.create("span","maplibregl-ctrl-icon",x).setAttribute("aria-hidden","true"),x.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const x=this._getTitle();this._fullscreenButton.setAttribute("aria-label",x),this._fullscreenButton.title=x}_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()}},p.GeoJSONSource=Rs,p.GeolocateControl=class extends c.E{constructor(x){super(),this._onSuccess=i=>{if(this._map){if(this._isOutOfMapMaxBounds(i))return this._setErrorState(),this.fire(new c.k("outofmaxbounds",i)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=i,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(i),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(i),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new c.k("geolocate",i)),this._finish()}},this._updateCamera=i=>{const h=new c.N(i.coords.longitude,i.coords.latitude),m=i.coords.accuracy,g=this._map.getBearing(),_=c.e({bearing:g},this.options.fitBoundsOptions),A=Ce.fromLngLat(h,m);this._map.fitBounds(A,_,{geolocateSource:!0})},this._updateMarker=i=>{if(i){const h=new c.N(i.coords.longitude,i.coords.latitude);this._accuracyCircleMarker.setLngLat(h).addTo(this._map),this._userLocationDotMarker.setLngLat(h).addTo(this._map),this._accuracy=i.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=i=>{if(this._map){if(this.options.trackUserLocation)if(i.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 h=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=h,this._geolocateButton.setAttribute("aria-label",h),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(i.code===3&&ll)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new c.k("error",i)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",i=>i.preventDefault()),this._geolocateButton=T.create("button","maplibregl-ctrl-geolocate",this._container),T.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=i=>{if(this._map){if(i===!1){c.w("Geolocation support is not available so the GeolocateControl will be disabled.");const h=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=h,this._geolocateButton.setAttribute("aria-label",h)}else{const h=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=h,this._geolocateButton.setAttribute("aria-label",h)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=T.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Sc({element:this._dotElement}),this._circleElement=T.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Sc({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",h=>{h.geolocateSource||this._watchState!=="ACTIVE_LOCK"||h.originalEvent&&h.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({},uf,x)}onAdd(x){return this._map=x,this._container=T.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return c._(this,arguments,void 0,function*(i=!1){if(ai!==void 0&&!i)return ai;if(window.navigator.permissions===void 0)return ai=!!window.navigator.geolocation,ai;try{ai=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{ai=!!window.navigator.geolocation}return ai})}().then(i=>this._finishSetupUI(i)),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(),T.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,al=0,ll=!1}_isOutOfMapMaxBounds(x){const i=this._map.getMaxBounds(),h=x.coords;return i&&(h.longitude<i.getWest()||h.longitude>i.getEast()||h.latitude<i.getSouth()||h.latitude>i.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 x=this._map.getBounds(),i=x.getSouthEast(),h=x.getNorthEast(),m=i.distanceTo(h),g=Math.ceil(this._accuracy/(m/this._map._container.clientHeight)*2);this._circleElement.style.width=`${g}px`,this._circleElement.style.height=`${g}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":al--,ll=!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 x;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),al++,al>1?(x={maximumAge:6e5,timeout:0},ll=!0):(x=this.options.positionOptions,ll=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,x)}}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)}},p.Hash=gc,p.ImageSource=Cr,p.KeyboardHandler=xi,p.LngLatBounds=Ce,p.LogoControl=xu,p.Map=class extends lf{constructor(x){c.bf.mark(c.bg.create);const i=Object.assign(Object.assign({},s0),x);if(i.minZoom!=null&&i.maxZoom!=null&&i.minZoom>i.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(i.minPitch!=null&&i.maxPitch!=null&&i.minPitch>i.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(i.minPitch!=null&&i.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(i.maxPitch!=null&&i.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new na(i.minZoom,i.maxZoom,i.minPitch,i.maxPitch,i.renderWorldCopies),{bearingSnap:i.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new Xt,this._controls=[],this._mapId=c.a4(),this._contextLost=h=>{h.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new c.k("webglcontextlost",{originalEvent:h}))},this._contextRestored=h=>{this._setupPainter(),this.resize(),this._update(),this.fire(new c.k("webglcontextrestored",{originalEvent:h}))},this._onMapScroll=h=>{if(h.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=i.interactive,this._maxTileCacheSize=i.maxTileCacheSize,this._maxTileCacheZoomLevels=i.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=i.failIfMajorPerformanceCaveat===!0,this._preserveDrawingBuffer=i.preserveDrawingBuffer===!0,this._antialias=i.antialias===!0,this._trackResize=i.trackResize===!0,this._bearingSnap=i.bearingSnap,this._refreshExpiredTiles=i.refreshExpiredTiles===!0,this._fadeDuration=i.fadeDuration,this._crossSourceCollisions=i.crossSourceCollisions===!0,this._collectResourceTiming=i.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},ku),i.locale),this._clickTolerance=i.clickTolerance,this._overridePixelRatio=i.pixelRatio,this._maxCanvasSize=i.maxCanvasSize,this.transformCameraUpdate=i.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=i.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=Q.addThrottleControl(()=>this.isMoving()),this._requestManager=new me(i.transformRequest),typeof i.container=="string"){if(this._container=document.getElementById(i.container),!this._container)throw new Error(`Container '${i.container}' not found.`)}else{if(!(i.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=i.container}if(i.maxBounds&&this.setMaxBounds(i.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 h=!1;const m=tl(g=>{this._trackResize&&!this._removed&&(this.resize(g),this.redraw())},50);this._resizeObserver=new ResizeObserver(g=>{h?m(g):h=!0}),this._resizeObserver.observe(this._container)}this.handlers=new bu(this,i),this._hash=i.hash&&new gc(typeof i.hash=="string"&&i.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:i.center,zoom:i.zoom,bearing:i.bearing,pitch:i.pitch}),i.bounds&&(this.resize(),this.fitBounds(i.bounds,c.e({},i.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=i.localIdeographFontFamily,this._validateStyle=i.validateStyle,i.style&&this.setStyle(i.style,{localIdeographFontFamily:i.localIdeographFontFamily}),i.attributionControl&&this.addControl(new oa(typeof i.attributionControl=="boolean"?void 0:i.attributionControl)),i.maplibreLogo&&this.addControl(new xu,i.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",h=>{this._update(h.dataType==="style"),this.fire(new c.k(`${h.dataType}data`,h))}),this.on("dataloading",h=>{this.fire(new c.k(`${h.dataType}dataloading`,h))}),this.on("dataabort",h=>{this.fire(new c.k("sourcedataabort",h))})}_getMapId(){return this._mapId}addControl(x,i){if(i===void 0&&(i=x.getDefaultPosition?x.getDefaultPosition():"top-right"),!x||!x.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 h=x.onAdd(this);this._controls.push(x);const m=this._controlPositions[i];return i.indexOf("bottom")!==-1?m.insertBefore(h,m.firstChild):m.appendChild(h),this}removeControl(x){if(!x||!x.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 i=this._controls.indexOf(x);return i>-1&&this._controls.splice(i,1),x.onRemove(this),this}hasControl(x){return this._controls.indexOf(x)>-1}calculateCameraOptionsFromTo(x,i,h,m){return m==null&&this.terrain&&(m=this.terrain.getElevationForLngLatZoom(h,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(x,i,h,m)}resize(x){var i;const h=this._containerDimensions(),m=h[0],g=h[1],_=this._getClampedPixelRatio(m,g);if(this._resizeCanvas(m,g,_),this.painter.resize(m,g,_),this.painter.overLimit()){const M=this.painter.context.gl;this._maxCanvasSize=[M.drawingBufferWidth,M.drawingBufferHeight];const P=this._getClampedPixelRatio(m,g);this._resizeCanvas(m,g,P),this.painter.resize(m,g,P)}this.transform.resize(m,g),(i=this._requestedCameraState)===null||i===void 0||i.resize(m,g);const A=!this._moving;return A&&(this.stop(),this.fire(new c.k("movestart",x)).fire(new c.k("move",x))),this.fire(new c.k("resize",x)),A&&this.fire(new c.k("moveend",x)),this}_getClampedPixelRatio(x,i){const{0:h,1:m}=this._maxCanvasSize,g=this.getPixelRatio(),_=x*g,A=i*g;return Math.min(_>h?h/_:1,A>m?m/A:1)*g}getPixelRatio(){var x;return(x=this._overridePixelRatio)!==null&&x!==void 0?x:devicePixelRatio}setPixelRatio(x){this._overridePixelRatio=x,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(x){return this.transform.setMaxBounds(Ce.convert(x)),this._update()}setMinZoom(x){if((x=x??-2)>=-2&&x<=this.transform.maxZoom)return this.transform.minZoom=x,this._update(),this.getZoom()<x&&this.setZoom(x),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(x){if((x=x??22)>=this.transform.minZoom)return this.transform.maxZoom=x,this._update(),this.getZoom()>x&&this.setZoom(x),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(x){if((x=x??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(x>=0&&x<=this.transform.maxPitch)return this.transform.minPitch=x,this._update(),this.getPitch()<x&&this.setPitch(x),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(x){if((x=x??60)>85)throw new Error("maxPitch must be less than or equal to 85");if(x>=this.transform.minPitch)return this.transform.maxPitch=x,this._update(),this.getPitch()>x&&this.setPitch(x),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(x){return this.transform.renderWorldCopies=x,this._update()}project(x){return this.transform.locationPoint(c.N.convert(x),this.style&&this.terrain)}unproject(x){return this.transform.pointLocation(c.P.convert(x),this.terrain)}isMoving(){var x;return this._moving||((x=this.handlers)===null||x===void 0?void 0:x.isMoving())}isZooming(){var x;return this._zooming||((x=this.handlers)===null||x===void 0?void 0:x.isZooming())}isRotating(){var x;return this._rotating||((x=this.handlers)===null||x===void 0?void 0:x.isRotating())}_createDelegatedListener(x,i,h){if(x==="mouseenter"||x==="mouseover"){let m=!1;return{layers:i,listener:h,delegates:{mousemove:_=>{const A=i.filter(P=>this.getLayer(P)),M=A.length!==0?this.queryRenderedFeatures(_.point,{layers:A}):[];M.length?m||(m=!0,h.call(this,new Sr(x,this,_.originalEvent,{features:M}))):m=!1},mouseout:()=>{m=!1}}}}if(x==="mouseleave"||x==="mouseout"){let m=!1;return{layers:i,listener:h,delegates:{mousemove:A=>{const M=i.filter(P=>this.getLayer(P));(M.length!==0?this.queryRenderedFeatures(A.point,{layers:M}):[]).length?m=!0:m&&(m=!1,h.call(this,new Sr(x,this,A.originalEvent)))},mouseout:A=>{m&&(m=!1,h.call(this,new Sr(x,this,A.originalEvent)))}}}}{const m=g=>{const _=i.filter(M=>this.getLayer(M)),A=_.length!==0?this.queryRenderedFeatures(g.point,{layers:_}):[];A.length&&(g.features=A,h.call(this,g),delete g.features)};return{layers:i,listener:h,delegates:{[x]:m}}}}_saveDelegatedListener(x,i){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[x]=this._delegatedListeners[x]||[],this._delegatedListeners[x].push(i)}_removeDelegatedListener(x,i,h){if(!this._delegatedListeners||!this._delegatedListeners[x])return;const m=this._delegatedListeners[x];for(let g=0;g<m.length;g++){const _=m[g];if(_.listener===h&&_.layers.length===i.length&&_.layers.every(A=>i.includes(A))){for(const A in _.delegates)this.off(A,_.delegates[A]);return void m.splice(g,1)}}}on(x,i,h){if(h===void 0)return super.on(x,i);const m=this._createDelegatedListener(x,typeof i=="string"?[i]:i,h);this._saveDelegatedListener(x,m);for(const g in m.delegates)this.on(g,m.delegates[g]);return this}once(x,i,h){if(h===void 0)return super.once(x,i);const m=typeof i=="string"?[i]:i,g=this._createDelegatedListener(x,m,h);for(const _ in g.delegates){const A=g.delegates[_];g.delegates[_]=(...M)=>{this._removeDelegatedListener(x,m,h),A(...M)}}this._saveDelegatedListener(x,g);for(const _ in g.delegates)this.once(_,g.delegates[_]);return this}off(x,i,h){return h===void 0?super.off(x,i):(this._removeDelegatedListener(x,typeof i=="string"?[i]:i,h),this)}queryRenderedFeatures(x,i){if(!this.style)return[];let h;const m=x instanceof c.P||Array.isArray(x),g=m?x:[[0,0],[this.transform.width,this.transform.height]];if(i=i||(m?{}:x)||{},g instanceof c.P||typeof g[0]=="number")h=[c.P.convert(g)];else{const _=c.P.convert(g[0]),A=c.P.convert(g[1]);h=[_,new c.P(A.x,_.y),A,new c.P(_.x,A.y),_]}return this.style.queryRenderedFeatures(h,i,this.transform)}querySourceFeatures(x,i){return this.style.querySourceFeatures(x,i)}setStyle(x,i){return(i=c.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},i)).diff!==!1&&i.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&x?(this._diffStyle(x,i),this):(this._localIdeographFontFamily=i.localIdeographFontFamily,this._updateStyle(x,i))}setTransformRequest(x){return this._requestManager.setTransformRequest(x),this}_getUIString(x){const i=this._locale[x];if(i==null)throw new Error(`Missing UI string '${x}'`);return i}_updateStyle(x,i){if(i.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(x,i));const h=this.style&&i.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!x)),x?(this.style=new Ql(this,i||{}),this.style.setEventedParent(this,{style:this.style}),typeof x=="string"?this.style.loadURL(x,i,h):this.style.loadJSON(x,i,h),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Ql(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(x,i){if(typeof x=="string"){const h=this._requestManager.transformRequest(x,"Style");c.h(h,new AbortController).then(m=>{this._updateDiff(m.data,i)}).catch(m=>{m&&this.fire(new c.j(m))})}else typeof x=="object"&&this._updateDiff(x,i)}_updateDiff(x,i){try{this.style.setState(x,i)&&this._update(!0)}catch(h){c.w(`Unable to perform style diff: ${h.message||h.error||h}. Rebuilding the style from scratch.`),this._updateStyle(x,i)}}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(x,i){return this._lazyInitEmptyStyle(),this.style.addSource(x,i),this._update(!0)}isSourceLoaded(x){const i=this.style&&this.style.sourceCaches[x];if(i!==void 0)return i.loaded();this.fire(new c.j(new Error(`There is no source with ID '${x}'`)))}setTerrain(x){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),x){const i=this.style.sourceCaches[x.source];if(!i)throw new Error(`cannot load terrain, because there exists no source with ID: ${x.source}`);this.terrain===null&&i.reload();for(const h in this.style._layers){const m=this.style._layers[h];m.type==="hillshade"&&m.source===x.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 wu(this.painter,i,x),this.painter.renderToTexture=new cf(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=h=>{h.dataType==="style"?this.terrain.sourceCache.freeRtt():h.dataType==="source"&&h.tile&&(h.sourceId!==x.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(h.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:x})),this}getTerrain(){var x,i;return(i=(x=this.terrain)===null||x===void 0?void 0:x.options)!==null&&i!==void 0?i:null}areTilesLoaded(){const x=this.style&&this.style.sourceCaches;for(const i in x){const h=x[i]._tiles;for(const m in h){const g=h[m];if(g.state!=="loaded"&&g.state!=="errored")return!1}}return!0}removeSource(x){return this.style.removeSource(x),this._update(!0)}getSource(x){return this.style.getSource(x)}addImage(x,i,h={}){const{pixelRatio:m=1,sdf:g=!1,stretchX:_,stretchY:A,content:M,textFitWidth:P,textFitHeight:V}=h;if(this._lazyInitEmptyStyle(),!(i instanceof HTMLImageElement||c.b(i))){if(i.width===void 0||i.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:O,height:L,data:G}=i,K=i;return this.style.addImage(x,{data:new c.R({width:O,height:L},new Uint8Array(G)),pixelRatio:m,stretchX:_,stretchY:A,content:M,textFitWidth:P,textFitHeight:V,sdf:g,version:0,userImage:K}),K.onAdd&&K.onAdd(this,x),this}}{const{width:O,height:L,data:G}=C.getImageData(i);this.style.addImage(x,{data:new c.R({width:O,height:L},G),pixelRatio:m,stretchX:_,stretchY:A,content:M,textFitWidth:P,textFitHeight:V,sdf:g,version:0})}}updateImage(x,i){const h=this.style.getImage(x);if(!h)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 m=i instanceof HTMLImageElement||c.b(i)?C.getImageData(i):i,{width:g,height:_,data:A}=m;if(g===void 0||_===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(g!==h.data.width||_!==h.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 M=!(i instanceof HTMLImageElement||c.b(i));return h.data.replace(A,M),this.style.updateImage(x,h),this}getImage(x){return this.style.getImage(x)}hasImage(x){return x?!!this.style.getImage(x):(this.fire(new c.j(new Error("Missing required image id"))),!1)}removeImage(x){this.style.removeImage(x)}loadImage(x){return Q.getImage(this._requestManager.transformRequest(x,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(x,i){return this._lazyInitEmptyStyle(),this.style.addLayer(x,i),this._update(!0)}moveLayer(x,i){return this.style.moveLayer(x,i),this._update(!0)}removeLayer(x){return this.style.removeLayer(x),this._update(!0)}getLayer(x){return this.style.getLayer(x)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(x,i,h){return this.style.setLayerZoomRange(x,i,h),this._update(!0)}setFilter(x,i,h={}){return this.style.setFilter(x,i,h),this._update(!0)}getFilter(x){return this.style.getFilter(x)}setPaintProperty(x,i,h,m={}){return this.style.setPaintProperty(x,i,h,m),this._update(!0)}getPaintProperty(x,i){return this.style.getPaintProperty(x,i)}setLayoutProperty(x,i,h,m={}){return this.style.setLayoutProperty(x,i,h,m),this._update(!0)}getLayoutProperty(x,i){return this.style.getLayoutProperty(x,i)}setGlyphs(x,i={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(x,i),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(x,i,h={}){return this._lazyInitEmptyStyle(),this.style.addSprite(x,i,h,m=>{m||this._update(!0)}),this}removeSprite(x){return this._lazyInitEmptyStyle(),this.style.removeSprite(x),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(x,i={}){return this._lazyInitEmptyStyle(),this.style.setSprite(x,i,h=>{h||this._update(!0)}),this}setLight(x,i={}){return this._lazyInitEmptyStyle(),this.style.setLight(x,i),this._update(!0)}getLight(){return this.style.getLight()}setSky(x){return this._lazyInitEmptyStyle(),this.style.setSky(x),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(x,i){return this.style.setFeatureState(x,i),this._update()}removeFeatureState(x,i){return this.style.removeFeatureState(x,i),this._update()}getFeatureState(x){return this.style.getFeatureState(x)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let x=0,i=0;return this._container&&(x=this._container.clientWidth||400,i=this._container.clientHeight||300),[x,i]}_setupContainer(){const x=this._container;x.classList.add("maplibregl-map");const i=this._canvasContainer=T.create("div","maplibregl-canvas-container",x);this._interactive&&i.classList.add("maplibregl-interactive"),this._canvas=T.create("canvas","maplibregl-canvas",i),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 h=this._containerDimensions(),m=this._getClampedPixelRatio(h[0],h[1]);this._resizeCanvas(h[0],h[1],m);const g=this._controlContainer=T.create("div","maplibregl-control-container",x),_=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(A=>{_[A]=T.create("div",`maplibregl-ctrl-${A} `,g)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(x,i,h){this._canvas.width=Math.floor(h*x),this._canvas.height=Math.floor(h*i),this._canvas.style.width=`${x}px`,this._canvas.style.height=`${i}px`}_setupPainter(){const x={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let i=null;this._canvas.addEventListener("webglcontextcreationerror",m=>{i={requestedAttributes:x},m&&(i.statusMessage=m.statusMessage,i.type=m.type)},{once:!0});const h=this._canvas.getContext("webgl2",x)||this._canvas.getContext("webgl",x);if(!h){const m="Failed to initialize WebGL";throw i?(i.message=m,new Error(JSON.stringify(i))):new Error(m)}this.painter=new mc(h,this.transform),I.testSupport(h)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(x){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||x,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(x){return this._update(),this._renderTaskQueue.add(x)}_cancelRenderFrame(x){this._renderTaskQueue.remove(x)}_render(x){const i=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(x),this._removed)return;let h=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const g=this.transform.zoom,_=C.now();this.style.zoomHistory.update(g,_);const A=new c.z(g,{now:_,fadeDuration:i,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),M=A.crossFadingFactor();M===1&&M===this._crossFadingFactor||(h=!0,this._crossFadingFactor=M),this.style.update(A)}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,i,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:i,showPadding:this.showPadding}),this.fire(new c.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,c.bf.mark(c.bg.load),this.fire(new c.k("load"))),this.style&&(this.style.hasTransitions()||h)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const m=this._sourcesDirty||this._styleDirty||this._placementDirty;return m||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new c.k("idle")),!this._loaded||this._fullyLoaded||m||(this._fullyLoaded=!0,c.bf.mark(c.bg.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var x;this._hash&&this._hash.remove();for(const h of this._controls)h.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),Q.removeThrottleControl(this._imageQueueHandle),(x=this._resizeObserver)===null||x===void 0||x.disconnect();const i=this.painter.context.gl.getExtension("WEBGL_lose_context");i!=null&&i.loseContext&&i.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),T.remove(this._canvasContainer),T.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),c.bf.clearMetrics(),this._removed=!0,this.fire(new c.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,C.frameAsync(this._frameRequest).then(x=>{c.bf.frame(x),this._frameRequest=null,this._render(x)}).catch(()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(x){this._showTileBoundaries!==x&&(this._showTileBoundaries=x,this._update())}get showPadding(){return!!this._showPadding}set showPadding(x){this._showPadding!==x&&(this._showPadding=x,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(x){this._showCollisionBoxes!==x&&(this._showCollisionBoxes=x,x?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(x){this._showOverdrawInspector!==x&&(this._showOverdrawInspector=x,this._update())}get repaint(){return!!this._repaint}set repaint(x){this._repaint!==x&&(this._repaint=x,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(x){this._vertices=x,this._update()}get version(){return df}getCameraTargetElevation(){return this.transform.elevation}},p.MapMouseEvent=Sr,p.MapTouchEvent=_o,p.MapWheelEvent=nf,p.Marker=Sc,p.NavigationControl=class{constructor(x){this._updateZoomButtons=()=>{const i=this._map.getZoom(),h=i===this._map.getMaxZoom(),m=i===this._map.getMinZoom();this._zoomInButton.disabled=h,this._zoomOutButton.disabled=m,this._zoomInButton.setAttribute("aria-disabled",h.toString()),this._zoomOutButton.setAttribute("aria-disabled",m.toString())},this._rotateCompassArrow=()=>{const i=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=i},this._setButtonTitle=(i,h)=>{const m=this._map._getUIString(`NavigationControl.${h}`);i.title=m,i.setAttribute("aria-label",m)},this.options=c.e({},o0,x),this._container=T.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",i=>i.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",i=>this._map.zoomIn({},{originalEvent:i})),T.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",i=>this._map.zoomOut({},{originalEvent:i})),T.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",i=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:i}):this._map.resetNorth({},{originalEvent:i})}),this._compassIcon=T.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(x){return this._map=x,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 a0(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){T.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(x,i){const h=T.create("button",x,this._container);return h.type="button",h.addEventListener("click",i),h}},p.Popup=class extends c.E{constructor(x){super(),this.remove=()=>(this._content&&T.remove(this._content),this._container&&(T.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=i=>{this._update(i.point)},this._onMouseMove=i=>{this._update(i.point)},this._onDrag=i=>{this._update(i.point)},this._update=i=>{var h;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=T.create("div","maplibregl-popup",this._map.getContainer()),this._tip=T.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const M of this.options.className.split(" "))this._container.classList.add(M);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?On(this._lngLat,this._flatPos,this._map.transform):(h=this._lngLat)===null||h===void 0?void 0:h.wrap(),this._trackPointer&&!i)return;const m=this._flatPos=this._pos=this._trackPointer&&i?i:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&i?i:this._map.transform.locationPoint(this._lngLat));let g=this.options.anchor;const _=Ac(this.options.offset);if(!g){const M=this._container.offsetWidth,P=this._container.offsetHeight;let V;V=m.y+_.bottom.y<P?["top"]:m.y>this._map.transform.height-P?["bottom"]:[],m.x<M/2?V.push("left"):m.x>this._map.transform.width-M/2&&V.push("right"),g=V.length===0?"bottom":V.join("-")}let A=m.add(_[g]);this.options.subpixelPositioning||(A=A.round()),T.setTransform(this._container,`${la[g]} translate(${A.x}px,${A.y}px)`),Cc(this._container,g,"popup")},this._onClose=()=>{this.remove()},this.options=c.e(Object.create(St),x)}addTo(x){return this._map&&this.remove(),this._map=x,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(x){return this._lngLat=c.N.convert(x),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(x){return this.setDOMContent(document.createTextNode(x))}setHTML(x){const i=document.createDocumentFragment(),h=document.createElement("body");let m;for(h.innerHTML=x;m=h.firstChild,m;)i.appendChild(m);return this.setDOMContent(i)}getMaxWidth(){var x;return(x=this._container)===null||x===void 0?void 0:x.style.maxWidth}setMaxWidth(x){return this.options.maxWidth=x,this._update(),this}setDOMContent(x){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=T.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(x),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(x){return this._container&&this._container.classList.add(x),this}removeClassName(x){return this._container&&this._container.classList.remove(x),this}setOffset(x){return this.options.offset=x,this._update(),this}toggleClassName(x){if(this._container)return this._container.classList.toggle(x)}setSubpixelPositioning(x){this.options.subpixelPositioning=x}_createCloseButton(){this.options.closeButton&&(this._closeButton=T.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const x=this._container.querySelector(Tc);x&&x.focus()}},p.RasterDEMTileSource=zn,p.RasterTileSource=Qt,p.ScaleControl=class{constructor(x){this._onMove=()=>{cl(this._map,this._container,this.options)},this.setUnit=i=>{this.options.unit=i,cl(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},ns),x)}getDefaultPosition(){return"bottom-left"}onAdd(x){return this._map=x,this._container=T.create("div","maplibregl-ctrl maplibregl-ctrl-scale",x.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){T.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},p.ScrollZoomHandler=Oi,p.Style=Ql,p.TerrainControl=class{constructor(x){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=x}onAdd(x){return this._map=x,this._container=T.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=T.create("button","maplibregl-ctrl-terrain",this._container),T.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(){T.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},p.TwoFingersTouchPitchHandler=ol,p.TwoFingersTouchRotateHandler=gu,p.TwoFingersTouchZoomHandler=fu,p.TwoFingersTouchZoomRotateHandler=_u,p.VectorTileSource=Ps,p.VideoSource=yi,p.addSourceType=(x,i)=>c._(void 0,void 0,void 0,function*(){if(Ii(x))throw new Error(`A source type called "${x}" already exists.`);((h,m)=>{Mi[h]=m})(x,i)}),p.clearPrewarmedResources=function(){const x=Te;x&&(x.isPreloaded()&&x.numActive()===1?(x.release(In),Te=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()"))},p.getMaxParallelImageRequests=function(){return c.a.MAX_PARALLEL_IMAGE_REQUESTS},p.getRTLTextPluginStatus=function(){return ni().getRTLTextPluginStatus()},p.getVersion=function(){return Cu},p.getWorkerCount=function(){return Hn.workerCount},p.getWorkerUrl=function(){return c.a.WORKER_URL},p.importScriptInWorkers=function(x){return qt().broadcast("IS",x)},p.prewarm=function(){nt().acquire(In)},p.setMaxParallelImageRequests=function(x){c.a.MAX_PARALLEL_IMAGE_REQUESTS=x},p.setRTLTextPlugin=function(x,i){return ni().setRTLTextPlugin(x,i)},p.setWorkerCount=function(x){Hn.workerCount=x},p.setWorkerUrl=function(x){c.a.WORKER_URL=x}});var d=n;return d})})(kx);var SP=kx.exports;const Dh=CP(SP);function Ex(t,e,n){if(t!==null)for(var r,o,d,p,c,b,k,E=0,C=0,T,I=t.type,N=I==="FeatureCollection",$=I==="Feature",F=N?t.features.length:1,q=0;q<F;q++){k=N?t.features[q].geometry:$?t.geometry:t,T=k?k.type==="GeometryCollection":!1,c=T?k.geometries.length:1;for(var J=0;J<c;J++){var Q=0,me=0;if(p=T?k.geometries[J]:k,p!==null){b=p.coordinates;var ke=p.type;switch(E=0,ke){case null:break;case"Point":if(e(b,C,q,Q,me)===!1)return!1;C++,Q++;break;case"LineString":case"MultiPoint":for(r=0;r<b.length;r++){if(e(b[r],C,q,Q,me)===!1)return!1;C++,ke==="MultiPoint"&&Q++}ke==="LineString"&&Q++;break;case"Polygon":case"MultiLineString":for(r=0;r<b.length;r++){for(o=0;o<b[r].length-E;o++){if(e(b[r][o],C,q,Q,me)===!1)return!1;C++}ke==="MultiLineString"&&Q++,ke==="Polygon"&&me++}ke==="Polygon"&&Q++;break;case"MultiPolygon":for(r=0;r<b.length;r++){for(me=0,o=0;o<b[r].length;o++){for(d=0;d<b[r][o].length-E;d++){if(e(b[r][o][d],C,q,Q,me)===!1)return!1;C++}me++}Q++}break;case"GeometryCollection":for(r=0;r<p.geometries.length;r++)if(Ex(p.geometries[r],e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function TP(t,e={}){if(t.bbox!=null&&e.recompute!==!0)return t.bbox;const n=[1/0,1/0,-1/0,-1/0];return Ex(t,r=>{n[0]>r[0]&&(n[0]=r[0]),n[1]>r[1]&&(n[1]=r[1]),n[2]<r[0]&&(n[2]=r[0]),n[3]<r[1]&&(n[3]=r[1])}),n}function AP(t,e,n={}){const r={type:"Feature"};return(n.id===0||n.id)&&(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties={},r.geometry=t,r}function Cx(t,e={}){const n={type:"FeatureCollection"};return e.id&&(n.id=e.id),e.bbox&&(n.bbox=e.bbox),n.features=t,n}const DP={},MP={xmlns:"http://www.w3.org/2000/svg",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-x"};function IP(t,e,n,r,o,d){return a.openBlock(),a.createElementBlock("svg",MP,e[0]||(e[0]=[a.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),a.createElementVNode("path",{d:"M18 6l-12 12"},null,-1),a.createElementVNode("path",{d:"M6 6l12 12"},null,-1)]))}const PP=Oe(DP,[["render",IP]]);function RP(t){const e=[{type:"fill",minzoom:t.pointZoom||0,paint:{"fill-color":t.color||"#ccc","fill-outline-color":t.stroke||"#blue","fill-opacity":t.opacity||1}}];return t.pointZoom&&e.push({type:"circle",maxzoom:t.pointZoom,paint:{"circle-color":t.color||"#ccc","circle-stroke-color":t.stroke||"#ccc","circle-stroke-width":t.width||1,"circle-opacity":t.opacity||1}}),t.label&&e.push({type:"symbol",layout:{"text-field":["get",t.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}}),e}function NP(t){const e=[{type:"line",paint:{"line-color":t.color||"#ccc","line-opacity":t.opacity||1}}];return t.label&&e.push({type:"symbol",layout:{"text-field":["get",t.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}}),e}function BP(t){const e=[{type:"circle",maxzoom:t.icon&&+t.iconZoom||22,paint:{"circle-radius":t.radius||6,"circle-stroke-color":t.stroke||"#ccc","circle-stroke-width":t.width||1,"circle-color":t.color||"blue","circle-opacity":t.opacity||1}}];return t!=null&&t.clusterZoom&&(e.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]}}),e.push({type:"symbol",filter:["has","point_count"],layout:{"text-field":["get","point_count"],"text-font":["Open Sans Regular"],"text-size":12}})),t.icon&&e.push({type:"symbol",minzoom:+t.iconZoom||16,layout:{"icon-image":t.icon,"icon-allow-overlap":!0}}),t.label&&e.push({type:"symbol",layout:{"text-field":["get",t.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}}),e}function VP(t){if(!t)return null;const e=t.type||"point";return e==="polygon"?RP(t):e==="line"?NP(t):BP(t)}const zP=["#69D2E7","yellow","#FE4365","#125B9A","#41B3A2","#D7C3F1","#F1D3CE"],OP=["ma-star","ma-water","ma-swimming","fa-home","fa-search","fa-trash","fa-check"],Sx={};async function Tx(t,e){const n=await fetch(`/api/gis-layer/${t}/${e}`),{rows:r}=await n.json();return r}async function Lm(t,e,n,r){if(!t)return null;const o=JSON.parse(JSON.stringify(t)),d=o.colorAttr?await Tx(e,o.colorAttr):null;d==null||d.forEach((c,b)=>{var k,E;c.color=c.color||((k=o.colorSet)==null?void 0:k[c.id])||((E=o.colorSet)==null?void 0:E[b])||zP[b],c.icon=o.icon?o.icon.split("+")[0]+"+"+c.color.replace("#","")+".png":null});const p=o.iconAttr?await Tx(e,o.iconAttr):null;if(p==null||p.forEach((c,b)=>{var I,N,$,F;const k=c.icon||((I=o.iconSet)==null?void 0:I[c.id])||((N=o.iconPattern)==null?void 0:N.replace("{id}",c.id))||(($=o.iconSet)==null?void 0:$[b])||(o.iconPrefix?null:OP[b]);if(!k)return;const E=c.color||((F=o.color)==null?void 0:F.replace("#",""))||"red",[C="pin6",T="m"]=o.icon?o.icon.split("-"):[];c.icon=o.iconPrefix||k!=null&&k.includes("/")?(o.iconPrefix||"")+k:`${C}-${T}-${k}+${E}.png`}),o.colorAttr&&d){const c=["match",["get",o.colorAttr]];d.forEach(b=>{c.push(b.id),c.push(b.color)}),c.push(o.color||"gray"),o.color=c}if(o.icon&&o.iconAttr&&p){const c=["match",["get",o.iconAttr]];p.filter(b=>b.icon).forEach(({id:b,icon:k})=>{if(o.colorAttr&&d){c.push(b);const E=["match",["get",o.colorAttr]];d.forEach(C=>{E.push(C.id);const T=k.split("+")[0]+"+"+C.color.replace("#","")+".png";E.push(T),Rl(T,n)}),E.push(o.icon),c.push(E)}else c.push(b),c.push(k),Rl(k,n)}),c.push((o.iconPrefix||"")+o.icon),Rl((o.iconPrefix||"")+o.icon,n),console.log(c),o.icon=c}else if(o.icon&&o.colorAttr&&d){const c=["match",["get",o.colorAttr]];d.forEach(b=>{c.push(b.id),c.push(b.icon),Rl(b.icon,n)}),c.push(o.icon),Rl(o.icon,n),o.icon=c}else o.icon&&await Rl(o.icon,n);return o.stroke=["case",["boolean",["feature-state","selected"],!1],"#000000",o.stroke||"#000000"],VP(o)}async function Rl(t="pin4-sm-mi-plumber+f45942.png",e=null){if(Sx[t])return null;Sx[t]=!0;const n=await(e==null?void 0:e.loadImage(t!=null&&t.includes("/")?t:`/api/marker_icon/${t.replace(".png","")}.png`));e==null||e.addImage(t,n.data)}const LP={data(){return{layerList:[],activeLayer:""}},computed:{interactiveSources(){return this.layerList.filter(t=>t==null?void 0:t.interactive).map(t=>t.id)}},methods:{moveLayer(t,e=this.map){e.getStyle().layers.forEach(n=>{n.id.match(t)&&e.moveLayer(n.id)})},async setVisible(t,e=!0,n=this.map){if(!t)return;const r=(t==null?void 0:t.id)||t,o=this.layerList.find(p=>p.id===t)||t;if(!(o!=null&&o.id))throw new Error("MixinError: Layer has no id");const d=n.getStyle().layers.filter(p=>p.id.match(r));d.forEach(p=>{n.setLayoutProperty(p.id,"visibility",e?"visible":"none")}),!d.length&&e&&await this.addLayer(o)},async addLayer(t,e=this==null?void 0:this.map){var o,d;const n=this.layerList.find(p=>p.id===t)||t;!this.map.getStyle()||this.map.getStyle().layers.find(p=>p.id===n.id)||(this.layerList.find(p=>p.id===n.id)||this.layerList.push(n),(n.service==="vtile"||n.service==="vector"||(o=n.url)!=null&&o.includes(".vmt"))&&this.addVtileLayer(n,e),n.service==="geojson"&&this.addGeoJsonLayer(n,e),((d=n.url)!=null&&d.includes(".png")||["tms","raster"].includes(n.service))&&await this.addRasterLayer(n,e))},async addRasterLayer(t,e=this==null?void 0:this.map){e.getSource(t.id)||(await e.addSource(t.id,{type:"raster",tiles:[t==null?void 0:t.url],tileSize:256,...t.bounds?{bounds:t.bounds.map(n=>n-0)}:{},...t!=null&&t.scheme?{scheme:t==null?void 0:t.scheme}:{}}),await e.addLayer({id:t.id,type:"raster",source:t.id,minzoom:0,maxzoom:(t==null?void 0:t.maxzoom)||22}))},async updateStyle(t,e=this==null?void 0:this.map){const n=t.id;e.getStyle().layers.forEach(async o=>{o.source===n&&await e.removeLayer(o.id)}),(await Lm(t.style,t.source,e)||t.layers||[]).forEach((o,d)=>{const p={...o,id:`${t.id}-${d}`,source:t.id,"source-layer":o["source-layer"]||t.source||t.id,maxzoom:+o.maxzoom||24,minzoom:+o.minzoom||0};e.addLayer(p)})},async addVtileLayer(t,e=this==null?void 0:this.map){var p;const n=["props","pointZoom","nocache"].filter(c=>t.style[c]).map(c=>{var b;return`&${c}=${(b=t.style)==null?void 0:b[c]}`}),r=new Date().toISOString().split("T")[0],o={type:"vector",tiles:[`${(p=t==null?void 0:t.url)!=null&&p.startsWith("http")?"":window.location.origin}${t==null?void 0:t.url}?dt=${r}${n}`],minzoom:t.minzoom||5,maxzoom:t.maxzoom||24};e.addSource(t.id,o),(t.layers||await Lm(t.style,t.source||t.id,e)||[]).forEach((c,b)=>{const k={...c,id:`${t.id}-${b}`,source:t.id,"source-layer":c["source-layer"]||t.source||t.id,maxzoom:+c.maxzoom||24,minzoom:+c.minzoom||0};e.addLayer(k)})},async addGeoJsonLayer(t,e=this.map){var o;const n=t.data||((o=t==null?void 0:t.url)!=null&&o.startsWith("http")?"":window.location.origin)+t.url;e.addSource(t.id,{type:"geojson",data:n}),(await Lm(t.style,n.source,e)||t.layers||[]).forEach(d=>{const p={...d,source:t.id,id:d.id||t.id,maxzoom:+d.maxzoom||24,minzoom:+d.minzoom||0,type:d.type||"circle"};e.addLayer(p)})},setLayerData(t,e){this.layerList=this.layerList.map(n=>n.id===t?{...n,...e}:n)},async removeLayer(t,e=this.map){e.getSource(t)&&(await e.getStyle().layers.forEach(async n=>{n.source===t&&await e.removeLayer(n.id)}),await e.removeSource(t))},async setFilter(t,e){const n=this.layerList.find(o=>o.id===t),r=await this.map.getSource(t);if(n.service==="vtile"){await r.setTiles([`${window.location.origin}${n.url}${n.url.includes("?")?"&":"?"}filter=${e}${n.props?`&props=${n.props}`:""}`]);return}n.service},async changeBaseLayer(t){t!==this.activeLayer&&(this.activeLayer&&this.map.setLayoutProperty(this.activeLayer,"visibility","none"),await this.setVisible(this.activeLayer,!1),await this.setVisible(t,!0),this.map.getStyle().layers.forEach(e=>{e.source!==t&&e.type!=="background"&&this.map.moveLayer(e.id)}),this.activeLayer=t)},async refreshLayer(t,e=this.map){await e.getStyle().layers.forEach(n=>{n.source===t&&e.removeLayer(n.id)}),await e.removeSource(t),this.setVisible(t)},addGeom(t,e={}){if(!this.map)return;const n={type:"FeatureCollection",features:[{type:"Feature",geometry:t.geometry,properties:{id:t.id,name:t==null?void 0:t.text}}]};if(this.map.getSource(t.id))this.map.getSource(t.id).setData(n);else{this.map.addSource(t.id,{type:"geojson",data:n});const r=t.geometry.type;let o={};switch(r){case"Point":o={"circle-color":e.color||"#ff0000","circle-radius":e.radius||5,"circle-opacity":e.opacity||1},this.map.addLayer({id:t.id,type:"circle",source:t.id,paint:o});break;case"LineString":o={"line-color":e.color||"#0000ff","line-width":e.width||2,"line-opacity":e.opacity||1},this.map.addLayer({id:t.id,type:"line",source:t.id,paint:o});break;case"Polygon":this.map.addLayer({id:t.id,type:"fill",source:t.id,paint:{"fill-color":e.color||"#00ff00","fill-opacity":e.opacity||.5}}),this.map.addLayer({id:`${t.id}-outline`,type:"line",source:t.id,paint:{"line-color":e.color||"#00ff00","line-width":e.width||2,"line-opacity":.8}});break;default:console.warn(`Unsupported geometry type: ${r}`);return}}},removeGeom(t){this.map&&(this.map.getLayer(t)&&this.map.removeLayer(t),this.map.getLayer(`${t}-outline`)&&this.map.removeLayer(`${t}-outline`),this.map.getSource(t)&&this.map.removeSource(t))}}},{Map:FP}=Dh,rr="widget-map-source",$P={mixins:[LP],props:{geometry:{type:Object,default:()=>null},zoom:{type:Number,default:()=>{var t,e;return((e=(t=et==null?void 0:et.value)==null?void 0:t.geom)==null?void 0:e.zoom)||1/0}},center:{type:Array,default:()=>{var t,e;return((e=(t=et==null?void 0:et.value)==null?void 0:t.geom)==null?void 0:e.center)||[30.5,50.45]}},height:{type:String,default:"400px"},layers:{type:Array,default:()=>{var t,e;return((e=(t=et==null?void 0:et.value)==null?void 0:t.geom)==null?void 0:e.layers)||[]}},card:{type:Boolean,default:!1}},data(){return{cardData:null,cardPosition:{top:"0px",right:"0px",left:"0px"},map:null,mapId:`gis-map-${Math.floor(Math.random()*1e3)}`,isOpen:!1,selectedBaseLayer:"topo100",isGeometryVisible:!0,localLayers:[],idleEventWorked:!1,selectedLayers:[],currentZoom:0,baseLayers:[{id:"topo100",name:"Карта України",url:"https://data.gki.com.ua/api-user/rtile/voyager/ua/{z}/{x}/{y}.png"},{id:"orto10",name:"Ortophoto 1:10К",url:"https://data.gki.com.ua/api-user/rtile/orto10/ua/{z}/{x}/{y}.png",service:"TMS"},{id:"osmb",name:"Open Street Map",url:"https://tile.openstreetmap.org.ua/styles/osm-bright/{z}/{x}/{y}.png",service:"TMS"}]}},mounted(){window.addEventListener("resize",this.updateCardPosition),this.updateCardPosition(),this.localLayers=this.layers,this.initMap()},components:{IconClose:PP},beforeUnmount(){window.removeEventListener("resize",this.updateCardPosition)},watch:{selectedLayers:{handler(){this.selectedLayers.forEach(t=>{this.map.getSource(t)&&this.map.getStyle().layers.forEach(n=>{n.source===t&&this.map.moveLayer(n.id)}),[`${rr}-polygon`,`${rr}-polygon-line`,`${rr}-line`,`${rr}-point`].forEach(n=>{this.map.getLayer(n)&&this.map.moveLayer(n)}),this.map.getLayer("selected-feature")&&this.map.moveLayer("selected-feature")})},immediate:!0},geometry(){this.initGeometryLayer()},layers:{handler(t){t&&!this.layers.length&&(this.localLayers=t)},deep:!0,immediate:!0}},methods:{updateCardPosition(){this.$nextTick(()=>{if(this.$refs.relativeContainer){const t=this.$refs.relativeContainer.getBoundingClientRect();this.cardPosition.top=`${t.top+10}`,this.cardPosition.right=`${t.right+10}`,this.cardPosition.left=`${t.left+10}`}})},initMap(){const t={version:8,glyphs:"https://fonts.openmaptiles.org/{fontstack}/{range}.pbf",sources:{},layers:[]};this.map=new FP({container:this.mapId,style:t,center:this.center,zoom:this.zoom,interactive:!0}),window==null||window.addEventListener("resize",()=>{this.map.resize()}),this.map.on("load",this.onMapLoad)},async onMapLoad(){var t,e,n,r,o,d;this.map.resize(),this.map.doubleClickZoom.disable(),this.map.on("zoom",()=>{this.currentZoom=this.map.getZoom()}),(e=(t=et==null?void 0:et.value)==null?void 0:t.geom)!=null&&e.bounds&&this.map.fitBounds(et.value.geom.bounds,{padding:20,duration:0}),this.zoom&&this.map.setZoom(this.zoom),this.changeBaseLayer(this.getLayerById(this.selectedBaseLayer)),this.localLayers.forEach(async p=>{p.enabled&&(await this.setLayerVisible(p,!0),this.selectedLayers.push(p.id))}),this.geometry&&this.initGeometryLayer(),(r=(n=et==null?void 0:et.value)==null?void 0:n.geom)!=null&&r.katottg&&await this.createAtuLayer((d=(o=et==null?void 0:et.value)==null?void 0:o.geom)==null?void 0:d.katottg),this.map.on("idle",()=>{this.idleEventWorked||this.selectedLayers.forEach(p=>{this.map.getSource(p)&&this.map.getStyle().layers.forEach(b=>{b.source===p&&this.map.moveLayer(b.id)}),[`${rr}-polygon`,`${rr}-polygon-line`,`${rr}-line`,`${rr}-point`].forEach(b=>{this.map.getLayer(b)&&this.map.moveLayer(b)})}),this.idleEventWorked=!0}),this.card&&this.map.on("click",async p=>{const c=this.map.queryRenderedFeatures(p.point);if(!c.length)return;const b=c.filter(k=>!k.source.includes(rr));if(b.length)try{const k=b.map(C=>Le.get(`/api/gis-format-admin?table=${C.sourceLayer}&id=${C.properties.id}`)),E=await Promise.all(k);this.cardData=E.map(C=>C.data)}catch(k){console.error("Помилка при отриманні даних",k)}})},async createAtuLayer(t){try{const{map:e}=this;if(!e)return;const{data:n}=await Le.get(`https://data.gki.com.ua/api-user/atu/${t}`);e.addSource("atu",{type:"geojson",data:n}),e.addLayer({id:"atu",type:"line",source:"atu",paint:{"line-color":"#3b82f6","line-width":2}})}catch(e){console.error(e)}},changeBaseLayer(t){const e="base-layer",n="base-layer";if(!this.map.getSource(e))this.map.addSource(e,{type:"raster",tiles:[t.url],tileSize:256}),this.map.addLayer({id:n,type:"raster",source:e});else{const r=this.map.getSource(e);r&&(r.tiles=[t.url],this.map.style.sourceCaches[e].clearTiles(),this.map.style.sourceCaches[e].update(this.map.transform),this.map.triggerRepaint())}},getLayerById(t){return this.baseLayers.find(e=>e.id===t)},initGeometryLayer(){var r,o,d;const{map:t}=this;if(!t)return;const e=this.formatGeojson(this.geometry),n=t.getSource(rr);if(((d=(o=(r=e.features)==null?void 0:r[0])==null?void 0:o.geometry)==null?void 0:d.type)!=="MultiPoint"&&this.zoomToGeometry(e),n){n.setData(e);return}t.addSource(rr,{type:"geojson",data:e}),t.addLayer({id:`${rr}-point`,type:"circle",source:rr,paint:{"circle-radius":10,"circle-color":"#F84C4C"},filter:["==","$type","Point"]}),t.addLayer({id:`${rr}-polygon`,type:"fill",source:rr,layout:{},paint:{"fill-color":"#4b0082","fill-opacity":.3},filter:["==","$type","Polygon"]}),t.addLayer({id:`${rr}-polygon-line`,type:"line",source:rr,layout:{},paint:{"line-color":"#4b0082","line-width":2},filter:["==","$type","Polygon"]}),t.addLayer({id:`${rr}-line`,type:"line",source:rr,layout:{},paint:{"line-color":"#4b0082","line-width":3},filter:["==","$type","LineString"]})},formatGeojson(t){let e=t;const n=t==null?void 0:t.type;if(Array.isArray(t))return Cx(t);if(!n)throw new Error("Unknown geometry type!");return n==="FeatureCollection"?t:(n==="Feature"&&(e=[t]),!["FeatureCollection","Feature"].includes(n)&&(e=[AP(t)]),Cx(e))},zoomToGeometry(t){var n,r,o,d,p,c;const{map:e}=this;if(((o=(r=(n=t.features)==null?void 0:n[0])==null?void 0:r.geometry)==null?void 0:o.type)==="Point"||t.type==="Point"){const b=((c=(p=(d=t.features)==null?void 0:d[0])==null?void 0:p.geometry)==null?void 0:c.coordinates)||t.coordinates;e.flyTo({center:b,zoom:this.zoom,duration:0})}else{const b=TP(t);e.fitBounds(b,{padding:30,duration:0})}},toggleGeometryVisibility(){[`${rr}-polygon`,`${rr}-polygon-line`,`${rr}-line`,`${rr}-point`].forEach(e=>{this.map.getLayer(e)&&this.map.setLayoutProperty(e,"visibility",this.isGeometryVisible?"visible":"none")})},async setLayerVisible(t,e){await this.setVisible(t,e,this.map)},closeCard(){this.cardData=null,this.removeGeom("selected-feature")}}},jP={key:1,class:"bg-white absolute top-[10px] right-[10px] z-20 border rounded-lg cursor-pointer"},UP={class:"flex items-center justify-between p-2 border-b"},HP={class:"flex items-center"},WP=["value","onChange"],qP={class:"ml-2"},GP={key:0,class:"p-2 border-b"},ZP={class:"flex items-center"},YP=["value","onChange"],XP={class:"ml-2"},KP={key:1,class:"p-2"},JP={class:"flex items-center"},QP=["id"];function eR(t,e,n,r,o,d){var c;const p=a.resolveComponent("IconClose");return a.openBlock(),a.createElementBlock("div",{class:"relative",ref:"relativeContainer",onClick:e[6]||(e[6]=(...b)=>d.updateCardPosition&&d.updateCardPosition(...b))},[o.isOpen?(a.openBlock(),a.createElementBlock("div",jP,[a.createElementVNode("div",UP,[e[7]||(e[7]=a.createElementVNode("div",null,"Шари",-1)),a.createVNode(p,{onClick:e[1]||(e[1]=b=>o.isOpen=!1),class:"w-4 h-4"})]),a.createElementVNode("div",{class:a.normalizeClass(["p-2 border-b",{"border-b":n.geometry}])},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(o.baseLayers,b=>(a.openBlock(),a.createElementBlock("div",{key:b.id},[a.createElementVNode("label",HP,[a.withDirectives(a.createElementVNode("input",{type:"radio",name:"base-layer",value:b.id,"onUpdate:modelValue":e[2]||(e[2]=k=>o.selectedBaseLayer=k),onChange:k=>d.changeBaseLayer(b)},null,40,WP),[[a.vModelRadio,o.selectedBaseLayer]]),a.createElementVNode("span",qP,a.toDisplayString(b.name),1)])]))),128))],2),(c=o.localLayers)!=null&&c.length?(a.openBlock(),a.createElementBlock("div",GP,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(o.localLayers,b=>(a.openBlock(),a.createElementBlock("div",{key:b.id},[a.createElementVNode("label",ZP,[a.withDirectives(a.createElementVNode("input",{type:"checkbox",value:b.id,"onUpdate:modelValue":e[3]||(e[3]=k=>o.selectedLayers=k),onChange:k=>d.setLayerVisible(b,k.target.checked)},null,40,YP),[[a.vModelCheckbox,o.selectedLayers]]),a.createElementVNode("span",XP,a.toDisplayString(b.name),1)])]))),128))])):a.createCommentVNode("",!0),n.geometry?(a.openBlock(),a.createElementBlock("div",KP,[a.createElementVNode("label",JP,[a.withDirectives(a.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":e[4]||(e[4]=b=>o.isGeometryVisible=b),onChange:e[5]||(e[5]=(...b)=>d.toggleGeometryVisibility&&d.toggleGeometryVisibility(...b))},null,544),[[a.vModelCheckbox,o.isGeometryVisible]]),e[8]||(e[8]=a.createElementVNode("span",{class:"ml-2"},"Показати геометрію",-1))])])):a.createCommentVNode("",!0)])):(a.openBlock(),a.createElementBlock("div",{key:0,class:"bg-white absolute top-[10px] right-[10px] z-[1] p-2 border rounded-lg cursor-pointer",onClick:e[0]||(e[0]=b=>o.isOpen=!0)}," Шари ")),a.createElementVNode("div",{id:o.mapId,style:a.normalizeStyle({height:n.height})},null,12,QP),a.renderSlot(t.$slots,"card",{map:o.map,cardData:o.cardData,cardPosition:o.cardPosition,closeCard:d.closeCard})],512)}const Fm=Oe($P,[["render",eR]]),ct=(t,e=1e4)=>(t=parseFloat(t+"")||0,Math.round((t+Number.EPSILON)*e)/e),$m=function(t){if(!(t&&t instanceof Element&&t.offsetParent))return!1;const e=t.scrollHeight>t.clientHeight,n=window.getComputedStyle(t).overflowY,r=n.indexOf("hidden")!==-1,o=n.indexOf("visible")!==-1;return e&&!r&&!o},Mh=function(t,e=void 0){return!(!t||t===document.body||e&&t===e)&&($m(t)?t:Mh(t.parentElement,e))},Ss=function(t){var e=new DOMParser().parseFromString(t,"text/html").body;if(e.childElementCount>1){for(var n=document.createElement("div");e.firstChild;)n.appendChild(e.firstChild);return n}return e.firstChild},jm=t=>`${t||""}`.split(" ").filter(e=>!!e),Ts=(t,e,n)=>{t&&jm(e).forEach(r=>{t.classList.toggle(r,n||!1)})};let Nl=class{constructor(e){Object.defineProperty(this,"pageX",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"pageY",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientX",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientY",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"nativePointer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.nativePointer=e,this.pageX=e.pageX,this.pageY=e.pageY,this.clientX=e.clientX,this.clientY=e.clientY,this.id=self.Touch&&e instanceof Touch?e.identifier:-1,this.time=Date.now()}};const Bl={passive:!1};let tR=class{constructor(e,{start:n=()=>!0,move:r=()=>{},end:o=()=>{}}){Object.defineProperty(this,"element",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"startCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"moveCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"endCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"currentPointers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"startPointers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),this.element=e,this.startCallback=n,this.moveCallback=r,this.endCallback=o;for(const d of["onPointerStart","onTouchStart","onMove","onTouchEnd","onPointerEnd","onWindowBlur"])this[d]=this[d].bind(this);this.element.addEventListener("mousedown",this.onPointerStart,Bl),this.element.addEventListener("touchstart",this.onTouchStart,Bl),this.element.addEventListener("touchmove",this.onMove,Bl),this.element.addEventListener("touchend",this.onTouchEnd),this.element.addEventListener("touchcancel",this.onTouchEnd)}onPointerStart(e){if(!e.buttons||e.button!==0)return;const n=new Nl(e);this.currentPointers.some(r=>r.id===n.id)||this.triggerPointerStart(n,e)&&(window.addEventListener("mousemove",this.onMove),window.addEventListener("mouseup",this.onPointerEnd),window.addEventListener("blur",this.onWindowBlur))}onTouchStart(e){for(const n of Array.from(e.changedTouches||[]))this.triggerPointerStart(new Nl(n),e);window.addEventListener("blur",this.onWindowBlur)}onMove(e){const n=this.currentPointers.slice(),r="changedTouches"in e?Array.from(e.changedTouches||[]).map(d=>new Nl(d)):[new Nl(e)],o=[];for(const d of r){const p=this.currentPointers.findIndex(c=>c.id===d.id);p<0||(o.push(d),this.currentPointers[p]=d)}o.length&&this.moveCallback(e,this.currentPointers.slice(),n)}onPointerEnd(e){e.buttons>0&&e.button!==0||(this.triggerPointerEnd(e,new Nl(e)),window.removeEventListener("mousemove",this.onMove),window.removeEventListener("mouseup",this.onPointerEnd),window.removeEventListener("blur",this.onWindowBlur))}onTouchEnd(e){for(const n of Array.from(e.changedTouches||[]))this.triggerPointerEnd(e,new Nl(n))}triggerPointerStart(e,n){return!!this.startCallback(n,e,this.currentPointers.slice())&&(this.currentPointers.push(e),this.startPointers.push(e),!0)}triggerPointerEnd(e,n){const r=this.currentPointers.findIndex(o=>o.id===n.id);r<0||(this.currentPointers.splice(r,1),this.startPointers.splice(r,1),this.endCallback(e,n,this.currentPointers.slice()))}onWindowBlur(){this.clear()}clear(){for(;this.currentPointers.length;){const e=this.currentPointers[this.currentPointers.length-1];this.currentPointers.splice(this.currentPointers.length-1,1),this.startPointers.splice(this.currentPointers.length-1,1),this.endCallback(new Event("touchend",{bubbles:!0,cancelable:!0,clientX:e.clientX,clientY:e.clientY}),e,this.currentPointers.slice())}}stop(){this.element.removeEventListener("mousedown",this.onPointerStart,Bl),this.element.removeEventListener("touchstart",this.onTouchStart,Bl),this.element.removeEventListener("touchmove",this.onMove,Bl),this.element.removeEventListener("touchend",this.onTouchEnd),this.element.removeEventListener("touchcancel",this.onTouchEnd),window.removeEventListener("mousemove",this.onMove),window.removeEventListener("mouseup",this.onPointerEnd),window.removeEventListener("blur",this.onWindowBlur)}};function Ax(t,e){return e?Math.sqrt(Math.pow(e.clientX-t.clientX,2)+Math.pow(e.clientY-t.clientY,2)):0}function Dx(t,e){return e?{clientX:(t.clientX+e.clientX)/2,clientY:(t.clientY+e.clientY)/2}:t}const Um=t=>typeof t=="object"&&t!==null&&t.constructor===Object&&Object.prototype.toString.call(t)==="[object Object]",fi=(t,...e)=>{const n=e.length;for(let r=0;r<n;r++){const o=e[r]||{};Object.entries(o).forEach(([d,p])=>{const c=Array.isArray(p)?[]:{};t[d]||Object.assign(t,{[d]:c}),Um(p)?Object.assign(t[d],fi(c,p)):Array.isArray(p)?Object.assign(t,{[d]:[...p]}):Object.assign(t,{[d]:p})})}return t},Hm=function(t,e){return t.split(".").reduce((n,r)=>typeof n=="object"?n[r]:void 0,e)};let Ih=class{constructor(e={}){Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),this.setOptions(e);for(const n of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))n.startsWith("on")&&typeof this[n]=="function"&&(this[n]=this[n].bind(this))}setOptions(e){this.options=e?fi({},this.constructor.defaults,e):{};for(const[n,r]of Object.entries(this.option("on")||{}))this.on(n,r)}option(e,...n){let r=Hm(e,this.options);return r&&typeof r=="function"&&(r=r.call(this,this,...n)),r}optionFor(e,n,r,...o){let d=Hm(n,e);var p;typeof(p=d)!="string"||isNaN(p)||isNaN(parseFloat(p))||(d=parseFloat(d)),d==="true"&&(d=!0),d==="false"&&(d=!1),d&&typeof d=="function"&&(d=d.call(this,this,e,...o));let c=Hm(n,this.options);return c&&typeof c=="function"?d=c.call(this,this,e,...o,d):d===void 0&&(d=c),d===void 0?r:d}cn(e){const n=this.options.classes;return n&&n[e]||""}localize(e,n=[]){e=String(e).replace(/\{\{(\w+).?(\w+)?\}\}/g,(r,o,d)=>{let p="";return d?p=this.option(`${o[0]+o.toLowerCase().substring(1)}.l10n.${d}`):o&&(p=this.option(`l10n.${o}`)),p||(p=r),p});for(let r=0;r<n.length;r++)e=e.split(n[r][0]).join(n[r][1]);return e=e.replace(/\{\{(.*?)\}\}/g,(r,o)=>o)}on(e,n){let r=[];typeof e=="string"?r=e.split(" "):Array.isArray(e)&&(r=e),this.events||(this.events=new Map),r.forEach(o=>{let d=this.events.get(o);d||(this.events.set(o,[]),d=[]),d.includes(n)||d.push(n),this.events.set(o,d)})}off(e,n){let r=[];typeof e=="string"?r=e.split(" "):Array.isArray(e)&&(r=e),r.forEach(o=>{const d=this.events.get(o);if(Array.isArray(d)){const p=d.indexOf(n);p>-1&&d.splice(p,1)}})}emit(e,...n){[...this.events.get(e)||[]].forEach(r=>r(this,...n)),e!=="*"&&this.emit("*",e,...n)}};Object.defineProperty(Ih,"version",{enumerable:!0,configurable:!0,writable:!0,value:"5.0.36"}),Object.defineProperty(Ih,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{}});let Wm=class extends Ih{constructor(e={}){super(e),Object.defineProperty(this,"plugins",{enumerable:!0,configurable:!0,writable:!0,value:{}})}attachPlugins(e={}){const n=new Map;for(const[r,o]of Object.entries(e)){const d=this.option(r),p=this.plugins[r];p||d===!1?p&&d===!1&&(p.detach(),delete this.plugins[r]):n.set(r,new o(this,d||{}))}for(const[r,o]of n)this.plugins[r]=o,o.attach()}detachPlugins(e){e=e||Object.keys(this.plugins);for(const n of e){const r=this.plugins[n];r&&r.detach(),delete this.plugins[n]}return this.emit("detachPlugins"),this}};var An;(function(t){t[t.Init=0]="Init",t[t.Error=1]="Error",t[t.Ready=2]="Ready",t[t.Panning=3]="Panning",t[t.Mousemove=4]="Mousemove",t[t.Destroy=5]="Destroy"})(An||(An={}));const eo=["a","b","c","d","e","f"],Mx={PANUP:"Move up",PANDOWN:"Move down",PANLEFT:"Move left",PANRIGHT:"Move right",ZOOMIN:"Zoom in",ZOOMOUT:"Zoom out",TOGGLEZOOM:"Toggle zoom level",TOGGLE1TO1:"Toggle zoom level",ITERATEZOOM:"Toggle zoom level",ROTATECCW:"Rotate counterclockwise",ROTATECW:"Rotate clockwise",FLIPX:"Flip horizontally",FLIPY:"Flip vertically",FITX:"Fit horizontally",FITY:"Fit vertically",RESET:"Reset",TOGGLEFS:"Toggle fullscreen"},nR={content:null,width:"auto",height:"auto",panMode:"drag",touch:!0,dragMinThreshold:3,lockAxis:!1,mouseMoveFactor:1,mouseMoveFriction:.12,zoom:!0,pinchToZoom:!0,panOnlyZoomed:"auto",minScale:1,maxScale:2,friction:.25,dragFriction:.35,decelFriction:.05,click:"toggleZoom",dblClick:!1,wheel:"zoom",wheelLimit:7,spinner:!0,bounds:"auto",infinite:!1,rubberband:!0,bounce:!0,maxVelocity:75,transformParent:!1,classes:{content:"f-panzoom__content",isLoading:"is-loading",canZoomIn:"can-zoom_in",canZoomOut:"can-zoom_out",isDraggable:"is-draggable",isDragging:"is-dragging",inFullscreen:"in-fullscreen",htmlHasFullscreen:"with-panzoom-in-fullscreen"},l10n:Mx},Ix='<circle cx="25" cy="25" r="20"></circle>',qm='<div class="f-spinner"><svg viewBox="0 0 50 50">'+Ix+Ix+"</svg></div>",mi=t=>t&&t!==null&&t instanceof Element&&"nodeType"in t,En=(t,e)=>{t&&jm(e).forEach(n=>{t.classList.remove(n)})},Tt=(t,e)=>{t&&jm(e).forEach(n=>{t.classList.add(n)})},Ph={a:1,b:0,c:0,d:1,e:0,f:0},rR=1e5,Rh=1e4,Yi="mousemove",Px="drag",Rx="content",Xi="auto";let Gm=null,Zm=null,Vl=class vE extends Wm{get fits(){return this.contentRect.width-this.contentRect.fitWidth<1&&this.contentRect.height-this.contentRect.fitHeight<1}get isTouchDevice(){return Zm===null&&(Zm=window.matchMedia("(hover: none)").matches),Zm}get isMobile(){return Gm===null&&(Gm=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)),Gm}get panMode(){return this.options.panMode!==Yi||this.isTouchDevice?Px:Yi}get panOnlyZoomed(){const e=this.options.panOnlyZoomed;return e===Xi?this.isTouchDevice:e}get isInfinite(){return this.option("infinite")}get angle(){return 180*Math.atan2(this.current.b,this.current.a)/Math.PI||0}get targetAngle(){return 180*Math.atan2(this.target.b,this.target.a)/Math.PI||0}get scale(){const{a:e,b:n}=this.current;return Math.sqrt(e*e+n*n)||1}get targetScale(){const{a:e,b:n}=this.target;return Math.sqrt(e*e+n*n)||1}get minScale(){return this.option("minScale")||1}get fullScale(){const{contentRect:e}=this;return e.fullWidth/e.fitWidth||1}get maxScale(){return this.fullScale*(this.option("maxScale")||1)||1}get coverScale(){const{containerRect:e,contentRect:n}=this,r=Math.max(e.height/n.fitHeight,e.width/n.fitWidth)||1;return Math.min(this.fullScale,r)}get isScaling(){return Math.abs(this.targetScale-this.scale)>1e-5&&!this.isResting}get isContentLoading(){const e=this.content;return!!(e&&e instanceof HTMLImageElement)&&!e.complete}get isResting(){if(this.isBouncingX||this.isBouncingY)return!1;for(const e of eo){const n=e=="e"||e==="f"?1e-4:1e-5;if(Math.abs(this.target[e]-this.current[e])>n)return!1}return!(!this.ignoreBounds&&!this.checkBounds().inBounds)}constructor(e,n={},r={}){var o;if(super(n),Object.defineProperty(this,"pointerTracker",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"resizeObserver",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"updateTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"clickTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"rAF",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"isTicking",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"ignoreBounds",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isBouncingX",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isBouncingY",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"clicks",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"trackingPoints",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"pwt",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"cwd",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"pmme",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"friction",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:An.Init}),Object.defineProperty(this,"isDragging",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"content",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"spinner",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"containerRect",{enumerable:!0,configurable:!0,writable:!0,value:{width:0,height:0,innerWidth:0,innerHeight:0}}),Object.defineProperty(this,"contentRect",{enumerable:!0,configurable:!0,writable:!0,value:{top:0,right:0,bottom:0,left:0,fullWidth:0,fullHeight:0,fitWidth:0,fitHeight:0,width:0,height:0}}),Object.defineProperty(this,"dragStart",{enumerable:!0,configurable:!0,writable:!0,value:{x:0,y:0,top:0,left:0,time:0}}),Object.defineProperty(this,"dragOffset",{enumerable:!0,configurable:!0,writable:!0,value:{x:0,y:0,time:0}}),Object.defineProperty(this,"current",{enumerable:!0,configurable:!0,writable:!0,value:Object.assign({},Ph)}),Object.defineProperty(this,"target",{enumerable:!0,configurable:!0,writable:!0,value:Object.assign({},Ph)}),Object.defineProperty(this,"velocity",{enumerable:!0,configurable:!0,writable:!0,value:{a:0,b:0,c:0,d:0,e:0,f:0}}),Object.defineProperty(this,"lockedAxis",{enumerable:!0,configurable:!0,writable:!0,value:!1}),!e)throw new Error("Container Element Not Found");this.container=e,this.initContent(),this.attachPlugins(Object.assign(Object.assign({},vE.Plugins),r)),this.emit("attachPlugins"),this.emit("init");const d=this.content;if(d.addEventListener("load",this.onLoad),d.addEventListener("error",this.onError),this.isContentLoading){if(this.option("spinner")){e.classList.add(this.cn("isLoading"));const p=Ss(qm);!e.contains(d)||d.parentElement instanceof HTMLPictureElement?this.spinner=e.appendChild(p):this.spinner=((o=d.parentElement)===null||o===void 0?void 0:o.insertBefore(p,d))||null}this.emit("beforeLoad")}else queueMicrotask(()=>{this.enable()})}initContent(){const{container:e}=this,n=this.cn(Rx);let r=this.option(Rx)||e.querySelector(`.${n}`);if(r||(r=e.querySelector("img,picture")||e.firstElementChild,r&&Tt(r,n)),r instanceof HTMLPictureElement&&(r=r.querySelector("img")),!r)throw new Error("No content found");this.content=r}onLoad(){const{spinner:e,container:n,state:r}=this;e&&(e.remove(),this.spinner=null),this.option("spinner")&&n.classList.remove(this.cn("isLoading")),this.emit("afterLoad"),r===An.Init?this.enable():this.updateMetrics()}onError(){this.state!==An.Destroy&&(this.spinner&&(this.spinner.remove(),this.spinner=null),this.stop(),this.detachEvents(),this.state=An.Error,this.emit("error"))}getNextScale(e){const{fullScale:n,targetScale:r,coverScale:o,maxScale:d,minScale:p}=this;let c=p;switch(e){case"toggleMax":c=r-p<.5*(d-p)?d:p;break;case"toggleCover":c=r-p<.5*(o-p)?o:p;break;case"toggleZoom":c=r-p<.5*(n-p)?n:p;break;case"iterateZoom":let b=[1,n,d].sort((E,C)=>E-C),k=b.findIndex(E=>E>r+1e-5);c=b[k]||1}return c}attachObserver(){var e;const n=()=>{const{container:r,containerRect:o}=this;return Math.abs(o.width-r.getBoundingClientRect().width)>.1||Math.abs(o.height-r.getBoundingClientRect().height)>.1};this.resizeObserver||window.ResizeObserver===void 0||(this.resizeObserver=new ResizeObserver(()=>{this.updateTimer||(n()?(this.onResize(),this.isMobile&&(this.updateTimer=setTimeout(()=>{n()&&this.onResize(),this.updateTimer=null},500))):this.updateTimer&&(clearTimeout(this.updateTimer),this.updateTimer=null))})),(e=this.resizeObserver)===null||e===void 0||e.observe(this.container)}detachObserver(){var e;(e=this.resizeObserver)===null||e===void 0||e.disconnect()}attachEvents(){const{container:e}=this;e.addEventListener("click",this.onClick,{passive:!1,capture:!1}),e.addEventListener("wheel",this.onWheel,{passive:!1}),this.pointerTracker=new tR(e,{start:this.onPointerDown,move:this.onPointerMove,end:this.onPointerUp}),document.addEventListener(Yi,this.onMouseMove)}detachEvents(){var e;const{container:n}=this;n.removeEventListener("click",this.onClick,{passive:!1,capture:!1}),n.removeEventListener("wheel",this.onWheel,{passive:!1}),(e=this.pointerTracker)===null||e===void 0||e.stop(),this.pointerTracker=null,document.removeEventListener(Yi,this.onMouseMove),document.removeEventListener("keydown",this.onKeydown,!0),this.clickTimer&&(clearTimeout(this.clickTimer),this.clickTimer=null),this.updateTimer&&(clearTimeout(this.updateTimer),this.updateTimer=null)}animate(){this.setTargetForce();const e=this.friction,n=this.option("maxVelocity");for(const r of eo)e?(this.velocity[r]*=1-e,n&&!this.isScaling&&(this.velocity[r]=Math.max(Math.min(this.velocity[r],n),-1*n)),this.current[r]+=this.velocity[r]):this.current[r]=this.target[r];this.setTransform(),this.setEdgeForce(),!this.isResting||this.isDragging?this.rAF=requestAnimationFrame(()=>this.animate()):this.stop("current")}setTargetForce(){for(const e of eo)e==="e"&&this.isBouncingX||e==="f"&&this.isBouncingY||(this.velocity[e]=(1/(1-this.friction)-1)*(this.target[e]-this.current[e]))}checkBounds(e=0,n=0){const{current:r}=this,o=r.e+e,d=r.f+n,p=this.getBounds(),{x:c,y:b}=p,k=c.min,E=c.max,C=b.min,T=b.max;let I=0,N=0;return k!==1/0&&o<k?I=k-o:E!==1/0&&o>E&&(I=E-o),C!==1/0&&d<C?N=C-d:T!==1/0&&d>T&&(N=T-d),Math.abs(I)<1e-4&&(I=0),Math.abs(N)<1e-4&&(N=0),Object.assign(Object.assign({},p),{xDiff:I,yDiff:N,inBounds:!I&&!N})}clampTargetBounds(){const{target:e}=this,{x:n,y:r}=this.getBounds();n.min!==1/0&&(e.e=Math.max(e.e,n.min)),n.max!==1/0&&(e.e=Math.min(e.e,n.max)),r.min!==1/0&&(e.f=Math.max(e.f,r.min)),r.max!==1/0&&(e.f=Math.min(e.f,r.max))}calculateContentDim(e=this.current){const{content:n,contentRect:r}=this,{fitWidth:o,fitHeight:d,fullWidth:p,fullHeight:c}=r;let b=p,k=c;if(this.option("zoom")||this.angle!==0){const E=!(n instanceof HTMLImageElement)&&(window.getComputedStyle(n).maxWidth==="none"||window.getComputedStyle(n).maxHeight==="none"),C=E?p:o,T=E?c:d,I=this.getMatrix(e),N=new DOMPoint(0,0).matrixTransform(I),$=new DOMPoint(0+C,0).matrixTransform(I),F=new DOMPoint(0+C,0+T).matrixTransform(I),q=new DOMPoint(0,0+T).matrixTransform(I),J=Math.abs(F.x-N.x),Q=Math.abs(F.y-N.y),me=Math.abs(q.x-$.x),ke=Math.abs(q.y-$.y);b=Math.max(J,me),k=Math.max(Q,ke)}return{contentWidth:b,contentHeight:k}}setEdgeForce(){if(this.ignoreBounds||this.isDragging||this.panMode===Yi||this.targetScale<this.scale)return this.isBouncingX=!1,void(this.isBouncingY=!1);const{target:e}=this,{x:n,y:r,xDiff:o,yDiff:d}=this.checkBounds(),p=this.option("maxVelocity");let c=this.velocity.e,b=this.velocity.f;o!==0?(this.isBouncingX=!0,o*c<=0?c+=.14*o:(c=.14*o,n.min!==1/0&&(this.target.e=Math.max(e.e,n.min)),n.max!==1/0&&(this.target.e=Math.min(e.e,n.max))),p&&(c=Math.max(Math.min(c,p),-1*p))):this.isBouncingX=!1,d!==0?(this.isBouncingY=!0,d*b<=0?b+=.14*d:(b=.14*d,r.min!==1/0&&(this.target.f=Math.max(e.f,r.min)),r.max!==1/0&&(this.target.f=Math.min(e.f,r.max))),p&&(b=Math.max(Math.min(b,p),-1*p))):this.isBouncingY=!1,this.isBouncingX&&(this.velocity.e=c),this.isBouncingY&&(this.velocity.f=b)}enable(){const{content:e}=this,n=new DOMMatrixReadOnly(window.getComputedStyle(e).transform);for(const r of eo)this.current[r]=this.target[r]=n[r];this.updateMetrics(),this.attachObserver(),this.attachEvents(),this.state=An.Ready,this.emit("ready")}onClick(e){var n;e.type==="click"&&e.detail===0&&(this.dragOffset.x=0,this.dragOffset.y=0),this.isDragging&&((n=this.pointerTracker)===null||n===void 0||n.clear(),this.trackingPoints=[],this.startDecelAnim());const r=e.target;if(!r||e.defaultPrevented)return;if(r.hasAttribute("disabled"))return e.preventDefault(),void e.stopPropagation();if((()=>{const I=window.getSelection();return I&&I.type==="Range"})()&&!r.closest("button"))return;const o=r.closest("[data-panzoom-action]"),d=r.closest("[data-panzoom-change]"),p=o||d,c=p&&mi(p)?p.dataset:null;if(c){const I=c.panzoomChange,N=c.panzoomAction;if((I||N)&&e.preventDefault(),I){let $={};try{$=JSON.parse(I)}catch{console&&console.warn("The given data was not valid JSON")}return void this.applyChange($)}if(N)return void(this[N]&&this[N]())}if(Math.abs(this.dragOffset.x)>3||Math.abs(this.dragOffset.y)>3)return e.preventDefault(),void e.stopPropagation();if(r.closest("[data-fancybox]"))return;const b=this.content.getBoundingClientRect(),k=this.dragStart;if(k.time&&!this.canZoomOut()&&(Math.abs(b.x-k.x)>2||Math.abs(b.y-k.y)>2))return;this.dragStart.time=0;const E=I=>{this.option("zoom",e)&&I&&typeof I=="string"&&/(iterateZoom)|(toggle(Zoom|Full|Cover|Max)|(zoomTo(Fit|Cover|Max)))/.test(I)&&typeof this[I]=="function"&&(e.preventDefault(),this[I]({event:e}))},C=this.option("click",e),T=this.option("dblClick",e);T?(this.clicks++,this.clicks==1&&(this.clickTimer=setTimeout(()=>{this.clicks===1?(this.emit("click",e),!e.defaultPrevented&&C&&E(C)):(this.emit("dblClick",e),e.defaultPrevented||E(T)),this.clicks=0,this.clickTimer=null},350))):(this.emit("click",e),!e.defaultPrevented&&C&&E(C))}addTrackingPoint(e){const n=this.trackingPoints.filter(r=>r.time>Date.now()-100);n.push(e),this.trackingPoints=n}onPointerDown(e,n,r){var o;if(this.option("touch",e)===!1)return!1;this.pwt=0,this.dragOffset={x:0,y:0,time:0},this.trackingPoints=[];const d=this.content.getBoundingClientRect();if(this.dragStart={x:d.x,y:d.y,top:d.top,left:d.left,time:Date.now()},this.clickTimer)return!1;if(this.panMode===Yi&&this.targetScale>1)return e.preventDefault(),e.stopPropagation(),!1;const p=e.composedPath()[0];if(!r.length){if(["TEXTAREA","OPTION","INPUT","SELECT","VIDEO","IFRAME"].includes(p.nodeName)||p.closest("[contenteditable],[data-selectable],[data-draggable],[data-clickable],[data-panzoom-change],[data-panzoom-action]"))return!1;(o=window.getSelection())===null||o===void 0||o.removeAllRanges()}if(e.type==="mousedown")["A","BUTTON"].includes(p.nodeName)||e.preventDefault();else if(Math.abs(this.velocity.a)>.3)return!1;return this.target.e=this.current.e,this.target.f=this.current.f,this.stop(),this.isDragging||(this.isDragging=!0,this.addTrackingPoint(n),this.emit("touchStart",e)),!0}onPointerMove(e,n,r){if(this.option("touch",e)===!1||!this.isDragging||n.length<2&&this.panOnlyZoomed&&ct(this.targetScale)<=ct(this.minScale)||(this.emit("touchMove",e),e.defaultPrevented))return;this.addTrackingPoint(n[0]);const{content:o}=this,d=Dx(r[0],r[1]),p=Dx(n[0],n[1]);let c=0,b=0;if(n.length>1){const Q=o.getBoundingClientRect();c=d.clientX-Q.left-.5*Q.width,b=d.clientY-Q.top-.5*Q.height}const k=Ax(r[0],r[1]),E=Ax(n[0],n[1]);let C=k?E/k:1,T=p.clientX-d.clientX,I=p.clientY-d.clientY;this.dragOffset.x+=T,this.dragOffset.y+=I,this.dragOffset.time=Date.now()-this.dragStart.time;let N=ct(this.targetScale)===ct(this.minScale)&&this.option("lockAxis");if(N&&!this.lockedAxis)if(N==="xy"||N==="y"||e.type==="touchmove"){if(Math.abs(this.dragOffset.x)<6&&Math.abs(this.dragOffset.y)<6)return void e.preventDefault();const Q=Math.abs(180*Math.atan2(this.dragOffset.y,this.dragOffset.x)/Math.PI);this.lockedAxis=Q>45&&Q<135?"y":"x",this.dragOffset.x=0,this.dragOffset.y=0,T=0,I=0}else this.lockedAxis=N;if(Mh(e.target,this.content)&&(N="x",this.dragOffset.y=0),N&&N!=="xy"&&this.lockedAxis!==N&&ct(this.targetScale)===ct(this.minScale))return;e.cancelable&&e.preventDefault(),this.container.classList.add(this.cn("isDragging"));const $=this.checkBounds(T,I);this.option("rubberband")?(this.isInfinite!=="x"&&($.xDiff>0&&T<0||$.xDiff<0&&T>0)&&(T*=Math.max(0,.5-Math.abs(.75/this.contentRect.fitWidth*$.xDiff))),this.isInfinite!=="y"&&($.yDiff>0&&I<0||$.yDiff<0&&I>0)&&(I*=Math.max(0,.5-Math.abs(.75/this.contentRect.fitHeight*$.yDiff)))):($.xDiff&&(T=0),$.yDiff&&(I=0));const F=this.targetScale,q=this.minScale,J=this.maxScale;F<.5*q&&(C=Math.max(C,q)),F>1.5*J&&(C=Math.min(C,J)),this.lockedAxis==="y"&&ct(F)===ct(q)&&(T=0),this.lockedAxis==="x"&&ct(F)===ct(q)&&(I=0),this.applyChange({originX:c,originY:b,panX:T,panY:I,scale:C,friction:this.option("dragFriction"),ignoreBounds:!0})}onPointerUp(e,n,r){if(r.length)return this.dragOffset.x=0,this.dragOffset.y=0,void(this.trackingPoints=[]);this.container.classList.remove(this.cn("isDragging")),this.isDragging&&(this.addTrackingPoint(n),this.panOnlyZoomed&&this.contentRect.width-this.contentRect.fitWidth<1&&this.contentRect.height-this.contentRect.fitHeight<1&&(this.trackingPoints=[]),Mh(e.target,this.content)&&this.lockedAxis==="y"&&(this.trackingPoints=[]),this.emit("touchEnd",e),this.isDragging=!1,this.lockedAxis=!1,this.state!==An.Destroy&&(e.defaultPrevented||this.startDecelAnim()))}startDecelAnim(){var e;const n=this.isScaling;this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const Q of eo)this.velocity[Q]=0;this.target.e=this.current.e,this.target.f=this.current.f,En(this.container,"is-scaling"),En(this.container,"is-animating"),this.isTicking=!1;const{trackingPoints:r}=this,o=r[0],d=r[r.length-1];let p=0,c=0,b=0;d&&o&&(p=d.clientX-o.clientX,c=d.clientY-o.clientY,b=d.time-o.time);const k=((e=window.visualViewport)===null||e===void 0?void 0:e.scale)||1;k!==1&&(p*=k,c*=k);let E=0,C=0,T=0,I=0,N=this.option("decelFriction");const $=this.targetScale;if(b>0){T=Math.abs(p)>3?p/(b/30):0,I=Math.abs(c)>3?c/(b/30):0;const Q=this.option("maxVelocity");Q&&(T=Math.max(Math.min(T,Q),-1*Q),I=Math.max(Math.min(I,Q),-1*Q))}T&&(E=T/(1/(1-N)-1)),I&&(C=I/(1/(1-N)-1)),(this.option("lockAxis")==="y"||this.option("lockAxis")==="xy"&&this.lockedAxis==="y"&&ct($)===this.minScale)&&(E=T=0),(this.option("lockAxis")==="x"||this.option("lockAxis")==="xy"&&this.lockedAxis==="x"&&ct($)===this.minScale)&&(C=I=0);const F=this.dragOffset.x,q=this.dragOffset.y,J=this.option("dragMinThreshold")||0;Math.abs(F)<J&&Math.abs(q)<J&&(E=C=0,T=I=0),(this.option("zoom")&&($<this.minScale-1e-5||$>this.maxScale+1e-5)||n&&!E&&!C)&&(N=.35),this.applyChange({panX:E,panY:C,friction:N}),this.emit("decel",T,I,F,q)}onWheel(e){var n=[-e.deltaX||0,-e.deltaY||0,-e.detail||0].reduce(function(d,p){return Math.abs(p)>Math.abs(d)?p:d});const r=Math.max(-1,Math.min(1,n));if(this.emit("wheel",e,r),this.panMode===Yi||e.defaultPrevented)return;const o=this.option("wheel");o==="pan"?(e.preventDefault(),this.panOnlyZoomed&&!this.canZoomOut()||this.applyChange({panX:2*-e.deltaX,panY:2*-e.deltaY,bounce:!1})):o==="zoom"&&this.option("zoom")!==!1&&this.zoomWithWheel(e)}onMouseMove(e){this.panWithMouse(e)}onKeydown(e){e.key==="Escape"&&this.toggleFS()}onResize(){this.updateMetrics(),this.checkBounds().inBounds||this.requestTick()}setTransform(){this.emit("beforeTransform");const{current:e,target:n,content:r,contentRect:o}=this,d=Object.assign({},Ph);for(const F of eo){const q=F=="e"||F==="f"?Rh:rR;d[F]=ct(e[F],q),Math.abs(n[F]-e[F])<(F=="e"||F==="f"?.51:.001)&&(e[F]=n[F])}let{a:p,b:c,c:b,d:k,e:E,f:C}=d,T=`matrix(${p}, ${c}, ${b}, ${k}, ${E}, ${C})`,I=r.parentElement instanceof HTMLPictureElement?r.parentElement:r;if(this.option("transformParent")&&(I=I.parentElement||I),I.style.transform===T)return;I.style.transform=T;const{contentWidth:N,contentHeight:$}=this.calculateContentDim();o.width=N,o.height=$,this.emit("afterTransform")}updateMetrics(e=!1){var n;if(!this||this.state===An.Destroy||this.isContentLoading)return;const r=Math.max(1,((n=window.visualViewport)===null||n===void 0?void 0:n.scale)||1),{container:o,content:d}=this,p=d instanceof HTMLImageElement,c=o.getBoundingClientRect(),b=getComputedStyle(this.container);let k=c.width*r,E=c.height*r;const C=parseFloat(b.paddingTop)+parseFloat(b.paddingBottom),T=k-(parseFloat(b.paddingLeft)+parseFloat(b.paddingRight)),I=E-C;this.containerRect={width:k,height:E,innerWidth:T,innerHeight:I};const N=parseFloat(d.dataset.width||"")||(ot=>{let ue=0;return ue=ot instanceof HTMLImageElement?ot.naturalWidth:ot instanceof SVGElement?ot.width.baseVal.value:Math.max(ot.offsetWidth,ot.scrollWidth),ue||0})(d),$=parseFloat(d.dataset.height||"")||(ot=>{let ue=0;return ue=ot instanceof HTMLImageElement?ot.naturalHeight:ot instanceof SVGElement?ot.height.baseVal.value:Math.max(ot.offsetHeight,ot.scrollHeight),ue||0})(d);let F=this.option("width",N)||Xi,q=this.option("height",$)||Xi;const J=F===Xi,Q=q===Xi;typeof F!="number"&&(F=N),typeof q!="number"&&(q=$),J&&(F=N*(q/$)),Q&&(q=$/(N/F));let me=d.parentElement instanceof HTMLPictureElement?d.parentElement:d;this.option("transformParent")&&(me=me.parentElement||me);const ke=me.getAttribute("style")||"";me.style.setProperty("transform","none","important"),p&&(me.style.width="",me.style.height=""),me.offsetHeight;const Re=d.getBoundingClientRect();let Ee=Re.width*r,Ve=Re.height*r,Be=Ee,Ze=Ve;Ee=Math.min(Ee,F),Ve=Math.min(Ve,q),p?{width:Ee,height:Ve}=((ot,ue,Ut,wt)=>{const $t=Ut/ot,an=wt/ue,xn=Math.min($t,an);return{width:ot*=xn,height:ue*=xn}})(F,q,Ee,Ve):(Ee=Math.min(Ee,F),Ve=Math.min(Ve,q));let tt=.5*(Ze-Ve),Xe=.5*(Be-Ee);this.contentRect=Object.assign(Object.assign({},this.contentRect),{top:Re.top-c.top+tt,bottom:c.bottom-Re.bottom+tt,left:Re.left-c.left+Xe,right:c.right-Re.right+Xe,fitWidth:Ee,fitHeight:Ve,width:Ee,height:Ve,fullWidth:F,fullHeight:q}),me.style.cssText=ke,p&&(me.style.width=`${Ee}px`,me.style.height=`${Ve}px`),this.setTransform(),e!==!0&&this.emit("refresh"),this.ignoreBounds||(ct(this.targetScale)<ct(this.minScale)?this.zoomTo(this.minScale,{friction:0}):this.targetScale>this.maxScale?this.zoomTo(this.maxScale,{friction:0}):this.state===An.Init||this.checkBounds().inBounds||this.requestTick()),this.updateControls()}calculateBounds(){const{contentWidth:e,contentHeight:n}=this.calculateContentDim(this.target),{targetScale:r,lockedAxis:o}=this,{fitWidth:d,fitHeight:p}=this.contentRect;let c=0,b=0,k=0,E=0;const C=this.option("infinite");if(C===!0||o&&C===o)c=-1/0,k=1/0,b=-1/0,E=1/0;else{let{containerRect:T,contentRect:I}=this,N=ct(d*r,Rh),$=ct(p*r,Rh),{innerWidth:F,innerHeight:q}=T;if(T.width===N&&(F=T.width),T.width===$&&(q=T.height),e>F){k=.5*(e-F),c=-1*k;let J=.5*(I.right-I.left);c+=J,k+=J}if(d>F&&e<F&&(c-=.5*(d-F),k-=.5*(d-F)),n>q){E=.5*(n-q),b=-1*E;let J=.5*(I.bottom-I.top);b+=J,E+=J}p>q&&n<q&&(c-=.5*(p-q),k-=.5*(p-q))}return{x:{min:c,max:k},y:{min:b,max:E}}}getBounds(){const e=this.option("bounds");return e!==Xi?e:this.calculateBounds()}updateControls(){const e=this,n=e.container,{panMode:r,contentRect:o,targetScale:d,minScale:p}=e;let c=p,b=e.option("click")||!1;b&&(c=e.getNextScale(b));let k=e.canZoomIn(),E=e.canZoomOut(),C=r===Px&&!!this.option("touch"),T=E&&C;if(C&&(ct(d)<ct(p)&&!this.panOnlyZoomed&&(T=!0),(ct(o.width,1)>ct(o.fitWidth,1)||ct(o.height,1)>ct(o.fitHeight,1))&&(T=!0)),ct(o.width*d,1)<ct(o.fitWidth,1)&&(T=!1),r===Yi&&(T=!1),Ts(n,this.cn("isDraggable"),T),!this.option("zoom"))return;let I=k&&ct(c)>ct(d),N=!I&&!T&&E&&ct(c)<ct(d);Ts(n,this.cn("canZoomIn"),I),Ts(n,this.cn("canZoomOut"),N);for(const $ of n.querySelectorAll("[data-panzoom-action]")){let F=!1,q=!1;switch($.dataset.panzoomAction){case"zoomIn":k?F=!0:q=!0;break;case"zoomOut":E?F=!0:q=!0;break;case"toggleZoom":case"iterateZoom":k||E?F=!0:q=!0;const J=$.querySelector("g");J&&(J.style.display=k?"":"none")}F?($.removeAttribute("disabled"),$.removeAttribute("tabindex")):q&&($.setAttribute("disabled",""),$.setAttribute("tabindex","-1"))}}panTo({x:e=this.target.e,y:n=this.target.f,scale:r=this.targetScale,friction:o=this.option("friction"),angle:d=0,originX:p=0,originY:c=0,flipX:b=!1,flipY:k=!1,ignoreBounds:E=!1}){this.state!==An.Destroy&&this.applyChange({panX:e-this.target.e,panY:n-this.target.f,scale:r/this.targetScale,angle:d,originX:p,originY:c,friction:o,flipX:b,flipY:k,ignoreBounds:E})}applyChange({panX:e=0,panY:n=0,scale:r=1,angle:o=0,originX:d=-this.current.e,originY:p=-this.current.f,friction:c=this.option("friction"),flipX:b=!1,flipY:k=!1,ignoreBounds:E=!1,bounce:C=this.option("bounce")}){const T=this.state;if(T===An.Destroy)return;this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.friction=c||0,this.ignoreBounds=E;const{current:I}=this,N=I.e,$=I.f,F=this.getMatrix(this.target);let q=new DOMMatrix().translate(N,$).translate(d,p).translate(e,n);if(this.option("zoom")){if(!E){const J=this.targetScale,Q=this.minScale,me=this.maxScale;J*r<Q&&(r=Q/J),J*r>me&&(r=me/J)}q=q.scale(r)}q=q.translate(-d,-p).translate(-N,-$).multiply(F),o&&(q=q.rotate(o)),b&&(q=q.scale(-1,1)),k&&(q=q.scale(1,-1));for(const J of eo)J!=="e"&&J!=="f"&&(q[J]>this.minScale+1e-5||q[J]<this.minScale-1e-5)?this.target[J]=q[J]:this.target[J]=ct(q[J],Rh);(this.targetScale<this.scale||Math.abs(r-1)>.1||this.panMode===Yi||C===!1)&&!E&&this.clampTargetBounds(),T===An.Init?this.animate():this.isResting||(this.state=An.Panning,this.requestTick())}stop(e=!1){if(this.state===An.Init||this.state===An.Destroy)return;const n=this.isTicking;this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const r of eo)this.velocity[r]=0,e==="current"?this.current[r]=this.target[r]:e==="target"&&(this.target[r]=this.current[r]);this.setTransform(),En(this.container,"is-scaling"),En(this.container,"is-animating"),this.isTicking=!1,this.state=An.Ready,n&&(this.emit("endAnimation"),this.updateControls())}requestTick(){this.isTicking||(this.emit("startAnimation"),this.updateControls(),Tt(this.container,"is-animating"),this.isScaling&&Tt(this.container,"is-scaling")),this.isTicking=!0,this.rAF||(this.rAF=requestAnimationFrame(()=>this.animate()))}panWithMouse(e,n=this.option("mouseMoveFriction")){if(this.pmme=e,this.panMode!==Yi||!e||ct(this.targetScale)<=ct(this.minScale))return;this.emit("mouseMove",e);const{container:r,containerRect:o,contentRect:d}=this,p=o.width,c=o.height,b=r.getBoundingClientRect(),k=(e.clientX||0)-b.left,E=(e.clientY||0)-b.top;let{contentWidth:C,contentHeight:T}=this.calculateContentDim(this.target);const I=this.option("mouseMoveFactor");I>1&&(C!==p&&(C*=I),T!==c&&(T*=I));let N=.5*(C-p)-k/p*100/100*(C-p);N+=.5*(d.right-d.left);let $=.5*(T-c)-E/c*100/100*(T-c);$+=.5*(d.bottom-d.top),this.applyChange({panX:N-this.target.e,panY:$-this.target.f,friction:n})}zoomWithWheel(e){if(this.state===An.Destroy||this.state===An.Init)return;const n=Date.now();if(n-this.pwt<45)return void e.preventDefault();this.pwt=n;var r=[-e.deltaX||0,-e.deltaY||0,-e.detail||0].reduce(function(k,E){return Math.abs(E)>Math.abs(k)?E:k});const o=Math.max(-1,Math.min(1,r)),{targetScale:d,maxScale:p,minScale:c}=this;let b=d*(100+45*o)/100;ct(b)<ct(c)&&ct(d)<=ct(c)?(this.cwd+=Math.abs(o),b=c):ct(b)>ct(p)&&ct(d)>=ct(p)?(this.cwd+=Math.abs(o),b=p):(this.cwd=0,b=Math.max(Math.min(b,p),c)),this.cwd>this.option("wheelLimit")||(e.preventDefault(),ct(b)!==ct(d)&&this.zoomTo(b,{event:e}))}canZoomIn(){return this.option("zoom")&&(ct(this.contentRect.width,1)<ct(this.contentRect.fitWidth,1)||ct(this.targetScale)<ct(this.maxScale))}canZoomOut(){return this.option("zoom")&&ct(this.targetScale)>ct(this.minScale)}zoomIn(e=1.25,n){this.zoomTo(this.targetScale*e,n)}zoomOut(e=.8,n){this.zoomTo(this.targetScale*e,n)}zoomToFit(e){this.zoomTo("fit",e)}zoomToCover(e){this.zoomTo("cover",e)}zoomToFull(e){this.zoomTo("full",e)}zoomToMax(e){this.zoomTo("max",e)}toggleZoom(e){this.zoomTo(this.getNextScale("toggleZoom"),e)}toggleMax(e){this.zoomTo(this.getNextScale("toggleMax"),e)}toggleCover(e){this.zoomTo(this.getNextScale("toggleCover"),e)}iterateZoom(e){this.zoomTo("next",e)}zoomTo(e=1,{friction:n=Xi,originX:r=Xi,originY:o=Xi,event:d}={}){if(this.isContentLoading||this.state===An.Destroy)return;const{targetScale:p,fullScale:c,maxScale:b,coverScale:k}=this;if(this.stop(),this.panMode===Yi&&(d=this.pmme||d),d||r===Xi||o===Xi){const C=this.content.getBoundingClientRect(),T=this.container.getBoundingClientRect(),I=d?d.clientX:T.left+.5*T.width,N=d?d.clientY:T.top+.5*T.height;r=I-C.left-.5*C.width,o=N-C.top-.5*C.height}let E=1;typeof e=="number"?E=e:e==="full"?E=c:e==="cover"?E=k:e==="max"?E=b:e==="fit"?E=1:e==="next"&&(E=this.getNextScale("iterateZoom")),E=E/p||1,n=n===Xi?E>1?.15:.25:n,this.applyChange({scale:E,originX:r,originY:o,friction:n}),d&&this.panMode===Yi&&this.panWithMouse(d,n)}rotateCCW(){this.applyChange({angle:-90})}rotateCW(){this.applyChange({angle:90})}flipX(){this.applyChange({flipX:!0})}flipY(){this.applyChange({flipY:!0})}fitX(){this.stop("target");const{containerRect:e,contentRect:n,target:r}=this;this.applyChange({panX:.5*e.width-(n.left+.5*n.fitWidth)-r.e,panY:.5*e.height-(n.top+.5*n.fitHeight)-r.f,scale:e.width/n.fitWidth/this.targetScale,originX:0,originY:0,ignoreBounds:!0})}fitY(){this.stop("target");const{containerRect:e,contentRect:n,target:r}=this;this.applyChange({panX:.5*e.width-(n.left+.5*n.fitWidth)-r.e,panY:.5*e.innerHeight-(n.top+.5*n.fitHeight)-r.f,scale:e.height/n.fitHeight/this.targetScale,originX:0,originY:0,ignoreBounds:!0})}toggleFS(){const{container:e}=this,n=this.cn("inFullscreen"),r=this.cn("htmlHasFullscreen");e.classList.toggle(n);const o=e.classList.contains(n);o?(document.documentElement.classList.add(r),document.addEventListener("keydown",this.onKeydown,!0)):(document.documentElement.classList.remove(r),document.removeEventListener("keydown",this.onKeydown,!0)),this.updateMetrics(),this.emit(o?"enterFS":"exitFS")}getMatrix(e=this.current){const{a:n,b:r,c:o,d,e:p,f:c}=e;return new DOMMatrix([n,r,o,d,p,c])}reset(e){if(this.state!==An.Init&&this.state!==An.Destroy){this.stop("current");for(const n of eo)this.target[n]=Ph[n];this.target.a=this.minScale,this.target.d=this.minScale,this.clampTargetBounds(),this.isResting||(this.friction=e===void 0?this.option("friction"):e,this.state=An.Panning,this.requestTick())}}destroy(){this.stop(),this.state=An.Destroy,this.detachEvents(),this.detachObserver();const{container:e,content:n}=this,r=this.option("classes")||{};for(const o of Object.values(r))e.classList.remove(o+"");n&&(n.removeEventListener("load",this.onLoad),n.removeEventListener("error",this.onError)),this.detachPlugins()}};Object.defineProperty(Vl,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:nR}),Object.defineProperty(Vl,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:{}});const Nx=function(t,e){let n=!0;return(...r)=>{n&&(n=!1,t(...r),setTimeout(()=>{n=!0},e))}},Bx=(t,e)=>{let n=[];return t.childNodes.forEach(r=>{r.nodeType!==Node.ELEMENT_NODE||e&&!r.matches(e)||n.push(r)}),n},iR={viewport:null,track:null,enabled:!0,slides:[],axis:"x",transition:"fade",preload:1,slidesPerPage:"auto",initialPage:0,friction:.12,Panzoom:{decelFriction:.12},center:!0,infinite:!0,fill:!0,dragFree:!1,adaptiveHeight:!1,direction:"ltr",classes:{container:"f-carousel",viewport:"f-carousel__viewport",track:"f-carousel__track",slide:"f-carousel__slide",isLTR:"is-ltr",isRTL:"is-rtl",isHorizontal:"is-horizontal",isVertical:"is-vertical",inTransition:"in-transition",isSelected:"is-selected"},l10n:{NEXT:"Next slide",PREV:"Previous slide",GOTO:"Go to slide #%d"}};var ur;(function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Destroy=2]="Destroy"})(ur||(ur={}));const Ym=t=>{if(typeof t=="string"||t instanceof HTMLElement)t={html:t};else{const e=t.thumb;e!==void 0&&(typeof e=="string"&&(t.thumbSrc=e),e instanceof HTMLImageElement&&(t.thumbEl=e,t.thumbElSrc=e.src,t.thumbSrc=e.src),delete t.thumb)}return Object.assign({html:"",el:null,isDom:!1,class:"",customClass:"",index:-1,dim:0,gap:0,pos:0,transition:!1},t)},sR=(t={})=>Object.assign({index:-1,slides:[],dim:0,pos:-1},t);let us=class extends Ih{constructor(e,n){super(n),Object.defineProperty(this,"instance",{enumerable:!0,configurable:!0,writable:!0,value:e})}attach(){}detach(){}};const oR={classes:{list:"f-carousel__dots",isDynamic:"is-dynamic",hasDots:"has-dots",dot:"f-carousel__dot",isBeforePrev:"is-before-prev",isPrev:"is-prev",isCurrent:"is-current",isNext:"is-next",isAfterNext:"is-after-next"},dotTpl:'<button type="button" data-carousel-page="%i" aria-label="{{GOTO}}"><span class="f-carousel__dot" aria-hidden="true"></span></button>',dynamicFrom:11,maxCount:1/0,minCount:2};let Vx=class extends us{constructor(){super(...arguments),Object.defineProperty(this,"isDynamic",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"list",{enumerable:!0,configurable:!0,writable:!0,value:null})}onRefresh(){this.refresh()}build(){let e=this.list;if(!e){e=document.createElement("ul"),Tt(e,this.cn("list")),e.setAttribute("role","tablist");const n=this.instance.container;n.appendChild(e),Tt(n,this.cn("hasDots")),this.list=e}return e}refresh(){var e;const n=this.instance.pages.length,r=Math.min(2,this.option("minCount")),o=Math.max(2e3,this.option("maxCount")),d=this.option("dynamicFrom");if(n<r||n>o)return void this.cleanup();const p=typeof d=="number"&&n>5&&n>=d,c=!this.list||this.isDynamic!==p||this.list.children.length!==n;c&&this.cleanup();const b=this.build();if(Ts(b,this.cn("isDynamic"),!!p),c)for(let C=0;C<n;C++)b.append(this.createItem(C));let k,E=0;for(const C of[...b.children]){const T=E===this.instance.page;T&&(k=C),Ts(C,this.cn("isCurrent"),T),(e=C.children[0])===null||e===void 0||e.setAttribute("aria-selected",T?"true":"false");for(const I of["isBeforePrev","isPrev","isNext","isAfterNext"])En(C,this.cn(I));E++}if(k=k||b.firstChild,p&&k){const C=k.previousElementSibling,T=C&&C.previousElementSibling;Tt(C,this.cn("isPrev")),Tt(T,this.cn("isBeforePrev"));const I=k.nextElementSibling,N=I&&I.nextElementSibling;Tt(I,this.cn("isNext")),Tt(N,this.cn("isAfterNext"))}this.isDynamic=p}createItem(e=0){var n;const r=document.createElement("li");r.setAttribute("role","presentation");const o=Ss(this.instance.localize(this.option("dotTpl"),[["%d",e+1]]).replace(/\%i/g,e+""));return r.appendChild(o),(n=r.children[0])===null||n===void 0||n.setAttribute("role","tab"),r}cleanup(){this.list&&(this.list.remove(),this.list=null),this.isDynamic=!1,En(this.instance.container,this.cn("hasDots"))}attach(){this.instance.on(["refresh","change"],this.onRefresh)}detach(){this.instance.off(["refresh","change"],this.onRefresh),this.cleanup()}};Object.defineProperty(Vx,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:oR});const Nh="disabled",Bh="next",zx="prev";let Ox=class extends us{constructor(){super(...arguments),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"prev",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"next",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"isDom",{enumerable:!0,configurable:!0,writable:!0,value:!1})}onRefresh(){const e=this.instance,n=e.pages.length,r=e.page;if(n<2)return void this.cleanup();this.build();let o=this.prev,d=this.next;o&&d&&(o.removeAttribute(Nh),d.removeAttribute(Nh),e.isInfinite||(r<=0&&o.setAttribute(Nh,""),r>=n-1&&d.setAttribute(Nh,"")))}addBtn(e){var n;const r=this.instance,o=document.createElement("button");o.setAttribute("tabindex","0"),o.setAttribute("title",r.localize(`{{${e.toUpperCase()}}}`)),Tt(o,this.cn("button")+" "+this.cn(e===Bh?"isNext":"isPrev"));const d=r.isRTL?e===Bh?zx:Bh:e;var p;return o.innerHTML=r.localize(this.option(`${d}Tpl`)),o.dataset[`carousel${p=e,p?p.match("^[a-z]")?p.charAt(0).toUpperCase()+p.substring(1):p:""}`]="true",(n=this.container)===null||n===void 0||n.appendChild(o),o}build(){const e=this.instance.container,n=this.cn("container");let{container:r,prev:o,next:d}=this;r||(r=e.querySelector("."+n),this.isDom=!!r),r||(r=document.createElement("div"),Tt(r,n),e.appendChild(r)),this.container=r,d||(d=r.querySelector("[data-carousel-next]")),d||(d=this.addBtn(Bh)),this.next=d,o||(o=r.querySelector("[data-carousel-prev]")),o||(o=this.addBtn(zx)),this.prev=o}cleanup(){this.isDom||(this.prev&&this.prev.remove(),this.next&&this.next.remove(),this.container&&this.container.remove()),this.prev=null,this.next=null,this.container=null,this.isDom=!1}attach(){this.instance.on(["refresh","change"],this.onRefresh)}detach(){this.instance.off(["refresh","change"],this.onRefresh),this.cleanup()}};Object.defineProperty(Ox,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{classes:{container:"f-carousel__nav",button:"f-button",isNext:"is-next",isPrev:"is-prev"},nextTpl:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" tabindex="-1"><path d="M9 3l9 9-9 9"/></svg>',prevTpl:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" tabindex="-1"><path d="M15 3l-9 9 9 9"/></svg>'}});let Lx=class extends us{constructor(){super(...arguments),Object.defineProperty(this,"selectedIndex",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"target",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"nav",{enumerable:!0,configurable:!0,writable:!0,value:null})}addAsTargetFor(e){this.target=this.instance,this.nav=e,this.attachEvents()}addAsNavFor(e){this.nav=this.instance,this.target=e,this.attachEvents()}attachEvents(){const{nav:e,target:n}=this;e&&n&&(e.options.initialSlide=n.options.initialPage,e.state===ur.Ready?this.onNavReady(e):e.on("ready",this.onNavReady),n.state===ur.Ready?this.onTargetReady(n):n.on("ready",this.onTargetReady))}onNavReady(e){e.on("createSlide",this.onNavCreateSlide),e.on("Panzoom.click",this.onNavClick),e.on("Panzoom.touchEnd",this.onNavTouch),this.onTargetChange()}onTargetReady(e){e.on("change",this.onTargetChange),e.on("Panzoom.refresh",this.onTargetChange),this.onTargetChange()}onNavClick(e,n,r){this.onNavTouch(e,e.panzoom,r)}onNavTouch(e,n,r){var o,d;if(Math.abs(n.dragOffset.x)>3||Math.abs(n.dragOffset.y)>3)return;const p=r.target,{nav:c,target:b}=this;if(!c||!b||!p)return;const k=p.closest("[data-index]");if(r.stopPropagation(),r.preventDefault(),!k)return;const E=parseInt(k.dataset.index||"",10)||0,C=b.getPageForSlide(E),T=c.getPageForSlide(E);c.slideTo(T),b.slideTo(C,{friction:((d=(o=this.nav)===null||o===void 0?void 0:o.plugins)===null||d===void 0?void 0:d.Sync.option("friction"))||0}),this.markSelectedSlide(E)}onNavCreateSlide(e,n){n.index===this.selectedIndex&&this.markSelectedSlide(n.index)}onTargetChange(){var e,n;const{target:r,nav:o}=this;if(!r||!o||o.state!==ur.Ready||r.state!==ur.Ready)return;const d=(n=(e=r.pages[r.page])===null||e===void 0?void 0:e.slides[0])===null||n===void 0?void 0:n.index,p=o.getPageForSlide(d);this.markSelectedSlide(d),o.slideTo(p,o.prevPage===null&&r.prevPage===null?{friction:0}:void 0)}markSelectedSlide(e){const n=this.nav;n&&n.state===ur.Ready&&(this.selectedIndex=e,[...n.slides].map(r=>{r.el&&r.el.classList[r.index===e?"add":"remove"]("is-nav-selected")}))}attach(){const e=this;let n=e.options.target,r=e.options.nav;n?e.addAsNavFor(n):r&&e.addAsTargetFor(r)}detach(){const e=this,n=e.nav,r=e.target;n&&(n.off("ready",e.onNavReady),n.off("createSlide",e.onNavCreateSlide),n.off("Panzoom.click",e.onNavClick),n.off("Panzoom.touchEnd",e.onNavTouch)),e.nav=null,r&&(r.off("ready",e.onTargetReady),r.off("refresh",e.onTargetChange),r.off("change",e.onTargetChange)),e.target=null}};Object.defineProperty(Lx,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{friction:.35}});const aR={Navigation:Ox,Dots:Vx,Sync:Lx},Vh="animationend",Fx="isSelected",zh="slide";let gd=class K0 extends Wm{get axis(){return this.isHorizontal?"e":"f"}get isEnabled(){return this.state===ur.Ready}get isInfinite(){let e=!1;const{contentDim:n,viewportDim:r,pages:o,slides:d}=this,p=d[0];return o.length>=2&&p&&n+p.dim>=r&&(e=this.option("infinite")),e}get isRTL(){return this.option("direction")==="rtl"}get isHorizontal(){return this.option("axis")==="x"}constructor(e,n={},r={}){if(super(),Object.defineProperty(this,"bp",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"lp",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"userOptions",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"userPlugins",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:ur.Init}),Object.defineProperty(this,"page",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevPage",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"viewport",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"track",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"slides",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"pages",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"panzoom",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"inTransition",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),Object.defineProperty(this,"contentDim",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"viewportDim",{enumerable:!0,configurable:!0,writable:!0,value:0}),typeof e=="string"&&(e=document.querySelector(e)),!e||!mi(e))throw new Error("No Element found");this.container=e,this.slideNext=Nx(this.slideNext.bind(this),150),this.slidePrev=Nx(this.slidePrev.bind(this),150),this.userOptions=n,this.userPlugins=r,queueMicrotask(()=>{this.processOptions()})}processOptions(){var e,n;const r=fi({},K0.defaults,this.userOptions);let o="";const d=r.breakpoints;if(d&&Um(d))for(const[p,c]of Object.entries(d))window.matchMedia(p).matches&&Um(c)&&(o+=p,fi(r,c));o===this.bp&&this.state!==ur.Init||(this.bp=o,this.state===ur.Ready&&(r.initialSlide=((n=(e=this.pages[this.page])===null||e===void 0?void 0:e.slides[0])===null||n===void 0?void 0:n.index)||0),this.state!==ur.Init&&this.destroy(),super.setOptions(r),this.option("enabled")===!1?this.attachEvents():setTimeout(()=>{this.init()},0))}init(){this.state=ur.Init,this.emit("init"),this.attachPlugins(Object.assign(Object.assign({},K0.Plugins),this.userPlugins)),this.emit("attachPlugins"),this.initLayout(),this.initSlides(),this.updateMetrics(),this.setInitialPosition(),this.initPanzoom(),this.attachEvents(),this.state=ur.Ready,this.emit("ready")}initLayout(){const{container:e}=this,n=this.option("classes");Tt(e,this.cn("container")),Ts(e,n.isLTR,!this.isRTL),Ts(e,n.isRTL,this.isRTL),Ts(e,n.isVertical,!this.isHorizontal),Ts(e,n.isHorizontal,this.isHorizontal);let r=this.option("viewport")||e.querySelector(`.${n.viewport}`);r||(r=document.createElement("div"),Tt(r,n.viewport),r.append(...Bx(e,`.${n.slide}`)),e.prepend(r)),r.addEventListener("scroll",this.onScroll);let o=this.option("track")||e.querySelector(`.${n.track}`);o||(o=document.createElement("div"),Tt(o,n.track),o.append(...Array.from(r.childNodes))),o.setAttribute("aria-live","polite"),r.contains(o)||r.prepend(o),this.viewport=r,this.track=o,this.emit("initLayout")}initSlides(){const{track:e}=this;if(!e)return;const n=[...this.slides],r=[];[...Bx(e,`.${this.cn(zh)}`)].forEach(o=>{if(mi(o)){const d=Ym({el:o,isDom:!0,index:this.slides.length});r.push(d)}});for(let o of[...this.option("slides",[])||[],...n])r.push(Ym(o));this.slides=r;for(let o=0;o<this.slides.length;o++)this.slides[o].index=o;for(const o of r)this.emit("beforeInitSlide",o,o.index),this.emit("initSlide",o,o.index);this.emit("initSlides")}setInitialPage(){const e=this.option("initialSlide");this.page=typeof e=="number"?this.getPageForSlide(e):parseInt(this.option("initialPage",0)+"",10)||0}setInitialPosition(){const{track:e,pages:n,isHorizontal:r}=this;if(!e||!n.length)return;let o=this.page;n[o]||(this.page=o=0);const d=(n[o].pos||0)*(this.isRTL&&r?1:-1),p=r?`${d}px`:"0",c=r?"0":`${d}px`;e.style.transform=`translate3d(${p}, ${c}, 0) scale(1)`,this.option("adaptiveHeight")&&this.setViewportHeight()}initPanzoom(){this.panzoom&&(this.panzoom.destroy(),this.panzoom=null);const e=this.option("Panzoom")||{};this.panzoom=new Vl(this.viewport,fi({},{content:this.track,zoom:!1,panOnlyZoomed:!1,lockAxis:this.isHorizontal?"x":"y",infinite:this.isInfinite,click:!1,dblClick:!1,touch:n=>!(this.pages.length<2&&!n.options.infinite),bounds:()=>this.getBounds(),maxVelocity:n=>Math.abs(n.target[this.axis]-n.current[this.axis])<2*this.viewportDim?100:0},e)),this.panzoom.on("*",(n,r,...o)=>{this.emit(`Panzoom.${r}`,n,...o)}),this.panzoom.on("decel",this.onDecel),this.panzoom.on("refresh",this.onRefresh),this.panzoom.on("beforeTransform",this.onBeforeTransform),this.panzoom.on("endAnimation",this.onEndAnimation)}attachEvents(){const e=this.container;e&&(e.addEventListener("click",this.onClick,{passive:!1,capture:!1}),e.addEventListener("slideTo",this.onSlideTo)),window.addEventListener("resize",this.onResize)}createPages(){let e=[];const{contentDim:n,viewportDim:r}=this;let o=this.option("slidesPerPage");o=(o==="auto"||n<=r)&&this.option("fill")!==!1?1/0:parseFloat(o+"");let d=0,p=0,c=0;for(const b of this.slides)(!e.length||p+b.dim-r>.05||c>=o)&&(e.push(sR()),d=e.length-1,p=0,c=0),e[d].slides.push(b),p+=b.dim+b.gap,c++;return e}processPages(){const e=this.pages,{contentDim:n,viewportDim:r,isInfinite:o}=this,d=this.option("center"),p=this.option("fill"),c=p&&d&&n>r&&!o;if(e.forEach((E,C)=>{var T;E.index=C,E.pos=((T=E.slides[0])===null||T===void 0?void 0:T.pos)||0,E.dim=0;for(const[I,N]of E.slides.entries())E.dim+=N.dim,I<E.slides.length-1&&(E.dim+=N.gap);c&&E.pos+.5*E.dim<.5*r?E.pos=0:c&&E.pos+.5*E.dim>=n-.5*r?E.pos=n-r:d&&(E.pos+=-.5*(r-E.dim))}),e.forEach(E=>{p&&!o&&n>r&&(E.pos=Math.max(E.pos,0),E.pos=Math.min(E.pos,n-r)),E.pos=ct(E.pos,1e3),E.dim=ct(E.dim,1e3),Math.abs(E.pos)<=.1&&(E.pos=0)}),o)return e;const b=[];let k;return e.forEach(E=>{const C=Object.assign({},E);k&&C.pos===k.pos?(k.dim+=C.dim,k.slides=[...k.slides,...C.slides]):(C.index=b.length,k=C,b.push(C))}),b}getPageFromIndex(e=0){const n=this.pages.length;let r;return e=parseInt((e||0).toString())||0,r=this.isInfinite?(e%n+n)%n:Math.max(Math.min(e,n-1),0),r}getSlideMetrics(e){var n,r;const o=this.isHorizontal?"width":"height";let d=0,p=0,c=e.el;const b=!(!c||c.parentNode);if(c?d=parseFloat(c.dataset[o]||"")||0:(c=document.createElement("div"),c.style.visibility="hidden",(this.track||document.body).prepend(c)),Tt(c,this.cn(zh)+" "+e.class+" "+e.customClass),d)c.style[o]=`${d}px`,c.style[o==="width"?"height":"width"]="";else{b&&(this.track||document.body).prepend(c),d=c.getBoundingClientRect()[o]*Math.max(1,((n=window.visualViewport)===null||n===void 0?void 0:n.scale)||1);let E=c[this.isHorizontal?"offsetWidth":"offsetHeight"];E-1>d&&(d=E)}const k=getComputedStyle(c);return k.boxSizing==="content-box"&&(this.isHorizontal?(d+=parseFloat(k.paddingLeft)||0,d+=parseFloat(k.paddingRight)||0):(d+=parseFloat(k.paddingTop)||0,d+=parseFloat(k.paddingBottom)||0)),p=parseFloat(k[this.isHorizontal?"marginRight":"marginBottom"])||0,b?(r=c.parentElement)===null||r===void 0||r.removeChild(c):e.el||c.remove(),{dim:ct(d,1e3),gap:ct(p,1e3)}}getBounds(){const{isInfinite:e,isRTL:n,isHorizontal:r,pages:o}=this;let d={min:0,max:0};if(e)d={min:-1/0,max:1/0};else if(o.length){const p=o[0].pos,c=o[o.length-1].pos;d=n&&r?{min:p,max:c}:{min:-1*c,max:-1*p}}return{x:r?d:{min:0,max:0},y:r?{min:0,max:0}:d}}repositionSlides(){let e,{isHorizontal:n,isRTL:r,isInfinite:o,viewport:d,viewportDim:p,contentDim:c,page:b,pages:k,slides:E,panzoom:C}=this,T=0,I=0,N=0,$=0;C?$=-1*C.current[this.axis]:k[b]&&($=k[b].pos||0),e=n?r?"right":"left":"top",r&&n&&($*=-1);for(const Q of E){const me=Q.el;me?(e==="top"?(me.style.right="",me.style.left=""):me.style.top="",Q.index!==T?me.style[e]=I===0?"":`${ct(I,1e3)}px`:me.style[e]="",N+=Q.dim+Q.gap,T++):I+=Q.dim+Q.gap}if(o&&N&&d){let Q=getComputedStyle(d),me="padding",ke=n?"Right":"Bottom",Re=parseFloat(Q[me+(n?"Left":"Top")]);$-=Re,p+=Re,p+=parseFloat(Q[me+ke]);for(const Ee of E)Ee.el&&(ct(Ee.pos)<ct(p)&&ct(Ee.pos+Ee.dim+Ee.gap)<ct($)&&ct($)>ct(c-p)&&(Ee.el.style[e]=`${ct(I+N,1e3)}px`),ct(Ee.pos+Ee.gap)>=ct(c-p)&&ct(Ee.pos)>ct($+p)&&ct($)<ct(p)&&(Ee.el.style[e]=`-${ct(N,1e3)}px`))}let F,q,J=[...this.inTransition];if(J.length>1&&(F=k[J[0]],q=k[J[1]]),F&&q){let Q=0;for(const me of E)me.el?this.inTransition.has(me.index)&&F.slides.indexOf(me)<0&&(me.el.style[e]=`${ct(Q+(F.pos-q.pos),1e3)}px`):Q+=me.dim+me.gap}}createSlideEl(e){const{track:n,slides:r}=this;if(!n||!e||e.el&&e.el.parentNode)return;const o=e.el||document.createElement("div");Tt(o,this.cn(zh)),Tt(o,e.class),Tt(o,e.customClass);const d=e.html;d&&(d instanceof HTMLElement?o.appendChild(d):o.innerHTML=e.html+"");const p=[];r.forEach((E,C)=>{E.el&&p.push(C)});const c=e.index;let b=null;p.length&&(b=r[p.reduce((E,C)=>Math.abs(C-c)<Math.abs(E-c)?C:E)]);const k=b&&b.el&&b.el.parentNode?b.index<e.index?b.el.nextSibling:b.el:null;n.insertBefore(o,n.contains(k)?k:null),e.el=o,this.emit("createSlide",e)}removeSlideEl(e,n=!1){const r=e==null?void 0:e.el;if(!r||!r.parentNode)return;const o=this.cn(Fx);if(r.classList.contains(o)&&(En(r,o),this.emit("unselectSlide",e)),e.isDom&&!n)return r.removeAttribute("aria-hidden"),r.removeAttribute("data-index"),void(r.style.left="");this.emit("removeSlide",e);const d=new CustomEvent(Vh);r.dispatchEvent(d),e.el&&(e.el.remove(),e.el=null)}transitionTo(e=0,n=this.option("transition")){var r,o,d,p;if(!n)return!1;const c=this.page,{pages:b,panzoom:k}=this;e=parseInt((e||0).toString())||0;const E=this.getPageFromIndex(e);if(!k||!b[E]||b.length<2||Math.abs((((o=(r=b[c])===null||r===void 0?void 0:r.slides[0])===null||o===void 0?void 0:o.dim)||0)-this.viewportDim)>1)return!1;let C=e>c?1:-1;this.isInfinite&&(c===0&&e===b.length-1&&(C=-1),c===b.length-1&&e===0&&(C=1));const T=b[E].pos*(this.isRTL?1:-1);if(c===E&&Math.abs(T-k.target[this.axis])<1)return!1;this.clearTransitions();const I=k.isResting;Tt(this.container,this.cn("inTransition"));const N=((d=b[c])===null||d===void 0?void 0:d.slides[0])||null,$=((p=b[E])===null||p===void 0?void 0:p.slides[0])||null;this.inTransition.add($.index),this.createSlideEl($);let F=N.el,q=$.el;I||n===zh||(n="fadeFast",F=null);const J=this.isRTL?"next":"prev",Q=this.isRTL?"prev":"next";return F&&(this.inTransition.add(N.index),N.transition=n,F.addEventListener(Vh,this.onAnimationEnd),F.classList.add(`f-${n}Out`,`to-${C>0?Q:J}`)),q&&($.transition=n,q.addEventListener(Vh,this.onAnimationEnd),q.classList.add(`f-${n}In`,`from-${C>0?J:Q}`)),k.current[this.axis]=T,k.target[this.axis]=T,k.requestTick(),this.onChange(E),!0}manageSlideVisiblity(){const e=new Set,n=new Set,r=this.getVisibleSlides(parseFloat(this.option("preload",0)+"")||0);for(const o of this.slides)r.has(o)?e.add(o):n.add(o);for(const o of this.inTransition)e.add(this.slides[o]);for(const o of e)this.createSlideEl(o),this.lazyLoadSlide(o);for(const o of n)e.has(o)||this.removeSlideEl(o);this.markSelectedSlides(),this.repositionSlides()}markSelectedSlides(){if(!this.pages[this.page]||!this.pages[this.page].slides)return;const e="aria-hidden";let n=this.cn(Fx);if(n)for(const r of this.slides){const o=r.el;o&&(o.dataset.index=`${r.index}`,o.classList.contains("f-thumbs__slide")?this.getVisibleSlides(0).has(r)?o.removeAttribute(e):o.setAttribute(e,"true"):this.pages[this.page].slides.includes(r)?(o.classList.contains(n)||(Tt(o,n),this.emit("selectSlide",r)),o.removeAttribute(e)):(o.classList.contains(n)&&(En(o,n),this.emit("unselectSlide",r)),o.setAttribute(e,"true")))}}flipInfiniteTrack(){const{axis:e,isHorizontal:n,isInfinite:r,isRTL:o,viewportDim:d,contentDim:p}=this,c=this.panzoom;if(!c||!r)return;let b=c.current[e],k=c.target[e]-b,E=0,C=.5*d;o&&n?(b<-C&&(E=-1,b+=p),b>p-C&&(E=1,b-=p)):(b>C&&(E=1,b-=p),b<-p+C&&(E=-1,b+=p)),E&&(c.current[e]=b,c.target[e]=b+k)}lazyLoadImg(e,n){const r=this,o="f-fadeIn",d="is-preloading";let p=!1,c=null;const b=()=>{p||(p=!0,c&&(c.remove(),c=null),En(n,d),n.complete&&(Tt(n,o),setTimeout(()=>{En(n,o)},350)),this.option("adaptiveHeight")&&e.el&&this.pages[this.page].slides.indexOf(e)>-1&&(r.updateMetrics(),r.setViewportHeight()),this.emit("load",e))};Tt(n,d),n.src=n.dataset.lazySrcset||n.dataset.lazySrc||"",delete n.dataset.lazySrc,delete n.dataset.lazySrcset,n.addEventListener("error",()=>{b()}),n.addEventListener("load",()=>{b()}),setTimeout(()=>{const k=n.parentNode;k&&e.el&&(n.complete?b():p||(c=Ss(qm),k.insertBefore(c,n)))},300)}lazyLoadSlide(e){const n=e&&e.el;if(!n)return;const r=new Set;let o=Array.from(n.querySelectorAll("[data-lazy-src],[data-lazy-srcset]"));n.dataset.lazySrc&&o.push(n),o.map(d=>{d instanceof HTMLImageElement?r.add(d):d instanceof HTMLElement&&d.dataset.lazySrc&&(d.style.backgroundImage=`url('${d.dataset.lazySrc}')`,delete d.dataset.lazySrc)});for(const d of r)this.lazyLoadImg(e,d)}onAnimationEnd(e){var n;const r=e.target,o=r?parseInt(r.dataset.index||"",10)||0:-1,d=this.slides[o],p=e.animationName;if(!r||!d||!p)return;const c=!!this.inTransition.has(o)&&d.transition;c&&p.substring(0,c.length+2)===`f-${c}`&&this.inTransition.delete(o),this.inTransition.size||this.clearTransitions(),o===this.page&&(!((n=this.panzoom)===null||n===void 0)&&n.isResting)&&this.emit("settle")}onDecel(e,n=0,r=0,o=0,d=0){if(this.option("dragFree"))return void this.setPageFromPosition();const{isRTL:p,isHorizontal:c,axis:b,pages:k}=this,E=k.length,C=Math.abs(Math.atan2(r,n)/(Math.PI/180));let T=0;if(T=C>45&&C<135?c?0:r:c?n:0,!E)return;let I=this.page,N=p&&c?1:-1;const $=e.current[b]*N;let{pageIndex:F}=this.getPageFromPosition($);Math.abs(T)>5?(k[I].dim<document.documentElement["client"+(this.isHorizontal?"Width":"Height")]-1&&(I=F),I=p&&c?T<0?I-1:I+1:T<0?I+1:I-1):I=o===0&&d===0?I:F,this.slideTo(I,{transition:!1,friction:e.option("decelFriction")})}onClick(e){const n=e.target,r=n&&mi(n)?n.dataset:null;let o,d;r&&(r.carouselPage!==void 0?(d="slideTo",o=r.carouselPage):r.carouselNext!==void 0?d="slideNext":r.carouselPrev!==void 0&&(d="slidePrev")),d?(e.preventDefault(),e.stopPropagation(),n&&!n.hasAttribute("disabled")&&this[d](o)):this.emit("click",e)}onSlideTo(e){const n=e.detail||0;this.slideTo(this.getPageForSlide(n),{friction:0})}onChange(e,n=0){const r=this.page;this.prevPage=r,this.page=e,this.option("adaptiveHeight")&&this.setViewportHeight(),e!==r&&(this.markSelectedSlides(),this.emit("change",e,r,n))}onRefresh(){let e=this.contentDim,n=this.viewportDim;this.updateMetrics(),this.contentDim===e&&this.viewportDim===n||this.slideTo(this.page,{friction:0,transition:!1})}onScroll(){var e;(e=this.viewport)===null||e===void 0||e.scroll(0,0)}onResize(){this.option("breakpoints")&&this.processOptions()}onBeforeTransform(e){this.lp!==e.current[this.axis]&&(this.flipInfiniteTrack(),this.manageSlideVisiblity()),this.lp=e.current.e}onEndAnimation(){this.inTransition.size||this.emit("settle")}reInit(e=null,n=null){this.destroy(),this.state=ur.Init,this.prevPage=null,this.userOptions=e||this.userOptions,this.userPlugins=n||this.userPlugins,this.processOptions()}slideTo(e=0,{friction:n=this.option("friction"),transition:r=this.option("transition")}={}){if(this.state===ur.Destroy)return;e=parseInt((e||0).toString())||0;const o=this.getPageFromIndex(e),{axis:d,isHorizontal:p,isRTL:c,pages:b,panzoom:k}=this,E=b.length,C=c&&p?1:-1;if(!k||!E)return;if(this.page!==o){const I=new Event("beforeChange",{bubbles:!0,cancelable:!0});if(this.emit("beforeChange",I,e),I.defaultPrevented)return}if(this.transitionTo(e,r))return;let T=b[o].pos;if(this.isInfinite){const I=this.contentDim,N=k.target[d]*C;E===2?T+=I*Math.floor(parseFloat(e+"")/2):T=[T,T-I,T+I].reduce(function($,F){return Math.abs(F-N)<Math.abs($-N)?F:$})}T*=C,Math.abs(k.target[d]-T)<1||(k.panTo({x:p?T:0,y:p?0:T,friction:n}),this.onChange(o))}slideToClosest(e){if(this.panzoom){const{pageIndex:n}=this.getPageFromPosition();this.slideTo(n,e)}}slideNext(){this.slideTo(this.page+1)}slidePrev(){this.slideTo(this.page-1)}clearTransitions(){this.inTransition.clear(),En(this.container,this.cn("inTransition"));const e=["to-prev","to-next","from-prev","from-next"];for(const n of this.slides){const r=n.el;if(r){r.removeEventListener(Vh,this.onAnimationEnd),r.classList.remove(...e);const o=n.transition;o&&r.classList.remove(`f-${o}Out`,`f-${o}In`)}}this.manageSlideVisiblity()}addSlide(e,n){var r,o,d,p;const c=this.panzoom,b=((r=this.pages[this.page])===null||r===void 0?void 0:r.pos)||0,k=((o=this.pages[this.page])===null||o===void 0?void 0:o.dim)||0,E=this.contentDim<this.viewportDim;let C=Array.isArray(n)?n:[n];const T=[];for(const I of C)T.push(Ym(I));this.slides.splice(e,0,...T);for(let I=0;I<this.slides.length;I++)this.slides[I].index=I;for(const I of T)this.emit("beforeInitSlide",I,I.index);if(this.page>=e&&(this.page+=T.length),this.updateMetrics(),c){const I=((d=this.pages[this.page])===null||d===void 0?void 0:d.pos)||0,N=((p=this.pages[this.page])===null||p===void 0?void 0:p.dim)||0,$=this.pages.length||1,F=this.isRTL?k-N:N-k,q=this.isRTL?b-I:I-b;E&&$===1?(e<=this.page&&(c.current[this.axis]-=F,c.target[this.axis]-=F),c.panTo({[this.isHorizontal?"x":"y"]:-1*I})):q&&e<=this.page&&(c.target[this.axis]-=q,c.current[this.axis]-=q,c.requestTick())}for(const I of T)this.emit("initSlide",I,I.index)}prependSlide(e){this.addSlide(0,e)}appendSlide(e){this.addSlide(this.slides.length,e)}removeSlide(e){const n=this.slides.length;e=(e%n+n)%n;const r=this.slides[e];if(r){this.removeSlideEl(r,!0),this.slides.splice(e,1);for(let o=0;o<this.slides.length;o++)this.slides[o].index=o;this.updateMetrics(),this.slideTo(this.page,{friction:0,transition:!1}),this.emit("destroySlide",r)}}updateMetrics(){const{panzoom:e,viewport:n,track:r,slides:o,isHorizontal:d,isInfinite:p}=this;if(!r)return;const c=d?"width":"height",b=d?"offsetWidth":"offsetHeight";if(n){let C=Math.max(n[b],ct(n.getBoundingClientRect()[c],1e3)),T=getComputedStyle(n),I="padding",N=d?"Right":"Bottom";C-=parseFloat(T[I+(d?"Left":"Top")])+parseFloat(T[I+N]),this.viewportDim=C}let k,E=0;for(const[C,T]of o.entries()){let I=0,N=0;!T.el&&k?(I=k.dim,N=k.gap):({dim:I,gap:N}=this.getSlideMetrics(T),k=T),I=ct(I,1e3),N=ct(N,1e3),T.dim=I,T.gap=N,T.pos=E,E+=I,(p||C<o.length-1)&&(E+=N)}E=ct(E,1e3),this.contentDim=E,e&&(e.contentRect[c]=E,e.contentRect[d?"fullWidth":"fullHeight"]=E),this.pages=this.createPages(),this.pages=this.processPages(),this.state===ur.Init&&this.setInitialPage(),this.page=Math.max(0,Math.min(this.page,this.pages.length-1)),this.manageSlideVisiblity(),this.emit("refresh")}getProgress(e,n=!1,r=!1){e===void 0&&(e=this.page);const o=this,d=o.panzoom,p=o.contentDim,c=o.pages[e]||0;if(!c||!d)return e>this.page?-1:1;let b=-1*d.current.e,k=ct((b-c.pos)/(1*c.dim),1e3),E=k,C=k;this.isInfinite&&r!==!0&&(E=ct((b-c.pos+p)/(1*c.dim),1e3),C=ct((b-c.pos-p)/(1*c.dim),1e3));let T=[k,E,C].reduce(function(I,N){return Math.abs(N)<Math.abs(I)?N:I});return n?T:T>1?1:T<-1?-1:T}setViewportHeight(){const{page:e,pages:n,viewport:r,isHorizontal:o}=this;if(!r||!n[e])return;let d=0;o&&this.track&&(this.track.style.height="auto",n[e].slides.forEach(p=>{p.el&&(d=Math.max(d,p.el.offsetHeight))})),r.style.height=d?`${d}px`:""}getPageForSlide(e){for(const n of this.pages)for(const r of n.slides)if(r.index===e)return n.index;return-1}getVisibleSlides(e=0){var n;const r=new Set;let{panzoom:o,contentDim:d,viewportDim:p,pages:c,page:b}=this;if(p){d=d+((n=this.slides[this.slides.length-1])===null||n===void 0?void 0:n.gap)||0;let k=0;k=o&&o.state!==An.Init&&o.state!==An.Destroy?-1*o.current[this.axis]:c[b]&&c[b].pos||0,this.isInfinite&&(k-=Math.floor(k/d)*d),this.isRTL&&this.isHorizontal&&(k*=-1);const E=k-p*e,C=k+p*(e+1),T=this.isInfinite?[-1,0,1]:[0];for(const I of this.slides)for(const N of T){const $=I.pos+N*d,F=$+I.dim+I.gap;$<C&&F>E&&r.add(I)}}return r}getPageFromPosition(e){const{viewportDim:n,contentDim:r,slides:o,pages:d,panzoom:p}=this,c=d.length,b=o.length,k=o[0],E=o[b-1],C=this.option("center");let T=0,I=0,N=0,$=e===void 0?-1*((p==null?void 0:p.target[this.axis])||0):e;C&&($+=.5*n),this.isInfinite?($<k.pos-.5*E.gap&&($-=r,N=-1),$>E.pos+E.dim+.5*E.gap&&($-=r,N=1)):$=Math.max(k.pos||0,Math.min($,E.pos));let F=E,q=o.find(J=>{const Q=J.pos-.5*F.gap,me=J.pos+J.dim+.5*J.gap;return F=J,$>=Q&&$<me});return q||(q=E),I=this.getPageForSlide(q.index),T=I+N*c,{page:T,pageIndex:I}}setPageFromPosition(){const{pageIndex:e}=this.getPageFromPosition();this.onChange(e)}destroy(){if([ur.Destroy].includes(this.state))return;this.state=ur.Destroy;const{container:e,viewport:n,track:r,slides:o,panzoom:d}=this,p=this.option("classes");e.removeEventListener("click",this.onClick,{passive:!1,capture:!1}),e.removeEventListener("slideTo",this.onSlideTo),window.removeEventListener("resize",this.onResize),d&&(d.destroy(),this.panzoom=null),o&&o.forEach(b=>{this.removeSlideEl(b)}),this.detachPlugins(),n&&(n.removeEventListener("scroll",this.onScroll),n.offsetParent&&r&&r.offsetParent&&n.replaceWith(...r.childNodes));for(const[b,k]of Object.entries(p))b!=="container"&&k&&e.classList.remove(k);this.track=null,this.viewport=null,this.page=0,this.slides=[];const c=this.events.get("ready");this.events=new Map,c&&this.events.set("ready",c)}};Object.defineProperty(gd,"Panzoom",{enumerable:!0,configurable:!0,writable:!0,value:Vl}),Object.defineProperty(gd,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:iR}),Object.defineProperty(gd,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:aR});const $x=function(t){if(!mi(t))return 0;const e=window.scrollY,n=window.innerHeight,r=e+n,o=t.getBoundingClientRect(),d=o.y+e,p=o.height,c=d+p;if(e>c||r<d)return 0;if(e<d&&r>c||d<e&&c>r)return 100;let b=p;d<e&&(b-=e-d),c>r&&(b-=c-r);const k=b/n*100;return Math.round(k)},yd=!(typeof window>"u"||!window.document||!window.document.createElement);let Xm;const Km=["a[href]","area[href]",'input:not([disabled]):not([type="hidden"]):not([aria-hidden])',"select:not([disabled]):not([aria-hidden])","textarea:not([disabled]):not([aria-hidden])","button:not([disabled]):not([aria-hidden]):not(.fancybox-focus-guard)","iframe","object","embed","video","audio","[contenteditable]",'[tabindex]:not([tabindex^="-"]):not([disabled]):not([aria-hidden])'].join(","),jx=t=>{if(t&&yd){Xm===void 0&&document.createElement("div").focus({get preventScroll(){return Xm=!0,!1}});try{if(Xm)t.focus({preventScroll:!0});else{const e=window.scrollY||document.body.scrollTop,n=window.scrollX||document.body.scrollLeft;t.focus(),document.body.scrollTo({top:e,left:n,behavior:"auto"})}}catch{}}},Ux=()=>{const t=document;let e,n="",r="",o="";return t.fullscreenEnabled?(n="requestFullscreen",r="exitFullscreen",o="fullscreenElement"):t.webkitFullscreenEnabled&&(n="webkitRequestFullscreen",r="webkitExitFullscreen",o="webkitFullscreenElement"),n&&(e={request:function(d=t.documentElement){return n==="webkitRequestFullscreen"?d[n](Element.ALLOW_KEYBOARD_INPUT):d[n]()},exit:function(){return t[o]&&t[r]()},isFullscreen:function(){return t[o]}}),e},Jm={animated:!0,autoFocus:!0,backdropClick:"close",Carousel:{classes:{container:"fancybox__carousel",viewport:"fancybox__viewport",track:"fancybox__track",slide:"fancybox__slide"}},closeButton:"auto",closeExisting:!1,commonCaption:!1,compact:()=>window.matchMedia("(max-width: 578px), (max-height: 578px)").matches,contentClick:"toggleZoom",contentDblClick:!1,defaultType:"image",defaultDisplay:"flex",dragToClose:!0,Fullscreen:{autoStart:!1},groupAll:!1,groupAttr:"data-fancybox",hideClass:"f-fadeOut",hideScrollbar:!0,idle:3500,keyboard:{Escape:"close",Delete:"close",Backspace:"close",PageUp:"next",PageDown:"prev",ArrowUp:"prev",ArrowDown:"next",ArrowRight:"next",ArrowLeft:"prev"},l10n:Object.assign(Object.assign({},Mx),{CLOSE:"Close",NEXT:"Next",PREV:"Previous",MODAL:"You can close this modal content with the ESC key",ERROR:"Something Went Wrong, Please Try Again Later",IMAGE_ERROR:"Image Not Found",ELEMENT_NOT_FOUND:"HTML Element Not Found",AJAX_NOT_FOUND:"Error Loading AJAX : Not Found",AJAX_FORBIDDEN:"Error Loading AJAX : Forbidden",IFRAME_ERROR:"Error Loading Page",TOGGLE_ZOOM:"Toggle zoom level",TOGGLE_THUMBS:"Toggle thumbnails",TOGGLE_SLIDESHOW:"Toggle slideshow",TOGGLE_FULLSCREEN:"Toggle full-screen mode",DOWNLOAD:"Download"}),parentEl:null,placeFocusBack:!0,showClass:"f-zoomInUp",startIndex:0,tpl:{closeButton:'<button data-fancybox-close class="f-button is-close-btn" title="{{CLOSE}}"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" tabindex="-1"><path d="M20 20L4 4m16 0L4 20"/></svg></button>',main:`<div class="fancybox__container" role="dialog" aria-modal="true" aria-label="{{MODAL}}" tabindex="-1">
|
620
|
+
`),te=M.createShader(M.FRAGMENT_SHADER);if(M.isContextLost())return void(this.failedToCreate=!0);if(M.shaderSource(te,ce),M.compileShader(te),!M.getShaderParameter(te,M.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${M.getShaderInfoLog(te)}`);M.attachShader(this.program,te);const ge=M.createShader(M.VERTEX_SHADER);if(M.isContextLost())return void(this.failedToCreate=!0);if(M.shaderSource(ge,he),M.compileShader(ge),!M.getShaderParameter(ge,M.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${M.getShaderInfoLog(ge)}`);M.attachShader(this.program,ge),this.attributes={};const _e={};this.numAttributes=O.length;for(let we=0;we<this.numAttributes;we++)O[we]&&(M.bindAttribLocation(this.program,we,O[we]),this.attributes[O[we]]=we);if(M.linkProgram(this.program),!M.getProgramParameter(this.program,M.LINK_STATUS))throw new Error(`Program failed to link: ${M.getProgramInfoLog(this.program)}`);M.deleteShader(ge),M.deleteShader(te);for(let we=0;we<ie.length;we++){const Ne=ie[we];if(Ne&&!_e[Ne]){const $e=M.getUniformLocation(this.program,Ne);$e&&(_e[Ne]=$e)}}this.fixedUniforms=g(i,_e),this.terrainUniforms=((we,Ne)=>({u_depth:new c.aH(we,Ne.u_depth),u_terrain:new c.aH(we,Ne.u_terrain),u_terrain_dim:new c.aI(we,Ne.u_terrain_dim),u_terrain_matrix:new c.aJ(we,Ne.u_terrain_matrix),u_terrain_unpack:new c.aK(we,Ne.u_terrain_unpack),u_terrain_exaggeration:new c.aI(we,Ne.u_terrain_exaggeration)}))(i,_e),this.binderUniforms=m?m.getUniforms(i,_e):[]}draw(i,h,m,g,_,A,M,P,V,O,L,G,K,ee,ie,ae,ce,he){const te=i.gl;if(this.failedToCreate)return;if(i.program.set(this.program),i.setDepthMode(m),i.setStencilMode(g),i.setColorMode(_),i.setCullFace(A),P){i.activeTexture.set(te.TEXTURE2),te.bindTexture(te.TEXTURE_2D,P.depthTexture),i.activeTexture.set(te.TEXTURE3),te.bindTexture(te.TEXTURE_2D,P.texture);for(const _e in this.terrainUniforms)this.terrainUniforms[_e].set(P[_e])}for(const _e in this.fixedUniforms)this.fixedUniforms[_e].set(M[_e]);ie&&ie.setUniforms(i,this.binderUniforms,K,{zoom:ee});let ge=0;switch(h){case te.LINES:ge=2;break;case te.TRIANGLES:ge=3;break;case te.LINE_STRIP:ge=1}for(const _e of G.get()){const we=_e.vaos||(_e.vaos={});(we[V]||(we[V]=new Fd)).bind(i,this,O,ie?ie.getPaintVertexBuffers():[],L,_e.vertexOffset,ae,ce,he),te.drawElements(h,_e.primitiveLength*ge,te.UNSIGNED_SHORT,_e.primitiveOffset*ge*2)}}}function ec(x,i,h){const m=1/Zt(h,1,i.transform.tileZoom),g=Math.pow(2,h.tileID.overscaledZ),_=h.tileSize*Math.pow(2,i.transform.tileZoom)/g,A=_*(h.tileID.canonical.x+h.tileID.wrap*g),M=_*h.tileID.canonical.y;return{u_image:0,u_texsize:h.imageAtlasTexture.size,u_scale:[m,x.fromScale,x.toScale],u_fade:x.t,u_pixel_coord_upper:[A>>16,M>>16],u_pixel_coord_lower:[65535&A,65535&M]}}const qa=(x,i,h,m)=>{const g=i.style.light,_=g.properties.get("position"),A=[_.x,_.y,_.z],M=function(){var V=new c.A(9);return c.A!=Float32Array&&(V[1]=0,V[2]=0,V[3]=0,V[5]=0,V[6]=0,V[7]=0),V[0]=1,V[4]=1,V[8]=1,V}();g.properties.get("anchor")==="viewport"&&function(V,O){var L=Math.sin(O),G=Math.cos(O);V[0]=G,V[1]=L,V[2]=0,V[3]=-L,V[4]=G,V[5]=0,V[6]=0,V[7]=0,V[8]=1}(M,-i.transform.angle),function(V,O,L){var G=O[0],K=O[1],ee=O[2];V[0]=G*L[0]+K*L[3]+ee*L[6],V[1]=G*L[1]+K*L[4]+ee*L[7],V[2]=G*L[2]+K*L[5]+ee*L[8]}(A,A,M);const P=g.properties.get("color");return{u_matrix:x,u_lightpos:A,u_lightintensity:g.properties.get("intensity"),u_lightcolor:[P.r,P.g,P.b],u_vertical_gradient:+h,u_opacity:m}},tc=(x,i,h,m,g,_,A)=>c.e(qa(x,i,h,m),ec(_,i,A),{u_height_factor:-Math.pow(2,g.overscaledZ)/A.tileSize/8}),Wo=x=>({u_matrix:x}),Pp=(x,i,h,m)=>c.e(Wo(x),ec(h,i,m)),Oy=(x,i)=>({u_matrix:x,u_world:i}),Rp=(x,i,h,m,g)=>c.e(Pp(x,i,h,m),{u_world:g}),Ly=(x,i,h,m)=>{const g=x.transform;let _,A;if(m.paint.get("circle-pitch-alignment")==="map"){const M=Zt(h,1,g.zoom);_=!0,A=[M,M]}else _=!1,A=g.pixelsToGLUnits;return{u_camera_to_center_distance:g.cameraToCenterDistance,u_scale_with_map:+(m.paint.get("circle-pitch-scale")==="map"),u_matrix:x.translatePosMatrix(i.posMatrix,h,m.paint.get("circle-translate"),m.paint.get("circle-translate-anchor")),u_pitch_with_map:+_,u_device_pixel_ratio:x.pixelRatio,u_extrude_scale:A}},uo=(x,i,h)=>({u_matrix:x,u_inv_matrix:i,u_camera_to_center_distance:h.cameraToCenterDistance,u_viewport_size:[h.width,h.height]}),Ga=(x,i,h=1)=>({u_matrix:x,u_color:i,u_overlay:0,u_overlay_scale:h}),Wr=x=>({u_matrix:x}),qr=(x,i,h,m)=>({u_matrix:x,u_extrude_scale:Zt(i,1,h),u_intensity:m}),nc=(x,i,h,m)=>{const g=c.H();c.aP(g,0,x.width,x.height,0,0,1);const _=x.context.gl;return{u_matrix:g,u_world:[_.drawingBufferWidth,_.drawingBufferHeight],u_image:h,u_color_ramp:m,u_opacity:i.paint.get("heatmap-opacity")}};function rc(x,i){const h=Math.pow(2,i.canonical.z),m=i.canonical.y;return[new c.Z(0,m/h).toLngLat().lat,new c.Z(0,(m+1)/h).toLngLat().lat]}const ic=(x,i,h,m)=>{const g=x.transform;return{u_matrix:Vp(x,i,h,m),u_ratio:1/Zt(i,1,g.zoom),u_device_pixel_ratio:x.pixelRatio,u_units_to_pixels:[1/g.pixelsToGLUnits[0],1/g.pixelsToGLUnits[1]]}},Np=(x,i,h,m,g)=>c.e(ic(x,i,h,g),{u_image:0,u_image_height:m}),qo=(x,i,h,m,g)=>{const _=x.transform,A=Bp(i,_);return{u_matrix:Vp(x,i,h,g),u_texsize:i.imageAtlasTexture.size,u_ratio:1/Zt(i,1,_.zoom),u_device_pixel_ratio:x.pixelRatio,u_image:0,u_scale:[A,m.fromScale,m.toScale],u_fade:m.t,u_units_to_pixels:[1/_.pixelsToGLUnits[0],1/_.pixelsToGLUnits[1]]}},Fy=(x,i,h,m,g,_)=>{const A=x.lineAtlas,M=Bp(i,x.transform),P=h.layout.get("line-cap")==="round",V=A.getDash(m.from,P),O=A.getDash(m.to,P),L=V.width*g.fromScale,G=O.width*g.toScale;return c.e(ic(x,i,h,_),{u_patternscale_a:[M/L,-V.height/2],u_patternscale_b:[M/G,-O.height/2],u_sdfgamma:A.width/(256*Math.min(L,G)*x.pixelRatio)/2,u_image:0,u_tex_y_a:V.y,u_tex_y_b:O.y,u_mix:g.t})};function Bp(x,i){return 1/Zt(x,1,i.tileZoom)}function Vp(x,i,h,m){return x.translatePosMatrix(m?m.posMatrix:i.tileID.posMatrix,i,h.paint.get("line-translate"),h.paint.get("line-translate-anchor"))}const $y=(x,i,h,m,g)=>{return{u_matrix:x,u_tl_parent:i,u_scale_parent:h,u_buffer_scale:1,u_fade_t:m.mix,u_opacity:m.opacity*g.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:g.paint.get("raster-brightness-min"),u_brightness_high:g.paint.get("raster-brightness-max"),u_saturation_factor:(A=g.paint.get("raster-saturation"),A>0?1-1/(1.001-A):-A),u_contrast_factor:(_=g.paint.get("raster-contrast"),_>0?1/(1-_):1+_),u_spin_weights:jy(g.paint.get("raster-hue-rotate"))};var _,A};function jy(x){x*=Math.PI/180;const i=Math.sin(x),h=Math.cos(x);return[(2*h+1)/3,(-Math.sqrt(3)*i-h+1)/3,(Math.sqrt(3)*i-h+1)/3]}const zp=(x,i,h,m,g,_,A,M,P,V,O,L,G,K)=>{const ee=A.transform;return{u_is_size_zoom_constant:+(x==="constant"||x==="source"),u_is_size_feature_constant:+(x==="constant"||x==="camera"),u_size_t:i?i.uSizeT:0,u_size:i?i.uSize:0,u_camera_to_center_distance:ee.cameraToCenterDistance,u_pitch:ee.pitch/360*2*Math.PI,u_rotate_symbol:+h,u_aspect_ratio:ee.width/ee.height,u_fade_change:A.options.fadeDuration?A.symbolFadeChange:1,u_matrix:M,u_label_plane_matrix:P,u_coord_matrix:V,u_is_text:+L,u_pitch_with_map:+m,u_is_along_line:g,u_is_variable_anchor:_,u_texsize:G,u_texture:0,u_translation:O,u_pitched_scale:K}},Za=(x,i,h,m,g,_,A,M,P,V,O,L,G,K,ee)=>{const ie=A.transform;return c.e(zp(x,i,h,m,g,_,A,M,P,V,O,L,G,ee),{u_gamma_scale:m?Math.cos(ie._pitch)*ie.cameraToCenterDistance:1,u_device_pixel_ratio:A.pixelRatio,u_is_halo:1})},Ud=(x,i,h,m,g,_,A,M,P,V,O,L,G,K)=>c.e(Za(x,i,h,m,g,_,A,M,P,V,O,!0,L,!0,K),{u_texsize_icon:G,u_texture_icon:1}),sc=(x,i,h)=>({u_matrix:x,u_opacity:i,u_color:h}),Hd=(x,i,h,m,g,_)=>c.e(function(A,M,P,V){const O=P.imageManager.getPattern(A.from.toString()),L=P.imageManager.getPattern(A.to.toString()),{width:G,height:K}=P.imageManager.getPixelSize(),ee=Math.pow(2,V.tileID.overscaledZ),ie=V.tileSize*Math.pow(2,P.transform.tileZoom)/ee,ae=ie*(V.tileID.canonical.x+V.tileID.wrap*ee),ce=ie*V.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:O.tl,u_pattern_br_a:O.br,u_pattern_tl_b:L.tl,u_pattern_br_b:L.br,u_texsize:[G,K],u_mix:M.t,u_pattern_size_a:O.displaySize,u_pattern_size_b:L.displaySize,u_scale_a:M.fromScale,u_scale_b:M.toScale,u_tile_units_to_pixels:1/Zt(V,1,P.transform.tileZoom),u_pixel_coord_upper:[ae>>16,ce>>16],u_pixel_coord_lower:[65535&ae,65535&ce]}}(m,_,h,g),{u_matrix:x,u_opacity:i}),Wd={fillExtrusion:(x,i)=>({u_matrix:new c.aJ(x,i.u_matrix),u_lightpos:new c.aN(x,i.u_lightpos),u_lightintensity:new c.aI(x,i.u_lightintensity),u_lightcolor:new c.aN(x,i.u_lightcolor),u_vertical_gradient:new c.aI(x,i.u_vertical_gradient),u_opacity:new c.aI(x,i.u_opacity)}),fillExtrusionPattern:(x,i)=>({u_matrix:new c.aJ(x,i.u_matrix),u_lightpos:new c.aN(x,i.u_lightpos),u_lightintensity:new c.aI(x,i.u_lightintensity),u_lightcolor:new c.aN(x,i.u_lightcolor),u_vertical_gradient:new c.aI(x,i.u_vertical_gradient),u_height_factor:new c.aI(x,i.u_height_factor),u_image:new c.aH(x,i.u_image),u_texsize:new c.aO(x,i.u_texsize),u_pixel_coord_upper:new c.aO(x,i.u_pixel_coord_upper),u_pixel_coord_lower:new c.aO(x,i.u_pixel_coord_lower),u_scale:new c.aN(x,i.u_scale),u_fade:new c.aI(x,i.u_fade),u_opacity:new c.aI(x,i.u_opacity)}),fill:(x,i)=>({u_matrix:new c.aJ(x,i.u_matrix)}),fillPattern:(x,i)=>({u_matrix:new c.aJ(x,i.u_matrix),u_image:new c.aH(x,i.u_image),u_texsize:new c.aO(x,i.u_texsize),u_pixel_coord_upper:new c.aO(x,i.u_pixel_coord_upper),u_pixel_coord_lower:new c.aO(x,i.u_pixel_coord_lower),u_scale:new c.aN(x,i.u_scale),u_fade:new c.aI(x,i.u_fade)}),fillOutline:(x,i)=>({u_matrix:new c.aJ(x,i.u_matrix),u_world:new c.aO(x,i.u_world)}),fillOutlinePattern:(x,i)=>({u_matrix:new c.aJ(x,i.u_matrix),u_world:new c.aO(x,i.u_world),u_image:new c.aH(x,i.u_image),u_texsize:new c.aO(x,i.u_texsize),u_pixel_coord_upper:new c.aO(x,i.u_pixel_coord_upper),u_pixel_coord_lower:new c.aO(x,i.u_pixel_coord_lower),u_scale:new c.aN(x,i.u_scale),u_fade:new c.aI(x,i.u_fade)}),circle:(x,i)=>({u_camera_to_center_distance:new c.aI(x,i.u_camera_to_center_distance),u_scale_with_map:new c.aH(x,i.u_scale_with_map),u_pitch_with_map:new c.aH(x,i.u_pitch_with_map),u_extrude_scale:new c.aO(x,i.u_extrude_scale),u_device_pixel_ratio:new c.aI(x,i.u_device_pixel_ratio),u_matrix:new c.aJ(x,i.u_matrix)}),collisionBox:(x,i)=>({u_matrix:new c.aJ(x,i.u_matrix),u_pixel_extrude_scale:new c.aO(x,i.u_pixel_extrude_scale)}),collisionCircle:(x,i)=>({u_matrix:new c.aJ(x,i.u_matrix),u_inv_matrix:new c.aJ(x,i.u_inv_matrix),u_camera_to_center_distance:new c.aI(x,i.u_camera_to_center_distance),u_viewport_size:new c.aO(x,i.u_viewport_size)}),debug:(x,i)=>({u_color:new c.aL(x,i.u_color),u_matrix:new c.aJ(x,i.u_matrix),u_overlay:new c.aH(x,i.u_overlay),u_overlay_scale:new c.aI(x,i.u_overlay_scale)}),clippingMask:(x,i)=>({u_matrix:new c.aJ(x,i.u_matrix)}),heatmap:(x,i)=>({u_extrude_scale:new c.aI(x,i.u_extrude_scale),u_intensity:new c.aI(x,i.u_intensity),u_matrix:new c.aJ(x,i.u_matrix)}),heatmapTexture:(x,i)=>({u_matrix:new c.aJ(x,i.u_matrix),u_world:new c.aO(x,i.u_world),u_image:new c.aH(x,i.u_image),u_color_ramp:new c.aH(x,i.u_color_ramp),u_opacity:new c.aI(x,i.u_opacity)}),hillshade:(x,i)=>({u_matrix:new c.aJ(x,i.u_matrix),u_image:new c.aH(x,i.u_image),u_latrange:new c.aO(x,i.u_latrange),u_light:new c.aO(x,i.u_light),u_shadow:new c.aL(x,i.u_shadow),u_highlight:new c.aL(x,i.u_highlight),u_accent:new c.aL(x,i.u_accent)}),hillshadePrepare:(x,i)=>({u_matrix:new c.aJ(x,i.u_matrix),u_image:new c.aH(x,i.u_image),u_dimension:new c.aO(x,i.u_dimension),u_zoom:new c.aI(x,i.u_zoom),u_unpack:new c.aK(x,i.u_unpack)}),line:(x,i)=>({u_matrix:new c.aJ(x,i.u_matrix),u_ratio:new c.aI(x,i.u_ratio),u_device_pixel_ratio:new c.aI(x,i.u_device_pixel_ratio),u_units_to_pixels:new c.aO(x,i.u_units_to_pixels)}),lineGradient:(x,i)=>({u_matrix:new c.aJ(x,i.u_matrix),u_ratio:new c.aI(x,i.u_ratio),u_device_pixel_ratio:new c.aI(x,i.u_device_pixel_ratio),u_units_to_pixels:new c.aO(x,i.u_units_to_pixels),u_image:new c.aH(x,i.u_image),u_image_height:new c.aI(x,i.u_image_height)}),linePattern:(x,i)=>({u_matrix:new c.aJ(x,i.u_matrix),u_texsize:new c.aO(x,i.u_texsize),u_ratio:new c.aI(x,i.u_ratio),u_device_pixel_ratio:new c.aI(x,i.u_device_pixel_ratio),u_image:new c.aH(x,i.u_image),u_units_to_pixels:new c.aO(x,i.u_units_to_pixels),u_scale:new c.aN(x,i.u_scale),u_fade:new c.aI(x,i.u_fade)}),lineSDF:(x,i)=>({u_matrix:new c.aJ(x,i.u_matrix),u_ratio:new c.aI(x,i.u_ratio),u_device_pixel_ratio:new c.aI(x,i.u_device_pixel_ratio),u_units_to_pixels:new c.aO(x,i.u_units_to_pixels),u_patternscale_a:new c.aO(x,i.u_patternscale_a),u_patternscale_b:new c.aO(x,i.u_patternscale_b),u_sdfgamma:new c.aI(x,i.u_sdfgamma),u_image:new c.aH(x,i.u_image),u_tex_y_a:new c.aI(x,i.u_tex_y_a),u_tex_y_b:new c.aI(x,i.u_tex_y_b),u_mix:new c.aI(x,i.u_mix)}),raster:(x,i)=>({u_matrix:new c.aJ(x,i.u_matrix),u_tl_parent:new c.aO(x,i.u_tl_parent),u_scale_parent:new c.aI(x,i.u_scale_parent),u_buffer_scale:new c.aI(x,i.u_buffer_scale),u_fade_t:new c.aI(x,i.u_fade_t),u_opacity:new c.aI(x,i.u_opacity),u_image0:new c.aH(x,i.u_image0),u_image1:new c.aH(x,i.u_image1),u_brightness_low:new c.aI(x,i.u_brightness_low),u_brightness_high:new c.aI(x,i.u_brightness_high),u_saturation_factor:new c.aI(x,i.u_saturation_factor),u_contrast_factor:new c.aI(x,i.u_contrast_factor),u_spin_weights:new c.aN(x,i.u_spin_weights)}),symbolIcon:(x,i)=>({u_is_size_zoom_constant:new c.aH(x,i.u_is_size_zoom_constant),u_is_size_feature_constant:new c.aH(x,i.u_is_size_feature_constant),u_size_t:new c.aI(x,i.u_size_t),u_size:new c.aI(x,i.u_size),u_camera_to_center_distance:new c.aI(x,i.u_camera_to_center_distance),u_pitch:new c.aI(x,i.u_pitch),u_rotate_symbol:new c.aH(x,i.u_rotate_symbol),u_aspect_ratio:new c.aI(x,i.u_aspect_ratio),u_fade_change:new c.aI(x,i.u_fade_change),u_matrix:new c.aJ(x,i.u_matrix),u_label_plane_matrix:new c.aJ(x,i.u_label_plane_matrix),u_coord_matrix:new c.aJ(x,i.u_coord_matrix),u_is_text:new c.aH(x,i.u_is_text),u_pitch_with_map:new c.aH(x,i.u_pitch_with_map),u_is_along_line:new c.aH(x,i.u_is_along_line),u_is_variable_anchor:new c.aH(x,i.u_is_variable_anchor),u_texsize:new c.aO(x,i.u_texsize),u_texture:new c.aH(x,i.u_texture),u_translation:new c.aO(x,i.u_translation),u_pitched_scale:new c.aI(x,i.u_pitched_scale)}),symbolSDF:(x,i)=>({u_is_size_zoom_constant:new c.aH(x,i.u_is_size_zoom_constant),u_is_size_feature_constant:new c.aH(x,i.u_is_size_feature_constant),u_size_t:new c.aI(x,i.u_size_t),u_size:new c.aI(x,i.u_size),u_camera_to_center_distance:new c.aI(x,i.u_camera_to_center_distance),u_pitch:new c.aI(x,i.u_pitch),u_rotate_symbol:new c.aH(x,i.u_rotate_symbol),u_aspect_ratio:new c.aI(x,i.u_aspect_ratio),u_fade_change:new c.aI(x,i.u_fade_change),u_matrix:new c.aJ(x,i.u_matrix),u_label_plane_matrix:new c.aJ(x,i.u_label_plane_matrix),u_coord_matrix:new c.aJ(x,i.u_coord_matrix),u_is_text:new c.aH(x,i.u_is_text),u_pitch_with_map:new c.aH(x,i.u_pitch_with_map),u_is_along_line:new c.aH(x,i.u_is_along_line),u_is_variable_anchor:new c.aH(x,i.u_is_variable_anchor),u_texsize:new c.aO(x,i.u_texsize),u_texture:new c.aH(x,i.u_texture),u_gamma_scale:new c.aI(x,i.u_gamma_scale),u_device_pixel_ratio:new c.aI(x,i.u_device_pixel_ratio),u_is_halo:new c.aH(x,i.u_is_halo),u_translation:new c.aO(x,i.u_translation),u_pitched_scale:new c.aI(x,i.u_pitched_scale)}),symbolTextAndIcon:(x,i)=>({u_is_size_zoom_constant:new c.aH(x,i.u_is_size_zoom_constant),u_is_size_feature_constant:new c.aH(x,i.u_is_size_feature_constant),u_size_t:new c.aI(x,i.u_size_t),u_size:new c.aI(x,i.u_size),u_camera_to_center_distance:new c.aI(x,i.u_camera_to_center_distance),u_pitch:new c.aI(x,i.u_pitch),u_rotate_symbol:new c.aH(x,i.u_rotate_symbol),u_aspect_ratio:new c.aI(x,i.u_aspect_ratio),u_fade_change:new c.aI(x,i.u_fade_change),u_matrix:new c.aJ(x,i.u_matrix),u_label_plane_matrix:new c.aJ(x,i.u_label_plane_matrix),u_coord_matrix:new c.aJ(x,i.u_coord_matrix),u_is_text:new c.aH(x,i.u_is_text),u_pitch_with_map:new c.aH(x,i.u_pitch_with_map),u_is_along_line:new c.aH(x,i.u_is_along_line),u_is_variable_anchor:new c.aH(x,i.u_is_variable_anchor),u_texsize:new c.aO(x,i.u_texsize),u_texsize_icon:new c.aO(x,i.u_texsize_icon),u_texture:new c.aH(x,i.u_texture),u_texture_icon:new c.aH(x,i.u_texture_icon),u_gamma_scale:new c.aI(x,i.u_gamma_scale),u_device_pixel_ratio:new c.aI(x,i.u_device_pixel_ratio),u_is_halo:new c.aH(x,i.u_is_halo),u_translation:new c.aO(x,i.u_translation),u_pitched_scale:new c.aI(x,i.u_pitched_scale)}),background:(x,i)=>({u_matrix:new c.aJ(x,i.u_matrix),u_opacity:new c.aI(x,i.u_opacity),u_color:new c.aL(x,i.u_color)}),backgroundPattern:(x,i)=>({u_matrix:new c.aJ(x,i.u_matrix),u_opacity:new c.aI(x,i.u_opacity),u_image:new c.aH(x,i.u_image),u_pattern_tl_a:new c.aO(x,i.u_pattern_tl_a),u_pattern_br_a:new c.aO(x,i.u_pattern_br_a),u_pattern_tl_b:new c.aO(x,i.u_pattern_tl_b),u_pattern_br_b:new c.aO(x,i.u_pattern_br_b),u_texsize:new c.aO(x,i.u_texsize),u_mix:new c.aI(x,i.u_mix),u_pattern_size_a:new c.aO(x,i.u_pattern_size_a),u_pattern_size_b:new c.aO(x,i.u_pattern_size_b),u_scale_a:new c.aI(x,i.u_scale_a),u_scale_b:new c.aI(x,i.u_scale_b),u_pixel_coord_upper:new c.aO(x,i.u_pixel_coord_upper),u_pixel_coord_lower:new c.aO(x,i.u_pixel_coord_lower),u_tile_units_to_pixels:new c.aI(x,i.u_tile_units_to_pixels)}),terrain:(x,i)=>({u_matrix:new c.aJ(x,i.u_matrix),u_texture:new c.aH(x,i.u_texture),u_ele_delta:new c.aI(x,i.u_ele_delta),u_fog_matrix:new c.aJ(x,i.u_fog_matrix),u_fog_color:new c.aL(x,i.u_fog_color),u_fog_ground_blend:new c.aI(x,i.u_fog_ground_blend),u_fog_ground_blend_opacity:new c.aI(x,i.u_fog_ground_blend_opacity),u_horizon_color:new c.aL(x,i.u_horizon_color),u_horizon_fog_blend:new c.aI(x,i.u_horizon_fog_blend)}),terrainDepth:(x,i)=>({u_matrix:new c.aJ(x,i.u_matrix),u_ele_delta:new c.aI(x,i.u_ele_delta)}),terrainCoords:(x,i)=>({u_matrix:new c.aJ(x,i.u_matrix),u_texture:new c.aH(x,i.u_texture),u_terrain_coords_id:new c.aI(x,i.u_terrain_coords_id),u_ele_delta:new c.aI(x,i.u_ele_delta)}),sky:(x,i)=>({u_sky_color:new c.aL(x,i.u_sky_color),u_horizon_color:new c.aL(x,i.u_horizon_color),u_horizon:new c.aI(x,i.u_horizon),u_sky_horizon_blend:new c.aI(x,i.u_sky_horizon_blend)})};class es{constructor(i,h,m){this.context=i;const g=i.gl;this.buffer=g.createBuffer(),this.dynamicDraw=!!m,this.context.unbindVAO(),i.bindElementBuffer.set(this.buffer),g.bufferData(g.ELEMENT_ARRAY_BUFFER,h.arrayBuffer,this.dynamicDraw?g.DYNAMIC_DRAW:g.STATIC_DRAW),this.dynamicDraw||delete h.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(i){const h=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),h.bufferSubData(h.ELEMENT_ARRAY_BUFFER,0,i.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Uy={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class qd{constructor(i,h,m,g){this.length=h.length,this.attributes=m,this.itemSize=h.bytesPerElement,this.dynamicDraw=g,this.context=i;const _=i.gl;this.buffer=_.createBuffer(),i.bindVertexBuffer.set(this.buffer),_.bufferData(_.ARRAY_BUFFER,h.arrayBuffer,this.dynamicDraw?_.DYNAMIC_DRAW:_.STATIC_DRAW),this.dynamicDraw||delete h.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(i){if(i.length!==this.length)throw new Error(`Length of new data is ${i.length}, which doesn't match current length of ${this.length}`);const h=this.context.gl;this.bind(),h.bufferSubData(h.ARRAY_BUFFER,0,i.arrayBuffer)}enableAttributes(i,h){for(let m=0;m<this.attributes.length;m++){const g=h.attributes[this.attributes[m].name];g!==void 0&&i.enableVertexAttribArray(g)}}setVertexAttribPointers(i,h,m){for(let g=0;g<this.attributes.length;g++){const _=this.attributes[g],A=h.attributes[_.name];A!==void 0&&i.vertexAttribPointer(A,_.components,i[Uy[_.type]],!1,this.itemSize,_.offset+this.itemSize*(m||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const ho=new WeakMap;function Vs(x){var i;if(ho.has(x))return ho.get(x);{const h=(i=x.getParameter(x.VERSION))===null||i===void 0?void 0:i.startsWith("WebGL 2.0");return ho.set(x,h),h}}class fn{constructor(i){this.gl=i.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(i){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class oc extends fn{getDefault(){return c.aM.transparent}set(i){const h=this.current;(i.r!==h.r||i.g!==h.g||i.b!==h.b||i.a!==h.a||this.dirty)&&(this.gl.clearColor(i.r,i.g,i.b,i.a),this.current=i,this.dirty=!1)}}class Hy extends fn{getDefault(){return 1}set(i){(i!==this.current||this.dirty)&&(this.gl.clearDepth(i),this.current=i,this.dirty=!1)}}class Go extends fn{getDefault(){return 0}set(i){(i!==this.current||this.dirty)&&(this.gl.clearStencil(i),this.current=i,this.dirty=!1)}}class Wy extends fn{getDefault(){return[!0,!0,!0,!0]}set(i){const h=this.current;(i[0]!==h[0]||i[1]!==h[1]||i[2]!==h[2]||i[3]!==h[3]||this.dirty)&&(this.gl.colorMask(i[0],i[1],i[2],i[3]),this.current=i,this.dirty=!1)}}class Op extends fn{getDefault(){return!0}set(i){(i!==this.current||this.dirty)&&(this.gl.depthMask(i),this.current=i,this.dirty=!1)}}class qy extends fn{getDefault(){return 255}set(i){(i!==this.current||this.dirty)&&(this.gl.stencilMask(i),this.current=i,this.dirty=!1)}}class Lp extends fn{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(i){const h=this.current;(i.func!==h.func||i.ref!==h.ref||i.mask!==h.mask||this.dirty)&&(this.gl.stencilFunc(i.func,i.ref,i.mask),this.current=i,this.dirty=!1)}}class Gd extends fn{getDefault(){const i=this.gl;return[i.KEEP,i.KEEP,i.KEEP]}set(i){const h=this.current;(i[0]!==h[0]||i[1]!==h[1]||i[2]!==h[2]||this.dirty)&&(this.gl.stencilOp(i[0],i[1],i[2]),this.current=i,this.dirty=!1)}}class Fp extends fn{getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;const h=this.gl;i?h.enable(h.STENCIL_TEST):h.disable(h.STENCIL_TEST),this.current=i,this.dirty=!1}}class $p extends fn{getDefault(){return[0,1]}set(i){const h=this.current;(i[0]!==h[0]||i[1]!==h[1]||this.dirty)&&(this.gl.depthRange(i[0],i[1]),this.current=i,this.dirty=!1)}}class jp extends fn{getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;const h=this.gl;i?h.enable(h.DEPTH_TEST):h.disable(h.DEPTH_TEST),this.current=i,this.dirty=!1}}class Up extends fn{getDefault(){return this.gl.LESS}set(i){(i!==this.current||this.dirty)&&(this.gl.depthFunc(i),this.current=i,this.dirty=!1)}}class po extends fn{getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;const h=this.gl;i?h.enable(h.BLEND):h.disable(h.BLEND),this.current=i,this.dirty=!1}}class Hp extends fn{getDefault(){const i=this.gl;return[i.ONE,i.ZERO]}set(i){const h=this.current;(i[0]!==h[0]||i[1]!==h[1]||this.dirty)&&(this.gl.blendFunc(i[0],i[1]),this.current=i,this.dirty=!1)}}class Gy extends fn{getDefault(){return c.aM.transparent}set(i){const h=this.current;(i.r!==h.r||i.g!==h.g||i.b!==h.b||i.a!==h.a||this.dirty)&&(this.gl.blendColor(i.r,i.g,i.b,i.a),this.current=i,this.dirty=!1)}}class Wp extends fn{getDefault(){return this.gl.FUNC_ADD}set(i){(i!==this.current||this.dirty)&&(this.gl.blendEquation(i),this.current=i,this.dirty=!1)}}class Ya extends fn{getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;const h=this.gl;i?h.enable(h.CULL_FACE):h.disable(h.CULL_FACE),this.current=i,this.dirty=!1}}class Zy extends fn{getDefault(){return this.gl.BACK}set(i){(i!==this.current||this.dirty)&&(this.gl.cullFace(i),this.current=i,this.dirty=!1)}}class ac extends fn{getDefault(){return this.gl.CCW}set(i){(i!==this.current||this.dirty)&&(this.gl.frontFace(i),this.current=i,this.dirty=!1)}}class Yy extends fn{getDefault(){return null}set(i){(i!==this.current||this.dirty)&&(this.gl.useProgram(i),this.current=i,this.dirty=!1)}}class Xy extends fn{getDefault(){return this.gl.TEXTURE0}set(i){(i!==this.current||this.dirty)&&(this.gl.activeTexture(i),this.current=i,this.dirty=!1)}}class qp extends fn{getDefault(){const i=this.gl;return[0,0,i.drawingBufferWidth,i.drawingBufferHeight]}set(i){const h=this.current;(i[0]!==h[0]||i[1]!==h[1]||i[2]!==h[2]||i[3]!==h[3]||this.dirty)&&(this.gl.viewport(i[0],i[1],i[2],i[3]),this.current=i,this.dirty=!1)}}class Gp extends fn{getDefault(){return null}set(i){if(i===this.current&&!this.dirty)return;const h=this.gl;h.bindFramebuffer(h.FRAMEBUFFER,i),this.current=i,this.dirty=!1}}class Zp extends fn{getDefault(){return null}set(i){if(i===this.current&&!this.dirty)return;const h=this.gl;h.bindRenderbuffer(h.RENDERBUFFER,i),this.current=i,this.dirty=!1}}class Zd extends fn{getDefault(){return null}set(i){if(i===this.current&&!this.dirty)return;const h=this.gl;h.bindTexture(h.TEXTURE_2D,i),this.current=i,this.dirty=!1}}class Yp extends fn{getDefault(){return null}set(i){if(i===this.current&&!this.dirty)return;const h=this.gl;h.bindBuffer(h.ARRAY_BUFFER,i),this.current=i,this.dirty=!1}}class lc extends fn{getDefault(){return null}set(i){const h=this.gl;h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,i),this.current=i,this.dirty=!1}}class gs extends fn{getDefault(){return null}set(i){var h;if(i===this.current&&!this.dirty)return;const m=this.gl;Vs(m)?m.bindVertexArray(i):(h=m.getExtension("OES_vertex_array_object"))===null||h===void 0||h.bindVertexArrayOES(i),this.current=i,this.dirty=!1}}class Yd extends fn{getDefault(){return 4}set(i){if(i===this.current&&!this.dirty)return;const h=this.gl;h.pixelStorei(h.UNPACK_ALIGNMENT,i),this.current=i,this.dirty=!1}}class Xd extends fn{getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;const h=this.gl;h.pixelStorei(h.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i),this.current=i,this.dirty=!1}}class Kd extends fn{getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;const h=this.gl;h.pixelStorei(h.UNPACK_FLIP_Y_WEBGL,i),this.current=i,this.dirty=!1}}class cc extends fn{constructor(i,h){super(i),this.context=i,this.parent=h}getDefault(){return null}}class Jd extends cc{setDirty(){this.dirty=!0}set(i){if(i===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const h=this.gl;h.framebufferTexture2D(h.FRAMEBUFFER,h.COLOR_ATTACHMENT0,h.TEXTURE_2D,i,0),this.current=i,this.dirty=!1}}class fo extends cc{set(i){if(i===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const h=this.gl;h.framebufferRenderbuffer(h.FRAMEBUFFER,h.DEPTH_ATTACHMENT,h.RENDERBUFFER,i),this.current=i,this.dirty=!1}}class Qd extends cc{set(i){if(i===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const h=this.gl;h.framebufferRenderbuffer(h.FRAMEBUFFER,h.DEPTH_STENCIL_ATTACHMENT,h.RENDERBUFFER,i),this.current=i,this.dirty=!1}}class Ky{constructor(i,h,m,g,_){this.context=i,this.width=h,this.height=m;const A=i.gl,M=this.framebuffer=A.createFramebuffer();if(this.colorAttachment=new Jd(i,M),g)this.depthAttachment=_?new Qd(i,M):new fo(i,M);else if(_)throw new Error("Stencil cannot be set without depth");if(A.checkFramebufferStatus(A.FRAMEBUFFER)!==A.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer is not complete")}destroy(){const i=this.context.gl,h=this.colorAttachment.get();if(h&&i.deleteTexture(h),this.depthAttachment){const m=this.depthAttachment.get();m&&i.deleteRenderbuffer(m)}i.deleteFramebuffer(this.framebuffer)}}class er{constructor(i,h,m){this.blendFunction=i,this.blendColor=h,this.mask=m}}er.Replace=[1,0],er.disabled=new er(er.Replace,c.aM.transparent,[!1,!1,!1,!1]),er.unblended=new er(er.Replace,c.aM.transparent,[!0,!0,!0,!0]),er.alphaBlended=new er([1,771],c.aM.transparent,[!0,!0,!0,!0]);class Jy{constructor(i){var h,m;if(this.gl=i,this.clearColor=new oc(this),this.clearDepth=new Hy(this),this.clearStencil=new Go(this),this.colorMask=new Wy(this),this.depthMask=new Op(this),this.stencilMask=new qy(this),this.stencilFunc=new Lp(this),this.stencilOp=new Gd(this),this.stencilTest=new Fp(this),this.depthRange=new $p(this),this.depthTest=new jp(this),this.depthFunc=new Up(this),this.blend=new po(this),this.blendFunc=new Hp(this),this.blendColor=new Gy(this),this.blendEquation=new Wp(this),this.cullFace=new Ya(this),this.cullFaceSide=new Zy(this),this.frontFace=new ac(this),this.program=new Yy(this),this.activeTexture=new Xy(this),this.viewport=new qp(this),this.bindFramebuffer=new Gp(this),this.bindRenderbuffer=new Zp(this),this.bindTexture=new Zd(this),this.bindVertexBuffer=new Yp(this),this.bindElementBuffer=new lc(this),this.bindVertexArray=new gs(this),this.pixelStoreUnpack=new Yd(this),this.pixelStoreUnpackPremultiplyAlpha=new Xd(this),this.pixelStoreUnpackFlipY=new Kd(this),this.extTextureFilterAnisotropic=i.getExtension("EXT_texture_filter_anisotropic")||i.getExtension("MOZ_EXT_texture_filter_anisotropic")||i.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=i.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=i.getParameter(i.MAX_TEXTURE_SIZE),Vs(i)){this.HALF_FLOAT=i.HALF_FLOAT;const g=i.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(h=i.RGBA16F)!==null&&h!==void 0?h:g==null?void 0:g.RGBA16F_EXT,this.RGB16F=(m=i.RGB16F)!==null&&m!==void 0?m:g==null?void 0:g.RGB16F_EXT,i.getExtension("EXT_color_buffer_float")}else{i.getExtension("EXT_color_buffer_half_float"),i.getExtension("OES_texture_half_float_linear");const g=i.getExtension("OES_texture_half_float");this.HALF_FLOAT=g==null?void 0:g.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(i,h){return new es(this,i,h)}createVertexBuffer(i,h,m){return new qd(this,i,h,m)}createRenderbuffer(i,h,m){const g=this.gl,_=g.createRenderbuffer();return this.bindRenderbuffer.set(_),g.renderbufferStorage(g.RENDERBUFFER,i,h,m),this.bindRenderbuffer.set(null),_}createFramebuffer(i,h,m,g){return new Ky(this,i,h,m,g)}clear({color:i,depth:h,stencil:m}){const g=this.gl;let _=0;i&&(_|=g.COLOR_BUFFER_BIT,this.clearColor.set(i),this.colorMask.set([!0,!0,!0,!0])),h!==void 0&&(_|=g.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(h),this.depthMask.set(!0)),m!==void 0&&(_|=g.STENCIL_BUFFER_BIT,this.clearStencil.set(m),this.stencilMask.set(255)),g.clear(_)}setCullFace(i){i.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(i.mode),this.frontFace.set(i.frontFace))}setDepthMode(i){i.func!==this.gl.ALWAYS||i.mask?(this.depthTest.set(!0),this.depthFunc.set(i.func),this.depthMask.set(i.mask),this.depthRange.set(i.range)):this.depthTest.set(!1)}setStencilMode(i){i.test.func!==this.gl.ALWAYS||i.mask?(this.stencilTest.set(!0),this.stencilMask.set(i.mask),this.stencilOp.set([i.fail,i.depthFail,i.pass]),this.stencilFunc.set({func:i.test.func,ref:i.ref,mask:i.test.mask})):this.stencilTest.set(!1)}setColorMode(i){c.aE(i.blendFunction,er.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(i.blendFunction),this.blendColor.set(i.blendColor)),this.colorMask.set(i.mask)}createVertexArray(){var i;return Vs(this.gl)?this.gl.createVertexArray():(i=this.gl.getExtension("OES_vertex_array_object"))===null||i===void 0?void 0:i.createVertexArrayOES()}deleteVertexArray(i){var h;return Vs(this.gl)?this.gl.deleteVertexArray(i):(h=this.gl.getExtension("OES_vertex_array_object"))===null||h===void 0?void 0:h.deleteVertexArrayOES(i)}unbindVAO(){this.bindVertexArray.set(null)}}class Ht{constructor(i,h,m){this.func=i,this.mask=h,this.range=m}}Ht.ReadOnly=!1,Ht.ReadWrite=!0,Ht.disabled=new Ht(519,Ht.ReadOnly,[0,1]);const dc=7680;class Pn{constructor(i,h,m,g,_,A){this.test=i,this.ref=h,this.mask=m,this.fail=g,this.depthFail=_,this.pass=A}}Pn.disabled=new Pn({func:519,mask:0},0,0,dc,dc,dc);class Cn{constructor(i,h,m){this.enable=i,this.mode=h,this.frontFace=m}}let mo;function Xa(x,i,h,m,g){const _=x.context,A=_.gl,M=x.useProgram("collisionBox"),P=[];let V=0,O=0;for(let ce=0;ce<m.length;ce++){const he=m[ce],te=i.getTile(he).getBucket(h);if(!te)continue;const ge=g?te.textCollisionBox:te.iconCollisionBox,_e=te.collisionCircleArray;if(_e.length>0){const we=c.H();c.aQ(we,te.placementInvProjMatrix,x.transform.glCoordMatrix),c.aQ(we,we,te.placementViewportMatrix),P.push({circleArray:_e,circleOffset:O,transform:he.posMatrix,invTransform:we,coord:he}),V+=_e.length/4,O=V}ge&&M.draw(_,A.LINES,Ht.disabled,Pn.disabled,x.colorModeForRenderPass(),Cn.disabled,{u_matrix:he.posMatrix,u_pixel_extrude_scale:[1/(L=x.transform).width,1/L.height]},x.style.map.terrain&&x.style.map.terrain.getTerrainData(he),h.id,ge.layoutVertexBuffer,ge.indexBuffer,ge.segments,null,x.transform.zoom,null,null,ge.collisionVertexBuffer)}var L;if(!g||!P.length)return;const G=x.useProgram("collisionCircle"),K=new c.aR;K.resize(4*V),K._trim();let ee=0;for(const ce of P)for(let he=0;he<ce.circleArray.length/4;he++){const te=4*he,ge=ce.circleArray[te+0],_e=ce.circleArray[te+1],we=ce.circleArray[te+2],Ne=ce.circleArray[te+3];K.emplace(ee++,ge,_e,we,Ne,0),K.emplace(ee++,ge,_e,we,Ne,1),K.emplace(ee++,ge,_e,we,Ne,2),K.emplace(ee++,ge,_e,we,Ne,3)}(!mo||mo.length<2*V)&&(mo=function(ce){const he=2*ce,te=new c.aT;te.resize(he),te._trim();for(let ge=0;ge<he;ge++){const _e=6*ge;te.uint16[_e+0]=4*ge+0,te.uint16[_e+1]=4*ge+1,te.uint16[_e+2]=4*ge+2,te.uint16[_e+3]=4*ge+2,te.uint16[_e+4]=4*ge+3,te.uint16[_e+5]=4*ge+0}return te}(V));const ie=_.createIndexBuffer(mo,!0),ae=_.createVertexBuffer(K,c.aS.members,!0);for(const ce of P){const he=uo(ce.transform,ce.invTransform,x.transform);G.draw(_,A.TRIANGLES,Ht.disabled,Pn.disabled,x.colorModeForRenderPass(),Cn.disabled,he,x.style.map.terrain&&x.style.map.terrain.getTerrainData(ce.coord),h.id,ae,ie,c.a0.simpleSegment(0,2*ce.circleOffset,ce.circleArray.length,ce.circleArray.length/2),null,x.transform.zoom,null,null,null)}ae.destroy(),ie.destroy()}Cn.disabled=new Cn(!1,1029,2305),Cn.backCCW=new Cn(!0,1029,2305);const Ka=c.an(new Float32Array(16));function eu(x,i,h,m,g,_){const{horizontalAlign:A,verticalAlign:M}=c.au(x);return new c.P((-(A-.5)*i/g+m[0])*_,(-(M-.5)*h/g+m[1])*_)}function go(x,i,h,m,g,_){const A=i.tileAnchorPoint.add(new c.P(i.translation[0],i.translation[1]));if(i.pitchWithMap){let M=m.mult(_);h||(M=M.rotate(-g));const P=A.add(M);return se(P.x,P.y,i.labelPlaneMatrix,i.getElevation).point}if(h){const M=Me(i.tileAnchorPoint.x+1,i.tileAnchorPoint.y,i).point.sub(x),P=Math.atan(M.y/M.x)+(M.x<0?Math.PI:0);return x.add(m.rotate(P))}return x.add(m)}function Zo(x,i,h,m,g,_,A,M,P,V,O,L,G,K){const ee=x.text.placedSymbolArray,ie=x.text.dynamicLayoutVertexArray,ae=x.icon.dynamicLayoutVertexArray,ce={};ie.clear();for(let he=0;he<ee.length;he++){const te=ee.get(he),ge=te.hidden||!te.crossTileID||x.allowVerticalPlacement&&!te.placedOrientation?null:m[te.crossTileID];if(ge){const _e=new c.P(te.anchorX,te.anchorY),we={getElevation:K,width:g.width,height:g.height,labelPlaneMatrix:_,pitchWithMap:h,projection:O,tileAnchorPoint:_e,translation:L,unwrappedTileID:G},Ne=h?se(_e.x,_e.y,A,K):Me(_e.x,_e.y,we),$e=H(g.cameraToCenterDistance,Ne.signedDistanceFromCamera);let Qe=c.ai(x.textSizeData,P,te)*$e/c.ap;h&&(Qe*=x.tilePixelRatio/M);const{width:at,height:Ge,anchor:qe,textOffset:mt,textBoxScale:Rt}=ge,Ye=eu(qe,at,Ge,mt,Rt,Qe),it=O.getPitchedTextCorrection(g,_e.add(new c.P(L[0],L[1])),G),Mt=go(Ne.point,we,i,Ye,g.angle,it),Ln=x.allowVerticalPlacement&&te.placedOrientation===c.ah.vertical?Math.PI/2:0;for(let Lt=0;Lt<te.numGlyphs;Lt++)c.aj(ie,Mt,Ln);V&&te.associatedIconIndex>=0&&(ce[te.associatedIconIndex]={shiftedAnchor:Mt,angle:Ln})}else kt(te.numGlyphs,ie)}if(V){ae.clear();const he=x.icon.placedSymbolArray;for(let te=0;te<he.length;te++){const ge=he.get(te);if(ge.hidden)kt(ge.numGlyphs,ae);else{const _e=ce[te];if(_e)for(let we=0;we<ge.numGlyphs;we++)c.aj(ae,_e.shiftedAnchor,_e.angle);else kt(ge.numGlyphs,ae)}}x.icon.dynamicLayoutVertexBuffer.updateData(ae)}x.text.dynamicLayoutVertexBuffer.updateData(ie)}function bi(x,i,h){return h.iconsInText&&i?"symbolTextAndIcon":x?"symbolSDF":"symbolIcon"}function tu(x,i,h,m,g,_,A,M,P,V,O,L){const G=x.context,K=G.gl,ee=x.transform,ie=lo(),ae=M==="map",ce=P==="map",he=M!=="viewport"&&h.layout.get("symbol-placement")!=="point",te=ae&&!ce&&!he,ge=!ce&&he,_e=!h.layout.get("symbol-sort-key").isConstant();let we=!1;const Ne=x.depthModeForSublayer(0,Ht.ReadOnly),$e=h._unevaluatedLayout.hasValue("text-variable-anchor")||h._unevaluatedLayout.hasValue("text-variable-anchor-offset"),Qe=[],at=ie.getCircleRadiusCorrection(ee);for(const Ge of m){const qe=i.getTile(Ge),mt=qe.getBucket(h);if(!mt)continue;const Rt=g?mt.text:mt.icon;if(!Rt||!Rt.segments.get().length||!Rt.hasVisibleVertices)continue;const Ye=Rt.programConfigurations.get(h.id),it=g||mt.sdfIcons,Mt=g?mt.textSizeData:mt.iconSizeData,Ln=ce||ee.pitch!==0,Lt=x.useProgram(bi(it,g,mt),Ye),Yt=c.ag(Mt,ee.zoom),Fn=x.style.map.terrain&&x.style.map.terrain.getTerrainData(Ge);let Tr,Li,$n,Gr,Br=[0,0],Ar=null;if(g)Li=qe.glyphAtlasTexture,$n=K.LINEAR,Tr=qe.glyphAtlasTexture.size,mt.iconsInText&&(Br=qe.imageAtlasTexture.size,Ar=qe.imageAtlasTexture,Gr=Ln||x.options.rotating||x.options.zooming||Mt.kind==="composite"||Mt.kind==="camera"?K.LINEAR:K.NEAREST);else{const Kt=h.layout.get("icon-size").constantOr(0)!==1||mt.iconsNeedLinear;Li=qe.imageAtlasTexture,$n=it||x.options.rotating||x.options.zooming||Kt||Ln?K.LINEAR:K.NEAREST,Tr=qe.imageAtlasTexture.size}const Vr=Zt(qe,1,x.transform.zoom),rs=ge?Ge.posMatrix:Ka,ca=Ns(rs,ce,ae,x.transform,Vr),Dc=Qi(rs,ce,ae,x.transform,Vr),da=Qi(Ge.posMatrix,ce,ae,x.transform,Vr),wi=ie.translatePosition(x.transform,qe,_,A),Mc=$e&&mt.hasTextData(),Su=h.layout.get("icon-text-fit")!=="none"&&Mc&&mt.hasIconData();if(he){const Kt=x.style.map.terrain?(ua,ha)=>x.style.map.terrain.getElevation(Ge,ua,ha):null,vo=h.layout.get("text-rotation-alignment")==="map";X(mt,Ge.posMatrix,x,g,ca,da,ce,V,vo,ie,Ge.toUnwrapped(),ee.width,ee.height,wi,Kt)}const ki=Ge.posMatrix,Ei=g&&$e||Su,zs=he||Ei?Ka:ca,Fi=Dc,wr=it&&h.paint.get(g?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let Dr;Dr=it?mt.iconsInText?Ud(Mt.kind,Yt,te,ce,he,Ei,x,ki,zs,Fi,wi,Tr,Br,at):Za(Mt.kind,Yt,te,ce,he,Ei,x,ki,zs,Fi,wi,g,Tr,!0,at):zp(Mt.kind,Yt,te,ce,he,Ei,x,ki,zs,Fi,wi,g,Tr,at);const li={program:Lt,buffers:Rt,uniformValues:Dr,atlasTexture:Li,atlasTextureIcon:Ar,atlasInterpolation:$n,atlasInterpolationIcon:Gr,isSDF:it,hasHalo:wr};if(_e&&mt.canOverlap){we=!0;const Kt=Rt.segments.get();for(const vo of Kt)Qe.push({segments:new c.a0([vo]),sortKey:vo.sortKey,state:li,terrainData:Fn})}else Qe.push({segments:Rt.segments,sortKey:0,state:li,terrainData:Fn})}we&&Qe.sort((Ge,qe)=>Ge.sortKey-qe.sortKey);for(const Ge of Qe){const qe=Ge.state;if(G.activeTexture.set(K.TEXTURE0),qe.atlasTexture.bind(qe.atlasInterpolation,K.CLAMP_TO_EDGE),qe.atlasTextureIcon&&(G.activeTexture.set(K.TEXTURE1),qe.atlasTextureIcon&&qe.atlasTextureIcon.bind(qe.atlasInterpolationIcon,K.CLAMP_TO_EDGE)),qe.isSDF){const mt=qe.uniformValues;qe.hasHalo&&(mt.u_is_halo=1,nu(qe.buffers,Ge.segments,h,x,qe.program,Ne,O,L,mt,Ge.terrainData)),mt.u_is_halo=0}nu(qe.buffers,Ge.segments,h,x,qe.program,Ne,O,L,qe.uniformValues,Ge.terrainData)}}function nu(x,i,h,m,g,_,A,M,P,V){const O=m.context;g.draw(O,O.gl.TRIANGLES,_,A,M,Cn.disabled,P,V,h.id,x.layoutVertexBuffer,x.indexBuffer,i,h.paint,m.transform.zoom,x.programConfigurations.get(h.id),x.dynamicLayoutVertexBuffer,x.opacityVertexBuffer)}function ru(x,i,h,m){const g=x.context,_=g.gl,A=Pn.disabled,M=new er([_.ONE,_.ONE],c.aM.transparent,[!0,!0,!0,!0]),P=i.getBucket(h);if(!P)return;const V=m.key;let O=h.heatmapFbos.get(V);O||(O=Ja(g,i.tileSize,i.tileSize),h.heatmapFbos.set(V,O)),g.bindFramebuffer.set(O.framebuffer),g.viewport.set([0,0,i.tileSize,i.tileSize]),g.clear({color:c.aM.transparent});const L=P.programConfigurations.get(h.id),G=x.useProgram("heatmap",L),K=x.style.map.terrain.getTerrainData(m);G.draw(g,_.TRIANGLES,Ht.disabled,A,M,Cn.disabled,qr(m.posMatrix,i,x.transform.zoom,h.paint.get("heatmap-intensity")),K,h.id,P.layoutVertexBuffer,P.indexBuffer,P.segments,h.paint,x.transform.zoom,L)}function yo(x,i,h){const m=x.context,g=m.gl;m.setColorMode(x.colorModeForRenderPass());const _=Qa(m,i),A=h.key,M=i.heatmapFbos.get(A);M&&(m.activeTexture.set(g.TEXTURE0),g.bindTexture(g.TEXTURE_2D,M.colorAttachment.get()),m.activeTexture.set(g.TEXTURE1),_.bind(g.LINEAR,g.CLAMP_TO_EDGE),x.useProgram("heatmapTexture").draw(m,g.TRIANGLES,Ht.disabled,Pn.disabled,x.colorModeForRenderPass(),Cn.disabled,nc(x,i,0,1),null,i.id,x.rasterBoundsBuffer,x.quadTriangleIndexBuffer,x.rasterBoundsSegments,i.paint,x.transform.zoom),M.destroy(),i.heatmapFbos.delete(A))}function Ja(x,i,h){var m,g;const _=x.gl,A=_.createTexture();_.bindTexture(_.TEXTURE_2D,A),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_WRAP_S,_.CLAMP_TO_EDGE),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_WRAP_T,_.CLAMP_TO_EDGE),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_MIN_FILTER,_.LINEAR),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_MAG_FILTER,_.LINEAR);const M=(m=x.HALF_FLOAT)!==null&&m!==void 0?m:_.UNSIGNED_BYTE,P=(g=x.RGBA16F)!==null&&g!==void 0?g:_.RGBA;_.texImage2D(_.TEXTURE_2D,0,P,i,h,0,_.RGBA,M,null);const V=x.createFramebuffer(i,h,!1,!1);return V.colorAttachment.set(A),V}function Qa(x,i){return i.colorRampTexture||(i.colorRampTexture=new tt(x,i.colorRamp,x.gl.RGBA)),i.colorRampTexture}function Yo(x,i,h,m,g){if(!h||!m||!m.imageAtlas)return;const _=m.imageAtlas.patternPositions;let A=_[h.to.toString()],M=_[h.from.toString()];if(!A&&M&&(A=M),!M&&A&&(M=A),!A||!M){const P=g.getPaintProperty(i);A=_[P],M=_[P]}A&&M&&x.setConstantPatternPositions(A,M)}function el(x,i,h,m,g,_,A){const M=x.context.gl,P="fill-pattern",V=h.paint.get(P),O=V&&V.constantOr(1),L=h.getCrossfadeParameters();let G,K,ee,ie,ae;A?(K=O&&!h.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",G=M.LINES):(K=O?"fillPattern":"fill",G=M.TRIANGLES);const ce=V.constantOr(null);for(const he of m){const te=i.getTile(he);if(O&&!te.patternsLoaded())continue;const ge=te.getBucket(h);if(!ge)continue;const _e=ge.programConfigurations.get(h.id),we=x.useProgram(K,_e),Ne=x.style.map.terrain&&x.style.map.terrain.getTerrainData(he);O&&(x.context.activeTexture.set(M.TEXTURE0),te.imageAtlasTexture.bind(M.LINEAR,M.CLAMP_TO_EDGE),_e.updatePaintBuffers(L)),Yo(_e,P,ce,te,h);const $e=Ne?he:null,Qe=x.translatePosMatrix($e?$e.posMatrix:he.posMatrix,te,h.paint.get("fill-translate"),h.paint.get("fill-translate-anchor"));if(A){ie=ge.indexBuffer2,ae=ge.segments2;const at=[M.drawingBufferWidth,M.drawingBufferHeight];ee=K==="fillOutlinePattern"&&O?Rp(Qe,x,L,te,at):Oy(Qe,at)}else ie=ge.indexBuffer,ae=ge.segments,ee=O?Pp(Qe,x,L,te):Wo(Qe);we.draw(x.context,G,g,x.stencilModeForClipping(he),_,Cn.disabled,ee,Ne,h.id,ge.layoutVertexBuffer,ie,ae,h.paint,x.transform.zoom,_e)}}function uc(x,i,h,m,g,_,A){const M=x.context,P=M.gl,V="fill-extrusion-pattern",O=h.paint.get(V),L=O.constantOr(1),G=h.getCrossfadeParameters(),K=h.paint.get("fill-extrusion-opacity"),ee=O.constantOr(null);for(const ie of m){const ae=i.getTile(ie),ce=ae.getBucket(h);if(!ce)continue;const he=x.style.map.terrain&&x.style.map.terrain.getTerrainData(ie),te=ce.programConfigurations.get(h.id),ge=x.useProgram(L?"fillExtrusionPattern":"fillExtrusion",te);L&&(x.context.activeTexture.set(P.TEXTURE0),ae.imageAtlasTexture.bind(P.LINEAR,P.CLAMP_TO_EDGE),te.updatePaintBuffers(G)),Yo(te,V,ee,ae,h);const _e=x.translatePosMatrix(ie.posMatrix,ae,h.paint.get("fill-extrusion-translate"),h.paint.get("fill-extrusion-translate-anchor")),we=h.paint.get("fill-extrusion-vertical-gradient"),Ne=L?tc(_e,x,we,K,ie,G,ae):qa(_e,x,we,K);ge.draw(M,M.gl.TRIANGLES,g,_,A,Cn.backCCW,Ne,he,h.id,ce.layoutVertexBuffer,ce.indexBuffer,ce.segments,h.paint,x.transform.zoom,te,x.style.map.terrain&&ce.centroidVertexBuffer)}}function Xo(x,i,h,m,g,_,A){const M=x.context,P=M.gl,V=h.fbo;if(!V)return;const O=x.useProgram("hillshade"),L=x.style.map.terrain&&x.style.map.terrain.getTerrainData(i);M.activeTexture.set(P.TEXTURE0),P.bindTexture(P.TEXTURE_2D,V.colorAttachment.get()),O.draw(M,P.TRIANGLES,g,_,A,Cn.disabled,((G,K,ee,ie)=>{const ae=ee.paint.get("hillshade-shadow-color"),ce=ee.paint.get("hillshade-highlight-color"),he=ee.paint.get("hillshade-accent-color");let te=ee.paint.get("hillshade-illumination-direction")*(Math.PI/180);ee.paint.get("hillshade-illumination-anchor")==="viewport"&&(te-=G.transform.angle);const ge=!G.options.moving;return{u_matrix:ie?ie.posMatrix:G.transform.calculatePosMatrix(K.tileID.toUnwrapped(),ge),u_image:0,u_latrange:rc(0,K.tileID),u_light:[ee.paint.get("hillshade-exaggeration"),te],u_shadow:ae,u_highlight:ce,u_accent:he}})(x,h,m,L?i:null),L,m.id,x.rasterBoundsBuffer,x.quadTriangleIndexBuffer,x.rasterBoundsSegments)}function Ko(x,i,h,m,g,_){const A=x.context,M=A.gl,P=i.dem;if(P&&P.data){const V=P.dim,O=P.stride,L=P.getPixels();if(A.activeTexture.set(M.TEXTURE1),A.pixelStoreUnpackPremultiplyAlpha.set(!1),i.demTexture=i.demTexture||x.getTileTexture(O),i.demTexture){const K=i.demTexture;K.update(L,{premultiply:!1}),K.bind(M.NEAREST,M.CLAMP_TO_EDGE)}else i.demTexture=new tt(A,L,M.RGBA,{premultiply:!1}),i.demTexture.bind(M.NEAREST,M.CLAMP_TO_EDGE);A.activeTexture.set(M.TEXTURE0);let G=i.fbo;if(!G){const K=new tt(A,{width:V,height:V,data:null},M.RGBA);K.bind(M.LINEAR,M.CLAMP_TO_EDGE),G=i.fbo=A.createFramebuffer(V,V,!0,!1),G.colorAttachment.set(K.texture)}A.bindFramebuffer.set(G.framebuffer),A.viewport.set([0,0,V,V]),x.useProgram("hillshadePrepare").draw(A,M.TRIANGLES,m,g,_,Cn.disabled,((K,ee)=>{const ie=ee.stride,ae=c.H();return c.aP(ae,0,c.X,-c.X,0,0,1),c.J(ae,ae,[0,-c.X,0]),{u_matrix:ae,u_image:1,u_dimension:[ie,ie],u_zoom:K.overscaledZ,u_unpack:ee.getUnpackVector()}})(i.tileID,P),null,h.id,x.rasterBoundsBuffer,x.quadTriangleIndexBuffer,x.rasterBoundsSegments),i.needsHillshadePrepare=!1}}function Xp(x,i,h,m,g,_){const A=m.paint.get("raster-fade-duration");if(!_&&A>0){const M=C.now(),P=(M-x.timeAdded)/A,V=i?(M-i.timeAdded)/A:-1,O=h.getSource(),L=g.coveringZoomLevel({tileSize:O.tileSize,roundZoom:O.roundZoom}),G=!i||Math.abs(i.tileID.overscaledZ-L)>Math.abs(x.tileID.overscaledZ-L),K=G&&x.refreshedUponExpiration?1:c.ac(G?P:1-V,0,1);return x.refreshedUponExpiration&&P>=1&&(x.refreshedUponExpiration=!1),i?{opacity:1,mix:1-K}:{opacity:K,mix:0}}return{opacity:1,mix:0}}const iu=new c.aM(1,0,0,1),rn=new c.aM(0,1,0,1),hc=new c.aM(0,0,1,1),Qy=new c.aM(1,0,1,1),Kp=new c.aM(0,1,1,1);function Jo(x,i,h,m){pc(x,0,i+h/2,x.transform.width,h,m)}function Jp(x,i,h,m){pc(x,i-h/2,0,h,x.transform.height,m)}function pc(x,i,h,m,g,_){const A=x.context,M=A.gl;M.enable(M.SCISSOR_TEST),M.scissor(i*x.pixelRatio,h*x.pixelRatio,m*x.pixelRatio,g*x.pixelRatio),A.clear({color:_}),M.disable(M.SCISSOR_TEST)}function Qp(x,i,h){const m=x.context,g=m.gl,_=h.posMatrix,A=x.useProgram("debug"),M=Ht.disabled,P=Pn.disabled,V=x.colorModeForRenderPass(),O="$debug",L=x.style.map.terrain&&x.style.map.terrain.getTerrainData(h);m.activeTexture.set(g.TEXTURE0);const G=i.getTileByID(h.key).latestRawTileData,K=Math.floor((G&&G.byteLength||0)/1024),ee=i.getTile(h).tileSize,ie=512/Math.min(ee,512)*(h.overscaledZ/x.transform.zoom)*.5;let ae=h.canonical.toString();h.overscaledZ!==h.canonical.z&&(ae+=` => ${h.overscaledZ}`),function(ce,he){ce.initDebugOverlayCanvas();const te=ce.debugOverlayCanvas,ge=ce.context.gl,_e=ce.debugOverlayCanvas.getContext("2d");_e.clearRect(0,0,te.width,te.height),_e.shadowColor="white",_e.shadowBlur=2,_e.lineWidth=1.5,_e.strokeStyle="white",_e.textBaseline="top",_e.font="bold 36px Open Sans, sans-serif",_e.fillText(he,5,5),_e.strokeText(he,5,5),ce.debugOverlayTexture.update(te),ce.debugOverlayTexture.bind(ge.LINEAR,ge.CLAMP_TO_EDGE)}(x,`${ae} ${K}kB`),A.draw(m,g.TRIANGLES,M,P,er.alphaBlended,Cn.disabled,Ga(_,c.aM.transparent,ie),null,O,x.debugBuffer,x.quadTriangleIndexBuffer,x.debugSegments),A.draw(m,g.LINE_STRIP,M,P,V,Cn.disabled,Ga(_,c.aM.red),L,O,x.debugBuffer,x.tileBorderIndexBuffer,x.debugSegments)}function ef(x,i,h){const m=x.context,g=m.gl,_=x.colorModeForRenderPass(),A=new Ht(g.LEQUAL,Ht.ReadWrite,x.depthRangeFor3D),M=x.useProgram("terrain"),P=i.getTerrainMesh();m.bindFramebuffer.set(null),m.viewport.set([0,0,x.width,x.height]);for(const V of h){const O=x.renderToTexture.getTexture(V),L=i.getTerrainData(V.tileID);m.activeTexture.set(g.TEXTURE0),g.bindTexture(g.TEXTURE_2D,O.texture);const G=x.transform.calculatePosMatrix(V.tileID.toUnwrapped()),K=i.getMeshFrameDelta(x.transform.zoom),ee=x.transform.calculateFogMatrix(V.tileID.toUnwrapped()),ie=$d(G,K,ee,x.style.sky,x.transform.pitch);M.draw(m,g.TRIANGLES,A,Pn.disabled,_,Cn.backCCW,ie,L,"terrain",P.vertexBuffer,P.indexBuffer,P.segments)}}class fc{constructor(i,h,m){this.vertexBuffer=i,this.indexBuffer=h,this.segments=m}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}class mc{constructor(i,h){this.context=new Jy(i),this.transform=h,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:c.an(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=At.maxUnderzooming+At.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Ld}resize(i,h,m){if(this.width=Math.floor(i*m),this.height=Math.floor(h*m),this.pixelRatio=m,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const g of this.style._order)this.style._layers[g].resize()}setup(){const i=this.context,h=new c.aX;h.emplaceBack(0,0),h.emplaceBack(c.X,0),h.emplaceBack(0,c.X),h.emplaceBack(c.X,c.X),this.tileExtentBuffer=i.createVertexBuffer(h,co.members),this.tileExtentSegments=c.a0.simpleSegment(0,0,4,2);const m=new c.aX;m.emplaceBack(0,0),m.emplaceBack(c.X,0),m.emplaceBack(0,c.X),m.emplaceBack(c.X,c.X),this.debugBuffer=i.createVertexBuffer(m,co.members),this.debugSegments=c.a0.simpleSegment(0,0,4,5);const g=new c.$;g.emplaceBack(0,0,0,0),g.emplaceBack(c.X,0,c.X,0),g.emplaceBack(0,c.X,0,c.X),g.emplaceBack(c.X,c.X,c.X,c.X),this.rasterBoundsBuffer=i.createVertexBuffer(g,ut.members),this.rasterBoundsSegments=c.a0.simpleSegment(0,0,4,2);const _=new c.aX;_.emplaceBack(0,0),_.emplaceBack(1,0),_.emplaceBack(0,1),_.emplaceBack(1,1),this.viewportBuffer=i.createVertexBuffer(_,co.members),this.viewportSegments=c.a0.simpleSegment(0,0,4,2);const A=new c.aZ;A.emplaceBack(0),A.emplaceBack(1),A.emplaceBack(3),A.emplaceBack(2),A.emplaceBack(0),this.tileBorderIndexBuffer=i.createIndexBuffer(A);const M=new c.aY;M.emplaceBack(0,1,2),M.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=i.createIndexBuffer(M);const P=this.context.gl;this.stencilClearMode=new Pn({func:P.ALWAYS,mask:0},0,255,P.ZERO,P.ZERO,P.ZERO)}clearStencil(){const i=this.context,h=i.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const m=c.H();c.aP(m,0,this.width,this.height,0,0,1),c.K(m,m,[h.drawingBufferWidth,h.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(i,h.TRIANGLES,Ht.disabled,this.stencilClearMode,er.disabled,Cn.disabled,Wr(m),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(i,h){if(this.currentStencilSource===i.source||!i.isTileClipped()||!h||!h.length)return;this.currentStencilSource=i.source;const m=this.context,g=m.gl;this.nextStencilID+h.length>256&&this.clearStencil(),m.setColorMode(er.disabled),m.setDepthMode(Ht.disabled);const _=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const A of h){const M=this._tileClippingMaskIDs[A.key]=this.nextStencilID++,P=this.style.map.terrain&&this.style.map.terrain.getTerrainData(A);_.draw(m,g.TRIANGLES,Ht.disabled,new Pn({func:g.ALWAYS,mask:0},M,255,g.KEEP,g.KEEP,g.REPLACE),er.disabled,Cn.disabled,Wr(A.posMatrix),P,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const i=this.nextStencilID++,h=this.context.gl;return new Pn({func:h.NOTEQUAL,mask:255},i,255,h.KEEP,h.KEEP,h.REPLACE)}stencilModeForClipping(i){const h=this.context.gl;return new Pn({func:h.EQUAL,mask:255},this._tileClippingMaskIDs[i.key],0,h.KEEP,h.KEEP,h.REPLACE)}stencilConfigForOverlap(i){const h=this.context.gl,m=i.sort((A,M)=>M.overscaledZ-A.overscaledZ),g=m[m.length-1].overscaledZ,_=m[0].overscaledZ-g+1;if(_>1){this.currentStencilSource=void 0,this.nextStencilID+_>256&&this.clearStencil();const A={};for(let M=0;M<_;M++)A[M+g]=new Pn({func:h.GEQUAL,mask:255},M+this.nextStencilID,255,h.KEEP,h.KEEP,h.REPLACE);return this.nextStencilID+=_,[A,m]}return[{[g]:Pn.disabled},m]}colorModeForRenderPass(){const i=this.context.gl;return this._showOverdrawInspector?new er([i.CONSTANT_COLOR,i.ONE],new c.aM(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?er.unblended:er.alphaBlended}depthModeForSublayer(i,h,m){if(!this.opaquePassEnabledForLayer())return Ht.disabled;const g=1-((1+this.currentLayer)*this.numSublayers+i)*this.depthEpsilon;return new Ht(m||this.context.gl.LEQUAL,h,[g,g])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(i,h){this.style=i,this.options=h,this.lineAtlas=i.lineAtlas,this.imageManager=i.imageManager,this.glyphManager=i.glyphManager,this.symbolFadeChange=i.placement.symbolFadeChange(C.now()),this.imageManager.beginFrame();const m=this.style._order,g=this.style.sourceCaches,_={},A={},M={};for(const P in g){const V=g[P];V.used&&V.prepare(this.context),_[P]=V.getVisibleCoordinates(),A[P]=_[P].slice().reverse(),M[P]=V.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let P=0;P<m.length;P++)if(this.style._layers[m[P]].is3D()){this.opaquePassCutoff=P;break}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const P of m){const V=this.style._layers[P];if(!V.hasOffscreenPass()||V.isHidden(this.transform.zoom))continue;const O=A[V.source];(V.type==="custom"||O.length)&&this.renderLayer(this,g[V.source],V,O)}if(this.context.bindFramebuffer.set(null),this.context.clear({color:h.showOverdrawInspector?c.aM.black:c.aM.transparent,depth:1}),this.clearStencil(),this.style.sky&&function(P,V){const O=P.context,L=O.gl,G=((ce,he,te)=>({u_sky_color:ce.properties.get("sky-color"),u_horizon_color:ce.properties.get("horizon-color"),u_horizon:(he.height/2+he.getHorizon())*te,u_sky_horizon_blend:ce.properties.get("sky-horizon-blend")*he.height/2*te}))(V,P.style.map.transform,P.pixelRatio),K=new Ht(L.LEQUAL,Ht.ReadWrite,[0,1]),ee=Pn.disabled,ie=P.colorModeForRenderPass(),ae=P.useProgram("sky");if(!V.mesh){const ce=new c.aX;ce.emplaceBack(-1,-1),ce.emplaceBack(1,-1),ce.emplaceBack(1,1),ce.emplaceBack(-1,1);const he=new c.aY;he.emplaceBack(0,1,2),he.emplaceBack(0,2,3),V.mesh=new fc(O.createVertexBuffer(ce,co.members),O.createIndexBuffer(he),c.a0.simpleSegment(0,0,ce.length,he.length))}ae.draw(O,L.TRIANGLES,K,ee,ie,Cn.disabled,G,void 0,"sky",V.mesh.vertexBuffer,V.mesh.indexBuffer,V.mesh.segments)}(this,this.style.sky),this._showOverdrawInspector=h.showOverdrawInspector,this.depthRangeFor3D=[0,1-(i._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=m.length-1;this.currentLayer>=0;this.currentLayer--){const P=this.style._layers[m[this.currentLayer]],V=g[P.source],O=_[P.source];this._renderTileClippingMasks(P,O),this.renderLayer(this,V,P,O)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<m.length;this.currentLayer++){const P=this.style._layers[m[this.currentLayer]],V=g[P.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(P))continue;const O=(P.type==="symbol"?M:A)[P.source];this._renderTileClippingMasks(P,_[P.source]),this.renderLayer(this,V,P,O)}if(this.options.showTileBoundaries){const P=function(V,O){let L=null;const G=Object.values(V._layers).flatMap(ae=>ae.source&&!ae.isHidden(O)?[V.sourceCaches[ae.source]]:[]),K=G.filter(ae=>ae.getSource().type==="vector"),ee=G.filter(ae=>ae.getSource().type!=="vector"),ie=ae=>{(!L||L.getSource().maxzoom<ae.getSource().maxzoom)&&(L=ae)};return K.forEach(ae=>ie(ae)),L||ee.forEach(ae=>ie(ae)),L}(this.style,this.transform.zoom);P&&function(V,O,L){for(let G=0;G<L.length;G++)Qp(V,O,L[G])}(this,P,P.getVisibleCoordinates())}this.options.showPadding&&function(P){const V=P.transform.padding;Jo(P,P.transform.height-(V.top||0),3,iu),Jo(P,V.bottom||0,3,rn),Jp(P,V.left||0,3,hc),Jp(P,P.transform.width-(V.right||0),3,Qy);const O=P.transform.centerPoint;(function(L,G,K,ee){pc(L,G-1,K-10,2,20,ee),pc(L,G-10,K-1,20,2,ee)})(P,O.x,P.transform.height-O.y,Kp)}(this),this.context.setDefault()}maybeDrawDepthAndCoords(i){if(!this.style||!this.style.map||!this.style.map.terrain)return;const h=this.terrainFacilitator.matrix,m=this.transform.modelViewProjectionMatrix;let g=this.terrainFacilitator.dirty;g||(g=i?!c.a_(h,m):!c.a$(h,m)),g||(g=this.style.map.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime).length>0),g&&(c.b0(h,m),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(_,A){const M=_.context,P=M.gl,V=er.unblended,O=new Ht(P.LEQUAL,Ht.ReadWrite,[0,1]),L=A.getTerrainMesh(),G=A.sourceCache.getRenderableTiles(),K=_.useProgram("terrainDepth");M.bindFramebuffer.set(A.getFramebuffer("depth").framebuffer),M.viewport.set([0,0,_.width/devicePixelRatio,_.height/devicePixelRatio]),M.clear({color:c.aM.transparent,depth:1});for(const ee of G){const ie=A.getTerrainData(ee.tileID),ae={u_matrix:_.transform.calculatePosMatrix(ee.tileID.toUnwrapped()),u_ele_delta:A.getMeshFrameDelta(_.transform.zoom)};K.draw(M,P.TRIANGLES,O,Pn.disabled,V,Cn.backCCW,ae,ie,"terrain",L.vertexBuffer,L.indexBuffer,L.segments)}M.bindFramebuffer.set(null),M.viewport.set([0,0,_.width,_.height])}(this,this.style.map.terrain),function(_,A){const M=_.context,P=M.gl,V=er.unblended,O=new Ht(P.LEQUAL,Ht.ReadWrite,[0,1]),L=A.getTerrainMesh(),G=A.getCoordsTexture(),K=A.sourceCache.getRenderableTiles(),ee=_.useProgram("terrainCoords");M.bindFramebuffer.set(A.getFramebuffer("coords").framebuffer),M.viewport.set([0,0,_.width/devicePixelRatio,_.height/devicePixelRatio]),M.clear({color:c.aM.transparent,depth:1}),A.coordsIndex=[];for(const ie of K){const ae=A.getTerrainData(ie.tileID);M.activeTexture.set(P.TEXTURE0),P.bindTexture(P.TEXTURE_2D,G.texture);const ce={u_matrix:_.transform.calculatePosMatrix(ie.tileID.toUnwrapped()),u_terrain_coords_id:(255-A.coordsIndex.length)/255,u_texture:0,u_ele_delta:A.getMeshFrameDelta(_.transform.zoom)};ee.draw(M,P.TRIANGLES,O,Pn.disabled,V,Cn.backCCW,ce,ae,"terrain",L.vertexBuffer,L.indexBuffer,L.segments),A.coordsIndex.push(ie.tileID.key)}M.bindFramebuffer.set(null),M.viewport.set([0,0,_.width,_.height])}(this,this.style.map.terrain))}renderLayer(i,h,m,g){if(!m.isHidden(this.transform.zoom)&&(m.type==="background"||m.type==="custom"||(g||[]).length))switch(this.id=m.id,m.type){case"symbol":(function(_,A,M,P,V){if(_.renderPass!=="translucent")return;const O=Pn.disabled,L=_.colorModeForRenderPass();(M._unevaluatedLayout.hasValue("text-variable-anchor")||M._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(G,K,ee,ie,ae,ce,he,te,ge){const _e=K.transform,we=lo(),Ne=ae==="map",$e=ce==="map";for(const Qe of G){const at=ie.getTile(Qe),Ge=at.getBucket(ee);if(!Ge||!Ge.text||!Ge.text.segments.get().length)continue;const qe=c.ag(Ge.textSizeData,_e.zoom),mt=Zt(at,1,K.transform.zoom),Rt=Ns(Qe.posMatrix,$e,Ne,K.transform,mt),Ye=ee.layout.get("icon-text-fit")!=="none"&&Ge.hasIconData();if(qe){const it=Math.pow(2,_e.zoom-at.tileID.overscaledZ),Mt=K.style.map.terrain?(Lt,Yt)=>K.style.map.terrain.getElevation(Qe,Lt,Yt):null,Ln=we.translatePosition(_e,at,he,te);Zo(Ge,Ne,$e,ge,_e,Rt,Qe.posMatrix,it,qe,Ye,we,Ln,Qe.toUnwrapped(),Mt)}}}(P,_,M,A,M.layout.get("text-rotation-alignment"),M.layout.get("text-pitch-alignment"),M.paint.get("text-translate"),M.paint.get("text-translate-anchor"),V),M.paint.get("icon-opacity").constantOr(1)!==0&&tu(_,A,M,P,!1,M.paint.get("icon-translate"),M.paint.get("icon-translate-anchor"),M.layout.get("icon-rotation-alignment"),M.layout.get("icon-pitch-alignment"),M.layout.get("icon-keep-upright"),O,L),M.paint.get("text-opacity").constantOr(1)!==0&&tu(_,A,M,P,!0,M.paint.get("text-translate"),M.paint.get("text-translate-anchor"),M.layout.get("text-rotation-alignment"),M.layout.get("text-pitch-alignment"),M.layout.get("text-keep-upright"),O,L),A.map.showCollisionBoxes&&(Xa(_,A,M,P,!0),Xa(_,A,M,P,!1))})(i,h,m,g,this.style.placement.variableOffsets);break;case"circle":(function(_,A,M,P){if(_.renderPass!=="translucent")return;const V=M.paint.get("circle-opacity"),O=M.paint.get("circle-stroke-width"),L=M.paint.get("circle-stroke-opacity"),G=!M.layout.get("circle-sort-key").isConstant();if(V.constantOr(1)===0&&(O.constantOr(1)===0||L.constantOr(1)===0))return;const K=_.context,ee=K.gl,ie=_.depthModeForSublayer(0,Ht.ReadOnly),ae=Pn.disabled,ce=_.colorModeForRenderPass(),he=[];for(let te=0;te<P.length;te++){const ge=P[te],_e=A.getTile(ge),we=_e.getBucket(M);if(!we)continue;const Ne=we.programConfigurations.get(M.id),$e=_.useProgram("circle",Ne),Qe=we.layoutVertexBuffer,at=we.indexBuffer,Ge=_.style.map.terrain&&_.style.map.terrain.getTerrainData(ge),qe={programConfiguration:Ne,program:$e,layoutVertexBuffer:Qe,indexBuffer:at,uniformValues:Ly(_,ge,_e,M),terrainData:Ge};if(G){const mt=we.segments.get();for(const Rt of mt)he.push({segments:new c.a0([Rt]),sortKey:Rt.sortKey,state:qe})}else he.push({segments:we.segments,sortKey:0,state:qe})}G&&he.sort((te,ge)=>te.sortKey-ge.sortKey);for(const te of he){const{programConfiguration:ge,program:_e,layoutVertexBuffer:we,indexBuffer:Ne,uniformValues:$e,terrainData:Qe}=te.state;_e.draw(K,ee.TRIANGLES,ie,ae,ce,Cn.disabled,$e,Qe,M.id,we,Ne,te.segments,M.paint,_.transform.zoom,ge)}})(i,h,m,g);break;case"heatmap":(function(_,A,M,P){if(M.paint.get("heatmap-opacity")===0)return;const V=_.context;if(_.style.map.terrain){for(const O of P){const L=A.getTile(O);A.hasRenderableParent(O)||(_.renderPass==="offscreen"?ru(_,L,M,O):_.renderPass==="translucent"&&yo(_,M,O))}V.viewport.set([0,0,_.width,_.height])}else _.renderPass==="offscreen"?function(O,L,G,K){const ee=O.context,ie=ee.gl,ae=Pn.disabled,ce=new er([ie.ONE,ie.ONE],c.aM.transparent,[!0,!0,!0,!0]);(function(he,te,ge){const _e=he.gl;he.activeTexture.set(_e.TEXTURE1),he.viewport.set([0,0,te.width/4,te.height/4]);let we=ge.heatmapFbos.get(c.aU);we?(_e.bindTexture(_e.TEXTURE_2D,we.colorAttachment.get()),he.bindFramebuffer.set(we.framebuffer)):(we=Ja(he,te.width/4,te.height/4),ge.heatmapFbos.set(c.aU,we))})(ee,O,G),ee.clear({color:c.aM.transparent});for(let he=0;he<K.length;he++){const te=K[he];if(L.hasRenderableParent(te))continue;const ge=L.getTile(te),_e=ge.getBucket(G);if(!_e)continue;const we=_e.programConfigurations.get(G.id),Ne=O.useProgram("heatmap",we),{zoom:$e}=O.transform;Ne.draw(ee,ie.TRIANGLES,Ht.disabled,ae,ce,Cn.disabled,qr(te.posMatrix,ge,$e,G.paint.get("heatmap-intensity")),null,G.id,_e.layoutVertexBuffer,_e.indexBuffer,_e.segments,G.paint,O.transform.zoom,we)}ee.viewport.set([0,0,O.width,O.height])}(_,A,M,P):_.renderPass==="translucent"&&function(O,L){const G=O.context,K=G.gl;G.setColorMode(O.colorModeForRenderPass());const ee=L.heatmapFbos.get(c.aU);ee&&(G.activeTexture.set(K.TEXTURE0),K.bindTexture(K.TEXTURE_2D,ee.colorAttachment.get()),G.activeTexture.set(K.TEXTURE1),Qa(G,L).bind(K.LINEAR,K.CLAMP_TO_EDGE),O.useProgram("heatmapTexture").draw(G,K.TRIANGLES,Ht.disabled,Pn.disabled,O.colorModeForRenderPass(),Cn.disabled,nc(O,L,0,1),null,L.id,O.viewportBuffer,O.quadTriangleIndexBuffer,O.viewportSegments,L.paint,O.transform.zoom))}(_,M)})(i,h,m,g);break;case"line":(function(_,A,M,P){if(_.renderPass!=="translucent")return;const V=M.paint.get("line-opacity"),O=M.paint.get("line-width");if(V.constantOr(1)===0||O.constantOr(1)===0)return;const L=_.depthModeForSublayer(0,Ht.ReadOnly),G=_.colorModeForRenderPass(),K=M.paint.get("line-dasharray"),ee=M.paint.get("line-pattern"),ie=ee.constantOr(1),ae=M.paint.get("line-gradient"),ce=M.getCrossfadeParameters(),he=ie?"linePattern":K?"lineSDF":ae?"lineGradient":"line",te=_.context,ge=te.gl;let _e=!0;for(const we of P){const Ne=A.getTile(we);if(ie&&!Ne.patternsLoaded())continue;const $e=Ne.getBucket(M);if(!$e)continue;const Qe=$e.programConfigurations.get(M.id),at=_.context.program.get(),Ge=_.useProgram(he,Qe),qe=_e||Ge.program!==at,mt=_.style.map.terrain&&_.style.map.terrain.getTerrainData(we),Rt=ee.constantOr(null);if(Rt&&Ne.imageAtlas){const Mt=Ne.imageAtlas,Ln=Mt.patternPositions[Rt.to.toString()],Lt=Mt.patternPositions[Rt.from.toString()];Ln&&Lt&&Qe.setConstantPatternPositions(Ln,Lt)}const Ye=mt?we:null,it=ie?qo(_,Ne,M,ce,Ye):K?Fy(_,Ne,M,K,ce,Ye):ae?Np(_,Ne,M,$e.lineClipsArray.length,Ye):ic(_,Ne,M,Ye);if(ie)te.activeTexture.set(ge.TEXTURE0),Ne.imageAtlasTexture.bind(ge.LINEAR,ge.CLAMP_TO_EDGE),Qe.updatePaintBuffers(ce);else if(K&&(qe||_.lineAtlas.dirty))te.activeTexture.set(ge.TEXTURE0),_.lineAtlas.bind(te);else if(ae){const Mt=$e.gradients[M.id];let Ln=Mt.texture;if(M.gradientVersion!==Mt.version){let Lt=256;if(M.stepInterpolant){const Yt=A.getSource().maxzoom,Fn=we.canonical.z===Yt?Math.ceil(1<<_.transform.maxZoom-we.canonical.z):1;Lt=c.ac(c.aV($e.maxLineLength/c.X*1024*Fn),256,te.maxTextureSize)}Mt.gradient=c.aW({expression:M.gradientExpression(),evaluationKey:"lineProgress",resolution:Lt,image:Mt.gradient||void 0,clips:$e.lineClipsArray}),Mt.texture?Mt.texture.update(Mt.gradient):Mt.texture=new tt(te,Mt.gradient,ge.RGBA),Mt.version=M.gradientVersion,Ln=Mt.texture}te.activeTexture.set(ge.TEXTURE0),Ln.bind(M.stepInterpolant?ge.NEAREST:ge.LINEAR,ge.CLAMP_TO_EDGE)}Ge.draw(te,ge.TRIANGLES,L,_.stencilModeForClipping(we),G,Cn.disabled,it,mt,M.id,$e.layoutVertexBuffer,$e.indexBuffer,$e.segments,M.paint,_.transform.zoom,Qe,$e.layoutVertexBuffer2),_e=!1}})(i,h,m,g);break;case"fill":(function(_,A,M,P){const V=M.paint.get("fill-color"),O=M.paint.get("fill-opacity");if(O.constantOr(1)===0)return;const L=_.colorModeForRenderPass(),G=M.paint.get("fill-pattern"),K=_.opaquePassEnabledForLayer()&&!G.constantOr(1)&&V.constantOr(c.aM.transparent).a===1&&O.constantOr(0)===1?"opaque":"translucent";if(_.renderPass===K){const ee=_.depthModeForSublayer(1,_.renderPass==="opaque"?Ht.ReadWrite:Ht.ReadOnly);el(_,A,M,P,ee,L,!1)}if(_.renderPass==="translucent"&&M.paint.get("fill-antialias")){const ee=_.depthModeForSublayer(M.getPaintProperty("fill-outline-color")?2:0,Ht.ReadOnly);el(_,A,M,P,ee,L,!0)}})(i,h,m,g);break;case"fill-extrusion":(function(_,A,M,P){const V=M.paint.get("fill-extrusion-opacity");if(V!==0&&_.renderPass==="translucent"){const O=new Ht(_.context.gl.LEQUAL,Ht.ReadWrite,_.depthRangeFor3D);if(V!==1||M.paint.get("fill-extrusion-pattern").constantOr(1))uc(_,A,M,P,O,Pn.disabled,er.disabled),uc(_,A,M,P,O,_.stencilModeFor3D(),_.colorModeForRenderPass());else{const L=_.colorModeForRenderPass();uc(_,A,M,P,O,Pn.disabled,L)}}})(i,h,m,g);break;case"hillshade":(function(_,A,M,P){if(_.renderPass!=="offscreen"&&_.renderPass!=="translucent")return;const V=_.context,O=_.depthModeForSublayer(0,Ht.ReadOnly),L=_.colorModeForRenderPass(),[G,K]=_.renderPass==="translucent"?_.stencilConfigForOverlap(P):[{},P];for(const ee of K){const ie=A.getTile(ee);ie.needsHillshadePrepare!==void 0&&ie.needsHillshadePrepare&&_.renderPass==="offscreen"?Ko(_,ie,M,O,Pn.disabled,L):_.renderPass==="translucent"&&Xo(_,ee,ie,M,O,G[ee.overscaledZ],L)}V.viewport.set([0,0,_.width,_.height])})(i,h,m,g);break;case"raster":(function(_,A,M,P){if(_.renderPass!=="translucent"||M.paint.get("raster-opacity")===0||!P.length)return;const V=_.context,O=V.gl,L=A.getSource(),G=_.useProgram("raster"),K=_.colorModeForRenderPass(),[ee,ie]=L instanceof Cr?[{},P]:_.stencilConfigForOverlap(P),ae=ie[ie.length-1].overscaledZ,ce=!_.options.moving;for(const he of ie){const te=_.depthModeForSublayer(he.overscaledZ-ae,M.paint.get("raster-opacity")===1?Ht.ReadWrite:Ht.ReadOnly,O.LESS),ge=A.getTile(he);ge.registerFadeDuration(M.paint.get("raster-fade-duration"));const _e=A.findLoadedParent(he,0),we=A.findLoadedSibling(he),Ne=Xp(ge,_e||we||null,A,M,_.transform,_.style.map.terrain);let $e,Qe;const at=M.paint.get("raster-resampling")==="nearest"?O.NEAREST:O.LINEAR;V.activeTexture.set(O.TEXTURE0),ge.texture.bind(at,O.CLAMP_TO_EDGE,O.LINEAR_MIPMAP_NEAREST),V.activeTexture.set(O.TEXTURE1),_e?(_e.texture.bind(at,O.CLAMP_TO_EDGE,O.LINEAR_MIPMAP_NEAREST),$e=Math.pow(2,_e.tileID.overscaledZ-ge.tileID.overscaledZ),Qe=[ge.tileID.canonical.x*$e%1,ge.tileID.canonical.y*$e%1]):ge.texture.bind(at,O.CLAMP_TO_EDGE,O.LINEAR_MIPMAP_NEAREST),ge.texture.useMipmap&&V.extTextureFilterAnisotropic&&_.transform.pitch>20&&O.texParameterf(O.TEXTURE_2D,V.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,V.extTextureFilterAnisotropicMax);const Ge=_.style.map.terrain&&_.style.map.terrain.getTerrainData(he),qe=Ge?he:null,mt=qe?qe.posMatrix:_.transform.calculatePosMatrix(he.toUnwrapped(),ce),Rt=$y(mt,Qe||[0,0],$e||1,Ne,M);L instanceof Cr?G.draw(V,O.TRIANGLES,te,Pn.disabled,K,Cn.disabled,Rt,Ge,M.id,L.boundsBuffer,_.quadTriangleIndexBuffer,L.boundsSegments):G.draw(V,O.TRIANGLES,te,ee[he.overscaledZ],K,Cn.disabled,Rt,Ge,M.id,_.rasterBoundsBuffer,_.quadTriangleIndexBuffer,_.rasterBoundsSegments)}})(i,h,m,g);break;case"background":(function(_,A,M,P){const V=M.paint.get("background-color"),O=M.paint.get("background-opacity");if(O===0)return;const L=_.context,G=L.gl,K=_.transform,ee=K.tileSize,ie=M.paint.get("background-pattern");if(_.isPatternMissing(ie))return;const ae=!ie&&V.a===1&&O===1&&_.opaquePassEnabledForLayer()?"opaque":"translucent";if(_.renderPass!==ae)return;const ce=Pn.disabled,he=_.depthModeForSublayer(0,ae==="opaque"?Ht.ReadWrite:Ht.ReadOnly),te=_.colorModeForRenderPass(),ge=_.useProgram(ie?"backgroundPattern":"background"),_e=P||K.coveringTiles({tileSize:ee,terrain:_.style.map.terrain});ie&&(L.activeTexture.set(G.TEXTURE0),_.imageManager.bind(_.context));const we=M.getCrossfadeParameters();for(const Ne of _e){const $e=P?Ne.posMatrix:_.transform.calculatePosMatrix(Ne.toUnwrapped()),Qe=ie?Hd($e,O,_,ie,{tileID:Ne,tileSize:ee},we):sc($e,O,V),at=_.style.map.terrain&&_.style.map.terrain.getTerrainData(Ne);ge.draw(L,G.TRIANGLES,he,ce,te,Cn.disabled,Qe,at,M.id,_.tileExtentBuffer,_.quadTriangleIndexBuffer,_.tileExtentSegments)}})(i,0,m,g);break;case"custom":(function(_,A,M){const P=_.context,V=M.implementation;if(_.renderPass==="offscreen"){const O=V.prerender;O&&(_.setCustomLayerDefaults(),P.setColorMode(_.colorModeForRenderPass()),O.call(V,P.gl,_.transform.customLayerMatrix()),P.setDirty(),_.setBaseState())}else if(_.renderPass==="translucent"){_.setCustomLayerDefaults(),P.setColorMode(_.colorModeForRenderPass()),P.setStencilMode(Pn.disabled);const O=V.renderingMode==="3d"?new Ht(_.context.gl.LEQUAL,Ht.ReadWrite,_.depthRangeFor3D):_.depthModeForSublayer(0,Ht.ReadOnly);P.setDepthMode(O),V.render(P.gl,_.transform.customLayerMatrix(),{farZ:_.transform.farZ,nearZ:_.transform.nearZ,fov:_.transform._fov,modelViewProjectionMatrix:_.transform.modelViewProjectionMatrix,projectionMatrix:_.transform.projectionMatrix}),P.setDirty(),_.setBaseState(),P.bindFramebuffer.set(null)}})(i,0,m)}}translatePosMatrix(i,h,m,g,_){if(!m[0]&&!m[1])return i;const A=_?g==="map"?this.transform.angle:0:g==="viewport"?-this.transform.angle:0;if(A){const V=Math.sin(A),O=Math.cos(A);m=[m[0]*O-m[1]*V,m[0]*V+m[1]*O]}const M=[_?m[0]:Zt(h,m[0],this.transform.zoom),_?m[1]:Zt(h,m[1],this.transform.zoom),0],P=new Float32Array(16);return c.J(P,i,M),P}saveTileTexture(i){const h=this._tileTextures[i.size[0]];h?h.push(i):this._tileTextures[i.size[0]]=[i]}getTileTexture(i){const h=this._tileTextures[i];return h&&h.length>0?h.pop():null}isPatternMissing(i){if(!i)return!1;if(!i.from||!i.to)return!0;const h=this.imageManager.getPattern(i.from.toString()),m=this.imageManager.getPattern(i.to.toString());return!h||!m}useProgram(i,h){this.cache=this.cache||{};const m=i+(h?h.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[m]||(this.cache[m]=new jd(this.context,Bs[i],h,Wd[i],this._showOverdrawInspector,this.style.map.terrain)),this.cache[m]}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 i=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(i.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new tt(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:i,drawingBufferHeight:h}=this.context.gl;return this.width!==i||this.height!==h}}class Qo{constructor(i,h){this.points=i,this.planes=h}static fromInvProjectionMatrix(i,h,m){const g=Math.pow(2,m),_=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(M=>{const P=1/(M=c.af([],M,i))[3]/h*g;return c.b1(M,M,[P,P,1/M[3],P])}),A=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(M=>{const P=function(G,K){var ee=K[0],ie=K[1],ae=K[2],ce=ee*ee+ie*ie+ae*ae;return ce>0&&(ce=1/Math.sqrt(ce)),G[0]=K[0]*ce,G[1]=K[1]*ce,G[2]=K[2]*ce,G}([],function(G,K,ee){var ie=K[0],ae=K[1],ce=K[2],he=ee[0],te=ee[1],ge=ee[2];return G[0]=ae*ge-ce*te,G[1]=ce*he-ie*ge,G[2]=ie*te-ae*he,G}([],Ee([],_[M[0]],_[M[1]]),Ee([],_[M[2]],_[M[1]]))),V=-((O=P)[0]*(L=_[M[1]])[0]+O[1]*L[1]+O[2]*L[2]);var O,L;return P.concat(V)});return new Qo(_,A)}}class ea{constructor(i,h){this.min=i,this.max=h,this.center=function(m,g,_){return m[0]=.5*g[0],m[1]=.5*g[1],m[2]=.5*g[2],m}([],function(m,g,_){return m[0]=g[0]+_[0],m[1]=g[1]+_[1],m[2]=g[2]+_[2],m}([],this.min,this.max))}quadrant(i){const h=[i%2==0,i<2],m=ke(this.min),g=ke(this.max);for(let _=0;_<h.length;_++)m[_]=h[_]?this.min[_]:this.center[_],g[_]=h[_]?this.center[_]:this.max[_];return g[2]=this.max[2],new ea(m,g)}distanceX(i){return Math.max(Math.min(this.max[0],i[0]),this.min[0])-i[0]}distanceY(i){return Math.max(Math.min(this.max[1],i[1]),this.min[1])-i[1]}intersects(i){const h=[[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 m=!0;for(let g=0;g<i.planes.length;g++){const _=i.planes[g];let A=0;for(let M=0;M<h.length;M++)c.b2(_,h[M])>=0&&A++;if(A===0)return 0;A!==h.length&&(m=!1)}if(m)return 2;for(let g=0;g<3;g++){let _=Number.MAX_VALUE,A=-Number.MAX_VALUE;for(let M=0;M<i.points.length;M++){const P=i.points[M][g]-this.min[g];_=Math.min(_,P),A=Math.max(A,P)}if(A<0||_>this.max[g]-this.min[g])return 0}return 1}}class ta{constructor(i=0,h=0,m=0,g=0){if(isNaN(i)||i<0||isNaN(h)||h<0||isNaN(m)||m<0||isNaN(g)||g<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=i,this.bottom=h,this.left=m,this.right=g}interpolate(i,h,m){return h.top!=null&&i.top!=null&&(this.top=c.y.number(i.top,h.top,m)),h.bottom!=null&&i.bottom!=null&&(this.bottom=c.y.number(i.bottom,h.bottom,m)),h.left!=null&&i.left!=null&&(this.left=c.y.number(i.left,h.left,m)),h.right!=null&&i.right!=null&&(this.right=c.y.number(i.right,h.right,m)),this}getCenter(i,h){const m=c.ac((this.left+i-this.right)/2,0,i),g=c.ac((this.top+h-this.bottom)/2,0,h);return new c.P(m,g)}equals(i){return this.top===i.top&&this.bottom===i.bottom&&this.left===i.left&&this.right===i.right}clone(){return new ta(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const su=85.051129;class na{constructor(i,h,m,g,_){this.tileSize=512,this._renderWorldCopies=_===void 0||!!_,this._minZoom=i||0,this._maxZoom=h||22,this._minPitch=m??0,this._maxPitch=g??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 ta,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={},this.minElevationForCurrentTile=0}clone(){const i=new na(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return i.apply(this),i}apply(i){this.tileSize=i.tileSize,this.latRange=i.latRange,this.lngRange=i.lngRange,this.width=i.width,this.height=i.height,this._center=i._center,this._elevation=i._elevation,this.minElevationForCurrentTile=i.minElevationForCurrentTile,this.zoom=i.zoom,this.angle=i.angle,this._fov=i._fov,this._pitch=i._pitch,this._unmodified=i._unmodified,this._edgeInsets=i._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(i){this._minZoom!==i&&(this._minZoom=i,this.zoom=Math.max(this.zoom,i))}get maxZoom(){return this._maxZoom}set maxZoom(i){this._maxZoom!==i&&(this._maxZoom=i,this.zoom=Math.min(this.zoom,i))}get minPitch(){return this._minPitch}set minPitch(i){this._minPitch!==i&&(this._minPitch=i,this.pitch=Math.max(this.pitch,i))}get maxPitch(){return this._maxPitch}set maxPitch(i){this._maxPitch!==i&&(this._maxPitch=i,this.pitch=Math.min(this.pitch,i))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(i){i===void 0?i=!0:i===null&&(i=!1),this._renderWorldCopies=i}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new c.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(i){const h=-c.b3(i,-180,180)*Math.PI/180;this.angle!==h&&(this._unmodified=!1,this.angle=h,this._calcMatrices(),this.rotationMatrix=function(){var m=new c.A(4);return c.A!=Float32Array&&(m[1]=0,m[2]=0),m[0]=1,m[3]=1,m}(),function(m,g,_){var A=g[0],M=g[1],P=g[2],V=g[3],O=Math.sin(_),L=Math.cos(_);m[0]=A*L+P*O,m[1]=M*L+V*O,m[2]=A*-O+P*L,m[3]=M*-O+V*L}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(i){const h=c.ac(i,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==h&&(this._unmodified=!1,this._pitch=h,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(i){i=Math.max(.01,Math.min(60,i)),this._fov!==i&&(this._unmodified=!1,this._fov=i/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(i){const h=Math.min(Math.max(i,this.minZoom),this.maxZoom);this._zoom!==h&&(this._unmodified=!1,this._zoom=h,this.tileZoom=Math.max(0,Math.floor(h)),this.scale=this.zoomScale(h),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(i){i.lat===this._center.lat&&i.lng===this._center.lng||(this._unmodified=!1,this._center=i,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(i){i!==this._elevation&&(this._elevation=i,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(i){this._edgeInsets.equals(i)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,i,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(i){return this._edgeInsets.equals(i)}interpolatePadding(i,h,m){this._unmodified=!1,this._edgeInsets.interpolate(i,h,m),this._constrain(),this._calcMatrices()}coveringZoomLevel(i){const h=(i.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/i.tileSize));return Math.max(0,h)}getVisibleUnwrappedCoordinates(i){const h=[new c.b4(0,i)];if(this._renderWorldCopies){const m=this.pointCoordinate(new c.P(0,0)),g=this.pointCoordinate(new c.P(this.width,0)),_=this.pointCoordinate(new c.P(this.width,this.height)),A=this.pointCoordinate(new c.P(0,this.height)),M=Math.floor(Math.min(m.x,g.x,_.x,A.x)),P=Math.floor(Math.max(m.x,g.x,_.x,A.x)),V=1;for(let O=M-V;O<=P+V;O++)O!==0&&h.push(new c.b4(O,i))}return h}coveringTiles(i){var h,m;let g=this.coveringZoomLevel(i);const _=g;if(i.minzoom!==void 0&&g<i.minzoom)return[];i.maxzoom!==void 0&&g>i.maxzoom&&(g=i.maxzoom);const A=this.pointCoordinate(this.getCameraPoint()),M=c.Z.fromLngLat(this.center),P=Math.pow(2,g),V=[P*A.x,P*A.y,0],O=[P*M.x,P*M.y,0],L=Qo.fromInvProjectionMatrix(this.invModelViewProjectionMatrix,this.worldSize,g);let G=i.minzoom||0;!i.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(G=g);const K=i.terrain?2/Math.min(this.tileSize,i.tileSize)*this.tileSize:3,ee=te=>({aabb:new ea([te*P,0,0],[(te+1)*P,P,0]),zoom:0,x:0,y:0,wrap:te,fullyVisible:!1}),ie=[],ae=[],ce=g,he=i.reparseOverscaled?_:g;if(this._renderWorldCopies)for(let te=1;te<=3;te++)ie.push(ee(-te)),ie.push(ee(te));for(ie.push(ee(0));ie.length>0;){const te=ie.pop(),ge=te.x,_e=te.y;let we=te.fullyVisible;if(!we){const Ge=te.aabb.intersects(L);if(Ge===0)continue;we=Ge===2}const Ne=i.terrain?V:O,$e=te.aabb.distanceX(Ne),Qe=te.aabb.distanceY(Ne),at=Math.max(Math.abs($e),Math.abs(Qe));if(te.zoom===ce||at>K+(1<<ce-te.zoom)-2&&te.zoom>=G){const Ge=ce-te.zoom,qe=V[0]-.5-(ge<<Ge),mt=V[1]-.5-(_e<<Ge);ae.push({tileID:new c.S(te.zoom===ce?he:te.zoom,te.wrap,te.zoom,ge,_e),distanceSq:Ve([O[0]-.5-ge,O[1]-.5-_e]),tileDistanceToCamera:Math.sqrt(qe*qe+mt*mt)})}else for(let Ge=0;Ge<4;Ge++){const qe=(ge<<1)+Ge%2,mt=(_e<<1)+(Ge>>1),Rt=te.zoom+1;let Ye=te.aabb.quadrant(Ge);if(i.terrain){const it=new c.S(Rt,te.wrap,Rt,qe,mt),Mt=i.terrain.getMinMaxElevation(it),Ln=(h=Mt.minElevation)!==null&&h!==void 0?h:this.elevation,Lt=(m=Mt.maxElevation)!==null&&m!==void 0?m:this.elevation;Ye=new ea([Ye.min[0],Ye.min[1],Ln],[Ye.max[0],Ye.max[1],Lt])}ie.push({aabb:Ye,zoom:Rt,x:qe,y:mt,wrap:te.wrap,fullyVisible:we})}}return ae.sort((te,ge)=>te.distanceSq-ge.distanceSq).map(te=>te.tileID)}resize(i,h){this.width=i,this.height=h,this.pixelsToGLUnits=[2/i,-2/h],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(i){return Math.pow(2,i)}scaleZoom(i){return Math.log(i)/Math.LN2}project(i){const h=c.ac(i.lat,-85.051129,su);return new c.P(c.O(i.lng)*this.worldSize,c.Q(h)*this.worldSize)}unproject(i){return new c.Z(i.x/this.worldSize,i.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(i){const h=this.elevation,m=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,g=this.pointLocation(this.centerPoint,i),_=i.getElevationForLngLatZoom(g,this.tileZoom);if(!(this.elevation-_))return;const A=m+h-_,M=Math.cos(this._pitch)*this.cameraToCenterDistance/A/c.b5(1,g.lat),P=this.scaleZoom(M/this.tileSize);this._elevation=_,this._center=g,this.zoom=P}setLocationAtPoint(i,h){const m=this.pointCoordinate(h),g=this.pointCoordinate(this.centerPoint),_=this.locationCoordinate(i),A=new c.Z(_.x-(m.x-g.x),_.y-(m.y-g.y));this.center=this.coordinateLocation(A),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(i,h){return h?this.coordinatePoint(this.locationCoordinate(i),h.getElevationForLngLatZoom(i,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(i))}pointLocation(i,h){return this.coordinateLocation(this.pointCoordinate(i,h))}locationCoordinate(i){return c.Z.fromLngLat(i)}coordinateLocation(i){return i&&i.toLngLat()}pointCoordinate(i,h){if(h){const G=h.pointCoordinate(i);if(G!=null)return G}const m=[i.x,i.y,0,1],g=[i.x,i.y,1,1];c.af(m,m,this.pixelMatrixInverse),c.af(g,g,this.pixelMatrixInverse);const _=m[3],A=g[3],M=m[1]/_,P=g[1]/A,V=m[2]/_,O=g[2]/A,L=V===O?0:(0-V)/(O-V);return new c.Z(c.y.number(m[0]/_,g[0]/A,L)/this.worldSize,c.y.number(M,P,L)/this.worldSize)}coordinatePoint(i,h=0,m=this.pixelMatrix){const g=[i.x*this.worldSize,i.y*this.worldSize,h,1];return c.af(g,g,m),new c.P(g[0]/g[3],g[1]/g[3])}getBounds(){const i=Math.max(0,this.height/2-this.getHorizon());return new Ce().extend(this.pointLocation(new c.P(0,i))).extend(this.pointLocation(new c.P(this.width,i))).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 Ce([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(i){i?(this.lngRange=[i.getWest(),i.getEast()],this.latRange=[i.getSouth(),i.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-85.051129,su])}calculateTileMatrix(i){const h=i.canonical,m=this.worldSize/this.zoomScale(h.z),g=h.x+Math.pow(2,h.z)*i.wrap,_=c.an(new Float64Array(16));return c.J(_,_,[g*m,h.y*m,0]),c.K(_,_,[m/c.X,m/c.X,1]),_}calculatePosMatrix(i,h=!1){const m=i.key,g=h?this._alignedPosMatrixCache:this._posMatrixCache;if(g[m])return g[m];const _=this.calculateTileMatrix(i);return c.L(_,h?this.alignedModelViewProjectionMatrix:this.modelViewProjectionMatrix,_),g[m]=new Float32Array(_),g[m]}calculateFogMatrix(i){const h=i.key,m=this._fogMatrixCache;if(m[h])return m[h];const g=this.calculateTileMatrix(i);return c.L(g,this.fogMatrix,g),m[h]=new Float32Array(g),m[h]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(i,h){h=c.ac(+h,this.minZoom,this.maxZoom);const m={center:new c.N(i.lng,i.lat),zoom:h};let g=this.lngRange;if(!this._renderWorldCopies&&g===null){const te=179.9999999999;g=[-te,te]}const _=this.tileSize*this.zoomScale(m.zoom);let A=0,M=_,P=0,V=_,O=0,L=0;const{x:G,y:K}=this.size;if(this.latRange){const te=this.latRange;A=c.Q(te[1])*_,M=c.Q(te[0])*_,M-A<K&&(O=K/(M-A))}g&&(P=c.b3(c.O(g[0])*_,0,_),V=c.b3(c.O(g[1])*_,0,_),V<P&&(V+=_),V-P<G&&(L=G/(V-P)));const{x:ee,y:ie}=this.project.call({worldSize:_},i);let ae,ce;const he=Math.max(L||0,O||0);if(he){const te=new c.P(L?(V+P)/2:ee,O?(M+A)/2:ie);return m.center=this.unproject.call({worldSize:_},te).wrap(),m.zoom+=this.scaleZoom(he),m}if(this.latRange){const te=K/2;ie-te<A&&(ce=A+te),ie+te>M&&(ce=M-te)}if(g){const te=(P+V)/2;let ge=ee;this._renderWorldCopies&&(ge=c.b3(ee,te-_/2,te+_/2));const _e=G/2;ge-_e<P&&(ae=P+_e),ge+_e>V&&(ae=V-_e)}if(ae!==void 0||ce!==void 0){const te=new c.P(ae??ee,ce??ie);m.center=this.unproject.call({worldSize:_},te).wrap()}return m}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const i=this._unmodified,{center:h,zoom:m}=this.getConstrained(this.center,this.zoom);this.center=h,this.zoom=m,this._unmodified=i,this._constraining=!1}_calcMatrices(){if(!this.height)return;const i=this.centerOffset,h=this.point.x,m=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=c.b5(1,this.center.lat)*this.worldSize;let g=c.an(new Float64Array(16));c.K(g,g,[this.width/2,-this.height/2,1]),c.J(g,g,[1,-1,0]),this.labelPlaneMatrix=g,g=c.an(new Float64Array(16)),c.K(g,g,[1,-1,1]),c.J(g,g,[-1,-1,0]),c.K(g,g,[2/this.width,2/this.height,1]),this.glCoordMatrix=g;const _=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),A=Math.min(this.elevation,this.minElevationForCurrentTile),M=_-A*this._pixelPerMeter/Math.cos(this._pitch),P=A<0?M:_,V=Math.PI/2+this._pitch,O=this._fov*(.5+i.y/this.height),L=Math.sin(O)*P/Math.sin(c.ac(Math.PI-V-O,.01,Math.PI-.01)),G=this.getHorizon(),K=2*Math.atan(G/this.cameraToCenterDistance)*(.5+i.y/(2*G)),ee=Math.sin(K)*P/Math.sin(c.ac(Math.PI-V-K,.01,Math.PI-.01)),ie=Math.min(L,ee);this.farZ=1.01*(Math.cos(Math.PI/2-this._pitch)*ie+P),this.nearZ=this.height/50,g=new Float64Array(16),c.b6(g,this._fov,this.width/this.height,this.nearZ,this.farZ),g[8]=2*-i.x/this.width,g[9]=2*i.y/this.height,this.projectionMatrix=c.ae(g),c.K(g,g,[1,-1,1]),c.J(g,g,[0,0,-this.cameraToCenterDistance]),c.b7(g,g,this._pitch),c.ad(g,g,this.angle),c.J(g,g,[-h,-m,0]),this.mercatorMatrix=c.K([],g,[this.worldSize,this.worldSize,this.worldSize]),c.K(g,g,[1,1,this._pixelPerMeter]),this.pixelMatrix=c.L(new Float64Array(16),this.labelPlaneMatrix,g),c.J(g,g,[0,0,-this.elevation]),this.modelViewProjectionMatrix=g,this.invModelViewProjectionMatrix=c.as([],g),this.fogMatrix=new Float64Array(16),c.b6(this.fogMatrix,this._fov,this.width/this.height,_,this.farZ),this.fogMatrix[8]=2*-i.x/this.width,this.fogMatrix[9]=2*i.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.ad(this.fogMatrix,this.fogMatrix,this.angle),c.J(this.fogMatrix,this.fogMatrix,[-h,-m,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,g);const ae=this.width%2/2,ce=this.height%2/2,he=Math.cos(this.angle),te=Math.sin(this.angle),ge=h-Math.round(h)+he*ae+te*ce,_e=m-Math.round(m)+he*ce+te*ae,we=new Float64Array(g);if(c.J(we,we,[ge>.5?ge-1:ge,_e>.5?_e-1:_e,0]),this.alignedModelViewProjectionMatrix=we,g=c.as(new Float64Array(16),this.pixelMatrix),!g)throw new Error("failed to invert matrix");this.pixelMatrixInverse=g,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const i=this.pointCoordinate(new c.P(0,0)),h=[i.x*this.worldSize,i.y*this.worldSize,0,1];return c.af(h,h,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const i=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new c.P(0,i))}getCameraQueryGeometry(i){const h=this.getCameraPoint();if(i.length===1)return[i[0],h];{let m=h.x,g=h.y,_=h.x,A=h.y;for(const M of i)m=Math.min(m,M.x),g=Math.min(g,M.y),_=Math.max(_,M.x),A=Math.max(A,M.y);return[new c.P(m,g),new c.P(_,g),new c.P(_,A),new c.P(m,A),new c.P(m,g)]}}lngLatToCameraDepth(i,h){const m=this.locationCoordinate(i),g=[m.x*this.worldSize,m.y*this.worldSize,h,1];return c.af(g,g,this.modelViewProjectionMatrix),g[2]/g[3]}}function tl(x,i){let h,m=!1,g=null,_=null;const A=()=>{g=null,m&&(x.apply(_,h),g=setTimeout(A,i),m=!1)};return(...M)=>(m=!0,_=this,h=M,g||A(),g)}class gc{constructor(i){this._getCurrentHash=()=>{const h=window.location.hash.replace("#","");if(this._hashName){let m;return h.split("&").map(g=>g.split("=")).forEach(g=>{g[0]===this._hashName&&(m=g)}),(m&&m[1]||"").split("/")}return h.split("/")},this._onHashChange=()=>{const h=this._getCurrentHash();if(h.length>=3&&!h.some(m=>isNaN(m))){const m=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(h[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+h[2],+h[1]],zoom:+h[0],bearing:m,pitch:+(h[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const h=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,h)},this._removeHash=()=>{const h=this._getCurrentHash();if(h.length===0)return;const m=h.join("/");let g=m;g.split("&").length>0&&(g=g.split("&")[0]),this._hashName&&(g=`${this._hashName}=${m}`);let _=window.location.hash.replace(g,"");_.startsWith("#&")?_=_.slice(0,1)+_.slice(2):_==="#"&&(_="");let A=window.location.href.replace(/(#.+)?$/,_);A=A.replace("&&","&"),window.history.replaceState(window.history.state,null,A)},this._updateHash=tl(this._updateHashUnthrottled,300),this._hashName=i&&encodeURIComponent(i)}addTo(i){return this._map=i,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(i){const h=this._map.getCenter(),m=Math.round(100*this._map.getZoom())/100,g=Math.ceil((m*Math.LN2+Math.log(512/360/.5))/Math.LN10),_=Math.pow(10,g),A=Math.round(h.lng*_)/_,M=Math.round(h.lat*_)/_,P=this._map.getBearing(),V=this._map.getPitch();let O="";if(O+=i?`/${A}/${M}/${m}`:`${m}/${M}/${A}`,(P||V)&&(O+="/"+Math.round(10*P)/10),V&&(O+=`/${Math.round(V)}`),this._hashName){const L=this._hashName;let G=!1;const K=window.location.hash.slice(1).split("&").map(ee=>{const ie=ee.split("=")[0];return ie===L?(G=!0,`${ie}=${O}`):ee}).filter(ee=>ee);return G||K.push(`${L}=${O}`),`#${K.join("&")}`}return`#${O}`}}const yc={linearity:.3,easing:c.b8(0,0,.3,1)},ou=c.e({deceleration:2500,maxSpeed:1400},yc),e0=c.e({deceleration:20,maxSpeed:1400},yc),tf=c.e({deceleration:1e3,maxSpeed:360},yc),_c=c.e({deceleration:1e3,maxSpeed:90},yc);class au{constructor(i){this._map=i,this.clear()}clear(){this._inertiaBuffer=[]}record(i){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:C.now(),settings:i})}_drainInertiaBuffer(){const i=this._inertiaBuffer,h=C.now();for(;i.length>0&&h-i[0].time>160;)i.shift()}_onMoveEnd(i){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const h={zoom:0,bearing:0,pitch:0,pan:new c.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:_}of this._inertiaBuffer)h.zoom+=_.zoomDelta||0,h.bearing+=_.bearingDelta||0,h.pitch+=_.pitchDelta||0,_.panDelta&&h.pan._add(_.panDelta),_.around&&(h.around=_.around),_.pinchAround&&(h.pinchAround=_.pinchAround);const m=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,g={};if(h.pan.mag()){const _=rl(h.pan.mag(),m,c.e({},ou,i||{}));g.offset=h.pan.mult(_.amount/h.pan.mag()),g.center=this._map.transform.center,nl(g,_)}if(h.zoom){const _=rl(h.zoom,m,e0);g.zoom=this._map.transform.zoom+_.amount,nl(g,_)}if(h.bearing){const _=rl(h.bearing,m,tf);g.bearing=this._map.transform.bearing+c.ac(_.amount,-179,179),nl(g,_)}if(h.pitch){const _=rl(h.pitch,m,_c);g.pitch=this._map.transform.pitch+_.amount,nl(g,_)}if(g.zoom||g.bearing){const _=h.pinchAround===void 0?h.around:h.pinchAround;g.around=_?this._map.unproject(_):this._map.getCenter()}return this.clear(),c.e(g,{noMoveStart:!0})}}function nl(x,i){(!x.duration||x.duration<i.duration)&&(x.duration=i.duration,x.easing=i.easing)}function rl(x,i,h){const{maxSpeed:m,linearity:g,deceleration:_}=h,A=c.ac(x*g/(i/1e3),-m,m),M=Math.abs(A)/(_*g);return{easing:h.easing,duration:1e3*M,amount:A*(M/2)}}class Sr extends c.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(i,h,m,g={}){const _=T.mousePos(h.getCanvas(),m),A=h.unproject(_);super(i,c.e({point:_,lngLat:A,originalEvent:m},g)),this._defaultPrevented=!1,this.target=h}}class _o extends c.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(i,h,m){const g=i==="touchend"?m.changedTouches:m.touches,_=T.touchPos(h.getCanvasContainer(),g),A=_.map(P=>h.unproject(P)),M=_.reduce((P,V,O,L)=>P.add(V.div(L.length)),new c.P(0,0));super(i,{points:_,point:M,lngLats:A,lngLat:h.unproject(M),originalEvent:m}),this._defaultPrevented=!1}}class nf extends c.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(i,h,m){super(i,{originalEvent:m}),this._defaultPrevented=!1}}class rf{constructor(i,h){this._map=i,this._clickTolerance=h.clickTolerance}reset(){delete this._mousedownPos}wheel(i){return this._firePreventable(new nf(i.type,this._map,i))}mousedown(i,h){return this._mousedownPos=h,this._firePreventable(new Sr(i.type,this._map,i))}mouseup(i){this._map.fire(new Sr(i.type,this._map,i))}click(i,h){this._mousedownPos&&this._mousedownPos.dist(h)>=this._clickTolerance||this._map.fire(new Sr(i.type,this._map,i))}dblclick(i){return this._firePreventable(new Sr(i.type,this._map,i))}mouseover(i){this._map.fire(new Sr(i.type,this._map,i))}mouseout(i){this._map.fire(new Sr(i.type,this._map,i))}touchstart(i){return this._firePreventable(new _o(i.type,this._map,i))}touchmove(i){this._map.fire(new _o(i.type,this._map,i))}touchend(i){this._map.fire(new _o(i.type,this._map,i))}touchcancel(i){this._map.fire(new _o(i.type,this._map,i))}_firePreventable(i){if(this._map.fire(i),i.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class tr{constructor(i){this._map=i}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(i){this._map.fire(new Sr(i.type,this._map,i))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Sr("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(i){this._delayContextMenu?this._contextMenuEvent=i:this._ignoreContextMenu||this._map.fire(new Sr(i.type,this._map,i)),this._map.listens("contextmenu")&&i.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class zi{constructor(i){this._map=i}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(i){return this.transform.pointLocation(c.P.convert(i),this._map.terrain)}}class oi{constructor(i,h){this._map=i,this._tr=new zi(i),this._el=i.getCanvasContainer(),this._container=i.getContainer(),this._clickTolerance=h.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(i,h){this.isEnabled()&&i.shiftKey&&i.button===0&&(T.disableDrag(),this._startPos=this._lastPos=h,this._active=!0)}mousemoveWindow(i,h){if(!this._active)return;const m=h;if(this._lastPos.equals(m)||!this._box&&m.dist(this._startPos)<this._clickTolerance)return;const g=this._startPos;this._lastPos=m,this._box||(this._box=T.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",i));const _=Math.min(g.x,m.x),A=Math.max(g.x,m.x),M=Math.min(g.y,m.y),P=Math.max(g.y,m.y);T.setTransform(this._box,`translate(${_}px,${M}px)`),this._box.style.width=A-_+"px",this._box.style.height=P-M+"px"}mouseupWindow(i,h){if(!this._active||i.button!==0)return;const m=this._startPos,g=h;if(this.reset(),T.suppressClick(),m.x!==g.x||m.y!==g.y)return this._map.fire(new c.k("boxzoomend",{originalEvent:i})),{cameraAnimation:_=>_.fitScreenCoordinates(m,g,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",i)}keydown(i){this._active&&i.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",i))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(T.remove(this._box),this._box=null),T.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(i,h){return this._map.fire(new c.k(i,{originalEvent:h}))}}function il(x,i){if(x.length!==i.length)throw new Error(`The number of touches and points are not equal - touches ${x.length}, points ${i.length}`);const h={};for(let m=0;m<x.length;m++)h[x[m].identifier]=i[m];return h}class lu{constructor(i){this.reset(),this.numTouches=i.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(i,h,m){(this.centroid||m.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=i.timeStamp),m.length===this.numTouches&&(this.centroid=function(g){const _=new c.P(0,0);for(const A of g)_._add(A);return _.div(g.length)}(h),this.touches=il(m,h)))}touchmove(i,h,m){if(this.aborted||!this.centroid)return;const g=il(m,h);for(const _ in this.touches){const A=g[_];(!A||A.dist(this.touches[_])>30)&&(this.aborted=!0)}}touchend(i,h,m){if((!this.centroid||i.timeStamp-this.startTime>500)&&(this.aborted=!0),m.length===0){const g=!this.aborted&&this.centroid;if(this.reset(),g)return g}}}class bc{constructor(i){this.singleTap=new lu(i),this.numTaps=i.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(i,h,m){this.singleTap.touchstart(i,h,m)}touchmove(i,h,m){this.singleTap.touchmove(i,h,m)}touchend(i,h,m){const g=this.singleTap.touchend(i,h,m);if(g){const _=i.timeStamp-this.lastTime<500,A=!this.lastTap||this.lastTap.dist(g)<30;if(_&&A||this.reset(),this.count++,this.lastTime=i.timeStamp,this.lastTap=g,this.count===this.numTaps)return this.reset(),g}}}class ra{constructor(i){this._tr=new zi(i),this._zoomIn=new bc({numTouches:1,numTaps:2}),this._zoomOut=new bc({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(i,h,m){this._zoomIn.touchstart(i,h,m),this._zoomOut.touchstart(i,h,m)}touchmove(i,h,m){this._zoomIn.touchmove(i,h,m),this._zoomOut.touchmove(i,h,m)}touchend(i,h,m){const g=this._zoomIn.touchend(i,h,m),_=this._zoomOut.touchend(i,h,m),A=this._tr;return g?(this._active=!0,i.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:M=>M.easeTo({duration:300,zoom:A.zoom+1,around:A.unproject(g)},{originalEvent:i})}):_?(this._active=!0,i.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:M=>M.easeTo({duration:300,zoom:A.zoom-1,around:A.unproject(_)},{originalEvent:i})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class ys{constructor(i){this._enabled=!!i.enable,this._moveStateManager=i.moveStateManager,this._clickTolerance=i.clickTolerance||1,this._moveFunction=i.move,this._activateOnStart=!!i.activateOnStart,i.assignEvents(this),this.reset()}reset(i){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(i)}_move(...i){const h=this._moveFunction(...i);if(h.bearingDelta||h.pitchDelta||h.around||h.panDelta)return this._active=!0,h}dragStart(i,h){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(i)&&(this._moveStateManager.startMove(i),this._lastPoint=h.length?h[0]:h,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(i,h){if(!this.isEnabled())return;const m=this._lastPoint;if(!m)return;if(i.preventDefault(),!this._moveStateManager.isValidMoveEvent(i))return void this.reset(i);const g=h.length?h[0]:h;return!this._moved&&g.dist(m)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=g,this._move(m,g))}dragEnd(i){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(i)&&(this._moved&&T.suppressClick(),this.reset(i))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}const cu={0:1,2:2};class xc{constructor(i){this._correctEvent=i.checkCorrectEvent}startMove(i){const h=T.mouseButton(i);this._eventButton=h}endMove(i){delete this._eventButton}isValidStartEvent(i){return this._correctEvent(i)}isValidMoveEvent(i){return!function(h,m){const g=cu[m];return h.buttons===void 0||(h.buttons&g)!==g}(i,this._eventButton)}isValidEndEvent(i){return T.mouseButton(i)===this._eventButton}}class du{constructor(){this._firstTouch=void 0}_isOneFingerTouch(i){return i.targetTouches.length===1}_isSameTouchEvent(i){return i.targetTouches[0].identifier===this._firstTouch}startMove(i){this._firstTouch=i.targetTouches[0].identifier}endMove(i){delete this._firstTouch}isValidStartEvent(i){return this._isOneFingerTouch(i)}isValidMoveEvent(i){return this._isOneFingerTouch(i)&&this._isSameTouchEvent(i)}isValidEndEvent(i){return this._isOneFingerTouch(i)&&this._isSameTouchEvent(i)}}const vc=x=>{x.mousedown=x.dragStart,x.mousemoveWindow=x.dragMove,x.mouseup=x.dragEnd,x.contextmenu=i=>{i.preventDefault()}},uu=({enable:x,clickTolerance:i,bearingDegreesPerPixelMoved:h=.8})=>{const m=new xc({checkCorrectEvent:g=>T.mouseButton(g)===0&&g.ctrlKey||T.mouseButton(g)===2});return new ys({clickTolerance:i,move:(g,_)=>({bearingDelta:(_.x-g.x)*h}),moveStateManager:m,enable:x,assignEvents:vc})},hu=({enable:x,clickTolerance:i,pitchDegreesPerPixelMoved:h=-.5})=>{const m=new xc({checkCorrectEvent:g=>T.mouseButton(g)===0&&g.ctrlKey||T.mouseButton(g)===2});return new ys({clickTolerance:i,move:(g,_)=>({pitchDelta:(_.y-g.y)*h}),moveStateManager:m,enable:x,assignEvents:vc})};class bo{constructor(i,h){this._clickTolerance=i.clickTolerance||1,this._map=h,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new c.P(0,0)}_shouldBePrevented(i){return i<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(i,h,m){return this._calculateTransform(i,h,m)}touchmove(i,h,m){if(this._active){if(!this._shouldBePrevented(m.length))return i.preventDefault(),this._calculateTransform(i,h,m);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",i)}}touchend(i,h,m){this._calculateTransform(i,h,m),this._active&&this._shouldBePrevented(m.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(i,h,m){m.length>0&&(this._active=!0);const g=il(m,h),_=new c.P(0,0),A=new c.P(0,0);let M=0;for(const V in g){const O=g[V],L=this._touches[V];L&&(_._add(O),A._add(O.sub(L)),M++,g[V]=O)}if(this._touches=g,this._shouldBePrevented(M)||!A.mag())return;const P=A.div(M);return this._sum._add(P),this._sum.mag()<this._clickTolerance?void 0:{around:_.div(M),panDelta:P}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class wc{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(i,h,m){this._firstTwoTouches||m.length<2||(this._firstTwoTouches=[m[0].identifier,m[1].identifier],this._start([h[0],h[1]]))}touchmove(i,h,m){if(!this._firstTwoTouches)return;i.preventDefault();const[g,_]=this._firstTwoTouches,A=sl(m,h,g),M=sl(m,h,_);if(!A||!M)return;const P=this._aroundCenter?null:A.add(M).div(2);return this._move([A,M],P,i)}touchend(i,h,m){if(!this._firstTwoTouches)return;const[g,_]=this._firstTwoTouches,A=sl(m,h,g),M=sl(m,h,_);A&&M||(this._active&&T.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(i){this._enabled=!0,this._aroundCenter=!!i&&i.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function sl(x,i,h){for(let m=0;m<x.length;m++)if(x[m].identifier===h)return i[m]}function pu(x,i){return Math.log(x/i)/Math.LN2}class fu extends wc{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(i){this._startDistance=this._distance=i[0].dist(i[1])}_move(i,h){const m=this._distance;if(this._distance=i[0].dist(i[1]),this._active||!(Math.abs(pu(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:pu(this._distance,m),pinchAround:h}}}function mu(x,i){return 180*x.angleWith(i)/Math.PI}class gu extends wc{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(i){this._startVector=this._vector=i[0].sub(i[1]),this._minDiameter=i[0].dist(i[1])}_move(i,h,m){const g=this._vector;if(this._vector=i[0].sub(i[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:mu(this._vector,g),pinchAround:h}}_isBelowThreshold(i){this._minDiameter=Math.min(this._minDiameter,i.mag());const h=25/(Math.PI*this._minDiameter)*360,m=mu(i,this._startVector);return Math.abs(m)<h}}function kc(x){return Math.abs(x.y)>Math.abs(x.x)}class ol extends wc{constructor(i){super(),this._currentTouchCount=0,this._map=i}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(i,h,m){super.touchstart(i,h,m),this._currentTouchCount=m.length}_start(i){this._lastPoints=i,kc(i[0].sub(i[1]))&&(this._valid=!1)}_move(i,h,m){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const g=i[0].sub(this._lastPoints[0]),_=i[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(g,_,m.timeStamp),this._valid?(this._lastPoints=i,this._active=!0,{pitchDelta:(g.y+_.y)/2*-.5}):void 0}gestureBeginsVertically(i,h,m){if(this._valid!==void 0)return this._valid;const g=i.mag()>=2,_=h.mag()>=2;if(!g&&!_)return;if(!g||!_)return this._firstMove===void 0&&(this._firstMove=m),m-this._firstMove<100&&void 0;const A=i.y>0==h.y>0;return kc(i)&&kc(h)&&A}}const sf={panStep:100,bearingStep:15,pitchStep:10};class xi{constructor(i){this._tr=new zi(i);const h=sf;this._panStep=h.panStep,this._bearingStep=h.bearingStep,this._pitchStep=h.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(i){if(i.altKey||i.ctrlKey||i.metaKey)return;let h=0,m=0,g=0,_=0,A=0;switch(i.keyCode){case 61:case 107:case 171:case 187:h=1;break;case 189:case 109:case 173:h=-1;break;case 37:i.shiftKey?m=-1:(i.preventDefault(),_=-1);break;case 39:i.shiftKey?m=1:(i.preventDefault(),_=1);break;case 38:i.shiftKey?g=1:(i.preventDefault(),A=-1);break;case 40:i.shiftKey?g=-1:(i.preventDefault(),A=1);break;default:return}return this._rotationDisabled&&(m=0,g=0),{cameraAnimation:M=>{const P=this._tr;M.easeTo({duration:300,easeId:"keyboardHandler",easing:ts,zoom:h?Math.round(P.zoom)+h*(i.shiftKey?2:1):P.zoom,bearing:P.bearing+m*this._bearingStep,pitch:P.pitch+g*this._pitchStep,offset:[-_*this._panStep,-A*this._panStep],center:P.center},{originalEvent:i})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function ts(x){return x*(2-x)}const yu=4.000244140625;class Oi{constructor(i,h){this._onTimeout=m=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(m)},this._map=i,this._tr=new zi(i),this._triggerRenderFrame=h,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(i){this._defaultZoomRate=i}setWheelZoomRate(i){this._wheelZoomRate=i}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(i){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!i&&i.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(i){return!!this._map.cooperativeGestures.isEnabled()&&!(i.ctrlKey||this._map.cooperativeGestures.isBypassed(i))}wheel(i){if(!this.isEnabled())return;if(this._shouldBePrevented(i))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",i);let h=i.deltaMode===WheelEvent.DOM_DELTA_LINE?40*i.deltaY:i.deltaY;const m=C.now(),g=m-(this._lastWheelEventTime||0);this._lastWheelEventTime=m,h!==0&&h%yu==0?this._type="wheel":h!==0&&Math.abs(h)<4?this._type="trackpad":g>400?(this._type=null,this._lastValue=h,this._timeout=setTimeout(this._onTimeout,40,i)):this._type||(this._type=Math.abs(g*h)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,h+=this._lastValue)),i.shiftKey&&h&&(h/=4),this._type&&(this._lastWheelEvent=i,this._delta-=h,this._active||this._start(i)),i.preventDefault()}_start(i){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const h=T.mousePos(this._map.getCanvas(),i),m=this._tr;this._around=h.y>m.transform.height/2-m.transform.getHorizon()?c.N.convert(this._aroundCenter?m.center:m.unproject(h)):c.N.convert(m.center),this._aroundPoint=m.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const i=this._tr.transform;if(this._delta!==0){const P=this._type==="wheel"&&Math.abs(this._delta)>yu?this._wheelZoomRate:this._defaultZoomRate;let V=2/(1+Math.exp(-Math.abs(this._delta*P)));this._delta<0&&V!==0&&(V=1/V);const O=typeof this._targetZoom=="number"?i.zoomScale(this._targetZoom):i.scale;this._targetZoom=Math.min(i.maxZoom,Math.max(i.minZoom,i.scaleZoom(O*V))),this._type==="wheel"&&(this._startZoom=i.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const h=typeof this._targetZoom=="number"?this._targetZoom:i.zoom,m=this._startZoom,g=this._easing;let _,A=!1;const M=C.now()-this._lastWheelEventTime;if(this._type==="wheel"&&m&&g&&M){const P=Math.min(M/200,1),V=g(P);_=c.y.number(m,h,V),P<1?this._frameId||(this._frameId=!0):A=!0}else _=h,A=!0;return this._active=!0,A&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!A,zoomDelta:_-i.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(i){let h=c.b9;if(this._prevEase){const m=this._prevEase,g=(C.now()-m.start)/m.duration,_=m.easing(g+.01)-m.easing(g),A=.27/Math.sqrt(_*_+1e-4)*.01,M=Math.sqrt(.0729-A*A);h=c.b8(A,M,.25,1)}return this._prevEase={start:C.now(),duration:i,easing:h},h}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class xo{constructor(i,h){this._clickZoom=i,this._tapZoom=h}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 t0{constructor(i){this._tr=new zi(i),this.reset()}reset(){this._active=!1}dblclick(i,h){return i.preventDefault(),{cameraAnimation:m=>{m.easeTo({duration:300,zoom:this._tr.zoom+(i.shiftKey?-1:1),around:this._tr.unproject(h)},{originalEvent:i})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class n0{constructor(){this._tap=new bc({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(i,h,m){if(!this._swipePoint)if(this._tapTime){const g=h[0],_=i.timeStamp-this._tapTime<500,A=this._tapPoint.dist(g)<30;_&&A?m.length>0&&(this._swipePoint=g,this._swipeTouch=m[0].identifier):this.reset()}else this._tap.touchstart(i,h,m)}touchmove(i,h,m){if(this._tapTime){if(this._swipePoint){if(m[0].identifier!==this._swipeTouch)return;const g=h[0],_=g.y-this._swipePoint.y;return this._swipePoint=g,i.preventDefault(),this._active=!0,{zoomDelta:_/128}}}else this._tap.touchmove(i,h,m)}touchend(i,h,m){if(this._tapTime)this._swipePoint&&m.length===0&&this.reset();else{const g=this._tap.touchend(i,h,m);g&&(this._tapTime=i.timeStamp,this._tapPoint=g)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class of{constructor(i,h,m){this._el=i,this._mousePan=h,this._touchPan=m}enable(i){this._inertiaOptions=i||{},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 af{constructor(i,h,m){this._pitchWithRotate=i.pitchWithRotate,this._mouseRotate=h,this._mousePitch=m}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 _u{constructor(i,h,m,g){this._el=i,this._touchZoom=h,this._touchRotate=m,this._tapDragZoom=g,this._rotationDisabled=!1,this._enabled=!0}enable(i){this._touchZoom.enable(i),this._rotationDisabled||this._touchRotate.enable(i),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}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 ia{constructor(i,h){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=i,this._options=h,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const i=this._map.getCanvasContainer();i.classList.add("maplibregl-cooperative-gestures"),this._container=T.create("div","maplibregl-cooperative-gesture-screen",i);let h=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(h=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const m=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),g=document.createElement("div");g.className="maplibregl-desktop-message",g.textContent=h,this._container.appendChild(g);const _=document.createElement("div");_.className="maplibregl-mobile-message",_.textContent=m,this._container.appendChild(_),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(T.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(i){return i[this._bypassKey]}notifyGestureBlocked(i,h){this._enabled&&(this._map.fire(new c.k("cooperativegestureprevented",{gestureType:i,originalEvent:h})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const vi=x=>x.zoom||x.drag||x.pitch||x.rotate;class dt extends c.k{}function Ec(x){return x.panDelta&&x.panDelta.mag()||x.zoomDelta||x.bearingDelta||x.pitchDelta}class bu{constructor(i,h){this.handleWindowEvent=g=>{this.handleEvent(g,`${g.type}Window`)},this.handleEvent=(g,_)=>{if(g.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const A=g.type==="renderFrame"?void 0:g,M={needsRenderFrame:!1},P={},V={},O=g.touches,L=O?this._getMapTouches(O):void 0,G=L?T.touchPos(this._map.getCanvas(),L):T.mousePos(this._map.getCanvas(),g);for(const{handlerName:ie,handler:ae,allowed:ce}of this._handlers){if(!ae.isEnabled())continue;let he;this._blockedByActive(V,ce,ie)?ae.reset():ae[_||g.type]&&(he=ae[_||g.type](g,G,L),this.mergeHandlerResult(M,P,he,ie,A),he&&he.needsRenderFrame&&this._triggerRenderFrame()),(he||ae.isActive())&&(V[ie]=ae)}const K={};for(const ie in this._previousActiveHandlers)V[ie]||(K[ie]=A);this._previousActiveHandlers=V,(Object.keys(K).length||Ec(M))&&(this._changes.push([M,P,K]),this._triggerRenderFrame()),(Object.keys(V).length||Ec(M))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:ee}=M;ee&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],ee(this._map))},this._map=i,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new au(i),this._bearingSnap=h.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(h);const m=this._el;this._listeners=[[m,"touchstart",{passive:!0}],[m,"touchmove",{passive:!1}],[m,"touchend",void 0],[m,"touchcancel",void 0],[m,"mousedown",void 0],[m,"mousemove",void 0],[m,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[m,"mouseover",void 0],[m,"mouseout",void 0],[m,"dblclick",void 0],[m,"click",void 0],[m,"keydown",{capture:!1}],[m,"keyup",void 0],[m,"wheel",{passive:!1}],[m,"contextmenu",void 0],[window,"blur",void 0]];for(const[g,_,A]of this._listeners)T.addEventListener(g,_,g===document?this.handleWindowEvent:this.handleEvent,A)}destroy(){for(const[i,h,m]of this._listeners)T.removeEventListener(i,h,i===document?this.handleWindowEvent:this.handleEvent,m)}_addDefaultHandlers(i){const h=this._map,m=h.getCanvasContainer();this._add("mapEvent",new rf(h,i));const g=h.boxZoom=new oi(h,i);this._add("boxZoom",g),i.interactive&&i.boxZoom&&g.enable();const _=h.cooperativeGestures=new ia(h,i.cooperativeGestures);this._add("cooperativeGestures",_),i.cooperativeGestures&&_.enable();const A=new ra(h),M=new t0(h);h.doubleClickZoom=new xo(M,A),this._add("tapZoom",A),this._add("clickZoom",M),i.interactive&&i.doubleClickZoom&&h.doubleClickZoom.enable();const P=new n0;this._add("tapDragZoom",P);const V=h.touchPitch=new ol(h);this._add("touchPitch",V),i.interactive&&i.touchPitch&&h.touchPitch.enable(i.touchPitch);const O=uu(i),L=hu(i);h.dragRotate=new af(i,O,L),this._add("mouseRotate",O,["mousePitch"]),this._add("mousePitch",L,["mouseRotate"]),i.interactive&&i.dragRotate&&h.dragRotate.enable();const G=(({enable:he,clickTolerance:te})=>{const ge=new xc({checkCorrectEvent:_e=>T.mouseButton(_e)===0&&!_e.ctrlKey});return new ys({clickTolerance:te,move:(_e,we)=>({around:we,panDelta:we.sub(_e)}),activateOnStart:!0,moveStateManager:ge,enable:he,assignEvents:vc})})(i),K=new bo(i,h);h.dragPan=new of(m,G,K),this._add("mousePan",G),this._add("touchPan",K,["touchZoom","touchRotate"]),i.interactive&&i.dragPan&&h.dragPan.enable(i.dragPan);const ee=new gu,ie=new fu;h.touchZoomRotate=new _u(m,ie,ee,P),this._add("touchRotate",ee,["touchPan","touchZoom"]),this._add("touchZoom",ie,["touchPan","touchRotate"]),i.interactive&&i.touchZoomRotate&&h.touchZoomRotate.enable(i.touchZoomRotate);const ae=h.scrollZoom=new Oi(h,()=>this._triggerRenderFrame());this._add("scrollZoom",ae,["mousePan"]),i.interactive&&i.scrollZoom&&h.scrollZoom.enable(i.scrollZoom);const ce=h.keyboard=new xi(h);this._add("keyboard",ce),i.interactive&&i.keyboard&&h.keyboard.enable(),this._add("blockableMapEvent",new tr(h))}_add(i,h,m){this._handlers.push({handlerName:i,handler:h,allowed:m}),this._handlersById[i]=h}stop(i){if(!this._updatingCamera){for(const{handler:h}of this._handlers)h.reset();this._inertia.clear(),this._fireEvents({},{},i),this._changes=[]}}isActive(){for(const{handler:i}of this._handlers)if(i.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!vi(this._eventsInProgress)||this.isZooming()}_blockedByActive(i,h,m){for(const g in i)if(g!==m&&(!h||h.indexOf(g)<0))return!0;return!1}_getMapTouches(i){const h=[];for(const m of i)this._el.contains(m.target)&&h.push(m);return h}mergeHandlerResult(i,h,m,g,_){if(!m)return;c.e(i,m);const A={handlerName:g,originalEvent:m.originalEvent||_};m.zoomDelta!==void 0&&(h.zoom=A),m.panDelta!==void 0&&(h.drag=A),m.pitchDelta!==void 0&&(h.pitch=A),m.bearingDelta!==void 0&&(h.rotate=A)}_applyChanges(){const i={},h={},m={};for(const[g,_,A]of this._changes)g.panDelta&&(i.panDelta=(i.panDelta||new c.P(0,0))._add(g.panDelta)),g.zoomDelta&&(i.zoomDelta=(i.zoomDelta||0)+g.zoomDelta),g.bearingDelta&&(i.bearingDelta=(i.bearingDelta||0)+g.bearingDelta),g.pitchDelta&&(i.pitchDelta=(i.pitchDelta||0)+g.pitchDelta),g.around!==void 0&&(i.around=g.around),g.pinchAround!==void 0&&(i.pinchAround=g.pinchAround),g.noInertia&&(i.noInertia=g.noInertia),c.e(h,_),c.e(m,A);this._updateMapTransform(i,h,m),this._changes=[]}_updateMapTransform(i,h,m){const g=this._map,_=g._getTransformForUpdate(),A=g.terrain;if(!(Ec(i)||A&&this._terrainMovement))return this._fireEvents(h,m,!0);let{panDelta:M,zoomDelta:P,bearingDelta:V,pitchDelta:O,around:L,pinchAround:G}=i;G!==void 0&&(L=G),g._stop(!0),L=L||g.transform.centerPoint;const K=_.pointLocation(M?L.sub(M):L);V&&(_.bearing+=V),O&&(_.pitch+=O),P&&(_.zoom+=P),A?this._terrainMovement||!h.drag&&!h.zoom?h.drag&&this._terrainMovement?_.center=_.pointLocation(_.centerPoint.sub(M)):_.setLocationAtPoint(K,L):(this._terrainMovement=!0,this._map._elevationFreeze=!0,_.setLocationAtPoint(K,L)):_.setLocationAtPoint(K,L),g._applyUpdatedTransform(_),this._map._update(),i.noInertia||this._inertia.record(i),this._fireEvents(h,m,!0)}_fireEvents(i,h,m){const g=vi(this._eventsInProgress),_=vi(i),A={};for(const L in i){const{originalEvent:G}=i[L];this._eventsInProgress[L]||(A[`${L}start`]=G),this._eventsInProgress[L]=i[L]}!g&&_&&this._fireEvent("movestart",_.originalEvent);for(const L in A)this._fireEvent(L,A[L]);_&&this._fireEvent("move",_.originalEvent);for(const L in i){const{originalEvent:G}=i[L];this._fireEvent(L,G)}const M={};let P;for(const L in this._eventsInProgress){const{handlerName:G,originalEvent:K}=this._eventsInProgress[L];this._handlersById[G].isActive()||(delete this._eventsInProgress[L],P=h[G]||K,M[`${L}end`]=P)}for(const L in M)this._fireEvent(L,M[L]);const V=vi(this._eventsInProgress),O=(g||_)&&!V;if(O&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const L=this._map._getTransformForUpdate();L.recalculateZoom(this._map.terrain),this._map._applyUpdatedTransform(L)}if(m&&O){this._updatingCamera=!0;const L=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),G=K=>K!==0&&-this._bearingSnap<K&&K<this._bearingSnap;!L||!L.essential&&C.prefersReducedMotion?(this._map.fire(new c.k("moveend",{originalEvent:P})),G(this._map.getBearing())&&this._map.resetNorth()):(G(L.bearing||this._map.getBearing())&&(L.bearing=0),L.freezeElevation=!0,this._map.easeTo(L,{originalEvent:P})),this._updatingCamera=!1}}_fireEvent(i,h){this._map.fire(new c.k(i,h?{originalEvent:h}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(i=>{delete this._frameId,this.handleEvent(new dt("renderFrame",{timeStamp:i})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class lf extends c.E{constructor(i,h){super(),this._renderFrameCallback=()=>{const m=Math.min((C.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(m)),m<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=i,this._bearingSnap=h.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new c.N(this.transform.center.lng,this.transform.center.lat)}setCenter(i,h){return this.jumpTo({center:i},h)}panBy(i,h,m){return i=c.P.convert(i).mult(-1),this.panTo(this.transform.center,c.e({offset:i},h),m)}panTo(i,h,m){return this.easeTo(c.e({center:i},h),m)}getZoom(){return this.transform.zoom}setZoom(i,h){return this.jumpTo({zoom:i},h),this}zoomTo(i,h,m){return this.easeTo(c.e({zoom:i},h),m)}zoomIn(i,h){return this.zoomTo(this.getZoom()+1,i,h),this}zoomOut(i,h){return this.zoomTo(this.getZoom()-1,i,h),this}getBearing(){return this.transform.bearing}setBearing(i,h){return this.jumpTo({bearing:i},h),this}getPadding(){return this.transform.padding}setPadding(i,h){return this.jumpTo({padding:i},h),this}rotateTo(i,h,m){return this.easeTo(c.e({bearing:i},h),m)}resetNorth(i,h){return this.rotateTo(0,c.e({duration:1e3},i),h),this}resetNorthPitch(i,h){return this.easeTo(c.e({bearing:0,pitch:0,duration:1e3},i),h),this}snapToNorth(i,h){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(i,h):this}getPitch(){return this.transform.pitch}setPitch(i,h){return this.jumpTo({pitch:i},h),this}cameraForBounds(i,h){i=Ce.convert(i).adjustAntiMeridian();const m=h&&h.bearing||0;return this._cameraForBoxAndBearing(i.getNorthWest(),i.getSouthEast(),m,h)}_cameraForBoxAndBearing(i,h,m,g){const _={top:0,bottom:0,right:0,left:0};if(typeof(g=c.e({padding:_,offset:[0,0],maxZoom:this.transform.maxZoom},g)).padding=="number"){const Ge=g.padding;g.padding={top:Ge,bottom:Ge,right:Ge,left:Ge}}g.padding=c.e(_,g.padding);const A=this.transform,M=A.padding,P=new Ce(i,h),V=A.project(P.getNorthWest()),O=A.project(P.getNorthEast()),L=A.project(P.getSouthEast()),G=A.project(P.getSouthWest()),K=c.ba(-m),ee=V.rotate(K),ie=O.rotate(K),ae=L.rotate(K),ce=G.rotate(K),he=new c.P(Math.max(ee.x,ie.x,ce.x,ae.x),Math.max(ee.y,ie.y,ce.y,ae.y)),te=new c.P(Math.min(ee.x,ie.x,ce.x,ae.x),Math.min(ee.y,ie.y,ce.y,ae.y)),ge=he.sub(te),_e=(A.width-(M.left+M.right+g.padding.left+g.padding.right))/ge.x,we=(A.height-(M.top+M.bottom+g.padding.top+g.padding.bottom))/ge.y;if(we<0||_e<0)return void c.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");const Ne=Math.min(A.scaleZoom(A.scale*Math.min(_e,we)),g.maxZoom),$e=c.P.convert(g.offset),Qe=new c.P((g.padding.left-g.padding.right)/2,(g.padding.top-g.padding.bottom)/2).rotate(c.ba(m)),at=$e.add(Qe).mult(A.scale/A.zoomScale(Ne));return{center:A.unproject(V.add(L).div(2).sub(at)),zoom:Ne,bearing:m}}fitBounds(i,h,m){return this._fitInternal(this.cameraForBounds(i,h),h,m)}fitScreenCoordinates(i,h,m,g,_){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(c.P.convert(i)),this.transform.pointLocation(c.P.convert(h)),m,g),g,_)}_fitInternal(i,h,m){return i?(delete(h=c.e(i,h)).padding,h.linear?this.easeTo(h,m):this.flyTo(h,m)):this}jumpTo(i,h){this.stop();const m=this._getTransformForUpdate();let g=!1,_=!1,A=!1;return"zoom"in i&&m.zoom!==+i.zoom&&(g=!0,m.zoom=+i.zoom),i.center!==void 0&&(m.center=c.N.convert(i.center)),"bearing"in i&&m.bearing!==+i.bearing&&(_=!0,m.bearing=+i.bearing),"pitch"in i&&m.pitch!==+i.pitch&&(A=!0,m.pitch=+i.pitch),i.padding==null||m.isPaddingEqual(i.padding)||(m.padding=i.padding),this._applyUpdatedTransform(m),this.fire(new c.k("movestart",h)).fire(new c.k("move",h)),g&&this.fire(new c.k("zoomstart",h)).fire(new c.k("zoom",h)).fire(new c.k("zoomend",h)),_&&this.fire(new c.k("rotatestart",h)).fire(new c.k("rotate",h)).fire(new c.k("rotateend",h)),A&&this.fire(new c.k("pitchstart",h)).fire(new c.k("pitch",h)).fire(new c.k("pitchend",h)),this.fire(new c.k("moveend",h))}calculateCameraOptionsFromTo(i,h,m,g=0){const _=c.Z.fromLngLat(i,h),A=c.Z.fromLngLat(m,g),M=A.x-_.x,P=A.y-_.y,V=A.z-_.z,O=Math.hypot(M,P,V);if(O===0)throw new Error("Can't calculate camera options with same From and To");const L=Math.hypot(M,P),G=this.transform.scaleZoom(this.transform.cameraToCenterDistance/O/this.transform.tileSize),K=180*Math.atan2(M,-P)/Math.PI;let ee=180*Math.acos(L/O)/Math.PI;return ee=V<0?90-ee:90+ee,{center:A.toLngLat(),zoom:G,pitch:ee,bearing:K}}easeTo(i,h){var m;this._stop(!1,i.easeId),((i=c.e({offset:[0,0],duration:500,easing:c.b9},i)).animate===!1||!i.essential&&C.prefersReducedMotion)&&(i.duration=0);const g=this._getTransformForUpdate(),_=g.zoom,A=g.bearing,M=g.pitch,P=g.padding,V="bearing"in i?this._normalizeBearing(i.bearing,A):A,O="pitch"in i?+i.pitch:M,L="padding"in i?i.padding:g.padding,G=c.P.convert(i.offset);let K=g.centerPoint.add(G);const ee=g.pointLocation(K),{center:ie,zoom:ae}=g.getConstrained(c.N.convert(i.center||ee),(m=i.zoom)!==null&&m!==void 0?m:_);this._normalizeCenter(ie,g);const ce=g.project(ee),he=g.project(ie).sub(ce),te=g.zoomScale(ae-_);let ge,_e;i.around&&(ge=c.N.convert(i.around),_e=g.locationPoint(ge));const we={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||ae!==_,this._rotating=this._rotating||A!==V,this._pitching=this._pitching||O!==M,this._padding=!g.isPaddingEqual(L),this._easeId=i.easeId,this._prepareEase(h,i.noMoveStart,we),this.terrain&&this._prepareElevation(ie),this._ease(Ne=>{if(this._zooming&&(g.zoom=c.y.number(_,ae,Ne)),this._rotating&&(g.bearing=c.y.number(A,V,Ne)),this._pitching&&(g.pitch=c.y.number(M,O,Ne)),this._padding&&(g.interpolatePadding(P,L,Ne),K=g.centerPoint.add(G)),this.terrain&&!i.freezeElevation&&this._updateElevation(Ne),ge)g.setLocationAtPoint(ge,_e);else{const $e=g.zoomScale(g.zoom-_),Qe=ae>_?Math.min(2,te):Math.max(.5,te),at=Math.pow(Qe,1-Ne),Ge=g.unproject(ce.add(he.mult(Ne*at)).mult($e));g.setLocationAtPoint(g.renderWorldCopies?Ge.wrap():Ge,K)}this._applyUpdatedTransform(g),this._fireMoveEvents(h)},Ne=>{this.terrain&&i.freezeElevation&&this._finalizeElevation(),this._afterEase(h,Ne)},i),this}_prepareEase(i,h,m={}){this._moving=!0,h||m.moving||this.fire(new c.k("movestart",i)),this._zooming&&!m.zooming&&this.fire(new c.k("zoomstart",i)),this._rotating&&!m.rotating&&this.fire(new c.k("rotatestart",i)),this._pitching&&!m.pitching&&this.fire(new c.k("pitchstart",i))}_prepareElevation(i){this._elevationCenter=i,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(i,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(i){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const h=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(i<1&&h!==this._elevationTarget){const m=this._elevationTarget-this._elevationStart;this._elevationStart+=i*(m-(h-(m*i+this._elevationStart))/(1-i)),this._elevationTarget=h}this.transform.elevation=c.y.number(this._elevationStart,this._elevationTarget,i)}_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(i){const h=i.getCameraPosition(),m=this.terrain.getElevationForLngLatZoom(h.lngLat,i.zoom);if(h.altitude<m){const g=this.calculateCameraOptionsFromTo(h.lngLat,m,i.center,i.elevation);return{pitch:g.pitch,zoom:g.zoom}}return{}}_applyUpdatedTransform(i){const h=[];if(this.terrain&&h.push(g=>this._elevateCameraIfInsideTerrain(g)),this.transformCameraUpdate&&h.push(g=>this.transformCameraUpdate(g)),!h.length)return;const m=i.clone();for(const g of h){const _=m.clone(),{center:A,zoom:M,pitch:P,bearing:V,elevation:O}=g(_);A&&(_.center=A),M!==void 0&&(_.zoom=M),P!==void 0&&(_.pitch=P),V!==void 0&&(_.bearing=V),O!==void 0&&(_.elevation=O),m.apply(_)}this.transform.apply(m)}_fireMoveEvents(i){this.fire(new c.k("move",i)),this._zooming&&this.fire(new c.k("zoom",i)),this._rotating&&this.fire(new c.k("rotate",i)),this._pitching&&this.fire(new c.k("pitch",i))}_afterEase(i,h){if(this._easeId&&h&&this._easeId===h)return;delete this._easeId;const m=this._zooming,g=this._rotating,_=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,m&&this.fire(new c.k("zoomend",i)),g&&this.fire(new c.k("rotateend",i)),_&&this.fire(new c.k("pitchend",i)),this.fire(new c.k("moveend",i))}flyTo(i,h){var m;if(!i.essential&&C.prefersReducedMotion){const it=c.M(i,["center","zoom","bearing","pitch","around"]);return this.jumpTo(it,h)}this.stop(),i=c.e({offset:[0,0],speed:1.2,curve:1.42,easing:c.b9},i);const g=this._getTransformForUpdate(),_=g.zoom,A=g.bearing,M=g.pitch,P=g.padding,V="bearing"in i?this._normalizeBearing(i.bearing,A):A,O="pitch"in i?+i.pitch:M,L="padding"in i?i.padding:g.padding,G=c.P.convert(i.offset);let K=g.centerPoint.add(G);const ee=g.pointLocation(K),{center:ie,zoom:ae}=g.getConstrained(c.N.convert(i.center||ee),(m=i.zoom)!==null&&m!==void 0?m:_);this._normalizeCenter(ie,g);const ce=g.zoomScale(ae-_),he=g.project(ee),te=g.project(ie).sub(he);let ge=i.curve;const _e=Math.max(g.width,g.height),we=_e/ce,Ne=te.mag();if("minZoom"in i){const it=c.ac(Math.min(i.minZoom,_,ae),g.minZoom,g.maxZoom),Mt=_e/g.zoomScale(it-_);ge=Math.sqrt(Mt/Ne*2)}const $e=ge*ge;function Qe(it){const Mt=(we*we-_e*_e+(it?-1:1)*$e*$e*Ne*Ne)/(2*(it?we:_e)*$e*Ne);return Math.log(Math.sqrt(Mt*Mt+1)-Mt)}function at(it){return(Math.exp(it)-Math.exp(-it))/2}function Ge(it){return(Math.exp(it)+Math.exp(-it))/2}const qe=Qe(!1);let mt=function(it){return Ge(qe)/Ge(qe+ge*it)},Rt=function(it){return _e*((Ge(qe)*(at(Mt=qe+ge*it)/Ge(Mt))-at(qe))/$e)/Ne;var Mt},Ye=(Qe(!0)-qe)/ge;if(Math.abs(Ne)<1e-6||!isFinite(Ye)){if(Math.abs(_e-we)<1e-6)return this.easeTo(i,h);const it=we<_e?-1:1;Ye=Math.abs(Math.log(we/_e))/ge,Rt=()=>0,mt=Mt=>Math.exp(it*ge*Mt)}return i.duration="duration"in i?+i.duration:1e3*Ye/("screenSpeed"in i?+i.screenSpeed/ge:+i.speed),i.maxDuration&&i.duration>i.maxDuration&&(i.duration=0),this._zooming=!0,this._rotating=A!==V,this._pitching=O!==M,this._padding=!g.isPaddingEqual(L),this._prepareEase(h,!1),this.terrain&&this._prepareElevation(ie),this._ease(it=>{const Mt=it*Ye,Ln=1/mt(Mt);g.zoom=it===1?ae:_+g.scaleZoom(Ln),this._rotating&&(g.bearing=c.y.number(A,V,it)),this._pitching&&(g.pitch=c.y.number(M,O,it)),this._padding&&(g.interpolatePadding(P,L,it),K=g.centerPoint.add(G)),this.terrain&&!i.freezeElevation&&this._updateElevation(it);const Lt=it===1?ie:g.unproject(he.add(te.mult(Rt(Mt))).mult(Ln));g.setLocationAtPoint(g.renderWorldCopies?Lt.wrap():Lt,K),this._applyUpdatedTransform(g),this._fireMoveEvents(h)},()=>{this.terrain&&i.freezeElevation&&this._finalizeElevation(),this._afterEase(h)},i),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(i,h){var m;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const g=this._onEaseEnd;delete this._onEaseEnd,g.call(this,h)}return i||(m=this.handlers)===null||m===void 0||m.stop(!1),this}_ease(i,h,m){m.animate===!1||m.duration===0?(i(1),h()):(this._easeStart=C.now(),this._easeOptions=m,this._onEaseFrame=i,this._onEaseEnd=h,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(i,h){i=c.b3(i,-180,180);const m=Math.abs(i-h);return Math.abs(i-360-h)<m&&(i-=360),Math.abs(i+360-h)<m&&(i+=360),i}_normalizeCenter(i,h){if(!h.renderWorldCopies||h.lngRange)return;const m=i.lng-h.center.lng;i.lng+=m>180?-360:m<-180?360:0}queryTerrainElevation(i){return this.terrain?this.terrain.getElevationForLngLatZoom(c.N.convert(i),this.transform.tileZoom)-this.transform.elevation:null}}const sa={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class oa{constructor(i=sa){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=h=>{!h||h.sourceDataType!=="metadata"&&h.sourceDataType!=="visibility"&&h.dataType!=="style"&&h.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=i}getDefaultPosition(){return"bottom-right"}onAdd(i){return this._map=i,this._compact=this.options.compact,this._container=T.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=T.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=T.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(){T.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(i,h){const m=this._map._getUIString(`AttributionControl.${h}`);i.title=m,i.setAttribute("aria-label",m)}_updateAttributions(){if(!this._map.style)return;let i=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?i=i.concat(this.options.customAttribution.map(g=>typeof g!="string"?"":g)):typeof this.options.customAttribution=="string"&&i.push(this.options.customAttribution)),this._map.style.stylesheet){const g=this._map.style.stylesheet;this.styleOwner=g.owner,this.styleId=g.id}const h=this._map.style.sourceCaches;for(const g in h){const _=h[g];if(_.used||_.usedForTerrain){const A=_.getSource();A.attribution&&i.indexOf(A.attribution)<0&&i.push(A.attribution)}}i=i.filter(g=>String(g).trim()),i.sort((g,_)=>g.length-_.length),i=i.filter((g,_)=>{for(let A=_+1;A<i.length;A++)if(i[A].indexOf(g)>=0)return!1;return!0});const m=i.join(" | ");m!==this._attribHTML&&(this._attribHTML=m,i.length?(this._innerContainer.innerHTML=m,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class xu{constructor(i={}){this._updateCompact=()=>{const h=this._container.children;if(h.length){const m=h[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&m.classList.add("maplibregl-compact"):m.classList.remove("maplibregl-compact")}},this.options=i}getDefaultPosition(){return"bottom-left"}onAdd(i){this._map=i,this._compact=this.options&&this.options.compact,this._container=T.create("div","maplibregl-ctrl");const h=T.create("a","maplibregl-ctrl-logo");return h.target="_blank",h.rel="noopener nofollow",h.href="https://maplibre.org/",h.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),h.setAttribute("rel","noopener nofollow"),this._container.appendChild(h),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){T.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class Xt{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(i){const h=++this._id;return this._queue.push({callback:i,id:h,cancelled:!1}),h}remove(i){const h=this._currentlyRunning,m=h?this._queue.concat(h):this._queue;for(const g of m)if(g.id===i)return void(g.cancelled=!0)}run(i=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const h=this._currentlyRunning=this._queue;this._queue=[];for(const m of h)if(!m.cancelled&&(m.callback(i),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var vu=c.Y([{name:"a_pos3d",type:"Int16",components:3}]);class r0 extends c.E{constructor(i){super(),this.sourceCache=i,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,i.usedForTerrain=!0,i.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(i,h){this.sourceCache.update(i,h),this._renderableTilesKeys=[];const m={};for(const g of i.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:h}))m[g.key]=!0,this._renderableTilesKeys.push(g.key),this._tiles[g.key]||(g.posMatrix=new Float64Array(16),c.aP(g.posMatrix,0,c.X,0,c.X,0,1),this._tiles[g.key]=new Pi(g,this.tileSize));for(const g in this._tiles)m[g]||delete this._tiles[g]}freeRtt(i){for(const h in this._tiles){const m=this._tiles[h];(!i||m.tileID.equals(i)||m.tileID.isChildOf(i)||i.isChildOf(m.tileID))&&(m.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(i=>this.getTileByID(i))}getTileByID(i){return this._tiles[i]}getTerrainCoords(i){const h={};for(const m of this._renderableTilesKeys){const g=this._tiles[m].tileID;if(g.canonical.equals(i.canonical)){const _=i.clone();_.posMatrix=new Float64Array(16),c.aP(_.posMatrix,0,c.X,0,c.X,0,1),h[m]=_}else if(g.canonical.isChildOf(i.canonical)){const _=i.clone();_.posMatrix=new Float64Array(16);const A=g.canonical.z-i.canonical.z,M=g.canonical.x-(g.canonical.x>>A<<A),P=g.canonical.y-(g.canonical.y>>A<<A),V=c.X>>A;c.aP(_.posMatrix,0,V,0,V,0,1),c.J(_.posMatrix,_.posMatrix,[-M*V,-P*V,0]),h[m]=_}else if(i.canonical.isChildOf(g.canonical)){const _=i.clone();_.posMatrix=new Float64Array(16);const A=i.canonical.z-g.canonical.z,M=i.canonical.x-(i.canonical.x>>A<<A),P=i.canonical.y-(i.canonical.y>>A<<A),V=c.X>>A;c.aP(_.posMatrix,0,c.X,0,c.X,0,1),c.J(_.posMatrix,_.posMatrix,[M*V,P*V,0]),c.K(_.posMatrix,_.posMatrix,[1/2**A,1/2**A,0]),h[m]=_}}return h}getSourceTile(i,h){const m=this.sourceCache._source;let g=i.overscaledZ-this.deltaZoom;if(g>m.maxzoom&&(g=m.maxzoom),g<m.minzoom)return null;this._sourceTileCache[i.key]||(this._sourceTileCache[i.key]=i.scaledTo(g).key);let _=this.sourceCache.getTileByID(this._sourceTileCache[i.key]);if((!_||!_.dem)&&h)for(;g>=m.minzoom&&(!_||!_.dem);)_=this.sourceCache.getTileByID(i.scaledTo(g--).key);return _}tilesAfterTime(i=Date.now()){return Object.values(this._tiles).filter(h=>h.timeAdded>=i)}}class wu{constructor(i,h,m){this.painter=i,this.sourceCache=new r0(h),this.options=m,this.exaggeration=typeof m.exaggeration=="number"?m.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(i,h,m,g=c.X){var _;if(!(h>=0&&h<g&&m>=0&&m<g))return 0;const A=this.getTerrainData(i),M=(_=A.tile)===null||_===void 0?void 0:_.dem;if(!M)return 0;const P=function(ee,ie,ae){var ce=ie[0],he=ie[1];return ee[0]=ae[0]*ce+ae[4]*he+ae[12],ee[1]=ae[1]*ce+ae[5]*he+ae[13],ee}([],[h/g*c.X,m/g*c.X],A.u_terrain_matrix),V=[P[0]*M.dim,P[1]*M.dim],O=Math.floor(V[0]),L=Math.floor(V[1]),G=V[0]-O,K=V[1]-L;return M.get(O,L)*(1-G)*(1-K)+M.get(O+1,L)*G*(1-K)+M.get(O,L+1)*(1-G)*K+M.get(O+1,L+1)*G*K}getElevationForLngLatZoom(i,h){if(!c.bb(h,i.wrap()))return 0;const{tileID:m,mercatorX:g,mercatorY:_}=this._getOverscaledTileIDFromLngLatZoom(i,h);return this.getElevation(m,g%c.X,_%c.X,c.X)}getElevation(i,h,m,g=c.X){return this.getDEMElevation(i,h,m,g)*this.exaggeration}getTerrainData(i){if(!this._emptyDemTexture){const g=this.painter.context,_=new c.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new tt(g,_,g.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new tt(g,new c.R({width:1,height:1}),g.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(g.gl.NEAREST,g.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=c.an([])}const h=this.sourceCache.getSourceTile(i,!0);if(h&&h.dem&&(!h.demTexture||h.needsTerrainPrepare)){const g=this.painter.context;h.demTexture=this.painter.getTileTexture(h.dem.stride),h.demTexture?h.demTexture.update(h.dem.getPixels(),{premultiply:!1}):h.demTexture=new tt(g,h.dem.getPixels(),g.gl.RGBA,{premultiply:!1}),h.demTexture.bind(g.gl.NEAREST,g.gl.CLAMP_TO_EDGE),h.needsTerrainPrepare=!1}const m=h&&h+h.tileID.key+i.key;if(m&&!this._demMatrixCache[m]){const g=this.sourceCache.sourceCache._source.maxzoom;let _=i.canonical.z-h.tileID.canonical.z;i.overscaledZ>i.canonical.z&&(i.canonical.z>=g?_=i.canonical.z-g:c.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const A=i.canonical.x-(i.canonical.x>>_<<_),M=i.canonical.y-(i.canonical.y>>_<<_),P=c.bc(new Float64Array(16),[1/(c.X<<_),1/(c.X<<_),0]);c.J(P,P,[A*c.X,M*c.X,0]),this._demMatrixCache[i.key]={matrix:P,coord:i}}return{u_depth:2,u_terrain:3,u_terrain_dim:h&&h.dem&&h.dem.dim||1,u_terrain_matrix:m?this._demMatrixCache[i.key].matrix:this._emptyDemMatrix,u_terrain_unpack:h&&h.dem&&h.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(h&&h.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:h}}getFramebuffer(i){const h=this.painter,m=h.width/devicePixelRatio,g=h.height/devicePixelRatio;return!this._fbo||this._fbo.width===m&&this._fbo.height===g||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new tt(h.context,{width:m,height:g,data:null},h.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(h.context.gl.NEAREST,h.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new tt(h.context,{width:m,height:g,data:null},h.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(h.context.gl.NEAREST,h.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=h.context.createFramebuffer(m,g,!0,!1),this._fbo.depthAttachment.set(h.context.createRenderbuffer(h.context.gl.DEPTH_COMPONENT16,m,g))),this._fbo.colorAttachment.set(i==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const i=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const h=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let _=0,A=0;_<this._coordsTextureSize;_++)for(let M=0;M<this._coordsTextureSize;M++,A+=4)h[A+0]=255&M,h[A+1]=255&_,h[A+2]=M>>8<<4|_>>8,h[A+3]=0;const m=new c.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(h.buffer)),g=new tt(i,m,i.gl.RGBA,{premultiply:!1});return g.bind(i.gl.NEAREST,i.gl.CLAMP_TO_EDGE),this._coordsTexture=g,g}pointCoordinate(i){this.painter.maybeDrawDepthAndCoords(!0);const h=new Uint8Array(4),m=this.painter.context,g=m.gl,_=Math.round(i.x*this.painter.pixelRatio/devicePixelRatio),A=Math.round(i.y*this.painter.pixelRatio/devicePixelRatio),M=Math.round(this.painter.height/devicePixelRatio);m.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),g.readPixels(_,M-A-1,1,1,g.RGBA,g.UNSIGNED_BYTE,h),m.bindFramebuffer.set(null);const P=h[0]+(h[2]>>4<<8),V=h[1]+((15&h[2])<<8),O=this.coordsIndex[255-h[3]],L=O&&this.sourceCache.getTileByID(O);if(!L)return null;const G=this._coordsTextureSize,K=(1<<L.tileID.canonical.z)*G;return new c.Z((L.tileID.canonical.x*G+P)/K+L.tileID.wrap,(L.tileID.canonical.y*G+V)/K,this.getElevation(L.tileID,P,V,G))}depthAtPoint(i){const h=new Uint8Array(4),m=this.painter.context,g=m.gl;return m.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),g.readPixels(i.x,this.painter.height/devicePixelRatio-i.y-1,1,1,g.RGBA,g.UNSIGNED_BYTE,h),m.bindFramebuffer.set(null),(h[0]/16777216+h[1]/65536+h[2]/256+h[3])/256}getTerrainMesh(){if(this._mesh)return this._mesh;const i=this.painter.context,h=new c.bd,m=new c.aY,g=this.meshSize,_=c.X/g,A=g*g;for(let L=0;L<=g;L++)for(let G=0;G<=g;G++)h.emplaceBack(G*_,L*_,0);for(let L=0;L<A;L+=g+1)for(let G=0;G<g;G++)m.emplaceBack(G+L,g+G+L+1,g+G+L+2),m.emplaceBack(G+L,g+G+L+2,G+L+1);const M=h.length,P=M+2*(g+1);for(const L of[0,1])for(let G=0;G<=g;G++)for(const K of[0,1])h.emplaceBack(G*_,L*c.X,K);for(let L=0;L<2*g;L+=2)m.emplaceBack(P+L,P+L+1,P+L+3),m.emplaceBack(P+L,P+L+3,P+L+2),m.emplaceBack(M+L,M+L+3,M+L+1),m.emplaceBack(M+L,M+L+2,M+L+3);const V=h.length,O=V+2*(g+1);for(const L of[0,1])for(let G=0;G<=g;G++)for(const K of[0,1])h.emplaceBack(L*c.X,G*_,K);for(let L=0;L<2*g;L+=2)m.emplaceBack(V+L,V+L+1,V+L+3),m.emplaceBack(V+L,V+L+3,V+L+2),m.emplaceBack(O+L,O+L+3,O+L+1),m.emplaceBack(O+L,O+L+2,O+L+3);return this._mesh=new fc(i.createVertexBuffer(h,vu.members),i.createIndexBuffer(m),c.a0.simpleSegment(0,0,h.length,m.length)),this._mesh}getMeshFrameDelta(i){return 2*Math.PI*c.be/Math.pow(2,i)/5}getMinTileElevationForLngLatZoom(i,h){var m;const{tileID:g}=this._getOverscaledTileIDFromLngLatZoom(i,h);return(m=this.getMinMaxElevation(g).minElevation)!==null&&m!==void 0?m:0}getMinMaxElevation(i){const h=this.getTerrainData(i).tile,m={minElevation:null,maxElevation:null};return h&&h.dem&&(m.minElevation=h.dem.min*this.exaggeration,m.maxElevation=h.dem.max*this.exaggeration),m}_getOverscaledTileIDFromLngLatZoom(i,h){const m=c.Z.fromLngLat(i.wrap()),g=(1<<h)*c.X,_=m.x*g,A=m.y*g,M=Math.floor(_/c.X),P=Math.floor(A/c.X);return{tileID:new c.S(h,0,h,M,P),mercatorX:_,mercatorY:A}}}class i0{constructor(i,h,m){this._context=i,this._size=h,this._tileSize=m,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const i of this._objects)i.texture.destroy(),i.fbo.destroy()}_createObject(i){const h=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),m=new tt(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return m.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),h.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),h.colorAttachment.set(m.texture),{id:i,fbo:h,texture:m,stamp:-1,inUse:!1}}getObjectForId(i){return this._objects[i]}useObject(i){i.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(h=>i.id!==h),this._recentlyUsed.push(i.id)}stampObject(i){i.stamp=++this._stamp}getOrCreateFreeObject(){for(const h of this._recentlyUsed)if(!this._objects[h].inUse)return this._objects[h];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const i=this._createObject(this._objects.length);return this._objects.push(i),i}freeObject(i){i.inUse=!1}freeAllObjects(){for(const i of this._objects)this.freeObject(i)}isFull(){return!(this._objects.length<this._size)&&this._objects.some(i=>!i.inUse)===!1}}const aa={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class cf{constructor(i,h){this.painter=i,this.terrain=h,this.pool=new i0(i.context,30,h.sourceCache.tileSize*h.qualityFactor)}destruct(){this.pool.destruct()}getTexture(i){return this.pool.getObjectForId(i.rtt[this._stacks.length-1].id).texture}prepareForRender(i,h){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=i._order.filter(m=>!i._layers[m].isHidden(h)),this._coordsDescendingInv={};for(const m in i.sourceCaches){this._coordsDescendingInv[m]={};const g=i.sourceCaches[m].getVisibleCoordinates();for(const _ of g){const A=this.terrain.sourceCache.getTerrainCoords(_);for(const M in A)this._coordsDescendingInv[m][M]||(this._coordsDescendingInv[m][M]=[]),this._coordsDescendingInv[m][M].push(A[M])}}this._coordsDescendingInvStr={};for(const m of i._order){const g=i._layers[m],_=g.source;if(aa[g.type]&&!this._coordsDescendingInvStr[_]){this._coordsDescendingInvStr[_]={};for(const A in this._coordsDescendingInv[_])this._coordsDescendingInvStr[_][A]=this._coordsDescendingInv[_][A].map(M=>M.key).sort().join()}}for(const m of this._renderableTiles)for(const g in this._coordsDescendingInvStr){const _=this._coordsDescendingInvStr[g][m.tileID.key];_&&_!==m.rttCoords[g]&&(m.rtt=[])}}renderLayer(i){if(i.isHidden(this.painter.transform.zoom))return!1;const h=i.type,m=this.painter,g=this._renderableLayerIds[this._renderableLayerIds.length-1]===i.id;if(aa[h]&&(this._prevType&&aa[this._prevType]||this._stacks.push([]),this._prevType=h,this._stacks[this._stacks.length-1].push(i.id),!g))return!0;if(aa[this._prevType]||aa[h]&&g){this._prevType=h;const _=this._stacks.length-1,A=this._stacks[_]||[];for(const M of this._renderableTiles){if(this.pool.isFull()&&(ef(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(M),M.rtt[_]){const V=this.pool.getObjectForId(M.rtt[_].id);if(V.stamp===M.rtt[_].stamp){this.pool.useObject(V);continue}}const P=this.pool.getOrCreateFreeObject();this.pool.useObject(P),this.pool.stampObject(P),M.rtt[_]={id:P.id,stamp:P.stamp},m.context.bindFramebuffer.set(P.fbo.framebuffer),m.context.clear({color:c.aM.transparent,stencil:0}),m.currentStencilSource=void 0;for(let V=0;V<A.length;V++){const O=m.style._layers[A[V]],L=O.source?this._coordsDescendingInv[O.source][M.tileID.key]:[M.tileID];m.context.viewport.set([0,0,P.fbo.width,P.fbo.height]),m._renderTileClippingMasks(O,L),m.renderLayer(m,m.style.sourceCaches[O.source],O,L),O.source&&(M.rttCoords[O.source]=this._coordsDescendingInvStr[O.source][M.tileID.key])}}return ef(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects(),aa[h]}return!1}}const ku={"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"},df=b,s0={hash:!1,interactive:!0,bearingSnap:7,attributionControl:sa,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},Eu=x=>{x.touchstart=x.dragStart,x.touchmoveWindow=x.dragMove,x.touchend=x.dragEnd},o0={showCompass:!0,showZoom:!0,visualizePitch:!1};class a0{constructor(i,h,m=!1){this.mousedown=A=>{this.startMouse(c.e({},A,{ctrlKey:!0,preventDefault:()=>A.preventDefault()}),T.mousePos(this.element,A)),T.addEventListener(window,"mousemove",this.mousemove),T.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=A=>{this.moveMouse(A,T.mousePos(this.element,A))},this.mouseup=A=>{this.mouseRotate.dragEnd(A),this.mousePitch&&this.mousePitch.dragEnd(A),this.offTemp()},this.touchstart=A=>{A.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=T.touchPos(this.element,A.targetTouches)[0],this.startTouch(A,this._startPos),T.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),T.addEventListener(window,"touchend",this.touchend))},this.touchmove=A=>{A.targetTouches.length!==1?this.reset():(this._lastPos=T.touchPos(this.element,A.targetTouches)[0],this.moveTouch(A,this._lastPos))},this.touchend=A=>{A.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 g=i.dragRotate._mouseRotate.getClickTolerance(),_=i.dragRotate._mousePitch.getClickTolerance();this.element=h,this.mouseRotate=uu({clickTolerance:g,enable:!0}),this.touchRotate=(({enable:A,clickTolerance:M,bearingDegreesPerPixelMoved:P=.8})=>{const V=new du;return new ys({clickTolerance:M,move:(O,L)=>({bearingDelta:(L.x-O.x)*P}),moveStateManager:V,enable:A,assignEvents:Eu})})({clickTolerance:g,enable:!0}),this.map=i,m&&(this.mousePitch=hu({clickTolerance:_,enable:!0}),this.touchPitch=(({enable:A,clickTolerance:M,pitchDegreesPerPixelMoved:P=-.5})=>{const V=new du;return new ys({clickTolerance:M,move:(O,L)=>({pitchDelta:(L.y-O.y)*P}),moveStateManager:V,enable:A,assignEvents:Eu})})({clickTolerance:_,enable:!0})),T.addEventListener(h,"mousedown",this.mousedown),T.addEventListener(h,"touchstart",this.touchstart,{passive:!1}),T.addEventListener(h,"touchcancel",this.reset)}startMouse(i,h){this.mouseRotate.dragStart(i,h),this.mousePitch&&this.mousePitch.dragStart(i,h),T.disableDrag()}startTouch(i,h){this.touchRotate.dragStart(i,h),this.touchPitch&&this.touchPitch.dragStart(i,h),T.disableDrag()}moveMouse(i,h){const m=this.map,{bearingDelta:g}=this.mouseRotate.dragMove(i,h)||{};if(g&&m.setBearing(m.getBearing()+g),this.mousePitch){const{pitchDelta:_}=this.mousePitch.dragMove(i,h)||{};_&&m.setPitch(m.getPitch()+_)}}moveTouch(i,h){const m=this.map,{bearingDelta:g}=this.touchRotate.dragMove(i,h)||{};if(g&&m.setBearing(m.getBearing()+g),this.touchPitch){const{pitchDelta:_}=this.touchPitch.dragMove(i,h)||{};_&&m.setPitch(m.getPitch()+_)}}off(){const i=this.element;T.removeEventListener(i,"mousedown",this.mousedown),T.removeEventListener(i,"touchstart",this.touchstart,{passive:!1}),T.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),T.removeEventListener(window,"touchend",this.touchend),T.removeEventListener(i,"touchcancel",this.reset),this.offTemp()}offTemp(){T.enableDrag(),T.removeEventListener(window,"mousemove",this.mousemove),T.removeEventListener(window,"mouseup",this.mouseup),T.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),T.removeEventListener(window,"touchend",this.touchend)}}let ai;function On(x,i,h){const m=new c.N(x.lng,x.lat);if(x=new c.N(x.lng,x.lat),i){const g=new c.N(x.lng-360,x.lat),_=new c.N(x.lng+360,x.lat),A=h.locationPoint(x).distSqr(i);h.locationPoint(g).distSqr(i)<A?x=g:h.locationPoint(_).distSqr(i)<A&&(x=_)}for(;Math.abs(x.lng-h.center.lng)>180;){const g=h.locationPoint(x);if(g.x>=0&&g.y>=0&&g.x<=h.width&&g.y<=h.height)break;x.lng>h.center.lng?x.lng-=360:x.lng+=360}return x.lng!==m.lng&&h.locationPoint(x).y>h.height/2-h.getHorizon()?x:m}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 Cc(x,i,h){const m=x.classList;for(const g in la)m.remove(`maplibregl-${h}-anchor-${g}`);m.add(`maplibregl-${h}-anchor-${i}`)}class Sc extends c.E{constructor(i){if(super(),this._onKeyPress=h=>{const m=h.code,g=h.charCode||h.keyCode;m!=="Space"&&m!=="Enter"&&g!==32&&g!==13||this.togglePopup()},this._onMapClick=h=>{const m=h.originalEvent.target,g=this._element;this._popup&&(m===g||g.contains(m))&&this.togglePopup()},this._update=h=>{var m;if(!this._map)return;const g=this._map.loaded()&&!this._map.isMoving();((h==null?void 0:h.type)==="terrain"||(h==null?void 0:h.type)==="render"&&!g)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?On(this._lngLat,this._flatPos,this._map.transform):(m=this._lngLat)===null||m===void 0?void 0:m.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 _="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?_=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(_=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let A="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?A="rotateX(0deg)":this._pitchAlignment==="map"&&(A=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||h&&h.type!=="moveend"||(this._pos=this._pos.round()),T.setTransform(this._element,`${la[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${A} ${_}`),C.frameAsync(new AbortController).then(()=>{this._updateOpacity(h&&h.type==="moveend")}).catch(()=>{})},this._onMove=h=>{if(!this._isDragging){const m=this._clickTolerance||this._map._clickTolerance;this._isDragging=h.point.dist(this._pointerdownPos)>=m}this._isDragging&&(this._pos=h.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=h=>{this._element.contains(h.originalEvent.target)&&(h.preventDefault(),this._positionDelta=h.point.sub(this._pos).add(this._offset),this._pointerdownPos=h.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=i&&i.anchor||"center",this._color=i&&i.color||"#3FB1CE",this._scale=i&&i.scale||1,this._draggable=i&&i.draggable||!1,this._clickTolerance=i&&i.clickTolerance||0,this._subpixelPositioning=i&&i.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=i&&i.rotation||0,this._rotationAlignment=i&&i.rotationAlignment||"auto",this._pitchAlignment=i&&i.pitchAlignment&&i.pitchAlignment!=="auto"?i.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(i==null?void 0:i.opacity,i==null?void 0:i.opacityWhenCovered),i&&i.element)this._element=i.element,this._offset=c.P.convert(i&&i.offset||[0,0]);else{this._defaultMarker=!0,this._element=T.create("div");const h=T.createNS("http://www.w3.org/2000/svg","svg"),m=41,g=27;h.setAttributeNS(null,"display","block"),h.setAttributeNS(null,"height",`${m}px`),h.setAttributeNS(null,"width",`${g}px`),h.setAttributeNS(null,"viewBox",`0 0 ${g} ${m}`);const _=T.createNS("http://www.w3.org/2000/svg","g");_.setAttributeNS(null,"stroke","none"),_.setAttributeNS(null,"stroke-width","1"),_.setAttributeNS(null,"fill","none"),_.setAttributeNS(null,"fill-rule","evenodd");const A=T.createNS("http://www.w3.org/2000/svg","g");A.setAttributeNS(null,"fill-rule","nonzero");const M=T.createNS("http://www.w3.org/2000/svg","g");M.setAttributeNS(null,"transform","translate(3.0, 29.0)"),M.setAttributeNS(null,"fill","#000000");const P=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const ce of P){const he=T.createNS("http://www.w3.org/2000/svg","ellipse");he.setAttributeNS(null,"opacity","0.04"),he.setAttributeNS(null,"cx","10.5"),he.setAttributeNS(null,"cy","5.80029008"),he.setAttributeNS(null,"rx",ce.rx),he.setAttributeNS(null,"ry",ce.ry),M.appendChild(he)}const V=T.createNS("http://www.w3.org/2000/svg","g");V.setAttributeNS(null,"fill",this._color);const O=T.createNS("http://www.w3.org/2000/svg","path");O.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"),V.appendChild(O);const L=T.createNS("http://www.w3.org/2000/svg","g");L.setAttributeNS(null,"opacity","0.25"),L.setAttributeNS(null,"fill","#000000");const G=T.createNS("http://www.w3.org/2000/svg","path");G.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"),L.appendChild(G);const K=T.createNS("http://www.w3.org/2000/svg","g");K.setAttributeNS(null,"transform","translate(6.0, 7.0)"),K.setAttributeNS(null,"fill","#FFFFFF");const ee=T.createNS("http://www.w3.org/2000/svg","g");ee.setAttributeNS(null,"transform","translate(8.0, 8.0)");const ie=T.createNS("http://www.w3.org/2000/svg","circle");ie.setAttributeNS(null,"fill","#000000"),ie.setAttributeNS(null,"opacity","0.25"),ie.setAttributeNS(null,"cx","5.5"),ie.setAttributeNS(null,"cy","5.5"),ie.setAttributeNS(null,"r","5.4999962");const ae=T.createNS("http://www.w3.org/2000/svg","circle");ae.setAttributeNS(null,"fill","#FFFFFF"),ae.setAttributeNS(null,"cx","5.5"),ae.setAttributeNS(null,"cy","5.5"),ae.setAttributeNS(null,"r","5.4999962"),ee.appendChild(ie),ee.appendChild(ae),A.appendChild(M),A.appendChild(V),A.appendChild(L),A.appendChild(K),A.appendChild(ee),h.appendChild(A),h.setAttributeNS(null,"height",m*this._scale+"px"),h.setAttributeNS(null,"width",g*this._scale+"px"),this._element.appendChild(h),this._offset=c.P.convert(i&&i.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",h=>{h.preventDefault()}),this._element.addEventListener("mousedown",h=>{h.preventDefault()}),Cc(this._element,this._anchor,"marker"),i&&i.className)for(const h of i.className.split(" "))this._element.classList.add(h);this._popup=null}addTo(i){return this.remove(),this._map=i,this._element.setAttribute("aria-label",i._getUIString("Marker.Title")),i.getCanvasContainer().appendChild(this._element),i.on("move",this._update),i.on("moveend",this._update),i.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),T.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(i){return this._lngLat=c.N.convert(i),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(i){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),i){if(!("offset"in i.options)){const g=Math.abs(13.5)/Math.SQRT2;i.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[g,-1*(38.1-13.5+g)],"bottom-right":[-g,-1*(38.1-13.5+g)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=i,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(i){return this._subpixelPositioning=i,this}getPopup(){return this._popup}togglePopup(){const i=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:i?(i.isOpen()?i.remove():(i.setLngLat(this._lngLat),i.addTo(this._map)),this):this}_updateOpacity(i=!1){var h,m;if(!(!((h=this._map)===null||h===void 0)&&h.terrain))return void(this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity));if(i)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const g=this._map,_=g.terrain.depthAtPoint(this._pos),A=g.terrain.getElevationForLngLatZoom(this._lngLat,g.transform.tileZoom);if(g.transform.lngLatToCameraDepth(this._lngLat,A)-_<.006)return void(this._element.style.opacity=this._opacity);const M=-this._offset.y/g.transform._pixelPerMeter,P=Math.sin(g.getPitch()*Math.PI/180)*M,V=g.terrain.depthAtPoint(new c.P(this._pos.x,this._pos.y-this._offset.y)),O=g.transform.lngLatToCameraDepth(this._lngLat,A+P)-V>.006;!((m=this._popup)===null||m===void 0)&&m.isOpen()&&O&&this._popup.remove(),this._element.style.opacity=O?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(i){return this._offset=c.P.convert(i),this._update(),this}addClassName(i){this._element.classList.add(i)}removeClassName(i){this._element.classList.remove(i)}toggleClassName(i){return this._element.classList.toggle(i)}setDraggable(i){return this._draggable=!!i,this._map&&(i?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(i){return this._rotation=i||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(i){return this._rotationAlignment=i||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(i){return this._pitchAlignment=i&&i!=="auto"?i:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(i,h){return i===void 0&&h===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),i!==void 0&&(this._opacity=i),h!==void 0&&(this._opacityWhenCovered=h),this._map&&this._updateOpacity(!0),this}}const uf={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let al=0,ll=!1;const ns={maxWidth:100,unit:"metric"};function cl(x,i,h){const m=h&&h.maxWidth||100,g=x._container.clientHeight/2,_=x.unproject([0,g]),A=x.unproject([m,g]),M=_.distanceTo(A);if(h&&h.unit==="imperial"){const P=3.2808*M;P>5280?ft(i,m,P/5280,x._getUIString("ScaleControl.Miles")):ft(i,m,P,x._getUIString("ScaleControl.Feet"))}else h&&h.unit==="nautical"?ft(i,m,M/1852,x._getUIString("ScaleControl.NauticalMiles")):M>=1e3?ft(i,m,M/1e3,x._getUIString("ScaleControl.Kilometers")):ft(i,m,M,x._getUIString("ScaleControl.Meters"))}function ft(x,i,h,m){const g=function(_){const A=Math.pow(10,`${Math.floor(_)}`.length-1);let M=_/A;return M=M>=10?10:M>=5?5:M>=3?3:M>=2?2:M>=1?1:function(P){const V=Math.pow(10,Math.ceil(-Math.log(P)/Math.LN10));return Math.round(P*V)/V}(M),A*M}(h);x.style.width=i*(g/h)+"px",x.innerHTML=`${g} ${m}`}const St={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},Tc=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Ac(x){if(x){if(typeof x=="number"){const i=Math.round(Math.abs(x)/Math.SQRT2);return{center:new c.P(0,0),top:new c.P(0,x),"top-left":new c.P(i,i),"top-right":new c.P(-i,i),bottom:new c.P(0,-x),"bottom-left":new c.P(i,-i),"bottom-right":new c.P(-i,-i),left:new c.P(x,0),right:new c.P(-x,0)}}if(x instanceof c.P||Array.isArray(x)){const i=c.P.convert(x);return{center:i,top:i,"top-left":i,"top-right":i,bottom:i,"bottom-left":i,"bottom-right":i,left:i,right:i}}return{center:c.P.convert(x.center||[0,0]),top:c.P.convert(x.top||[0,0]),"top-left":c.P.convert(x["top-left"]||[0,0]),"top-right":c.P.convert(x["top-right"]||[0,0]),bottom:c.P.convert(x.bottom||[0,0]),"bottom-left":c.P.convert(x["bottom-left"]||[0,0]),"bottom-right":c.P.convert(x["bottom-right"]||[0,0]),left:c.P.convert(x.left||[0,0]),right:c.P.convert(x.right||[0,0])}}return Ac(new c.P(0,0))}const Cu=b;p.AJAXError=c.bh,p.Evented=c.E,p.LngLat=c.N,p.MercatorCoordinate=c.Z,p.Point=c.P,p.addProtocol=c.bi,p.config=c.a,p.removeProtocol=c.bj,p.AttributionControl=oa,p.BoxZoomHandler=oi,p.CanvasSource=br,p.CooperativeGesturesHandler=ia,p.DoubleClickZoomHandler=xo,p.DragPanHandler=of,p.DragRotateHandler=af,p.EdgeInsets=ta,p.FullscreenControl=class extends c.E{constructor(x={}){super(),this._onFullscreenChange=()=>{var i;let h=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((i=h==null?void 0:h.shadowRoot)===null||i===void 0)&&i.fullscreenElement;)h=h.shadowRoot.fullscreenElement;h===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,x&&x.container&&(x.container instanceof HTMLElement?this._container=x.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(x){return this._map=x,this._container||(this._container=this._map.getContainer()),this._controlContainer=T.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){T.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const x=this._fullscreenButton=T.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);T.create("span","maplibregl-ctrl-icon",x).setAttribute("aria-hidden","true"),x.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const x=this._getTitle();this._fullscreenButton.setAttribute("aria-label",x),this._fullscreenButton.title=x}_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()}},p.GeoJSONSource=Rs,p.GeolocateControl=class extends c.E{constructor(x){super(),this._onSuccess=i=>{if(this._map){if(this._isOutOfMapMaxBounds(i))return this._setErrorState(),this.fire(new c.k("outofmaxbounds",i)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=i,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(i),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(i),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new c.k("geolocate",i)),this._finish()}},this._updateCamera=i=>{const h=new c.N(i.coords.longitude,i.coords.latitude),m=i.coords.accuracy,g=this._map.getBearing(),_=c.e({bearing:g},this.options.fitBoundsOptions),A=Ce.fromLngLat(h,m);this._map.fitBounds(A,_,{geolocateSource:!0})},this._updateMarker=i=>{if(i){const h=new c.N(i.coords.longitude,i.coords.latitude);this._accuracyCircleMarker.setLngLat(h).addTo(this._map),this._userLocationDotMarker.setLngLat(h).addTo(this._map),this._accuracy=i.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=i=>{if(this._map){if(this.options.trackUserLocation)if(i.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 h=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=h,this._geolocateButton.setAttribute("aria-label",h),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(i.code===3&&ll)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new c.k("error",i)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",i=>i.preventDefault()),this._geolocateButton=T.create("button","maplibregl-ctrl-geolocate",this._container),T.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=i=>{if(this._map){if(i===!1){c.w("Geolocation support is not available so the GeolocateControl will be disabled.");const h=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=h,this._geolocateButton.setAttribute("aria-label",h)}else{const h=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=h,this._geolocateButton.setAttribute("aria-label",h)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=T.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Sc({element:this._dotElement}),this._circleElement=T.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Sc({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",h=>{h.geolocateSource||this._watchState!=="ACTIVE_LOCK"||h.originalEvent&&h.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({},uf,x)}onAdd(x){return this._map=x,this._container=T.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return c._(this,arguments,void 0,function*(i=!1){if(ai!==void 0&&!i)return ai;if(window.navigator.permissions===void 0)return ai=!!window.navigator.geolocation,ai;try{ai=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{ai=!!window.navigator.geolocation}return ai})}().then(i=>this._finishSetupUI(i)),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(),T.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,al=0,ll=!1}_isOutOfMapMaxBounds(x){const i=this._map.getMaxBounds(),h=x.coords;return i&&(h.longitude<i.getWest()||h.longitude>i.getEast()||h.latitude<i.getSouth()||h.latitude>i.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 x=this._map.getBounds(),i=x.getSouthEast(),h=x.getNorthEast(),m=i.distanceTo(h),g=Math.ceil(this._accuracy/(m/this._map._container.clientHeight)*2);this._circleElement.style.width=`${g}px`,this._circleElement.style.height=`${g}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":al--,ll=!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 x;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),al++,al>1?(x={maximumAge:6e5,timeout:0},ll=!0):(x=this.options.positionOptions,ll=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,x)}}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)}},p.Hash=gc,p.ImageSource=Cr,p.KeyboardHandler=xi,p.LngLatBounds=Ce,p.LogoControl=xu,p.Map=class extends lf{constructor(x){c.bf.mark(c.bg.create);const i=Object.assign(Object.assign({},s0),x);if(i.minZoom!=null&&i.maxZoom!=null&&i.minZoom>i.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(i.minPitch!=null&&i.maxPitch!=null&&i.minPitch>i.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(i.minPitch!=null&&i.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(i.maxPitch!=null&&i.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new na(i.minZoom,i.maxZoom,i.minPitch,i.maxPitch,i.renderWorldCopies),{bearingSnap:i.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new Xt,this._controls=[],this._mapId=c.a4(),this._contextLost=h=>{h.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new c.k("webglcontextlost",{originalEvent:h}))},this._contextRestored=h=>{this._setupPainter(),this.resize(),this._update(),this.fire(new c.k("webglcontextrestored",{originalEvent:h}))},this._onMapScroll=h=>{if(h.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=i.interactive,this._maxTileCacheSize=i.maxTileCacheSize,this._maxTileCacheZoomLevels=i.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=i.failIfMajorPerformanceCaveat===!0,this._preserveDrawingBuffer=i.preserveDrawingBuffer===!0,this._antialias=i.antialias===!0,this._trackResize=i.trackResize===!0,this._bearingSnap=i.bearingSnap,this._refreshExpiredTiles=i.refreshExpiredTiles===!0,this._fadeDuration=i.fadeDuration,this._crossSourceCollisions=i.crossSourceCollisions===!0,this._collectResourceTiming=i.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},ku),i.locale),this._clickTolerance=i.clickTolerance,this._overridePixelRatio=i.pixelRatio,this._maxCanvasSize=i.maxCanvasSize,this.transformCameraUpdate=i.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=i.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=Q.addThrottleControl(()=>this.isMoving()),this._requestManager=new me(i.transformRequest),typeof i.container=="string"){if(this._container=document.getElementById(i.container),!this._container)throw new Error(`Container '${i.container}' not found.`)}else{if(!(i.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=i.container}if(i.maxBounds&&this.setMaxBounds(i.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 h=!1;const m=tl(g=>{this._trackResize&&!this._removed&&(this.resize(g),this.redraw())},50);this._resizeObserver=new ResizeObserver(g=>{h?m(g):h=!0}),this._resizeObserver.observe(this._container)}this.handlers=new bu(this,i),this._hash=i.hash&&new gc(typeof i.hash=="string"&&i.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:i.center,zoom:i.zoom,bearing:i.bearing,pitch:i.pitch}),i.bounds&&(this.resize(),this.fitBounds(i.bounds,c.e({},i.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=i.localIdeographFontFamily,this._validateStyle=i.validateStyle,i.style&&this.setStyle(i.style,{localIdeographFontFamily:i.localIdeographFontFamily}),i.attributionControl&&this.addControl(new oa(typeof i.attributionControl=="boolean"?void 0:i.attributionControl)),i.maplibreLogo&&this.addControl(new xu,i.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",h=>{this._update(h.dataType==="style"),this.fire(new c.k(`${h.dataType}data`,h))}),this.on("dataloading",h=>{this.fire(new c.k(`${h.dataType}dataloading`,h))}),this.on("dataabort",h=>{this.fire(new c.k("sourcedataabort",h))})}_getMapId(){return this._mapId}addControl(x,i){if(i===void 0&&(i=x.getDefaultPosition?x.getDefaultPosition():"top-right"),!x||!x.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 h=x.onAdd(this);this._controls.push(x);const m=this._controlPositions[i];return i.indexOf("bottom")!==-1?m.insertBefore(h,m.firstChild):m.appendChild(h),this}removeControl(x){if(!x||!x.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 i=this._controls.indexOf(x);return i>-1&&this._controls.splice(i,1),x.onRemove(this),this}hasControl(x){return this._controls.indexOf(x)>-1}calculateCameraOptionsFromTo(x,i,h,m){return m==null&&this.terrain&&(m=this.terrain.getElevationForLngLatZoom(h,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(x,i,h,m)}resize(x){var i;const h=this._containerDimensions(),m=h[0],g=h[1],_=this._getClampedPixelRatio(m,g);if(this._resizeCanvas(m,g,_),this.painter.resize(m,g,_),this.painter.overLimit()){const M=this.painter.context.gl;this._maxCanvasSize=[M.drawingBufferWidth,M.drawingBufferHeight];const P=this._getClampedPixelRatio(m,g);this._resizeCanvas(m,g,P),this.painter.resize(m,g,P)}this.transform.resize(m,g),(i=this._requestedCameraState)===null||i===void 0||i.resize(m,g);const A=!this._moving;return A&&(this.stop(),this.fire(new c.k("movestart",x)).fire(new c.k("move",x))),this.fire(new c.k("resize",x)),A&&this.fire(new c.k("moveend",x)),this}_getClampedPixelRatio(x,i){const{0:h,1:m}=this._maxCanvasSize,g=this.getPixelRatio(),_=x*g,A=i*g;return Math.min(_>h?h/_:1,A>m?m/A:1)*g}getPixelRatio(){var x;return(x=this._overridePixelRatio)!==null&&x!==void 0?x:devicePixelRatio}setPixelRatio(x){this._overridePixelRatio=x,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(x){return this.transform.setMaxBounds(Ce.convert(x)),this._update()}setMinZoom(x){if((x=x??-2)>=-2&&x<=this.transform.maxZoom)return this.transform.minZoom=x,this._update(),this.getZoom()<x&&this.setZoom(x),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(x){if((x=x??22)>=this.transform.minZoom)return this.transform.maxZoom=x,this._update(),this.getZoom()>x&&this.setZoom(x),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(x){if((x=x??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(x>=0&&x<=this.transform.maxPitch)return this.transform.minPitch=x,this._update(),this.getPitch()<x&&this.setPitch(x),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(x){if((x=x??60)>85)throw new Error("maxPitch must be less than or equal to 85");if(x>=this.transform.minPitch)return this.transform.maxPitch=x,this._update(),this.getPitch()>x&&this.setPitch(x),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(x){return this.transform.renderWorldCopies=x,this._update()}project(x){return this.transform.locationPoint(c.N.convert(x),this.style&&this.terrain)}unproject(x){return this.transform.pointLocation(c.P.convert(x),this.terrain)}isMoving(){var x;return this._moving||((x=this.handlers)===null||x===void 0?void 0:x.isMoving())}isZooming(){var x;return this._zooming||((x=this.handlers)===null||x===void 0?void 0:x.isZooming())}isRotating(){var x;return this._rotating||((x=this.handlers)===null||x===void 0?void 0:x.isRotating())}_createDelegatedListener(x,i,h){if(x==="mouseenter"||x==="mouseover"){let m=!1;return{layers:i,listener:h,delegates:{mousemove:_=>{const A=i.filter(P=>this.getLayer(P)),M=A.length!==0?this.queryRenderedFeatures(_.point,{layers:A}):[];M.length?m||(m=!0,h.call(this,new Sr(x,this,_.originalEvent,{features:M}))):m=!1},mouseout:()=>{m=!1}}}}if(x==="mouseleave"||x==="mouseout"){let m=!1;return{layers:i,listener:h,delegates:{mousemove:A=>{const M=i.filter(P=>this.getLayer(P));(M.length!==0?this.queryRenderedFeatures(A.point,{layers:M}):[]).length?m=!0:m&&(m=!1,h.call(this,new Sr(x,this,A.originalEvent)))},mouseout:A=>{m&&(m=!1,h.call(this,new Sr(x,this,A.originalEvent)))}}}}{const m=g=>{const _=i.filter(M=>this.getLayer(M)),A=_.length!==0?this.queryRenderedFeatures(g.point,{layers:_}):[];A.length&&(g.features=A,h.call(this,g),delete g.features)};return{layers:i,listener:h,delegates:{[x]:m}}}}_saveDelegatedListener(x,i){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[x]=this._delegatedListeners[x]||[],this._delegatedListeners[x].push(i)}_removeDelegatedListener(x,i,h){if(!this._delegatedListeners||!this._delegatedListeners[x])return;const m=this._delegatedListeners[x];for(let g=0;g<m.length;g++){const _=m[g];if(_.listener===h&&_.layers.length===i.length&&_.layers.every(A=>i.includes(A))){for(const A in _.delegates)this.off(A,_.delegates[A]);return void m.splice(g,1)}}}on(x,i,h){if(h===void 0)return super.on(x,i);const m=this._createDelegatedListener(x,typeof i=="string"?[i]:i,h);this._saveDelegatedListener(x,m);for(const g in m.delegates)this.on(g,m.delegates[g]);return this}once(x,i,h){if(h===void 0)return super.once(x,i);const m=typeof i=="string"?[i]:i,g=this._createDelegatedListener(x,m,h);for(const _ in g.delegates){const A=g.delegates[_];g.delegates[_]=(...M)=>{this._removeDelegatedListener(x,m,h),A(...M)}}this._saveDelegatedListener(x,g);for(const _ in g.delegates)this.once(_,g.delegates[_]);return this}off(x,i,h){return h===void 0?super.off(x,i):(this._removeDelegatedListener(x,typeof i=="string"?[i]:i,h),this)}queryRenderedFeatures(x,i){if(!this.style)return[];let h;const m=x instanceof c.P||Array.isArray(x),g=m?x:[[0,0],[this.transform.width,this.transform.height]];if(i=i||(m?{}:x)||{},g instanceof c.P||typeof g[0]=="number")h=[c.P.convert(g)];else{const _=c.P.convert(g[0]),A=c.P.convert(g[1]);h=[_,new c.P(A.x,_.y),A,new c.P(_.x,A.y),_]}return this.style.queryRenderedFeatures(h,i,this.transform)}querySourceFeatures(x,i){return this.style.querySourceFeatures(x,i)}setStyle(x,i){return(i=c.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},i)).diff!==!1&&i.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&x?(this._diffStyle(x,i),this):(this._localIdeographFontFamily=i.localIdeographFontFamily,this._updateStyle(x,i))}setTransformRequest(x){return this._requestManager.setTransformRequest(x),this}_getUIString(x){const i=this._locale[x];if(i==null)throw new Error(`Missing UI string '${x}'`);return i}_updateStyle(x,i){if(i.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(x,i));const h=this.style&&i.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!x)),x?(this.style=new Ql(this,i||{}),this.style.setEventedParent(this,{style:this.style}),typeof x=="string"?this.style.loadURL(x,i,h):this.style.loadJSON(x,i,h),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Ql(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(x,i){if(typeof x=="string"){const h=this._requestManager.transformRequest(x,"Style");c.h(h,new AbortController).then(m=>{this._updateDiff(m.data,i)}).catch(m=>{m&&this.fire(new c.j(m))})}else typeof x=="object"&&this._updateDiff(x,i)}_updateDiff(x,i){try{this.style.setState(x,i)&&this._update(!0)}catch(h){c.w(`Unable to perform style diff: ${h.message||h.error||h}. Rebuilding the style from scratch.`),this._updateStyle(x,i)}}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(x,i){return this._lazyInitEmptyStyle(),this.style.addSource(x,i),this._update(!0)}isSourceLoaded(x){const i=this.style&&this.style.sourceCaches[x];if(i!==void 0)return i.loaded();this.fire(new c.j(new Error(`There is no source with ID '${x}'`)))}setTerrain(x){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),x){const i=this.style.sourceCaches[x.source];if(!i)throw new Error(`cannot load terrain, because there exists no source with ID: ${x.source}`);this.terrain===null&&i.reload();for(const h in this.style._layers){const m=this.style._layers[h];m.type==="hillshade"&&m.source===x.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 wu(this.painter,i,x),this.painter.renderToTexture=new cf(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=h=>{h.dataType==="style"?this.terrain.sourceCache.freeRtt():h.dataType==="source"&&h.tile&&(h.sourceId!==x.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(h.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:x})),this}getTerrain(){var x,i;return(i=(x=this.terrain)===null||x===void 0?void 0:x.options)!==null&&i!==void 0?i:null}areTilesLoaded(){const x=this.style&&this.style.sourceCaches;for(const i in x){const h=x[i]._tiles;for(const m in h){const g=h[m];if(g.state!=="loaded"&&g.state!=="errored")return!1}}return!0}removeSource(x){return this.style.removeSource(x),this._update(!0)}getSource(x){return this.style.getSource(x)}addImage(x,i,h={}){const{pixelRatio:m=1,sdf:g=!1,stretchX:_,stretchY:A,content:M,textFitWidth:P,textFitHeight:V}=h;if(this._lazyInitEmptyStyle(),!(i instanceof HTMLImageElement||c.b(i))){if(i.width===void 0||i.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:O,height:L,data:G}=i,K=i;return this.style.addImage(x,{data:new c.R({width:O,height:L},new Uint8Array(G)),pixelRatio:m,stretchX:_,stretchY:A,content:M,textFitWidth:P,textFitHeight:V,sdf:g,version:0,userImage:K}),K.onAdd&&K.onAdd(this,x),this}}{const{width:O,height:L,data:G}=C.getImageData(i);this.style.addImage(x,{data:new c.R({width:O,height:L},G),pixelRatio:m,stretchX:_,stretchY:A,content:M,textFitWidth:P,textFitHeight:V,sdf:g,version:0})}}updateImage(x,i){const h=this.style.getImage(x);if(!h)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 m=i instanceof HTMLImageElement||c.b(i)?C.getImageData(i):i,{width:g,height:_,data:A}=m;if(g===void 0||_===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(g!==h.data.width||_!==h.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 M=!(i instanceof HTMLImageElement||c.b(i));return h.data.replace(A,M),this.style.updateImage(x,h),this}getImage(x){return this.style.getImage(x)}hasImage(x){return x?!!this.style.getImage(x):(this.fire(new c.j(new Error("Missing required image id"))),!1)}removeImage(x){this.style.removeImage(x)}loadImage(x){return Q.getImage(this._requestManager.transformRequest(x,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(x,i){return this._lazyInitEmptyStyle(),this.style.addLayer(x,i),this._update(!0)}moveLayer(x,i){return this.style.moveLayer(x,i),this._update(!0)}removeLayer(x){return this.style.removeLayer(x),this._update(!0)}getLayer(x){return this.style.getLayer(x)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(x,i,h){return this.style.setLayerZoomRange(x,i,h),this._update(!0)}setFilter(x,i,h={}){return this.style.setFilter(x,i,h),this._update(!0)}getFilter(x){return this.style.getFilter(x)}setPaintProperty(x,i,h,m={}){return this.style.setPaintProperty(x,i,h,m),this._update(!0)}getPaintProperty(x,i){return this.style.getPaintProperty(x,i)}setLayoutProperty(x,i,h,m={}){return this.style.setLayoutProperty(x,i,h,m),this._update(!0)}getLayoutProperty(x,i){return this.style.getLayoutProperty(x,i)}setGlyphs(x,i={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(x,i),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(x,i,h={}){return this._lazyInitEmptyStyle(),this.style.addSprite(x,i,h,m=>{m||this._update(!0)}),this}removeSprite(x){return this._lazyInitEmptyStyle(),this.style.removeSprite(x),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(x,i={}){return this._lazyInitEmptyStyle(),this.style.setSprite(x,i,h=>{h||this._update(!0)}),this}setLight(x,i={}){return this._lazyInitEmptyStyle(),this.style.setLight(x,i),this._update(!0)}getLight(){return this.style.getLight()}setSky(x){return this._lazyInitEmptyStyle(),this.style.setSky(x),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(x,i){return this.style.setFeatureState(x,i),this._update()}removeFeatureState(x,i){return this.style.removeFeatureState(x,i),this._update()}getFeatureState(x){return this.style.getFeatureState(x)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let x=0,i=0;return this._container&&(x=this._container.clientWidth||400,i=this._container.clientHeight||300),[x,i]}_setupContainer(){const x=this._container;x.classList.add("maplibregl-map");const i=this._canvasContainer=T.create("div","maplibregl-canvas-container",x);this._interactive&&i.classList.add("maplibregl-interactive"),this._canvas=T.create("canvas","maplibregl-canvas",i),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 h=this._containerDimensions(),m=this._getClampedPixelRatio(h[0],h[1]);this._resizeCanvas(h[0],h[1],m);const g=this._controlContainer=T.create("div","maplibregl-control-container",x),_=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(A=>{_[A]=T.create("div",`maplibregl-ctrl-${A} `,g)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(x,i,h){this._canvas.width=Math.floor(h*x),this._canvas.height=Math.floor(h*i),this._canvas.style.width=`${x}px`,this._canvas.style.height=`${i}px`}_setupPainter(){const x={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let i=null;this._canvas.addEventListener("webglcontextcreationerror",m=>{i={requestedAttributes:x},m&&(i.statusMessage=m.statusMessage,i.type=m.type)},{once:!0});const h=this._canvas.getContext("webgl2",x)||this._canvas.getContext("webgl",x);if(!h){const m="Failed to initialize WebGL";throw i?(i.message=m,new Error(JSON.stringify(i))):new Error(m)}this.painter=new mc(h,this.transform),I.testSupport(h)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(x){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||x,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(x){return this._update(),this._renderTaskQueue.add(x)}_cancelRenderFrame(x){this._renderTaskQueue.remove(x)}_render(x){const i=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(x),this._removed)return;let h=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const g=this.transform.zoom,_=C.now();this.style.zoomHistory.update(g,_);const A=new c.z(g,{now:_,fadeDuration:i,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),M=A.crossFadingFactor();M===1&&M===this._crossFadingFactor||(h=!0,this._crossFadingFactor=M),this.style.update(A)}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,i,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:i,showPadding:this.showPadding}),this.fire(new c.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,c.bf.mark(c.bg.load),this.fire(new c.k("load"))),this.style&&(this.style.hasTransitions()||h)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const m=this._sourcesDirty||this._styleDirty||this._placementDirty;return m||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new c.k("idle")),!this._loaded||this._fullyLoaded||m||(this._fullyLoaded=!0,c.bf.mark(c.bg.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var x;this._hash&&this._hash.remove();for(const h of this._controls)h.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),Q.removeThrottleControl(this._imageQueueHandle),(x=this._resizeObserver)===null||x===void 0||x.disconnect();const i=this.painter.context.gl.getExtension("WEBGL_lose_context");i!=null&&i.loseContext&&i.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),T.remove(this._canvasContainer),T.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),c.bf.clearMetrics(),this._removed=!0,this.fire(new c.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,C.frameAsync(this._frameRequest).then(x=>{c.bf.frame(x),this._frameRequest=null,this._render(x)}).catch(()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(x){this._showTileBoundaries!==x&&(this._showTileBoundaries=x,this._update())}get showPadding(){return!!this._showPadding}set showPadding(x){this._showPadding!==x&&(this._showPadding=x,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(x){this._showCollisionBoxes!==x&&(this._showCollisionBoxes=x,x?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(x){this._showOverdrawInspector!==x&&(this._showOverdrawInspector=x,this._update())}get repaint(){return!!this._repaint}set repaint(x){this._repaint!==x&&(this._repaint=x,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(x){this._vertices=x,this._update()}get version(){return df}getCameraTargetElevation(){return this.transform.elevation}},p.MapMouseEvent=Sr,p.MapTouchEvent=_o,p.MapWheelEvent=nf,p.Marker=Sc,p.NavigationControl=class{constructor(x){this._updateZoomButtons=()=>{const i=this._map.getZoom(),h=i===this._map.getMaxZoom(),m=i===this._map.getMinZoom();this._zoomInButton.disabled=h,this._zoomOutButton.disabled=m,this._zoomInButton.setAttribute("aria-disabled",h.toString()),this._zoomOutButton.setAttribute("aria-disabled",m.toString())},this._rotateCompassArrow=()=>{const i=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=i},this._setButtonTitle=(i,h)=>{const m=this._map._getUIString(`NavigationControl.${h}`);i.title=m,i.setAttribute("aria-label",m)},this.options=c.e({},o0,x),this._container=T.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",i=>i.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",i=>this._map.zoomIn({},{originalEvent:i})),T.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",i=>this._map.zoomOut({},{originalEvent:i})),T.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",i=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:i}):this._map.resetNorth({},{originalEvent:i})}),this._compassIcon=T.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(x){return this._map=x,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 a0(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){T.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(x,i){const h=T.create("button",x,this._container);return h.type="button",h.addEventListener("click",i),h}},p.Popup=class extends c.E{constructor(x){super(),this.remove=()=>(this._content&&T.remove(this._content),this._container&&(T.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=i=>{this._update(i.point)},this._onMouseMove=i=>{this._update(i.point)},this._onDrag=i=>{this._update(i.point)},this._update=i=>{var h;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=T.create("div","maplibregl-popup",this._map.getContainer()),this._tip=T.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const M of this.options.className.split(" "))this._container.classList.add(M);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?On(this._lngLat,this._flatPos,this._map.transform):(h=this._lngLat)===null||h===void 0?void 0:h.wrap(),this._trackPointer&&!i)return;const m=this._flatPos=this._pos=this._trackPointer&&i?i:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&i?i:this._map.transform.locationPoint(this._lngLat));let g=this.options.anchor;const _=Ac(this.options.offset);if(!g){const M=this._container.offsetWidth,P=this._container.offsetHeight;let V;V=m.y+_.bottom.y<P?["top"]:m.y>this._map.transform.height-P?["bottom"]:[],m.x<M/2?V.push("left"):m.x>this._map.transform.width-M/2&&V.push("right"),g=V.length===0?"bottom":V.join("-")}let A=m.add(_[g]);this.options.subpixelPositioning||(A=A.round()),T.setTransform(this._container,`${la[g]} translate(${A.x}px,${A.y}px)`),Cc(this._container,g,"popup")},this._onClose=()=>{this.remove()},this.options=c.e(Object.create(St),x)}addTo(x){return this._map&&this.remove(),this._map=x,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(x){return this._lngLat=c.N.convert(x),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(x){return this.setDOMContent(document.createTextNode(x))}setHTML(x){const i=document.createDocumentFragment(),h=document.createElement("body");let m;for(h.innerHTML=x;m=h.firstChild,m;)i.appendChild(m);return this.setDOMContent(i)}getMaxWidth(){var x;return(x=this._container)===null||x===void 0?void 0:x.style.maxWidth}setMaxWidth(x){return this.options.maxWidth=x,this._update(),this}setDOMContent(x){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=T.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(x),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(x){return this._container&&this._container.classList.add(x),this}removeClassName(x){return this._container&&this._container.classList.remove(x),this}setOffset(x){return this.options.offset=x,this._update(),this}toggleClassName(x){if(this._container)return this._container.classList.toggle(x)}setSubpixelPositioning(x){this.options.subpixelPositioning=x}_createCloseButton(){this.options.closeButton&&(this._closeButton=T.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const x=this._container.querySelector(Tc);x&&x.focus()}},p.RasterDEMTileSource=zn,p.RasterTileSource=Qt,p.ScaleControl=class{constructor(x){this._onMove=()=>{cl(this._map,this._container,this.options)},this.setUnit=i=>{this.options.unit=i,cl(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},ns),x)}getDefaultPosition(){return"bottom-left"}onAdd(x){return this._map=x,this._container=T.create("div","maplibregl-ctrl maplibregl-ctrl-scale",x.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){T.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},p.ScrollZoomHandler=Oi,p.Style=Ql,p.TerrainControl=class{constructor(x){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=x}onAdd(x){return this._map=x,this._container=T.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=T.create("button","maplibregl-ctrl-terrain",this._container),T.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(){T.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},p.TwoFingersTouchPitchHandler=ol,p.TwoFingersTouchRotateHandler=gu,p.TwoFingersTouchZoomHandler=fu,p.TwoFingersTouchZoomRotateHandler=_u,p.VectorTileSource=Ps,p.VideoSource=yi,p.addSourceType=(x,i)=>c._(void 0,void 0,void 0,function*(){if(Ii(x))throw new Error(`A source type called "${x}" already exists.`);((h,m)=>{Mi[h]=m})(x,i)}),p.clearPrewarmedResources=function(){const x=Te;x&&(x.isPreloaded()&&x.numActive()===1?(x.release(In),Te=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()"))},p.getMaxParallelImageRequests=function(){return c.a.MAX_PARALLEL_IMAGE_REQUESTS},p.getRTLTextPluginStatus=function(){return ni().getRTLTextPluginStatus()},p.getVersion=function(){return Cu},p.getWorkerCount=function(){return Hn.workerCount},p.getWorkerUrl=function(){return c.a.WORKER_URL},p.importScriptInWorkers=function(x){return qt().broadcast("IS",x)},p.prewarm=function(){nt().acquire(In)},p.setMaxParallelImageRequests=function(x){c.a.MAX_PARALLEL_IMAGE_REQUESTS=x},p.setRTLTextPlugin=function(x,i){return ni().setRTLTextPlugin(x,i)},p.setWorkerCount=function(x){Hn.workerCount=x},p.setWorkerUrl=function(x){c.a.WORKER_URL=x}});var d=n;return d})})(kx);var SP=kx.exports;const Dh=CP(SP);function Ex(t,e,n){if(t!==null)for(var r,o,d,p,c,b,k,E=0,C=0,T,I=t.type,N=I==="FeatureCollection",$=I==="Feature",F=N?t.features.length:1,q=0;q<F;q++){k=N?t.features[q].geometry:$?t.geometry:t,T=k?k.type==="GeometryCollection":!1,c=T?k.geometries.length:1;for(var J=0;J<c;J++){var Q=0,me=0;if(p=T?k.geometries[J]:k,p!==null){b=p.coordinates;var ke=p.type;switch(E=0,ke){case null:break;case"Point":if(e(b,C,q,Q,me)===!1)return!1;C++,Q++;break;case"LineString":case"MultiPoint":for(r=0;r<b.length;r++){if(e(b[r],C,q,Q,me)===!1)return!1;C++,ke==="MultiPoint"&&Q++}ke==="LineString"&&Q++;break;case"Polygon":case"MultiLineString":for(r=0;r<b.length;r++){for(o=0;o<b[r].length-E;o++){if(e(b[r][o],C,q,Q,me)===!1)return!1;C++}ke==="MultiLineString"&&Q++,ke==="Polygon"&&me++}ke==="Polygon"&&Q++;break;case"MultiPolygon":for(r=0;r<b.length;r++){for(me=0,o=0;o<b[r].length;o++){for(d=0;d<b[r][o].length-E;d++){if(e(b[r][o][d],C,q,Q,me)===!1)return!1;C++}me++}Q++}break;case"GeometryCollection":for(r=0;r<p.geometries.length;r++)if(Ex(p.geometries[r],e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function TP(t,e={}){if(t.bbox!=null&&e.recompute!==!0)return t.bbox;const n=[1/0,1/0,-1/0,-1/0];return Ex(t,r=>{n[0]>r[0]&&(n[0]=r[0]),n[1]>r[1]&&(n[1]=r[1]),n[2]<r[0]&&(n[2]=r[0]),n[3]<r[1]&&(n[3]=r[1])}),n}function AP(t,e,n={}){const r={type:"Feature"};return(n.id===0||n.id)&&(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties={},r.geometry=t,r}function Cx(t,e={}){const n={type:"FeatureCollection"};return e.id&&(n.id=e.id),e.bbox&&(n.bbox=e.bbox),n.features=t,n}const DP={},MP={xmlns:"http://www.w3.org/2000/svg",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-x"};function IP(t,e,n,r,o,d){return a.openBlock(),a.createElementBlock("svg",MP,e[0]||(e[0]=[a.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),a.createElementVNode("path",{d:"M18 6l-12 12"},null,-1),a.createElementVNode("path",{d:"M6 6l12 12"},null,-1)]))}const PP=Oe(DP,[["render",IP]]);function RP(t){const e=[{type:"fill",minzoom:t.pointZoom||0,paint:{"fill-color":t.color||"#ccc","fill-outline-color":t.stroke||"#blue","fill-opacity":t.opacity||1}}];return t.pointZoom&&e.push({type:"circle",maxzoom:t.pointZoom,paint:{"circle-color":t.color||"#ccc","circle-stroke-color":t.stroke||"#ccc","circle-stroke-width":t.width||1,"circle-opacity":t.opacity||1}}),t.label&&e.push({type:"symbol",layout:{"text-field":["get",t.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}}),e}function NP(t){const e=[{type:"line",paint:{"line-color":t.color||"#ccc","line-opacity":t.opacity||1}}];return t.label&&e.push({type:"symbol",layout:{"text-field":["get",t.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}}),e}function BP(t){const e=[{type:"circle",maxzoom:t.icon&&+t.iconZoom||22,paint:{"circle-radius":t.radius||6,"circle-stroke-color":t.stroke||"#ccc","circle-stroke-width":t.width||1,"circle-color":t.color||"blue","circle-opacity":t.opacity||1}}];return t!=null&&t.clusterZoom&&(e.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]}}),e.push({type:"symbol",filter:["has","point_count"],layout:{"text-field":["get","point_count"],"text-font":["Open Sans Regular"],"text-size":12}})),t.icon&&e.push({type:"symbol",minzoom:+t.iconZoom||16,layout:{"icon-image":t.icon,"icon-allow-overlap":!0}}),t.label&&e.push({type:"symbol",layout:{"text-field":["get",t.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}}),e}function VP(t){if(!t)return null;const e=t.type||"point";return e==="polygon"?RP(t):e==="line"?NP(t):BP(t)}const zP=["#69D2E7","yellow","#FE4365","#125B9A","#41B3A2","#D7C3F1","#F1D3CE"],OP=["ma-star","ma-water","ma-swimming","fa-home","fa-search","fa-trash","fa-check"],Sx={};async function Tx(t,e){const n=await fetch(`/api/gis-layer/${t}/${e}`),{rows:r}=await n.json();return r}async function Lm(t,e,n,r){if(!t)return null;const o=JSON.parse(JSON.stringify(t)),d=o.colorAttr?await Tx(e,o.colorAttr):null;d==null||d.forEach((c,b)=>{var k,E;c.color=c.color||((k=o.colorSet)==null?void 0:k[c.id])||((E=o.colorSet)==null?void 0:E[b])||zP[b],c.icon=o.icon?o.icon.split("+")[0]+"+"+c.color.replace("#","")+".png":null});const p=o.iconAttr?await Tx(e,o.iconAttr):null;if(p==null||p.forEach((c,b)=>{var I,N,$,F;const k=c.icon||((I=o.iconSet)==null?void 0:I[c.id])||((N=o.iconPattern)==null?void 0:N.replace("{id}",c.id))||(($=o.iconSet)==null?void 0:$[b])||(o.iconPrefix?null:OP[b]);if(!k)return;const E=c.color||((F=o.color)==null?void 0:F.replace("#",""))||"red",[C="pin6",T="m"]=o.icon?o.icon.split("-"):[];c.icon=o.iconPrefix||k!=null&&k.includes("/")?(o.iconPrefix||"")+k:`${C}-${T}-${k}+${E}.png`}),o.colorAttr&&d){const c=["match",["get",o.colorAttr]];d.forEach(b=>{c.push(b.id),c.push(b.color)}),c.push(o.color||"gray"),o.color=c}if(o.icon&&o.iconAttr&&p){const c=["match",["get",o.iconAttr]];p.filter(b=>b.icon).forEach(({id:b,icon:k})=>{if(o.colorAttr&&d){c.push(b);const E=["match",["get",o.colorAttr]];d.forEach(C=>{E.push(C.id);const T=k.split("+")[0]+"+"+C.color.replace("#","")+".png";E.push(T),Rl(T,n)}),E.push(o.icon),c.push(E)}else c.push(b),c.push(k),Rl(k,n)}),c.push((o.iconPrefix||"")+o.icon),Rl((o.iconPrefix||"")+o.icon,n),console.log(c),o.icon=c}else if(o.icon&&o.colorAttr&&d){const c=["match",["get",o.colorAttr]];d.forEach(b=>{c.push(b.id),c.push(b.icon),Rl(b.icon,n)}),c.push(o.icon),Rl(o.icon,n),o.icon=c}else o.icon&&await Rl(o.icon,n);return o.stroke=["case",["boolean",["feature-state","selected"],!1],"#000000",o.stroke||"#000000"],VP(o)}async function Rl(t="pin4-sm-mi-plumber+f45942.png",e=null){if(Sx[t])return null;Sx[t]=!0;const n=await(e==null?void 0:e.loadImage(t!=null&&t.includes("/")?t:`/api/marker_icon/${t.replace(".png","")}.png`));e==null||e.addImage(t,n.data)}const LP={data(){return{layerList:[],activeLayer:""}},computed:{interactiveSources(){return this.layerList.filter(t=>t==null?void 0:t.interactive).map(t=>t.id)}},methods:{moveLayer(t,e=this.map){e.getStyle().layers.forEach(n=>{n.id.match(t)&&e.moveLayer(n.id)})},async setVisible(t,e=!0,n=this.map){if(!t)return;const r=(t==null?void 0:t.id)||t,o=this.layerList.find(p=>p.id===t)||t;if(!(o!=null&&o.id))throw new Error("MixinError: Layer has no id");const d=n.getStyle().layers.filter(p=>p.id.match(r));d.forEach(p=>{n.setLayoutProperty(p.id,"visibility",e?"visible":"none")}),!d.length&&e&&await this.addLayer(o)},async addLayer(t,e=this==null?void 0:this.map){var o,d;const n=this.layerList.find(p=>p.id===t)||t;!this.map.getStyle()||this.map.getStyle().layers.find(p=>p.id===n.id)||(this.layerList.find(p=>p.id===n.id)||this.layerList.push(n),(n.service==="vtile"||n.service==="vector"||(o=n.url)!=null&&o.includes(".vmt"))&&this.addVtileLayer(n,e),n.service==="geojson"&&this.addGeoJsonLayer(n,e),((d=n.url)!=null&&d.includes(".png")||["tms","raster"].includes(n.service))&&await this.addRasterLayer(n,e))},async addRasterLayer(t,e=this==null?void 0:this.map){e.getSource(t.id)||(await e.addSource(t.id,{type:"raster",tiles:[t==null?void 0:t.url],tileSize:256,...t.bounds?{bounds:t.bounds.map(n=>n-0)}:{},...t!=null&&t.scheme?{scheme:t==null?void 0:t.scheme}:{}}),await e.addLayer({id:t.id,type:"raster",source:t.id,minzoom:0,maxzoom:(t==null?void 0:t.maxzoom)||22}))},async updateStyle(t,e=this==null?void 0:this.map){const n=t.id;e.getStyle().layers.forEach(async o=>{o.source===n&&await e.removeLayer(o.id)}),(await Lm(t.style,t.source,e)||t.layers||[]).forEach((o,d)=>{const p={...o,id:`${t.id}-${d}`,source:t.id,"source-layer":o["source-layer"]||t.source||t.id,maxzoom:+o.maxzoom||24,minzoom:+o.minzoom||0};e.addLayer(p)})},async addVtileLayer(t,e=this==null?void 0:this.map){var p;const n=["props","pointZoom","nocache"].filter(c=>t.style[c]).map(c=>{var b;return`&${c}=${(b=t.style)==null?void 0:b[c]}`}),r=new Date().toISOString().split("T")[0],o={type:"vector",tiles:[`${(p=t==null?void 0:t.url)!=null&&p.startsWith("http")?"":window.location.origin}${t==null?void 0:t.url}?dt=${r}${n}`],minzoom:t.minzoom||5,maxzoom:t.maxzoom||24};e.addSource(t.id,o),(t.layers||await Lm(t.style,t.source||t.id,e)||[]).forEach((c,b)=>{const k={...c,id:`${t.id}-${b}`,source:t.id,"source-layer":c["source-layer"]||t.source||t.id,maxzoom:+c.maxzoom||24,minzoom:+c.minzoom||0};e.addLayer(k)})},async addGeoJsonLayer(t,e=this.map){var o;const n=t.data||((o=t==null?void 0:t.url)!=null&&o.startsWith("http")?"":window.location.origin)+t.url;e.addSource(t.id,{type:"geojson",data:n}),(await Lm(t.style,n.source,e)||t.layers||[]).forEach(d=>{const p={...d,source:t.id,id:d.id||t.id,maxzoom:+d.maxzoom||24,minzoom:+d.minzoom||0,type:d.type||"circle"};e.addLayer(p)})},setLayerData(t,e){this.layerList=this.layerList.map(n=>n.id===t?{...n,...e}:n)},async removeLayer(t,e=this.map){e.getSource(t)&&(await e.getStyle().layers.forEach(async n=>{n.source===t&&await e.removeLayer(n.id)}),await e.removeSource(t))},async setFilter(t,e){const n=this.layerList.find(o=>o.id===t),r=await this.map.getSource(t);if(n.service==="vtile"){await r.setTiles([`${window.location.origin}${n.url}${n.url.includes("?")?"&":"?"}filter=${e}${n.props?`&props=${n.props}`:""}`]);return}n.service},async changeBaseLayer(t){t!==this.activeLayer&&(this.activeLayer&&this.map.setLayoutProperty(this.activeLayer,"visibility","none"),await this.setVisible(this.activeLayer,!1),await this.setVisible(t,!0),this.map.getStyle().layers.forEach(e=>{e.source!==t&&e.type!=="background"&&this.map.moveLayer(e.id)}),this.activeLayer=t)},async refreshLayer(t,e=this.map){await e.getStyle().layers.forEach(n=>{n.source===t&&e.removeLayer(n.id)}),await e.removeSource(t),this.setVisible(t)},addGeom(t,e={}){if(!this.map)return;const n={type:"FeatureCollection",features:[{type:"Feature",geometry:t.geometry,properties:{id:t.id,name:t==null?void 0:t.text}}]};if(this.map.getSource(t.id))this.map.getSource(t.id).setData(n);else{this.map.addSource(t.id,{type:"geojson",data:n});const r=t.geometry.type;let o={};switch(r){case"Point":o={"circle-color":e.color||"#ff0000","circle-radius":e.radius||5,"circle-opacity":e.opacity||1},this.map.addLayer({id:t.id,type:"circle",source:t.id,paint:o});break;case"LineString":o={"line-color":e.color||"#0000ff","line-width":e.width||2,"line-opacity":e.opacity||1},this.map.addLayer({id:t.id,type:"line",source:t.id,paint:o});break;case"Polygon":this.map.addLayer({id:t.id,type:"fill",source:t.id,paint:{"fill-color":e.color||"#00ff00","fill-opacity":e.opacity||.5}}),this.map.addLayer({id:`${t.id}-outline`,type:"line",source:t.id,paint:{"line-color":e.color||"#00ff00","line-width":e.width||2,"line-opacity":.8}});break;default:console.warn(`Unsupported geometry type: ${r}`);return}}},removeGeom(t){this.map&&(this.map.getLayer(t)&&this.map.removeLayer(t),this.map.getLayer(`${t}-outline`)&&this.map.removeLayer(`${t}-outline`),this.map.getSource(t)&&this.map.removeSource(t))}}},{Map:FP}=Dh,rr="widget-map-source",$P={mixins:[LP],props:{geometry:{type:Object,default:()=>null},zoom:{type:Number,default:()=>{var t,e;return((e=(t=et==null?void 0:et.value)==null?void 0:t.geom)==null?void 0:e.zoom)||1/0}},center:{type:Array,default:()=>{var t,e;return((e=(t=et==null?void 0:et.value)==null?void 0:t.geom)==null?void 0:e.center)||[30.5,50.45]}},height:{type:String,default:"400px"},layers:{type:Array,default:()=>{var t,e;return((e=(t=et==null?void 0:et.value)==null?void 0:t.geom)==null?void 0:e.layers)||[]}},card:{type:Boolean,default:!1}},data(){return{cardData:null,cardPosition:{top:"0px",right:"0px",left:"0px"},map:null,mapId:`gis-map-${Math.floor(Math.random()*1e3)}`,isOpen:!1,selectedBaseLayer:"topo100",isGeometryVisible:!0,localLayers:[],idleEventWorked:!1,selectedLayers:[],currentZoom:0,baseLayers:[{id:"topo100",name:"Карта України",url:"https://data.gki.com.ua/api-user/rtile/voyager/ua/{z}/{x}/{y}.png"},{id:"orto10",name:"Ortophoto 1:10К",url:"https://data.gki.com.ua/api-user/rtile/ortho_new/ua/{z}/{x}/{y}.png",service:"TMS"},{id:"osmb",name:"Open Street Map",url:"https://tile.openstreetmap.org.ua/styles/osm-bright/{z}/{x}/{y}.png",service:"TMS"}]}},mounted(){window.addEventListener("resize",this.updateCardPosition),this.updateCardPosition(),this.localLayers=this.layers,this.initMap()},components:{IconClose:PP},beforeUnmount(){window.removeEventListener("resize",this.updateCardPosition)},watch:{selectedLayers:{handler(){this.selectedLayers.forEach(t=>{this.map.getSource(t)&&this.map.getStyle().layers.forEach(n=>{n.source===t&&this.map.moveLayer(n.id)}),[`${rr}-polygon`,`${rr}-polygon-line`,`${rr}-line`,`${rr}-point`].forEach(n=>{this.map.getLayer(n)&&this.map.moveLayer(n)}),this.map.getLayer("selected-feature")&&this.map.moveLayer("selected-feature")})},immediate:!0},geometry(){this.initGeometryLayer()},layers:{handler(t){t&&!this.layers.length&&(this.localLayers=t)},deep:!0,immediate:!0}},methods:{updateCardPosition(){this.$nextTick(()=>{if(this.$refs.relativeContainer){const t=this.$refs.relativeContainer.getBoundingClientRect();this.cardPosition.top=`${t.top+10}`,this.cardPosition.right=`${t.right+10}`,this.cardPosition.left=`${t.left+10}`}})},initMap(){const t={version:8,glyphs:"https://fonts.openmaptiles.org/{fontstack}/{range}.pbf",sources:{},layers:[]};this.map=new FP({container:this.mapId,style:t,center:this.center,zoom:this.zoom,interactive:!0}),window==null||window.addEventListener("resize",()=>{this.map.resize()}),this.map.on("load",this.onMapLoad)},async onMapLoad(){var t,e,n,r,o,d;this.map.resize(),this.map.doubleClickZoom.disable(),this.map.on("zoom",()=>{this.currentZoom=this.map.getZoom()}),(e=(t=et==null?void 0:et.value)==null?void 0:t.geom)!=null&&e.bounds&&this.map.fitBounds(et.value.geom.bounds,{padding:20,duration:0}),this.zoom&&this.map.setZoom(this.zoom),this.changeBaseLayer(this.getLayerById(this.selectedBaseLayer)),this.localLayers.forEach(async p=>{p.enabled&&(await this.setLayerVisible(p,!0),this.selectedLayers.push(p.id))}),this.geometry&&this.initGeometryLayer(),(r=(n=et==null?void 0:et.value)==null?void 0:n.geom)!=null&&r.katottg&&await this.createAtuLayer((d=(o=et==null?void 0:et.value)==null?void 0:o.geom)==null?void 0:d.katottg),this.map.on("idle",()=>{this.idleEventWorked||this.selectedLayers.forEach(p=>{this.map.getSource(p)&&this.map.getStyle().layers.forEach(b=>{b.source===p&&this.map.moveLayer(b.id)}),[`${rr}-polygon`,`${rr}-polygon-line`,`${rr}-line`,`${rr}-point`].forEach(b=>{this.map.getLayer(b)&&this.map.moveLayer(b)})}),this.idleEventWorked=!0}),this.card&&this.map.on("click",async p=>{const c=this.map.queryRenderedFeatures(p.point);if(!c.length)return;const b=c.filter(k=>!k.source.includes(rr));if(b.length)try{const k=b.map(C=>Le.get(`/api/gis-format-admin?table=${C.sourceLayer}&id=${C.properties.id}`)),E=await Promise.all(k);this.cardData=E.map(C=>C.data)}catch(k){console.error("Помилка при отриманні даних",k)}})},async createAtuLayer(t){try{const{map:e}=this;if(!e)return;const{data:n}=await Le.get(`https://data.gki.com.ua/api-user/atu/${t}`);e.addSource("atu",{type:"geojson",data:n}),e.addLayer({id:"atu",type:"line",source:"atu",paint:{"line-color":"#3b82f6","line-width":2}})}catch(e){console.error(e)}},changeBaseLayer(t){const e="base-layer",n="base-layer";if(!this.map.getSource(e))this.map.addSource(e,{type:"raster",tiles:[t.url],tileSize:256}),this.map.addLayer({id:n,type:"raster",source:e});else{const r=this.map.getSource(e);r&&(r.tiles=[t.url],this.map.style.sourceCaches[e].clearTiles(),this.map.style.sourceCaches[e].update(this.map.transform),this.map.triggerRepaint())}},getLayerById(t){return this.baseLayers.find(e=>e.id===t)},initGeometryLayer(){var r,o,d;const{map:t}=this;if(!t)return;const e=this.formatGeojson(this.geometry),n=t.getSource(rr);if(((d=(o=(r=e.features)==null?void 0:r[0])==null?void 0:o.geometry)==null?void 0:d.type)!=="MultiPoint"&&this.zoomToGeometry(e),n){n.setData(e);return}t.addSource(rr,{type:"geojson",data:e}),t.addLayer({id:`${rr}-point`,type:"circle",source:rr,paint:{"circle-radius":10,"circle-color":"#F84C4C"},filter:["==","$type","Point"]}),t.addLayer({id:`${rr}-polygon`,type:"fill",source:rr,layout:{},paint:{"fill-color":"#4b0082","fill-opacity":.3},filter:["==","$type","Polygon"]}),t.addLayer({id:`${rr}-polygon-line`,type:"line",source:rr,layout:{},paint:{"line-color":"#4b0082","line-width":2},filter:["==","$type","Polygon"]}),t.addLayer({id:`${rr}-line`,type:"line",source:rr,layout:{},paint:{"line-color":"#4b0082","line-width":3},filter:["==","$type","LineString"]})},formatGeojson(t){let e=t;const n=t==null?void 0:t.type;if(Array.isArray(t))return Cx(t);if(!n)throw new Error("Unknown geometry type!");return n==="FeatureCollection"?t:(n==="Feature"&&(e=[t]),!["FeatureCollection","Feature"].includes(n)&&(e=[AP(t)]),Cx(e))},zoomToGeometry(t){var n,r,o,d,p,c;const{map:e}=this;if(((o=(r=(n=t.features)==null?void 0:n[0])==null?void 0:r.geometry)==null?void 0:o.type)==="Point"||t.type==="Point"){const b=((c=(p=(d=t.features)==null?void 0:d[0])==null?void 0:p.geometry)==null?void 0:c.coordinates)||t.coordinates;e.flyTo({center:b,zoom:this.zoom,duration:0})}else{const b=TP(t);e.fitBounds(b,{padding:30,duration:0})}},toggleGeometryVisibility(){[`${rr}-polygon`,`${rr}-polygon-line`,`${rr}-line`,`${rr}-point`].forEach(e=>{this.map.getLayer(e)&&this.map.setLayoutProperty(e,"visibility",this.isGeometryVisible?"visible":"none")})},async setLayerVisible(t,e){await this.setVisible(t,e,this.map)},closeCard(){this.cardData=null,this.removeGeom("selected-feature")}}},jP={key:1,class:"bg-white absolute top-[10px] right-[10px] z-20 border rounded-lg cursor-pointer"},UP={class:"flex items-center justify-between p-2 border-b"},HP={class:"flex items-center"},WP=["value","onChange"],qP={class:"ml-2"},GP={key:0,class:"p-2 border-b"},ZP={class:"flex items-center"},YP=["value","onChange"],XP={class:"ml-2"},KP={key:1,class:"p-2"},JP={class:"flex items-center"},QP=["id"];function eR(t,e,n,r,o,d){var c;const p=a.resolveComponent("IconClose");return a.openBlock(),a.createElementBlock("div",{class:"relative",ref:"relativeContainer",onClick:e[6]||(e[6]=(...b)=>d.updateCardPosition&&d.updateCardPosition(...b))},[o.isOpen?(a.openBlock(),a.createElementBlock("div",jP,[a.createElementVNode("div",UP,[e[7]||(e[7]=a.createElementVNode("div",null,"Шари",-1)),a.createVNode(p,{onClick:e[1]||(e[1]=b=>o.isOpen=!1),class:"w-4 h-4"})]),a.createElementVNode("div",{class:a.normalizeClass(["p-2 border-b",{"border-b":n.geometry}])},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(o.baseLayers,b=>(a.openBlock(),a.createElementBlock("div",{key:b.id},[a.createElementVNode("label",HP,[a.withDirectives(a.createElementVNode("input",{type:"radio",name:"base-layer",value:b.id,"onUpdate:modelValue":e[2]||(e[2]=k=>o.selectedBaseLayer=k),onChange:k=>d.changeBaseLayer(b)},null,40,WP),[[a.vModelRadio,o.selectedBaseLayer]]),a.createElementVNode("span",qP,a.toDisplayString(b.name),1)])]))),128))],2),(c=o.localLayers)!=null&&c.length?(a.openBlock(),a.createElementBlock("div",GP,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(o.localLayers,b=>(a.openBlock(),a.createElementBlock("div",{key:b.id},[a.createElementVNode("label",ZP,[a.withDirectives(a.createElementVNode("input",{type:"checkbox",value:b.id,"onUpdate:modelValue":e[3]||(e[3]=k=>o.selectedLayers=k),onChange:k=>d.setLayerVisible(b,k.target.checked)},null,40,YP),[[a.vModelCheckbox,o.selectedLayers]]),a.createElementVNode("span",XP,a.toDisplayString(b.name),1)])]))),128))])):a.createCommentVNode("",!0),n.geometry?(a.openBlock(),a.createElementBlock("div",KP,[a.createElementVNode("label",JP,[a.withDirectives(a.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":e[4]||(e[4]=b=>o.isGeometryVisible=b),onChange:e[5]||(e[5]=(...b)=>d.toggleGeometryVisibility&&d.toggleGeometryVisibility(...b))},null,544),[[a.vModelCheckbox,o.isGeometryVisible]]),e[8]||(e[8]=a.createElementVNode("span",{class:"ml-2"},"Показати геометрію",-1))])])):a.createCommentVNode("",!0)])):(a.openBlock(),a.createElementBlock("div",{key:0,class:"bg-white absolute top-[10px] right-[10px] z-[1] p-2 border rounded-lg cursor-pointer",onClick:e[0]||(e[0]=b=>o.isOpen=!0)}," Шари ")),a.createElementVNode("div",{id:o.mapId,style:a.normalizeStyle({height:n.height})},null,12,QP),a.renderSlot(t.$slots,"card",{map:o.map,cardData:o.cardData,cardPosition:o.cardPosition,closeCard:d.closeCard})],512)}const Fm=Oe($P,[["render",eR]]),ct=(t,e=1e4)=>(t=parseFloat(t+"")||0,Math.round((t+Number.EPSILON)*e)/e),$m=function(t){if(!(t&&t instanceof Element&&t.offsetParent))return!1;const e=t.scrollHeight>t.clientHeight,n=window.getComputedStyle(t).overflowY,r=n.indexOf("hidden")!==-1,o=n.indexOf("visible")!==-1;return e&&!r&&!o},Mh=function(t,e=void 0){return!(!t||t===document.body||e&&t===e)&&($m(t)?t:Mh(t.parentElement,e))},Ss=function(t){var e=new DOMParser().parseFromString(t,"text/html").body;if(e.childElementCount>1){for(var n=document.createElement("div");e.firstChild;)n.appendChild(e.firstChild);return n}return e.firstChild},jm=t=>`${t||""}`.split(" ").filter(e=>!!e),Ts=(t,e,n)=>{t&&jm(e).forEach(r=>{t.classList.toggle(r,n||!1)})};let Nl=class{constructor(e){Object.defineProperty(this,"pageX",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"pageY",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientX",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientY",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"nativePointer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.nativePointer=e,this.pageX=e.pageX,this.pageY=e.pageY,this.clientX=e.clientX,this.clientY=e.clientY,this.id=self.Touch&&e instanceof Touch?e.identifier:-1,this.time=Date.now()}};const Bl={passive:!1};let tR=class{constructor(e,{start:n=()=>!0,move:r=()=>{},end:o=()=>{}}){Object.defineProperty(this,"element",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"startCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"moveCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"endCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"currentPointers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"startPointers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),this.element=e,this.startCallback=n,this.moveCallback=r,this.endCallback=o;for(const d of["onPointerStart","onTouchStart","onMove","onTouchEnd","onPointerEnd","onWindowBlur"])this[d]=this[d].bind(this);this.element.addEventListener("mousedown",this.onPointerStart,Bl),this.element.addEventListener("touchstart",this.onTouchStart,Bl),this.element.addEventListener("touchmove",this.onMove,Bl),this.element.addEventListener("touchend",this.onTouchEnd),this.element.addEventListener("touchcancel",this.onTouchEnd)}onPointerStart(e){if(!e.buttons||e.button!==0)return;const n=new Nl(e);this.currentPointers.some(r=>r.id===n.id)||this.triggerPointerStart(n,e)&&(window.addEventListener("mousemove",this.onMove),window.addEventListener("mouseup",this.onPointerEnd),window.addEventListener("blur",this.onWindowBlur))}onTouchStart(e){for(const n of Array.from(e.changedTouches||[]))this.triggerPointerStart(new Nl(n),e);window.addEventListener("blur",this.onWindowBlur)}onMove(e){const n=this.currentPointers.slice(),r="changedTouches"in e?Array.from(e.changedTouches||[]).map(d=>new Nl(d)):[new Nl(e)],o=[];for(const d of r){const p=this.currentPointers.findIndex(c=>c.id===d.id);p<0||(o.push(d),this.currentPointers[p]=d)}o.length&&this.moveCallback(e,this.currentPointers.slice(),n)}onPointerEnd(e){e.buttons>0&&e.button!==0||(this.triggerPointerEnd(e,new Nl(e)),window.removeEventListener("mousemove",this.onMove),window.removeEventListener("mouseup",this.onPointerEnd),window.removeEventListener("blur",this.onWindowBlur))}onTouchEnd(e){for(const n of Array.from(e.changedTouches||[]))this.triggerPointerEnd(e,new Nl(n))}triggerPointerStart(e,n){return!!this.startCallback(n,e,this.currentPointers.slice())&&(this.currentPointers.push(e),this.startPointers.push(e),!0)}triggerPointerEnd(e,n){const r=this.currentPointers.findIndex(o=>o.id===n.id);r<0||(this.currentPointers.splice(r,1),this.startPointers.splice(r,1),this.endCallback(e,n,this.currentPointers.slice()))}onWindowBlur(){this.clear()}clear(){for(;this.currentPointers.length;){const e=this.currentPointers[this.currentPointers.length-1];this.currentPointers.splice(this.currentPointers.length-1,1),this.startPointers.splice(this.currentPointers.length-1,1),this.endCallback(new Event("touchend",{bubbles:!0,cancelable:!0,clientX:e.clientX,clientY:e.clientY}),e,this.currentPointers.slice())}}stop(){this.element.removeEventListener("mousedown",this.onPointerStart,Bl),this.element.removeEventListener("touchstart",this.onTouchStart,Bl),this.element.removeEventListener("touchmove",this.onMove,Bl),this.element.removeEventListener("touchend",this.onTouchEnd),this.element.removeEventListener("touchcancel",this.onTouchEnd),window.removeEventListener("mousemove",this.onMove),window.removeEventListener("mouseup",this.onPointerEnd),window.removeEventListener("blur",this.onWindowBlur)}};function Ax(t,e){return e?Math.sqrt(Math.pow(e.clientX-t.clientX,2)+Math.pow(e.clientY-t.clientY,2)):0}function Dx(t,e){return e?{clientX:(t.clientX+e.clientX)/2,clientY:(t.clientY+e.clientY)/2}:t}const Um=t=>typeof t=="object"&&t!==null&&t.constructor===Object&&Object.prototype.toString.call(t)==="[object Object]",fi=(t,...e)=>{const n=e.length;for(let r=0;r<n;r++){const o=e[r]||{};Object.entries(o).forEach(([d,p])=>{const c=Array.isArray(p)?[]:{};t[d]||Object.assign(t,{[d]:c}),Um(p)?Object.assign(t[d],fi(c,p)):Array.isArray(p)?Object.assign(t,{[d]:[...p]}):Object.assign(t,{[d]:p})})}return t},Hm=function(t,e){return t.split(".").reduce((n,r)=>typeof n=="object"?n[r]:void 0,e)};let Ih=class{constructor(e={}){Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),this.setOptions(e);for(const n of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))n.startsWith("on")&&typeof this[n]=="function"&&(this[n]=this[n].bind(this))}setOptions(e){this.options=e?fi({},this.constructor.defaults,e):{};for(const[n,r]of Object.entries(this.option("on")||{}))this.on(n,r)}option(e,...n){let r=Hm(e,this.options);return r&&typeof r=="function"&&(r=r.call(this,this,...n)),r}optionFor(e,n,r,...o){let d=Hm(n,e);var p;typeof(p=d)!="string"||isNaN(p)||isNaN(parseFloat(p))||(d=parseFloat(d)),d==="true"&&(d=!0),d==="false"&&(d=!1),d&&typeof d=="function"&&(d=d.call(this,this,e,...o));let c=Hm(n,this.options);return c&&typeof c=="function"?d=c.call(this,this,e,...o,d):d===void 0&&(d=c),d===void 0?r:d}cn(e){const n=this.options.classes;return n&&n[e]||""}localize(e,n=[]){e=String(e).replace(/\{\{(\w+).?(\w+)?\}\}/g,(r,o,d)=>{let p="";return d?p=this.option(`${o[0]+o.toLowerCase().substring(1)}.l10n.${d}`):o&&(p=this.option(`l10n.${o}`)),p||(p=r),p});for(let r=0;r<n.length;r++)e=e.split(n[r][0]).join(n[r][1]);return e=e.replace(/\{\{(.*?)\}\}/g,(r,o)=>o)}on(e,n){let r=[];typeof e=="string"?r=e.split(" "):Array.isArray(e)&&(r=e),this.events||(this.events=new Map),r.forEach(o=>{let d=this.events.get(o);d||(this.events.set(o,[]),d=[]),d.includes(n)||d.push(n),this.events.set(o,d)})}off(e,n){let r=[];typeof e=="string"?r=e.split(" "):Array.isArray(e)&&(r=e),r.forEach(o=>{const d=this.events.get(o);if(Array.isArray(d)){const p=d.indexOf(n);p>-1&&d.splice(p,1)}})}emit(e,...n){[...this.events.get(e)||[]].forEach(r=>r(this,...n)),e!=="*"&&this.emit("*",e,...n)}};Object.defineProperty(Ih,"version",{enumerable:!0,configurable:!0,writable:!0,value:"5.0.36"}),Object.defineProperty(Ih,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{}});let Wm=class extends Ih{constructor(e={}){super(e),Object.defineProperty(this,"plugins",{enumerable:!0,configurable:!0,writable:!0,value:{}})}attachPlugins(e={}){const n=new Map;for(const[r,o]of Object.entries(e)){const d=this.option(r),p=this.plugins[r];p||d===!1?p&&d===!1&&(p.detach(),delete this.plugins[r]):n.set(r,new o(this,d||{}))}for(const[r,o]of n)this.plugins[r]=o,o.attach()}detachPlugins(e){e=e||Object.keys(this.plugins);for(const n of e){const r=this.plugins[n];r&&r.detach(),delete this.plugins[n]}return this.emit("detachPlugins"),this}};var An;(function(t){t[t.Init=0]="Init",t[t.Error=1]="Error",t[t.Ready=2]="Ready",t[t.Panning=3]="Panning",t[t.Mousemove=4]="Mousemove",t[t.Destroy=5]="Destroy"})(An||(An={}));const eo=["a","b","c","d","e","f"],Mx={PANUP:"Move up",PANDOWN:"Move down",PANLEFT:"Move left",PANRIGHT:"Move right",ZOOMIN:"Zoom in",ZOOMOUT:"Zoom out",TOGGLEZOOM:"Toggle zoom level",TOGGLE1TO1:"Toggle zoom level",ITERATEZOOM:"Toggle zoom level",ROTATECCW:"Rotate counterclockwise",ROTATECW:"Rotate clockwise",FLIPX:"Flip horizontally",FLIPY:"Flip vertically",FITX:"Fit horizontally",FITY:"Fit vertically",RESET:"Reset",TOGGLEFS:"Toggle fullscreen"},nR={content:null,width:"auto",height:"auto",panMode:"drag",touch:!0,dragMinThreshold:3,lockAxis:!1,mouseMoveFactor:1,mouseMoveFriction:.12,zoom:!0,pinchToZoom:!0,panOnlyZoomed:"auto",minScale:1,maxScale:2,friction:.25,dragFriction:.35,decelFriction:.05,click:"toggleZoom",dblClick:!1,wheel:"zoom",wheelLimit:7,spinner:!0,bounds:"auto",infinite:!1,rubberband:!0,bounce:!0,maxVelocity:75,transformParent:!1,classes:{content:"f-panzoom__content",isLoading:"is-loading",canZoomIn:"can-zoom_in",canZoomOut:"can-zoom_out",isDraggable:"is-draggable",isDragging:"is-dragging",inFullscreen:"in-fullscreen",htmlHasFullscreen:"with-panzoom-in-fullscreen"},l10n:Mx},Ix='<circle cx="25" cy="25" r="20"></circle>',qm='<div class="f-spinner"><svg viewBox="0 0 50 50">'+Ix+Ix+"</svg></div>",mi=t=>t&&t!==null&&t instanceof Element&&"nodeType"in t,En=(t,e)=>{t&&jm(e).forEach(n=>{t.classList.remove(n)})},Tt=(t,e)=>{t&&jm(e).forEach(n=>{t.classList.add(n)})},Ph={a:1,b:0,c:0,d:1,e:0,f:0},rR=1e5,Rh=1e4,Yi="mousemove",Px="drag",Rx="content",Xi="auto";let Gm=null,Zm=null,Vl=class vE extends Wm{get fits(){return this.contentRect.width-this.contentRect.fitWidth<1&&this.contentRect.height-this.contentRect.fitHeight<1}get isTouchDevice(){return Zm===null&&(Zm=window.matchMedia("(hover: none)").matches),Zm}get isMobile(){return Gm===null&&(Gm=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)),Gm}get panMode(){return this.options.panMode!==Yi||this.isTouchDevice?Px:Yi}get panOnlyZoomed(){const e=this.options.panOnlyZoomed;return e===Xi?this.isTouchDevice:e}get isInfinite(){return this.option("infinite")}get angle(){return 180*Math.atan2(this.current.b,this.current.a)/Math.PI||0}get targetAngle(){return 180*Math.atan2(this.target.b,this.target.a)/Math.PI||0}get scale(){const{a:e,b:n}=this.current;return Math.sqrt(e*e+n*n)||1}get targetScale(){const{a:e,b:n}=this.target;return Math.sqrt(e*e+n*n)||1}get minScale(){return this.option("minScale")||1}get fullScale(){const{contentRect:e}=this;return e.fullWidth/e.fitWidth||1}get maxScale(){return this.fullScale*(this.option("maxScale")||1)||1}get coverScale(){const{containerRect:e,contentRect:n}=this,r=Math.max(e.height/n.fitHeight,e.width/n.fitWidth)||1;return Math.min(this.fullScale,r)}get isScaling(){return Math.abs(this.targetScale-this.scale)>1e-5&&!this.isResting}get isContentLoading(){const e=this.content;return!!(e&&e instanceof HTMLImageElement)&&!e.complete}get isResting(){if(this.isBouncingX||this.isBouncingY)return!1;for(const e of eo){const n=e=="e"||e==="f"?1e-4:1e-5;if(Math.abs(this.target[e]-this.current[e])>n)return!1}return!(!this.ignoreBounds&&!this.checkBounds().inBounds)}constructor(e,n={},r={}){var o;if(super(n),Object.defineProperty(this,"pointerTracker",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"resizeObserver",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"updateTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"clickTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"rAF",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"isTicking",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"ignoreBounds",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isBouncingX",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isBouncingY",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"clicks",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"trackingPoints",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"pwt",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"cwd",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"pmme",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"friction",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:An.Init}),Object.defineProperty(this,"isDragging",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"content",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"spinner",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"containerRect",{enumerable:!0,configurable:!0,writable:!0,value:{width:0,height:0,innerWidth:0,innerHeight:0}}),Object.defineProperty(this,"contentRect",{enumerable:!0,configurable:!0,writable:!0,value:{top:0,right:0,bottom:0,left:0,fullWidth:0,fullHeight:0,fitWidth:0,fitHeight:0,width:0,height:0}}),Object.defineProperty(this,"dragStart",{enumerable:!0,configurable:!0,writable:!0,value:{x:0,y:0,top:0,left:0,time:0}}),Object.defineProperty(this,"dragOffset",{enumerable:!0,configurable:!0,writable:!0,value:{x:0,y:0,time:0}}),Object.defineProperty(this,"current",{enumerable:!0,configurable:!0,writable:!0,value:Object.assign({},Ph)}),Object.defineProperty(this,"target",{enumerable:!0,configurable:!0,writable:!0,value:Object.assign({},Ph)}),Object.defineProperty(this,"velocity",{enumerable:!0,configurable:!0,writable:!0,value:{a:0,b:0,c:0,d:0,e:0,f:0}}),Object.defineProperty(this,"lockedAxis",{enumerable:!0,configurable:!0,writable:!0,value:!1}),!e)throw new Error("Container Element Not Found");this.container=e,this.initContent(),this.attachPlugins(Object.assign(Object.assign({},vE.Plugins),r)),this.emit("attachPlugins"),this.emit("init");const d=this.content;if(d.addEventListener("load",this.onLoad),d.addEventListener("error",this.onError),this.isContentLoading){if(this.option("spinner")){e.classList.add(this.cn("isLoading"));const p=Ss(qm);!e.contains(d)||d.parentElement instanceof HTMLPictureElement?this.spinner=e.appendChild(p):this.spinner=((o=d.parentElement)===null||o===void 0?void 0:o.insertBefore(p,d))||null}this.emit("beforeLoad")}else queueMicrotask(()=>{this.enable()})}initContent(){const{container:e}=this,n=this.cn(Rx);let r=this.option(Rx)||e.querySelector(`.${n}`);if(r||(r=e.querySelector("img,picture")||e.firstElementChild,r&&Tt(r,n)),r instanceof HTMLPictureElement&&(r=r.querySelector("img")),!r)throw new Error("No content found");this.content=r}onLoad(){const{spinner:e,container:n,state:r}=this;e&&(e.remove(),this.spinner=null),this.option("spinner")&&n.classList.remove(this.cn("isLoading")),this.emit("afterLoad"),r===An.Init?this.enable():this.updateMetrics()}onError(){this.state!==An.Destroy&&(this.spinner&&(this.spinner.remove(),this.spinner=null),this.stop(),this.detachEvents(),this.state=An.Error,this.emit("error"))}getNextScale(e){const{fullScale:n,targetScale:r,coverScale:o,maxScale:d,minScale:p}=this;let c=p;switch(e){case"toggleMax":c=r-p<.5*(d-p)?d:p;break;case"toggleCover":c=r-p<.5*(o-p)?o:p;break;case"toggleZoom":c=r-p<.5*(n-p)?n:p;break;case"iterateZoom":let b=[1,n,d].sort((E,C)=>E-C),k=b.findIndex(E=>E>r+1e-5);c=b[k]||1}return c}attachObserver(){var e;const n=()=>{const{container:r,containerRect:o}=this;return Math.abs(o.width-r.getBoundingClientRect().width)>.1||Math.abs(o.height-r.getBoundingClientRect().height)>.1};this.resizeObserver||window.ResizeObserver===void 0||(this.resizeObserver=new ResizeObserver(()=>{this.updateTimer||(n()?(this.onResize(),this.isMobile&&(this.updateTimer=setTimeout(()=>{n()&&this.onResize(),this.updateTimer=null},500))):this.updateTimer&&(clearTimeout(this.updateTimer),this.updateTimer=null))})),(e=this.resizeObserver)===null||e===void 0||e.observe(this.container)}detachObserver(){var e;(e=this.resizeObserver)===null||e===void 0||e.disconnect()}attachEvents(){const{container:e}=this;e.addEventListener("click",this.onClick,{passive:!1,capture:!1}),e.addEventListener("wheel",this.onWheel,{passive:!1}),this.pointerTracker=new tR(e,{start:this.onPointerDown,move:this.onPointerMove,end:this.onPointerUp}),document.addEventListener(Yi,this.onMouseMove)}detachEvents(){var e;const{container:n}=this;n.removeEventListener("click",this.onClick,{passive:!1,capture:!1}),n.removeEventListener("wheel",this.onWheel,{passive:!1}),(e=this.pointerTracker)===null||e===void 0||e.stop(),this.pointerTracker=null,document.removeEventListener(Yi,this.onMouseMove),document.removeEventListener("keydown",this.onKeydown,!0),this.clickTimer&&(clearTimeout(this.clickTimer),this.clickTimer=null),this.updateTimer&&(clearTimeout(this.updateTimer),this.updateTimer=null)}animate(){this.setTargetForce();const e=this.friction,n=this.option("maxVelocity");for(const r of eo)e?(this.velocity[r]*=1-e,n&&!this.isScaling&&(this.velocity[r]=Math.max(Math.min(this.velocity[r],n),-1*n)),this.current[r]+=this.velocity[r]):this.current[r]=this.target[r];this.setTransform(),this.setEdgeForce(),!this.isResting||this.isDragging?this.rAF=requestAnimationFrame(()=>this.animate()):this.stop("current")}setTargetForce(){for(const e of eo)e==="e"&&this.isBouncingX||e==="f"&&this.isBouncingY||(this.velocity[e]=(1/(1-this.friction)-1)*(this.target[e]-this.current[e]))}checkBounds(e=0,n=0){const{current:r}=this,o=r.e+e,d=r.f+n,p=this.getBounds(),{x:c,y:b}=p,k=c.min,E=c.max,C=b.min,T=b.max;let I=0,N=0;return k!==1/0&&o<k?I=k-o:E!==1/0&&o>E&&(I=E-o),C!==1/0&&d<C?N=C-d:T!==1/0&&d>T&&(N=T-d),Math.abs(I)<1e-4&&(I=0),Math.abs(N)<1e-4&&(N=0),Object.assign(Object.assign({},p),{xDiff:I,yDiff:N,inBounds:!I&&!N})}clampTargetBounds(){const{target:e}=this,{x:n,y:r}=this.getBounds();n.min!==1/0&&(e.e=Math.max(e.e,n.min)),n.max!==1/0&&(e.e=Math.min(e.e,n.max)),r.min!==1/0&&(e.f=Math.max(e.f,r.min)),r.max!==1/0&&(e.f=Math.min(e.f,r.max))}calculateContentDim(e=this.current){const{content:n,contentRect:r}=this,{fitWidth:o,fitHeight:d,fullWidth:p,fullHeight:c}=r;let b=p,k=c;if(this.option("zoom")||this.angle!==0){const E=!(n instanceof HTMLImageElement)&&(window.getComputedStyle(n).maxWidth==="none"||window.getComputedStyle(n).maxHeight==="none"),C=E?p:o,T=E?c:d,I=this.getMatrix(e),N=new DOMPoint(0,0).matrixTransform(I),$=new DOMPoint(0+C,0).matrixTransform(I),F=new DOMPoint(0+C,0+T).matrixTransform(I),q=new DOMPoint(0,0+T).matrixTransform(I),J=Math.abs(F.x-N.x),Q=Math.abs(F.y-N.y),me=Math.abs(q.x-$.x),ke=Math.abs(q.y-$.y);b=Math.max(J,me),k=Math.max(Q,ke)}return{contentWidth:b,contentHeight:k}}setEdgeForce(){if(this.ignoreBounds||this.isDragging||this.panMode===Yi||this.targetScale<this.scale)return this.isBouncingX=!1,void(this.isBouncingY=!1);const{target:e}=this,{x:n,y:r,xDiff:o,yDiff:d}=this.checkBounds(),p=this.option("maxVelocity");let c=this.velocity.e,b=this.velocity.f;o!==0?(this.isBouncingX=!0,o*c<=0?c+=.14*o:(c=.14*o,n.min!==1/0&&(this.target.e=Math.max(e.e,n.min)),n.max!==1/0&&(this.target.e=Math.min(e.e,n.max))),p&&(c=Math.max(Math.min(c,p),-1*p))):this.isBouncingX=!1,d!==0?(this.isBouncingY=!0,d*b<=0?b+=.14*d:(b=.14*d,r.min!==1/0&&(this.target.f=Math.max(e.f,r.min)),r.max!==1/0&&(this.target.f=Math.min(e.f,r.max))),p&&(b=Math.max(Math.min(b,p),-1*p))):this.isBouncingY=!1,this.isBouncingX&&(this.velocity.e=c),this.isBouncingY&&(this.velocity.f=b)}enable(){const{content:e}=this,n=new DOMMatrixReadOnly(window.getComputedStyle(e).transform);for(const r of eo)this.current[r]=this.target[r]=n[r];this.updateMetrics(),this.attachObserver(),this.attachEvents(),this.state=An.Ready,this.emit("ready")}onClick(e){var n;e.type==="click"&&e.detail===0&&(this.dragOffset.x=0,this.dragOffset.y=0),this.isDragging&&((n=this.pointerTracker)===null||n===void 0||n.clear(),this.trackingPoints=[],this.startDecelAnim());const r=e.target;if(!r||e.defaultPrevented)return;if(r.hasAttribute("disabled"))return e.preventDefault(),void e.stopPropagation();if((()=>{const I=window.getSelection();return I&&I.type==="Range"})()&&!r.closest("button"))return;const o=r.closest("[data-panzoom-action]"),d=r.closest("[data-panzoom-change]"),p=o||d,c=p&&mi(p)?p.dataset:null;if(c){const I=c.panzoomChange,N=c.panzoomAction;if((I||N)&&e.preventDefault(),I){let $={};try{$=JSON.parse(I)}catch{console&&console.warn("The given data was not valid JSON")}return void this.applyChange($)}if(N)return void(this[N]&&this[N]())}if(Math.abs(this.dragOffset.x)>3||Math.abs(this.dragOffset.y)>3)return e.preventDefault(),void e.stopPropagation();if(r.closest("[data-fancybox]"))return;const b=this.content.getBoundingClientRect(),k=this.dragStart;if(k.time&&!this.canZoomOut()&&(Math.abs(b.x-k.x)>2||Math.abs(b.y-k.y)>2))return;this.dragStart.time=0;const E=I=>{this.option("zoom",e)&&I&&typeof I=="string"&&/(iterateZoom)|(toggle(Zoom|Full|Cover|Max)|(zoomTo(Fit|Cover|Max)))/.test(I)&&typeof this[I]=="function"&&(e.preventDefault(),this[I]({event:e}))},C=this.option("click",e),T=this.option("dblClick",e);T?(this.clicks++,this.clicks==1&&(this.clickTimer=setTimeout(()=>{this.clicks===1?(this.emit("click",e),!e.defaultPrevented&&C&&E(C)):(this.emit("dblClick",e),e.defaultPrevented||E(T)),this.clicks=0,this.clickTimer=null},350))):(this.emit("click",e),!e.defaultPrevented&&C&&E(C))}addTrackingPoint(e){const n=this.trackingPoints.filter(r=>r.time>Date.now()-100);n.push(e),this.trackingPoints=n}onPointerDown(e,n,r){var o;if(this.option("touch",e)===!1)return!1;this.pwt=0,this.dragOffset={x:0,y:0,time:0},this.trackingPoints=[];const d=this.content.getBoundingClientRect();if(this.dragStart={x:d.x,y:d.y,top:d.top,left:d.left,time:Date.now()},this.clickTimer)return!1;if(this.panMode===Yi&&this.targetScale>1)return e.preventDefault(),e.stopPropagation(),!1;const p=e.composedPath()[0];if(!r.length){if(["TEXTAREA","OPTION","INPUT","SELECT","VIDEO","IFRAME"].includes(p.nodeName)||p.closest("[contenteditable],[data-selectable],[data-draggable],[data-clickable],[data-panzoom-change],[data-panzoom-action]"))return!1;(o=window.getSelection())===null||o===void 0||o.removeAllRanges()}if(e.type==="mousedown")["A","BUTTON"].includes(p.nodeName)||e.preventDefault();else if(Math.abs(this.velocity.a)>.3)return!1;return this.target.e=this.current.e,this.target.f=this.current.f,this.stop(),this.isDragging||(this.isDragging=!0,this.addTrackingPoint(n),this.emit("touchStart",e)),!0}onPointerMove(e,n,r){if(this.option("touch",e)===!1||!this.isDragging||n.length<2&&this.panOnlyZoomed&&ct(this.targetScale)<=ct(this.minScale)||(this.emit("touchMove",e),e.defaultPrevented))return;this.addTrackingPoint(n[0]);const{content:o}=this,d=Dx(r[0],r[1]),p=Dx(n[0],n[1]);let c=0,b=0;if(n.length>1){const Q=o.getBoundingClientRect();c=d.clientX-Q.left-.5*Q.width,b=d.clientY-Q.top-.5*Q.height}const k=Ax(r[0],r[1]),E=Ax(n[0],n[1]);let C=k?E/k:1,T=p.clientX-d.clientX,I=p.clientY-d.clientY;this.dragOffset.x+=T,this.dragOffset.y+=I,this.dragOffset.time=Date.now()-this.dragStart.time;let N=ct(this.targetScale)===ct(this.minScale)&&this.option("lockAxis");if(N&&!this.lockedAxis)if(N==="xy"||N==="y"||e.type==="touchmove"){if(Math.abs(this.dragOffset.x)<6&&Math.abs(this.dragOffset.y)<6)return void e.preventDefault();const Q=Math.abs(180*Math.atan2(this.dragOffset.y,this.dragOffset.x)/Math.PI);this.lockedAxis=Q>45&&Q<135?"y":"x",this.dragOffset.x=0,this.dragOffset.y=0,T=0,I=0}else this.lockedAxis=N;if(Mh(e.target,this.content)&&(N="x",this.dragOffset.y=0),N&&N!=="xy"&&this.lockedAxis!==N&&ct(this.targetScale)===ct(this.minScale))return;e.cancelable&&e.preventDefault(),this.container.classList.add(this.cn("isDragging"));const $=this.checkBounds(T,I);this.option("rubberband")?(this.isInfinite!=="x"&&($.xDiff>0&&T<0||$.xDiff<0&&T>0)&&(T*=Math.max(0,.5-Math.abs(.75/this.contentRect.fitWidth*$.xDiff))),this.isInfinite!=="y"&&($.yDiff>0&&I<0||$.yDiff<0&&I>0)&&(I*=Math.max(0,.5-Math.abs(.75/this.contentRect.fitHeight*$.yDiff)))):($.xDiff&&(T=0),$.yDiff&&(I=0));const F=this.targetScale,q=this.minScale,J=this.maxScale;F<.5*q&&(C=Math.max(C,q)),F>1.5*J&&(C=Math.min(C,J)),this.lockedAxis==="y"&&ct(F)===ct(q)&&(T=0),this.lockedAxis==="x"&&ct(F)===ct(q)&&(I=0),this.applyChange({originX:c,originY:b,panX:T,panY:I,scale:C,friction:this.option("dragFriction"),ignoreBounds:!0})}onPointerUp(e,n,r){if(r.length)return this.dragOffset.x=0,this.dragOffset.y=0,void(this.trackingPoints=[]);this.container.classList.remove(this.cn("isDragging")),this.isDragging&&(this.addTrackingPoint(n),this.panOnlyZoomed&&this.contentRect.width-this.contentRect.fitWidth<1&&this.contentRect.height-this.contentRect.fitHeight<1&&(this.trackingPoints=[]),Mh(e.target,this.content)&&this.lockedAxis==="y"&&(this.trackingPoints=[]),this.emit("touchEnd",e),this.isDragging=!1,this.lockedAxis=!1,this.state!==An.Destroy&&(e.defaultPrevented||this.startDecelAnim()))}startDecelAnim(){var e;const n=this.isScaling;this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const Q of eo)this.velocity[Q]=0;this.target.e=this.current.e,this.target.f=this.current.f,En(this.container,"is-scaling"),En(this.container,"is-animating"),this.isTicking=!1;const{trackingPoints:r}=this,o=r[0],d=r[r.length-1];let p=0,c=0,b=0;d&&o&&(p=d.clientX-o.clientX,c=d.clientY-o.clientY,b=d.time-o.time);const k=((e=window.visualViewport)===null||e===void 0?void 0:e.scale)||1;k!==1&&(p*=k,c*=k);let E=0,C=0,T=0,I=0,N=this.option("decelFriction");const $=this.targetScale;if(b>0){T=Math.abs(p)>3?p/(b/30):0,I=Math.abs(c)>3?c/(b/30):0;const Q=this.option("maxVelocity");Q&&(T=Math.max(Math.min(T,Q),-1*Q),I=Math.max(Math.min(I,Q),-1*Q))}T&&(E=T/(1/(1-N)-1)),I&&(C=I/(1/(1-N)-1)),(this.option("lockAxis")==="y"||this.option("lockAxis")==="xy"&&this.lockedAxis==="y"&&ct($)===this.minScale)&&(E=T=0),(this.option("lockAxis")==="x"||this.option("lockAxis")==="xy"&&this.lockedAxis==="x"&&ct($)===this.minScale)&&(C=I=0);const F=this.dragOffset.x,q=this.dragOffset.y,J=this.option("dragMinThreshold")||0;Math.abs(F)<J&&Math.abs(q)<J&&(E=C=0,T=I=0),(this.option("zoom")&&($<this.minScale-1e-5||$>this.maxScale+1e-5)||n&&!E&&!C)&&(N=.35),this.applyChange({panX:E,panY:C,friction:N}),this.emit("decel",T,I,F,q)}onWheel(e){var n=[-e.deltaX||0,-e.deltaY||0,-e.detail||0].reduce(function(d,p){return Math.abs(p)>Math.abs(d)?p:d});const r=Math.max(-1,Math.min(1,n));if(this.emit("wheel",e,r),this.panMode===Yi||e.defaultPrevented)return;const o=this.option("wheel");o==="pan"?(e.preventDefault(),this.panOnlyZoomed&&!this.canZoomOut()||this.applyChange({panX:2*-e.deltaX,panY:2*-e.deltaY,bounce:!1})):o==="zoom"&&this.option("zoom")!==!1&&this.zoomWithWheel(e)}onMouseMove(e){this.panWithMouse(e)}onKeydown(e){e.key==="Escape"&&this.toggleFS()}onResize(){this.updateMetrics(),this.checkBounds().inBounds||this.requestTick()}setTransform(){this.emit("beforeTransform");const{current:e,target:n,content:r,contentRect:o}=this,d=Object.assign({},Ph);for(const F of eo){const q=F=="e"||F==="f"?Rh:rR;d[F]=ct(e[F],q),Math.abs(n[F]-e[F])<(F=="e"||F==="f"?.51:.001)&&(e[F]=n[F])}let{a:p,b:c,c:b,d:k,e:E,f:C}=d,T=`matrix(${p}, ${c}, ${b}, ${k}, ${E}, ${C})`,I=r.parentElement instanceof HTMLPictureElement?r.parentElement:r;if(this.option("transformParent")&&(I=I.parentElement||I),I.style.transform===T)return;I.style.transform=T;const{contentWidth:N,contentHeight:$}=this.calculateContentDim();o.width=N,o.height=$,this.emit("afterTransform")}updateMetrics(e=!1){var n;if(!this||this.state===An.Destroy||this.isContentLoading)return;const r=Math.max(1,((n=window.visualViewport)===null||n===void 0?void 0:n.scale)||1),{container:o,content:d}=this,p=d instanceof HTMLImageElement,c=o.getBoundingClientRect(),b=getComputedStyle(this.container);let k=c.width*r,E=c.height*r;const C=parseFloat(b.paddingTop)+parseFloat(b.paddingBottom),T=k-(parseFloat(b.paddingLeft)+parseFloat(b.paddingRight)),I=E-C;this.containerRect={width:k,height:E,innerWidth:T,innerHeight:I};const N=parseFloat(d.dataset.width||"")||(ot=>{let ue=0;return ue=ot instanceof HTMLImageElement?ot.naturalWidth:ot instanceof SVGElement?ot.width.baseVal.value:Math.max(ot.offsetWidth,ot.scrollWidth),ue||0})(d),$=parseFloat(d.dataset.height||"")||(ot=>{let ue=0;return ue=ot instanceof HTMLImageElement?ot.naturalHeight:ot instanceof SVGElement?ot.height.baseVal.value:Math.max(ot.offsetHeight,ot.scrollHeight),ue||0})(d);let F=this.option("width",N)||Xi,q=this.option("height",$)||Xi;const J=F===Xi,Q=q===Xi;typeof F!="number"&&(F=N),typeof q!="number"&&(q=$),J&&(F=N*(q/$)),Q&&(q=$/(N/F));let me=d.parentElement instanceof HTMLPictureElement?d.parentElement:d;this.option("transformParent")&&(me=me.parentElement||me);const ke=me.getAttribute("style")||"";me.style.setProperty("transform","none","important"),p&&(me.style.width="",me.style.height=""),me.offsetHeight;const Re=d.getBoundingClientRect();let Ee=Re.width*r,Ve=Re.height*r,Be=Ee,Ze=Ve;Ee=Math.min(Ee,F),Ve=Math.min(Ve,q),p?{width:Ee,height:Ve}=((ot,ue,Ut,wt)=>{const $t=Ut/ot,an=wt/ue,xn=Math.min($t,an);return{width:ot*=xn,height:ue*=xn}})(F,q,Ee,Ve):(Ee=Math.min(Ee,F),Ve=Math.min(Ve,q));let tt=.5*(Ze-Ve),Xe=.5*(Be-Ee);this.contentRect=Object.assign(Object.assign({},this.contentRect),{top:Re.top-c.top+tt,bottom:c.bottom-Re.bottom+tt,left:Re.left-c.left+Xe,right:c.right-Re.right+Xe,fitWidth:Ee,fitHeight:Ve,width:Ee,height:Ve,fullWidth:F,fullHeight:q}),me.style.cssText=ke,p&&(me.style.width=`${Ee}px`,me.style.height=`${Ve}px`),this.setTransform(),e!==!0&&this.emit("refresh"),this.ignoreBounds||(ct(this.targetScale)<ct(this.minScale)?this.zoomTo(this.minScale,{friction:0}):this.targetScale>this.maxScale?this.zoomTo(this.maxScale,{friction:0}):this.state===An.Init||this.checkBounds().inBounds||this.requestTick()),this.updateControls()}calculateBounds(){const{contentWidth:e,contentHeight:n}=this.calculateContentDim(this.target),{targetScale:r,lockedAxis:o}=this,{fitWidth:d,fitHeight:p}=this.contentRect;let c=0,b=0,k=0,E=0;const C=this.option("infinite");if(C===!0||o&&C===o)c=-1/0,k=1/0,b=-1/0,E=1/0;else{let{containerRect:T,contentRect:I}=this,N=ct(d*r,Rh),$=ct(p*r,Rh),{innerWidth:F,innerHeight:q}=T;if(T.width===N&&(F=T.width),T.width===$&&(q=T.height),e>F){k=.5*(e-F),c=-1*k;let J=.5*(I.right-I.left);c+=J,k+=J}if(d>F&&e<F&&(c-=.5*(d-F),k-=.5*(d-F)),n>q){E=.5*(n-q),b=-1*E;let J=.5*(I.bottom-I.top);b+=J,E+=J}p>q&&n<q&&(c-=.5*(p-q),k-=.5*(p-q))}return{x:{min:c,max:k},y:{min:b,max:E}}}getBounds(){const e=this.option("bounds");return e!==Xi?e:this.calculateBounds()}updateControls(){const e=this,n=e.container,{panMode:r,contentRect:o,targetScale:d,minScale:p}=e;let c=p,b=e.option("click")||!1;b&&(c=e.getNextScale(b));let k=e.canZoomIn(),E=e.canZoomOut(),C=r===Px&&!!this.option("touch"),T=E&&C;if(C&&(ct(d)<ct(p)&&!this.panOnlyZoomed&&(T=!0),(ct(o.width,1)>ct(o.fitWidth,1)||ct(o.height,1)>ct(o.fitHeight,1))&&(T=!0)),ct(o.width*d,1)<ct(o.fitWidth,1)&&(T=!1),r===Yi&&(T=!1),Ts(n,this.cn("isDraggable"),T),!this.option("zoom"))return;let I=k&&ct(c)>ct(d),N=!I&&!T&&E&&ct(c)<ct(d);Ts(n,this.cn("canZoomIn"),I),Ts(n,this.cn("canZoomOut"),N);for(const $ of n.querySelectorAll("[data-panzoom-action]")){let F=!1,q=!1;switch($.dataset.panzoomAction){case"zoomIn":k?F=!0:q=!0;break;case"zoomOut":E?F=!0:q=!0;break;case"toggleZoom":case"iterateZoom":k||E?F=!0:q=!0;const J=$.querySelector("g");J&&(J.style.display=k?"":"none")}F?($.removeAttribute("disabled"),$.removeAttribute("tabindex")):q&&($.setAttribute("disabled",""),$.setAttribute("tabindex","-1"))}}panTo({x:e=this.target.e,y:n=this.target.f,scale:r=this.targetScale,friction:o=this.option("friction"),angle:d=0,originX:p=0,originY:c=0,flipX:b=!1,flipY:k=!1,ignoreBounds:E=!1}){this.state!==An.Destroy&&this.applyChange({panX:e-this.target.e,panY:n-this.target.f,scale:r/this.targetScale,angle:d,originX:p,originY:c,friction:o,flipX:b,flipY:k,ignoreBounds:E})}applyChange({panX:e=0,panY:n=0,scale:r=1,angle:o=0,originX:d=-this.current.e,originY:p=-this.current.f,friction:c=this.option("friction"),flipX:b=!1,flipY:k=!1,ignoreBounds:E=!1,bounce:C=this.option("bounce")}){const T=this.state;if(T===An.Destroy)return;this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.friction=c||0,this.ignoreBounds=E;const{current:I}=this,N=I.e,$=I.f,F=this.getMatrix(this.target);let q=new DOMMatrix().translate(N,$).translate(d,p).translate(e,n);if(this.option("zoom")){if(!E){const J=this.targetScale,Q=this.minScale,me=this.maxScale;J*r<Q&&(r=Q/J),J*r>me&&(r=me/J)}q=q.scale(r)}q=q.translate(-d,-p).translate(-N,-$).multiply(F),o&&(q=q.rotate(o)),b&&(q=q.scale(-1,1)),k&&(q=q.scale(1,-1));for(const J of eo)J!=="e"&&J!=="f"&&(q[J]>this.minScale+1e-5||q[J]<this.minScale-1e-5)?this.target[J]=q[J]:this.target[J]=ct(q[J],Rh);(this.targetScale<this.scale||Math.abs(r-1)>.1||this.panMode===Yi||C===!1)&&!E&&this.clampTargetBounds(),T===An.Init?this.animate():this.isResting||(this.state=An.Panning,this.requestTick())}stop(e=!1){if(this.state===An.Init||this.state===An.Destroy)return;const n=this.isTicking;this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const r of eo)this.velocity[r]=0,e==="current"?this.current[r]=this.target[r]:e==="target"&&(this.target[r]=this.current[r]);this.setTransform(),En(this.container,"is-scaling"),En(this.container,"is-animating"),this.isTicking=!1,this.state=An.Ready,n&&(this.emit("endAnimation"),this.updateControls())}requestTick(){this.isTicking||(this.emit("startAnimation"),this.updateControls(),Tt(this.container,"is-animating"),this.isScaling&&Tt(this.container,"is-scaling")),this.isTicking=!0,this.rAF||(this.rAF=requestAnimationFrame(()=>this.animate()))}panWithMouse(e,n=this.option("mouseMoveFriction")){if(this.pmme=e,this.panMode!==Yi||!e||ct(this.targetScale)<=ct(this.minScale))return;this.emit("mouseMove",e);const{container:r,containerRect:o,contentRect:d}=this,p=o.width,c=o.height,b=r.getBoundingClientRect(),k=(e.clientX||0)-b.left,E=(e.clientY||0)-b.top;let{contentWidth:C,contentHeight:T}=this.calculateContentDim(this.target);const I=this.option("mouseMoveFactor");I>1&&(C!==p&&(C*=I),T!==c&&(T*=I));let N=.5*(C-p)-k/p*100/100*(C-p);N+=.5*(d.right-d.left);let $=.5*(T-c)-E/c*100/100*(T-c);$+=.5*(d.bottom-d.top),this.applyChange({panX:N-this.target.e,panY:$-this.target.f,friction:n})}zoomWithWheel(e){if(this.state===An.Destroy||this.state===An.Init)return;const n=Date.now();if(n-this.pwt<45)return void e.preventDefault();this.pwt=n;var r=[-e.deltaX||0,-e.deltaY||0,-e.detail||0].reduce(function(k,E){return Math.abs(E)>Math.abs(k)?E:k});const o=Math.max(-1,Math.min(1,r)),{targetScale:d,maxScale:p,minScale:c}=this;let b=d*(100+45*o)/100;ct(b)<ct(c)&&ct(d)<=ct(c)?(this.cwd+=Math.abs(o),b=c):ct(b)>ct(p)&&ct(d)>=ct(p)?(this.cwd+=Math.abs(o),b=p):(this.cwd=0,b=Math.max(Math.min(b,p),c)),this.cwd>this.option("wheelLimit")||(e.preventDefault(),ct(b)!==ct(d)&&this.zoomTo(b,{event:e}))}canZoomIn(){return this.option("zoom")&&(ct(this.contentRect.width,1)<ct(this.contentRect.fitWidth,1)||ct(this.targetScale)<ct(this.maxScale))}canZoomOut(){return this.option("zoom")&&ct(this.targetScale)>ct(this.minScale)}zoomIn(e=1.25,n){this.zoomTo(this.targetScale*e,n)}zoomOut(e=.8,n){this.zoomTo(this.targetScale*e,n)}zoomToFit(e){this.zoomTo("fit",e)}zoomToCover(e){this.zoomTo("cover",e)}zoomToFull(e){this.zoomTo("full",e)}zoomToMax(e){this.zoomTo("max",e)}toggleZoom(e){this.zoomTo(this.getNextScale("toggleZoom"),e)}toggleMax(e){this.zoomTo(this.getNextScale("toggleMax"),e)}toggleCover(e){this.zoomTo(this.getNextScale("toggleCover"),e)}iterateZoom(e){this.zoomTo("next",e)}zoomTo(e=1,{friction:n=Xi,originX:r=Xi,originY:o=Xi,event:d}={}){if(this.isContentLoading||this.state===An.Destroy)return;const{targetScale:p,fullScale:c,maxScale:b,coverScale:k}=this;if(this.stop(),this.panMode===Yi&&(d=this.pmme||d),d||r===Xi||o===Xi){const C=this.content.getBoundingClientRect(),T=this.container.getBoundingClientRect(),I=d?d.clientX:T.left+.5*T.width,N=d?d.clientY:T.top+.5*T.height;r=I-C.left-.5*C.width,o=N-C.top-.5*C.height}let E=1;typeof e=="number"?E=e:e==="full"?E=c:e==="cover"?E=k:e==="max"?E=b:e==="fit"?E=1:e==="next"&&(E=this.getNextScale("iterateZoom")),E=E/p||1,n=n===Xi?E>1?.15:.25:n,this.applyChange({scale:E,originX:r,originY:o,friction:n}),d&&this.panMode===Yi&&this.panWithMouse(d,n)}rotateCCW(){this.applyChange({angle:-90})}rotateCW(){this.applyChange({angle:90})}flipX(){this.applyChange({flipX:!0})}flipY(){this.applyChange({flipY:!0})}fitX(){this.stop("target");const{containerRect:e,contentRect:n,target:r}=this;this.applyChange({panX:.5*e.width-(n.left+.5*n.fitWidth)-r.e,panY:.5*e.height-(n.top+.5*n.fitHeight)-r.f,scale:e.width/n.fitWidth/this.targetScale,originX:0,originY:0,ignoreBounds:!0})}fitY(){this.stop("target");const{containerRect:e,contentRect:n,target:r}=this;this.applyChange({panX:.5*e.width-(n.left+.5*n.fitWidth)-r.e,panY:.5*e.innerHeight-(n.top+.5*n.fitHeight)-r.f,scale:e.height/n.fitHeight/this.targetScale,originX:0,originY:0,ignoreBounds:!0})}toggleFS(){const{container:e}=this,n=this.cn("inFullscreen"),r=this.cn("htmlHasFullscreen");e.classList.toggle(n);const o=e.classList.contains(n);o?(document.documentElement.classList.add(r),document.addEventListener("keydown",this.onKeydown,!0)):(document.documentElement.classList.remove(r),document.removeEventListener("keydown",this.onKeydown,!0)),this.updateMetrics(),this.emit(o?"enterFS":"exitFS")}getMatrix(e=this.current){const{a:n,b:r,c:o,d,e:p,f:c}=e;return new DOMMatrix([n,r,o,d,p,c])}reset(e){if(this.state!==An.Init&&this.state!==An.Destroy){this.stop("current");for(const n of eo)this.target[n]=Ph[n];this.target.a=this.minScale,this.target.d=this.minScale,this.clampTargetBounds(),this.isResting||(this.friction=e===void 0?this.option("friction"):e,this.state=An.Panning,this.requestTick())}}destroy(){this.stop(),this.state=An.Destroy,this.detachEvents(),this.detachObserver();const{container:e,content:n}=this,r=this.option("classes")||{};for(const o of Object.values(r))e.classList.remove(o+"");n&&(n.removeEventListener("load",this.onLoad),n.removeEventListener("error",this.onError)),this.detachPlugins()}};Object.defineProperty(Vl,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:nR}),Object.defineProperty(Vl,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:{}});const Nx=function(t,e){let n=!0;return(...r)=>{n&&(n=!1,t(...r),setTimeout(()=>{n=!0},e))}},Bx=(t,e)=>{let n=[];return t.childNodes.forEach(r=>{r.nodeType!==Node.ELEMENT_NODE||e&&!r.matches(e)||n.push(r)}),n},iR={viewport:null,track:null,enabled:!0,slides:[],axis:"x",transition:"fade",preload:1,slidesPerPage:"auto",initialPage:0,friction:.12,Panzoom:{decelFriction:.12},center:!0,infinite:!0,fill:!0,dragFree:!1,adaptiveHeight:!1,direction:"ltr",classes:{container:"f-carousel",viewport:"f-carousel__viewport",track:"f-carousel__track",slide:"f-carousel__slide",isLTR:"is-ltr",isRTL:"is-rtl",isHorizontal:"is-horizontal",isVertical:"is-vertical",inTransition:"in-transition",isSelected:"is-selected"},l10n:{NEXT:"Next slide",PREV:"Previous slide",GOTO:"Go to slide #%d"}};var ur;(function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Destroy=2]="Destroy"})(ur||(ur={}));const Ym=t=>{if(typeof t=="string"||t instanceof HTMLElement)t={html:t};else{const e=t.thumb;e!==void 0&&(typeof e=="string"&&(t.thumbSrc=e),e instanceof HTMLImageElement&&(t.thumbEl=e,t.thumbElSrc=e.src,t.thumbSrc=e.src),delete t.thumb)}return Object.assign({html:"",el:null,isDom:!1,class:"",customClass:"",index:-1,dim:0,gap:0,pos:0,transition:!1},t)},sR=(t={})=>Object.assign({index:-1,slides:[],dim:0,pos:-1},t);let us=class extends Ih{constructor(e,n){super(n),Object.defineProperty(this,"instance",{enumerable:!0,configurable:!0,writable:!0,value:e})}attach(){}detach(){}};const oR={classes:{list:"f-carousel__dots",isDynamic:"is-dynamic",hasDots:"has-dots",dot:"f-carousel__dot",isBeforePrev:"is-before-prev",isPrev:"is-prev",isCurrent:"is-current",isNext:"is-next",isAfterNext:"is-after-next"},dotTpl:'<button type="button" data-carousel-page="%i" aria-label="{{GOTO}}"><span class="f-carousel__dot" aria-hidden="true"></span></button>',dynamicFrom:11,maxCount:1/0,minCount:2};let Vx=class extends us{constructor(){super(...arguments),Object.defineProperty(this,"isDynamic",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"list",{enumerable:!0,configurable:!0,writable:!0,value:null})}onRefresh(){this.refresh()}build(){let e=this.list;if(!e){e=document.createElement("ul"),Tt(e,this.cn("list")),e.setAttribute("role","tablist");const n=this.instance.container;n.appendChild(e),Tt(n,this.cn("hasDots")),this.list=e}return e}refresh(){var e;const n=this.instance.pages.length,r=Math.min(2,this.option("minCount")),o=Math.max(2e3,this.option("maxCount")),d=this.option("dynamicFrom");if(n<r||n>o)return void this.cleanup();const p=typeof d=="number"&&n>5&&n>=d,c=!this.list||this.isDynamic!==p||this.list.children.length!==n;c&&this.cleanup();const b=this.build();if(Ts(b,this.cn("isDynamic"),!!p),c)for(let C=0;C<n;C++)b.append(this.createItem(C));let k,E=0;for(const C of[...b.children]){const T=E===this.instance.page;T&&(k=C),Ts(C,this.cn("isCurrent"),T),(e=C.children[0])===null||e===void 0||e.setAttribute("aria-selected",T?"true":"false");for(const I of["isBeforePrev","isPrev","isNext","isAfterNext"])En(C,this.cn(I));E++}if(k=k||b.firstChild,p&&k){const C=k.previousElementSibling,T=C&&C.previousElementSibling;Tt(C,this.cn("isPrev")),Tt(T,this.cn("isBeforePrev"));const I=k.nextElementSibling,N=I&&I.nextElementSibling;Tt(I,this.cn("isNext")),Tt(N,this.cn("isAfterNext"))}this.isDynamic=p}createItem(e=0){var n;const r=document.createElement("li");r.setAttribute("role","presentation");const o=Ss(this.instance.localize(this.option("dotTpl"),[["%d",e+1]]).replace(/\%i/g,e+""));return r.appendChild(o),(n=r.children[0])===null||n===void 0||n.setAttribute("role","tab"),r}cleanup(){this.list&&(this.list.remove(),this.list=null),this.isDynamic=!1,En(this.instance.container,this.cn("hasDots"))}attach(){this.instance.on(["refresh","change"],this.onRefresh)}detach(){this.instance.off(["refresh","change"],this.onRefresh),this.cleanup()}};Object.defineProperty(Vx,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:oR});const Nh="disabled",Bh="next",zx="prev";let Ox=class extends us{constructor(){super(...arguments),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"prev",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"next",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"isDom",{enumerable:!0,configurable:!0,writable:!0,value:!1})}onRefresh(){const e=this.instance,n=e.pages.length,r=e.page;if(n<2)return void this.cleanup();this.build();let o=this.prev,d=this.next;o&&d&&(o.removeAttribute(Nh),d.removeAttribute(Nh),e.isInfinite||(r<=0&&o.setAttribute(Nh,""),r>=n-1&&d.setAttribute(Nh,"")))}addBtn(e){var n;const r=this.instance,o=document.createElement("button");o.setAttribute("tabindex","0"),o.setAttribute("title",r.localize(`{{${e.toUpperCase()}}}`)),Tt(o,this.cn("button")+" "+this.cn(e===Bh?"isNext":"isPrev"));const d=r.isRTL?e===Bh?zx:Bh:e;var p;return o.innerHTML=r.localize(this.option(`${d}Tpl`)),o.dataset[`carousel${p=e,p?p.match("^[a-z]")?p.charAt(0).toUpperCase()+p.substring(1):p:""}`]="true",(n=this.container)===null||n===void 0||n.appendChild(o),o}build(){const e=this.instance.container,n=this.cn("container");let{container:r,prev:o,next:d}=this;r||(r=e.querySelector("."+n),this.isDom=!!r),r||(r=document.createElement("div"),Tt(r,n),e.appendChild(r)),this.container=r,d||(d=r.querySelector("[data-carousel-next]")),d||(d=this.addBtn(Bh)),this.next=d,o||(o=r.querySelector("[data-carousel-prev]")),o||(o=this.addBtn(zx)),this.prev=o}cleanup(){this.isDom||(this.prev&&this.prev.remove(),this.next&&this.next.remove(),this.container&&this.container.remove()),this.prev=null,this.next=null,this.container=null,this.isDom=!1}attach(){this.instance.on(["refresh","change"],this.onRefresh)}detach(){this.instance.off(["refresh","change"],this.onRefresh),this.cleanup()}};Object.defineProperty(Ox,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{classes:{container:"f-carousel__nav",button:"f-button",isNext:"is-next",isPrev:"is-prev"},nextTpl:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" tabindex="-1"><path d="M9 3l9 9-9 9"/></svg>',prevTpl:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" tabindex="-1"><path d="M15 3l-9 9 9 9"/></svg>'}});let Lx=class extends us{constructor(){super(...arguments),Object.defineProperty(this,"selectedIndex",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"target",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"nav",{enumerable:!0,configurable:!0,writable:!0,value:null})}addAsTargetFor(e){this.target=this.instance,this.nav=e,this.attachEvents()}addAsNavFor(e){this.nav=this.instance,this.target=e,this.attachEvents()}attachEvents(){const{nav:e,target:n}=this;e&&n&&(e.options.initialSlide=n.options.initialPage,e.state===ur.Ready?this.onNavReady(e):e.on("ready",this.onNavReady),n.state===ur.Ready?this.onTargetReady(n):n.on("ready",this.onTargetReady))}onNavReady(e){e.on("createSlide",this.onNavCreateSlide),e.on("Panzoom.click",this.onNavClick),e.on("Panzoom.touchEnd",this.onNavTouch),this.onTargetChange()}onTargetReady(e){e.on("change",this.onTargetChange),e.on("Panzoom.refresh",this.onTargetChange),this.onTargetChange()}onNavClick(e,n,r){this.onNavTouch(e,e.panzoom,r)}onNavTouch(e,n,r){var o,d;if(Math.abs(n.dragOffset.x)>3||Math.abs(n.dragOffset.y)>3)return;const p=r.target,{nav:c,target:b}=this;if(!c||!b||!p)return;const k=p.closest("[data-index]");if(r.stopPropagation(),r.preventDefault(),!k)return;const E=parseInt(k.dataset.index||"",10)||0,C=b.getPageForSlide(E),T=c.getPageForSlide(E);c.slideTo(T),b.slideTo(C,{friction:((d=(o=this.nav)===null||o===void 0?void 0:o.plugins)===null||d===void 0?void 0:d.Sync.option("friction"))||0}),this.markSelectedSlide(E)}onNavCreateSlide(e,n){n.index===this.selectedIndex&&this.markSelectedSlide(n.index)}onTargetChange(){var e,n;const{target:r,nav:o}=this;if(!r||!o||o.state!==ur.Ready||r.state!==ur.Ready)return;const d=(n=(e=r.pages[r.page])===null||e===void 0?void 0:e.slides[0])===null||n===void 0?void 0:n.index,p=o.getPageForSlide(d);this.markSelectedSlide(d),o.slideTo(p,o.prevPage===null&&r.prevPage===null?{friction:0}:void 0)}markSelectedSlide(e){const n=this.nav;n&&n.state===ur.Ready&&(this.selectedIndex=e,[...n.slides].map(r=>{r.el&&r.el.classList[r.index===e?"add":"remove"]("is-nav-selected")}))}attach(){const e=this;let n=e.options.target,r=e.options.nav;n?e.addAsNavFor(n):r&&e.addAsTargetFor(r)}detach(){const e=this,n=e.nav,r=e.target;n&&(n.off("ready",e.onNavReady),n.off("createSlide",e.onNavCreateSlide),n.off("Panzoom.click",e.onNavClick),n.off("Panzoom.touchEnd",e.onNavTouch)),e.nav=null,r&&(r.off("ready",e.onTargetReady),r.off("refresh",e.onTargetChange),r.off("change",e.onTargetChange)),e.target=null}};Object.defineProperty(Lx,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{friction:.35}});const aR={Navigation:Ox,Dots:Vx,Sync:Lx},Vh="animationend",Fx="isSelected",zh="slide";let gd=class K0 extends Wm{get axis(){return this.isHorizontal?"e":"f"}get isEnabled(){return this.state===ur.Ready}get isInfinite(){let e=!1;const{contentDim:n,viewportDim:r,pages:o,slides:d}=this,p=d[0];return o.length>=2&&p&&n+p.dim>=r&&(e=this.option("infinite")),e}get isRTL(){return this.option("direction")==="rtl"}get isHorizontal(){return this.option("axis")==="x"}constructor(e,n={},r={}){if(super(),Object.defineProperty(this,"bp",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"lp",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"userOptions",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"userPlugins",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:ur.Init}),Object.defineProperty(this,"page",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevPage",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"viewport",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"track",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"slides",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"pages",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"panzoom",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"inTransition",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),Object.defineProperty(this,"contentDim",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"viewportDim",{enumerable:!0,configurable:!0,writable:!0,value:0}),typeof e=="string"&&(e=document.querySelector(e)),!e||!mi(e))throw new Error("No Element found");this.container=e,this.slideNext=Nx(this.slideNext.bind(this),150),this.slidePrev=Nx(this.slidePrev.bind(this),150),this.userOptions=n,this.userPlugins=r,queueMicrotask(()=>{this.processOptions()})}processOptions(){var e,n;const r=fi({},K0.defaults,this.userOptions);let o="";const d=r.breakpoints;if(d&&Um(d))for(const[p,c]of Object.entries(d))window.matchMedia(p).matches&&Um(c)&&(o+=p,fi(r,c));o===this.bp&&this.state!==ur.Init||(this.bp=o,this.state===ur.Ready&&(r.initialSlide=((n=(e=this.pages[this.page])===null||e===void 0?void 0:e.slides[0])===null||n===void 0?void 0:n.index)||0),this.state!==ur.Init&&this.destroy(),super.setOptions(r),this.option("enabled")===!1?this.attachEvents():setTimeout(()=>{this.init()},0))}init(){this.state=ur.Init,this.emit("init"),this.attachPlugins(Object.assign(Object.assign({},K0.Plugins),this.userPlugins)),this.emit("attachPlugins"),this.initLayout(),this.initSlides(),this.updateMetrics(),this.setInitialPosition(),this.initPanzoom(),this.attachEvents(),this.state=ur.Ready,this.emit("ready")}initLayout(){const{container:e}=this,n=this.option("classes");Tt(e,this.cn("container")),Ts(e,n.isLTR,!this.isRTL),Ts(e,n.isRTL,this.isRTL),Ts(e,n.isVertical,!this.isHorizontal),Ts(e,n.isHorizontal,this.isHorizontal);let r=this.option("viewport")||e.querySelector(`.${n.viewport}`);r||(r=document.createElement("div"),Tt(r,n.viewport),r.append(...Bx(e,`.${n.slide}`)),e.prepend(r)),r.addEventListener("scroll",this.onScroll);let o=this.option("track")||e.querySelector(`.${n.track}`);o||(o=document.createElement("div"),Tt(o,n.track),o.append(...Array.from(r.childNodes))),o.setAttribute("aria-live","polite"),r.contains(o)||r.prepend(o),this.viewport=r,this.track=o,this.emit("initLayout")}initSlides(){const{track:e}=this;if(!e)return;const n=[...this.slides],r=[];[...Bx(e,`.${this.cn(zh)}`)].forEach(o=>{if(mi(o)){const d=Ym({el:o,isDom:!0,index:this.slides.length});r.push(d)}});for(let o of[...this.option("slides",[])||[],...n])r.push(Ym(o));this.slides=r;for(let o=0;o<this.slides.length;o++)this.slides[o].index=o;for(const o of r)this.emit("beforeInitSlide",o,o.index),this.emit("initSlide",o,o.index);this.emit("initSlides")}setInitialPage(){const e=this.option("initialSlide");this.page=typeof e=="number"?this.getPageForSlide(e):parseInt(this.option("initialPage",0)+"",10)||0}setInitialPosition(){const{track:e,pages:n,isHorizontal:r}=this;if(!e||!n.length)return;let o=this.page;n[o]||(this.page=o=0);const d=(n[o].pos||0)*(this.isRTL&&r?1:-1),p=r?`${d}px`:"0",c=r?"0":`${d}px`;e.style.transform=`translate3d(${p}, ${c}, 0) scale(1)`,this.option("adaptiveHeight")&&this.setViewportHeight()}initPanzoom(){this.panzoom&&(this.panzoom.destroy(),this.panzoom=null);const e=this.option("Panzoom")||{};this.panzoom=new Vl(this.viewport,fi({},{content:this.track,zoom:!1,panOnlyZoomed:!1,lockAxis:this.isHorizontal?"x":"y",infinite:this.isInfinite,click:!1,dblClick:!1,touch:n=>!(this.pages.length<2&&!n.options.infinite),bounds:()=>this.getBounds(),maxVelocity:n=>Math.abs(n.target[this.axis]-n.current[this.axis])<2*this.viewportDim?100:0},e)),this.panzoom.on("*",(n,r,...o)=>{this.emit(`Panzoom.${r}`,n,...o)}),this.panzoom.on("decel",this.onDecel),this.panzoom.on("refresh",this.onRefresh),this.panzoom.on("beforeTransform",this.onBeforeTransform),this.panzoom.on("endAnimation",this.onEndAnimation)}attachEvents(){const e=this.container;e&&(e.addEventListener("click",this.onClick,{passive:!1,capture:!1}),e.addEventListener("slideTo",this.onSlideTo)),window.addEventListener("resize",this.onResize)}createPages(){let e=[];const{contentDim:n,viewportDim:r}=this;let o=this.option("slidesPerPage");o=(o==="auto"||n<=r)&&this.option("fill")!==!1?1/0:parseFloat(o+"");let d=0,p=0,c=0;for(const b of this.slides)(!e.length||p+b.dim-r>.05||c>=o)&&(e.push(sR()),d=e.length-1,p=0,c=0),e[d].slides.push(b),p+=b.dim+b.gap,c++;return e}processPages(){const e=this.pages,{contentDim:n,viewportDim:r,isInfinite:o}=this,d=this.option("center"),p=this.option("fill"),c=p&&d&&n>r&&!o;if(e.forEach((E,C)=>{var T;E.index=C,E.pos=((T=E.slides[0])===null||T===void 0?void 0:T.pos)||0,E.dim=0;for(const[I,N]of E.slides.entries())E.dim+=N.dim,I<E.slides.length-1&&(E.dim+=N.gap);c&&E.pos+.5*E.dim<.5*r?E.pos=0:c&&E.pos+.5*E.dim>=n-.5*r?E.pos=n-r:d&&(E.pos+=-.5*(r-E.dim))}),e.forEach(E=>{p&&!o&&n>r&&(E.pos=Math.max(E.pos,0),E.pos=Math.min(E.pos,n-r)),E.pos=ct(E.pos,1e3),E.dim=ct(E.dim,1e3),Math.abs(E.pos)<=.1&&(E.pos=0)}),o)return e;const b=[];let k;return e.forEach(E=>{const C=Object.assign({},E);k&&C.pos===k.pos?(k.dim+=C.dim,k.slides=[...k.slides,...C.slides]):(C.index=b.length,k=C,b.push(C))}),b}getPageFromIndex(e=0){const n=this.pages.length;let r;return e=parseInt((e||0).toString())||0,r=this.isInfinite?(e%n+n)%n:Math.max(Math.min(e,n-1),0),r}getSlideMetrics(e){var n,r;const o=this.isHorizontal?"width":"height";let d=0,p=0,c=e.el;const b=!(!c||c.parentNode);if(c?d=parseFloat(c.dataset[o]||"")||0:(c=document.createElement("div"),c.style.visibility="hidden",(this.track||document.body).prepend(c)),Tt(c,this.cn(zh)+" "+e.class+" "+e.customClass),d)c.style[o]=`${d}px`,c.style[o==="width"?"height":"width"]="";else{b&&(this.track||document.body).prepend(c),d=c.getBoundingClientRect()[o]*Math.max(1,((n=window.visualViewport)===null||n===void 0?void 0:n.scale)||1);let E=c[this.isHorizontal?"offsetWidth":"offsetHeight"];E-1>d&&(d=E)}const k=getComputedStyle(c);return k.boxSizing==="content-box"&&(this.isHorizontal?(d+=parseFloat(k.paddingLeft)||0,d+=parseFloat(k.paddingRight)||0):(d+=parseFloat(k.paddingTop)||0,d+=parseFloat(k.paddingBottom)||0)),p=parseFloat(k[this.isHorizontal?"marginRight":"marginBottom"])||0,b?(r=c.parentElement)===null||r===void 0||r.removeChild(c):e.el||c.remove(),{dim:ct(d,1e3),gap:ct(p,1e3)}}getBounds(){const{isInfinite:e,isRTL:n,isHorizontal:r,pages:o}=this;let d={min:0,max:0};if(e)d={min:-1/0,max:1/0};else if(o.length){const p=o[0].pos,c=o[o.length-1].pos;d=n&&r?{min:p,max:c}:{min:-1*c,max:-1*p}}return{x:r?d:{min:0,max:0},y:r?{min:0,max:0}:d}}repositionSlides(){let e,{isHorizontal:n,isRTL:r,isInfinite:o,viewport:d,viewportDim:p,contentDim:c,page:b,pages:k,slides:E,panzoom:C}=this,T=0,I=0,N=0,$=0;C?$=-1*C.current[this.axis]:k[b]&&($=k[b].pos||0),e=n?r?"right":"left":"top",r&&n&&($*=-1);for(const Q of E){const me=Q.el;me?(e==="top"?(me.style.right="",me.style.left=""):me.style.top="",Q.index!==T?me.style[e]=I===0?"":`${ct(I,1e3)}px`:me.style[e]="",N+=Q.dim+Q.gap,T++):I+=Q.dim+Q.gap}if(o&&N&&d){let Q=getComputedStyle(d),me="padding",ke=n?"Right":"Bottom",Re=parseFloat(Q[me+(n?"Left":"Top")]);$-=Re,p+=Re,p+=parseFloat(Q[me+ke]);for(const Ee of E)Ee.el&&(ct(Ee.pos)<ct(p)&&ct(Ee.pos+Ee.dim+Ee.gap)<ct($)&&ct($)>ct(c-p)&&(Ee.el.style[e]=`${ct(I+N,1e3)}px`),ct(Ee.pos+Ee.gap)>=ct(c-p)&&ct(Ee.pos)>ct($+p)&&ct($)<ct(p)&&(Ee.el.style[e]=`-${ct(N,1e3)}px`))}let F,q,J=[...this.inTransition];if(J.length>1&&(F=k[J[0]],q=k[J[1]]),F&&q){let Q=0;for(const me of E)me.el?this.inTransition.has(me.index)&&F.slides.indexOf(me)<0&&(me.el.style[e]=`${ct(Q+(F.pos-q.pos),1e3)}px`):Q+=me.dim+me.gap}}createSlideEl(e){const{track:n,slides:r}=this;if(!n||!e||e.el&&e.el.parentNode)return;const o=e.el||document.createElement("div");Tt(o,this.cn(zh)),Tt(o,e.class),Tt(o,e.customClass);const d=e.html;d&&(d instanceof HTMLElement?o.appendChild(d):o.innerHTML=e.html+"");const p=[];r.forEach((E,C)=>{E.el&&p.push(C)});const c=e.index;let b=null;p.length&&(b=r[p.reduce((E,C)=>Math.abs(C-c)<Math.abs(E-c)?C:E)]);const k=b&&b.el&&b.el.parentNode?b.index<e.index?b.el.nextSibling:b.el:null;n.insertBefore(o,n.contains(k)?k:null),e.el=o,this.emit("createSlide",e)}removeSlideEl(e,n=!1){const r=e==null?void 0:e.el;if(!r||!r.parentNode)return;const o=this.cn(Fx);if(r.classList.contains(o)&&(En(r,o),this.emit("unselectSlide",e)),e.isDom&&!n)return r.removeAttribute("aria-hidden"),r.removeAttribute("data-index"),void(r.style.left="");this.emit("removeSlide",e);const d=new CustomEvent(Vh);r.dispatchEvent(d),e.el&&(e.el.remove(),e.el=null)}transitionTo(e=0,n=this.option("transition")){var r,o,d,p;if(!n)return!1;const c=this.page,{pages:b,panzoom:k}=this;e=parseInt((e||0).toString())||0;const E=this.getPageFromIndex(e);if(!k||!b[E]||b.length<2||Math.abs((((o=(r=b[c])===null||r===void 0?void 0:r.slides[0])===null||o===void 0?void 0:o.dim)||0)-this.viewportDim)>1)return!1;let C=e>c?1:-1;this.isInfinite&&(c===0&&e===b.length-1&&(C=-1),c===b.length-1&&e===0&&(C=1));const T=b[E].pos*(this.isRTL?1:-1);if(c===E&&Math.abs(T-k.target[this.axis])<1)return!1;this.clearTransitions();const I=k.isResting;Tt(this.container,this.cn("inTransition"));const N=((d=b[c])===null||d===void 0?void 0:d.slides[0])||null,$=((p=b[E])===null||p===void 0?void 0:p.slides[0])||null;this.inTransition.add($.index),this.createSlideEl($);let F=N.el,q=$.el;I||n===zh||(n="fadeFast",F=null);const J=this.isRTL?"next":"prev",Q=this.isRTL?"prev":"next";return F&&(this.inTransition.add(N.index),N.transition=n,F.addEventListener(Vh,this.onAnimationEnd),F.classList.add(`f-${n}Out`,`to-${C>0?Q:J}`)),q&&($.transition=n,q.addEventListener(Vh,this.onAnimationEnd),q.classList.add(`f-${n}In`,`from-${C>0?J:Q}`)),k.current[this.axis]=T,k.target[this.axis]=T,k.requestTick(),this.onChange(E),!0}manageSlideVisiblity(){const e=new Set,n=new Set,r=this.getVisibleSlides(parseFloat(this.option("preload",0)+"")||0);for(const o of this.slides)r.has(o)?e.add(o):n.add(o);for(const o of this.inTransition)e.add(this.slides[o]);for(const o of e)this.createSlideEl(o),this.lazyLoadSlide(o);for(const o of n)e.has(o)||this.removeSlideEl(o);this.markSelectedSlides(),this.repositionSlides()}markSelectedSlides(){if(!this.pages[this.page]||!this.pages[this.page].slides)return;const e="aria-hidden";let n=this.cn(Fx);if(n)for(const r of this.slides){const o=r.el;o&&(o.dataset.index=`${r.index}`,o.classList.contains("f-thumbs__slide")?this.getVisibleSlides(0).has(r)?o.removeAttribute(e):o.setAttribute(e,"true"):this.pages[this.page].slides.includes(r)?(o.classList.contains(n)||(Tt(o,n),this.emit("selectSlide",r)),o.removeAttribute(e)):(o.classList.contains(n)&&(En(o,n),this.emit("unselectSlide",r)),o.setAttribute(e,"true")))}}flipInfiniteTrack(){const{axis:e,isHorizontal:n,isInfinite:r,isRTL:o,viewportDim:d,contentDim:p}=this,c=this.panzoom;if(!c||!r)return;let b=c.current[e],k=c.target[e]-b,E=0,C=.5*d;o&&n?(b<-C&&(E=-1,b+=p),b>p-C&&(E=1,b-=p)):(b>C&&(E=1,b-=p),b<-p+C&&(E=-1,b+=p)),E&&(c.current[e]=b,c.target[e]=b+k)}lazyLoadImg(e,n){const r=this,o="f-fadeIn",d="is-preloading";let p=!1,c=null;const b=()=>{p||(p=!0,c&&(c.remove(),c=null),En(n,d),n.complete&&(Tt(n,o),setTimeout(()=>{En(n,o)},350)),this.option("adaptiveHeight")&&e.el&&this.pages[this.page].slides.indexOf(e)>-1&&(r.updateMetrics(),r.setViewportHeight()),this.emit("load",e))};Tt(n,d),n.src=n.dataset.lazySrcset||n.dataset.lazySrc||"",delete n.dataset.lazySrc,delete n.dataset.lazySrcset,n.addEventListener("error",()=>{b()}),n.addEventListener("load",()=>{b()}),setTimeout(()=>{const k=n.parentNode;k&&e.el&&(n.complete?b():p||(c=Ss(qm),k.insertBefore(c,n)))},300)}lazyLoadSlide(e){const n=e&&e.el;if(!n)return;const r=new Set;let o=Array.from(n.querySelectorAll("[data-lazy-src],[data-lazy-srcset]"));n.dataset.lazySrc&&o.push(n),o.map(d=>{d instanceof HTMLImageElement?r.add(d):d instanceof HTMLElement&&d.dataset.lazySrc&&(d.style.backgroundImage=`url('${d.dataset.lazySrc}')`,delete d.dataset.lazySrc)});for(const d of r)this.lazyLoadImg(e,d)}onAnimationEnd(e){var n;const r=e.target,o=r?parseInt(r.dataset.index||"",10)||0:-1,d=this.slides[o],p=e.animationName;if(!r||!d||!p)return;const c=!!this.inTransition.has(o)&&d.transition;c&&p.substring(0,c.length+2)===`f-${c}`&&this.inTransition.delete(o),this.inTransition.size||this.clearTransitions(),o===this.page&&(!((n=this.panzoom)===null||n===void 0)&&n.isResting)&&this.emit("settle")}onDecel(e,n=0,r=0,o=0,d=0){if(this.option("dragFree"))return void this.setPageFromPosition();const{isRTL:p,isHorizontal:c,axis:b,pages:k}=this,E=k.length,C=Math.abs(Math.atan2(r,n)/(Math.PI/180));let T=0;if(T=C>45&&C<135?c?0:r:c?n:0,!E)return;let I=this.page,N=p&&c?1:-1;const $=e.current[b]*N;let{pageIndex:F}=this.getPageFromPosition($);Math.abs(T)>5?(k[I].dim<document.documentElement["client"+(this.isHorizontal?"Width":"Height")]-1&&(I=F),I=p&&c?T<0?I-1:I+1:T<0?I+1:I-1):I=o===0&&d===0?I:F,this.slideTo(I,{transition:!1,friction:e.option("decelFriction")})}onClick(e){const n=e.target,r=n&&mi(n)?n.dataset:null;let o,d;r&&(r.carouselPage!==void 0?(d="slideTo",o=r.carouselPage):r.carouselNext!==void 0?d="slideNext":r.carouselPrev!==void 0&&(d="slidePrev")),d?(e.preventDefault(),e.stopPropagation(),n&&!n.hasAttribute("disabled")&&this[d](o)):this.emit("click",e)}onSlideTo(e){const n=e.detail||0;this.slideTo(this.getPageForSlide(n),{friction:0})}onChange(e,n=0){const r=this.page;this.prevPage=r,this.page=e,this.option("adaptiveHeight")&&this.setViewportHeight(),e!==r&&(this.markSelectedSlides(),this.emit("change",e,r,n))}onRefresh(){let e=this.contentDim,n=this.viewportDim;this.updateMetrics(),this.contentDim===e&&this.viewportDim===n||this.slideTo(this.page,{friction:0,transition:!1})}onScroll(){var e;(e=this.viewport)===null||e===void 0||e.scroll(0,0)}onResize(){this.option("breakpoints")&&this.processOptions()}onBeforeTransform(e){this.lp!==e.current[this.axis]&&(this.flipInfiniteTrack(),this.manageSlideVisiblity()),this.lp=e.current.e}onEndAnimation(){this.inTransition.size||this.emit("settle")}reInit(e=null,n=null){this.destroy(),this.state=ur.Init,this.prevPage=null,this.userOptions=e||this.userOptions,this.userPlugins=n||this.userPlugins,this.processOptions()}slideTo(e=0,{friction:n=this.option("friction"),transition:r=this.option("transition")}={}){if(this.state===ur.Destroy)return;e=parseInt((e||0).toString())||0;const o=this.getPageFromIndex(e),{axis:d,isHorizontal:p,isRTL:c,pages:b,panzoom:k}=this,E=b.length,C=c&&p?1:-1;if(!k||!E)return;if(this.page!==o){const I=new Event("beforeChange",{bubbles:!0,cancelable:!0});if(this.emit("beforeChange",I,e),I.defaultPrevented)return}if(this.transitionTo(e,r))return;let T=b[o].pos;if(this.isInfinite){const I=this.contentDim,N=k.target[d]*C;E===2?T+=I*Math.floor(parseFloat(e+"")/2):T=[T,T-I,T+I].reduce(function($,F){return Math.abs(F-N)<Math.abs($-N)?F:$})}T*=C,Math.abs(k.target[d]-T)<1||(k.panTo({x:p?T:0,y:p?0:T,friction:n}),this.onChange(o))}slideToClosest(e){if(this.panzoom){const{pageIndex:n}=this.getPageFromPosition();this.slideTo(n,e)}}slideNext(){this.slideTo(this.page+1)}slidePrev(){this.slideTo(this.page-1)}clearTransitions(){this.inTransition.clear(),En(this.container,this.cn("inTransition"));const e=["to-prev","to-next","from-prev","from-next"];for(const n of this.slides){const r=n.el;if(r){r.removeEventListener(Vh,this.onAnimationEnd),r.classList.remove(...e);const o=n.transition;o&&r.classList.remove(`f-${o}Out`,`f-${o}In`)}}this.manageSlideVisiblity()}addSlide(e,n){var r,o,d,p;const c=this.panzoom,b=((r=this.pages[this.page])===null||r===void 0?void 0:r.pos)||0,k=((o=this.pages[this.page])===null||o===void 0?void 0:o.dim)||0,E=this.contentDim<this.viewportDim;let C=Array.isArray(n)?n:[n];const T=[];for(const I of C)T.push(Ym(I));this.slides.splice(e,0,...T);for(let I=0;I<this.slides.length;I++)this.slides[I].index=I;for(const I of T)this.emit("beforeInitSlide",I,I.index);if(this.page>=e&&(this.page+=T.length),this.updateMetrics(),c){const I=((d=this.pages[this.page])===null||d===void 0?void 0:d.pos)||0,N=((p=this.pages[this.page])===null||p===void 0?void 0:p.dim)||0,$=this.pages.length||1,F=this.isRTL?k-N:N-k,q=this.isRTL?b-I:I-b;E&&$===1?(e<=this.page&&(c.current[this.axis]-=F,c.target[this.axis]-=F),c.panTo({[this.isHorizontal?"x":"y"]:-1*I})):q&&e<=this.page&&(c.target[this.axis]-=q,c.current[this.axis]-=q,c.requestTick())}for(const I of T)this.emit("initSlide",I,I.index)}prependSlide(e){this.addSlide(0,e)}appendSlide(e){this.addSlide(this.slides.length,e)}removeSlide(e){const n=this.slides.length;e=(e%n+n)%n;const r=this.slides[e];if(r){this.removeSlideEl(r,!0),this.slides.splice(e,1);for(let o=0;o<this.slides.length;o++)this.slides[o].index=o;this.updateMetrics(),this.slideTo(this.page,{friction:0,transition:!1}),this.emit("destroySlide",r)}}updateMetrics(){const{panzoom:e,viewport:n,track:r,slides:o,isHorizontal:d,isInfinite:p}=this;if(!r)return;const c=d?"width":"height",b=d?"offsetWidth":"offsetHeight";if(n){let C=Math.max(n[b],ct(n.getBoundingClientRect()[c],1e3)),T=getComputedStyle(n),I="padding",N=d?"Right":"Bottom";C-=parseFloat(T[I+(d?"Left":"Top")])+parseFloat(T[I+N]),this.viewportDim=C}let k,E=0;for(const[C,T]of o.entries()){let I=0,N=0;!T.el&&k?(I=k.dim,N=k.gap):({dim:I,gap:N}=this.getSlideMetrics(T),k=T),I=ct(I,1e3),N=ct(N,1e3),T.dim=I,T.gap=N,T.pos=E,E+=I,(p||C<o.length-1)&&(E+=N)}E=ct(E,1e3),this.contentDim=E,e&&(e.contentRect[c]=E,e.contentRect[d?"fullWidth":"fullHeight"]=E),this.pages=this.createPages(),this.pages=this.processPages(),this.state===ur.Init&&this.setInitialPage(),this.page=Math.max(0,Math.min(this.page,this.pages.length-1)),this.manageSlideVisiblity(),this.emit("refresh")}getProgress(e,n=!1,r=!1){e===void 0&&(e=this.page);const o=this,d=o.panzoom,p=o.contentDim,c=o.pages[e]||0;if(!c||!d)return e>this.page?-1:1;let b=-1*d.current.e,k=ct((b-c.pos)/(1*c.dim),1e3),E=k,C=k;this.isInfinite&&r!==!0&&(E=ct((b-c.pos+p)/(1*c.dim),1e3),C=ct((b-c.pos-p)/(1*c.dim),1e3));let T=[k,E,C].reduce(function(I,N){return Math.abs(N)<Math.abs(I)?N:I});return n?T:T>1?1:T<-1?-1:T}setViewportHeight(){const{page:e,pages:n,viewport:r,isHorizontal:o}=this;if(!r||!n[e])return;let d=0;o&&this.track&&(this.track.style.height="auto",n[e].slides.forEach(p=>{p.el&&(d=Math.max(d,p.el.offsetHeight))})),r.style.height=d?`${d}px`:""}getPageForSlide(e){for(const n of this.pages)for(const r of n.slides)if(r.index===e)return n.index;return-1}getVisibleSlides(e=0){var n;const r=new Set;let{panzoom:o,contentDim:d,viewportDim:p,pages:c,page:b}=this;if(p){d=d+((n=this.slides[this.slides.length-1])===null||n===void 0?void 0:n.gap)||0;let k=0;k=o&&o.state!==An.Init&&o.state!==An.Destroy?-1*o.current[this.axis]:c[b]&&c[b].pos||0,this.isInfinite&&(k-=Math.floor(k/d)*d),this.isRTL&&this.isHorizontal&&(k*=-1);const E=k-p*e,C=k+p*(e+1),T=this.isInfinite?[-1,0,1]:[0];for(const I of this.slides)for(const N of T){const $=I.pos+N*d,F=$+I.dim+I.gap;$<C&&F>E&&r.add(I)}}return r}getPageFromPosition(e){const{viewportDim:n,contentDim:r,slides:o,pages:d,panzoom:p}=this,c=d.length,b=o.length,k=o[0],E=o[b-1],C=this.option("center");let T=0,I=0,N=0,$=e===void 0?-1*((p==null?void 0:p.target[this.axis])||0):e;C&&($+=.5*n),this.isInfinite?($<k.pos-.5*E.gap&&($-=r,N=-1),$>E.pos+E.dim+.5*E.gap&&($-=r,N=1)):$=Math.max(k.pos||0,Math.min($,E.pos));let F=E,q=o.find(J=>{const Q=J.pos-.5*F.gap,me=J.pos+J.dim+.5*J.gap;return F=J,$>=Q&&$<me});return q||(q=E),I=this.getPageForSlide(q.index),T=I+N*c,{page:T,pageIndex:I}}setPageFromPosition(){const{pageIndex:e}=this.getPageFromPosition();this.onChange(e)}destroy(){if([ur.Destroy].includes(this.state))return;this.state=ur.Destroy;const{container:e,viewport:n,track:r,slides:o,panzoom:d}=this,p=this.option("classes");e.removeEventListener("click",this.onClick,{passive:!1,capture:!1}),e.removeEventListener("slideTo",this.onSlideTo),window.removeEventListener("resize",this.onResize),d&&(d.destroy(),this.panzoom=null),o&&o.forEach(b=>{this.removeSlideEl(b)}),this.detachPlugins(),n&&(n.removeEventListener("scroll",this.onScroll),n.offsetParent&&r&&r.offsetParent&&n.replaceWith(...r.childNodes));for(const[b,k]of Object.entries(p))b!=="container"&&k&&e.classList.remove(k);this.track=null,this.viewport=null,this.page=0,this.slides=[];const c=this.events.get("ready");this.events=new Map,c&&this.events.set("ready",c)}};Object.defineProperty(gd,"Panzoom",{enumerable:!0,configurable:!0,writable:!0,value:Vl}),Object.defineProperty(gd,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:iR}),Object.defineProperty(gd,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:aR});const $x=function(t){if(!mi(t))return 0;const e=window.scrollY,n=window.innerHeight,r=e+n,o=t.getBoundingClientRect(),d=o.y+e,p=o.height,c=d+p;if(e>c||r<d)return 0;if(e<d&&r>c||d<e&&c>r)return 100;let b=p;d<e&&(b-=e-d),c>r&&(b-=c-r);const k=b/n*100;return Math.round(k)},yd=!(typeof window>"u"||!window.document||!window.document.createElement);let Xm;const Km=["a[href]","area[href]",'input:not([disabled]):not([type="hidden"]):not([aria-hidden])',"select:not([disabled]):not([aria-hidden])","textarea:not([disabled]):not([aria-hidden])","button:not([disabled]):not([aria-hidden]):not(.fancybox-focus-guard)","iframe","object","embed","video","audio","[contenteditable]",'[tabindex]:not([tabindex^="-"]):not([disabled]):not([aria-hidden])'].join(","),jx=t=>{if(t&&yd){Xm===void 0&&document.createElement("div").focus({get preventScroll(){return Xm=!0,!1}});try{if(Xm)t.focus({preventScroll:!0});else{const e=window.scrollY||document.body.scrollTop,n=window.scrollX||document.body.scrollLeft;t.focus(),document.body.scrollTo({top:e,left:n,behavior:"auto"})}}catch{}}},Ux=()=>{const t=document;let e,n="",r="",o="";return t.fullscreenEnabled?(n="requestFullscreen",r="exitFullscreen",o="fullscreenElement"):t.webkitFullscreenEnabled&&(n="webkitRequestFullscreen",r="webkitExitFullscreen",o="webkitFullscreenElement"),n&&(e={request:function(d=t.documentElement){return n==="webkitRequestFullscreen"?d[n](Element.ALLOW_KEYBOARD_INPUT):d[n]()},exit:function(){return t[o]&&t[r]()},isFullscreen:function(){return t[o]}}),e},Jm={animated:!0,autoFocus:!0,backdropClick:"close",Carousel:{classes:{container:"fancybox__carousel",viewport:"fancybox__viewport",track:"fancybox__track",slide:"fancybox__slide"}},closeButton:"auto",closeExisting:!1,commonCaption:!1,compact:()=>window.matchMedia("(max-width: 578px), (max-height: 578px)").matches,contentClick:"toggleZoom",contentDblClick:!1,defaultType:"image",defaultDisplay:"flex",dragToClose:!0,Fullscreen:{autoStart:!1},groupAll:!1,groupAttr:"data-fancybox",hideClass:"f-fadeOut",hideScrollbar:!0,idle:3500,keyboard:{Escape:"close",Delete:"close",Backspace:"close",PageUp:"next",PageDown:"prev",ArrowUp:"prev",ArrowDown:"next",ArrowRight:"next",ArrowLeft:"prev"},l10n:Object.assign(Object.assign({},Mx),{CLOSE:"Close",NEXT:"Next",PREV:"Previous",MODAL:"You can close this modal content with the ESC key",ERROR:"Something Went Wrong, Please Try Again Later",IMAGE_ERROR:"Image Not Found",ELEMENT_NOT_FOUND:"HTML Element Not Found",AJAX_NOT_FOUND:"Error Loading AJAX : Not Found",AJAX_FORBIDDEN:"Error Loading AJAX : Forbidden",IFRAME_ERROR:"Error Loading Page",TOGGLE_ZOOM:"Toggle zoom level",TOGGLE_THUMBS:"Toggle thumbnails",TOGGLE_SLIDESHOW:"Toggle slideshow",TOGGLE_FULLSCREEN:"Toggle full-screen mode",DOWNLOAD:"Download"}),parentEl:null,placeFocusBack:!0,showClass:"f-zoomInUp",startIndex:0,tpl:{closeButton:'<button data-fancybox-close class="f-button is-close-btn" title="{{CLOSE}}"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" tabindex="-1"><path d="M20 20L4 4m16 0L4 20"/></svg></button>',main:`<div class="fancybox__container" role="dialog" aria-modal="true" aria-label="{{MODAL}}" tabindex="-1">
|
621
621
|
<div class="fancybox__backdrop"></div>
|
622
622
|
<div class="fancybox__carousel"></div>
|
623
623
|
<div class="fancybox__footer"></div>
|
@@ -657,4 +657,4 @@ uniform ${O} ${L} u_${G};
|
|
657
657
|
</div>
|
658
658
|
`}).mount(p)},{Fancybox:p9}=Wh,Ny={$form:c9,$api:u9,$map:h9,$preview:({media:t})=>{const e=document.querySelector("#app");if(!e){console.error('Modal root element with id "#app" not found!');return}const n=document.createElement("div");e.appendChild(n),a.createApp({data(){return{items:Array.isArray(t)?t:[t]}},mounted(){this.$nextTick(()=>{p9.show(this.items.map(o=>{const d=typeof o=="string"&&o.endsWith(".pdf");return{src:o,type:d?"iframe":"image"}}),{groupAll:!0,Thumbs:{autoStart:!0}})})},template:`
|
659
659
|
<div style="display: none;"></div> <!-- Keeps container hidden -->
|
660
|
-
`}).mount(n)}};window.addEventListener("click",t=>{var n,r,o;const e=(n=t==null?void 0:t.target)==null?void 0:n.closest("[_href]");if(e&&(e==null?void 0:e.tagName)==="A"){const d=e==null?void 0:e.getAttribute("_href");(o=(r=window==null?void 0:window.app)==null?void 0:r.router)==null||o.push(d),t==null||t.preventDefault()}});const f9=()=>{const t=a.defineCustomElement(Py);customElements.define("admin-info",t)},m9=["black","gray","red","yellow","green","blue","indigo","purple","pink","rose","amber","lime","emerald","teal","cyan","sky","violet","fuchsia","lavender","zinc","neutral","stone"],g9=["white"];let Vd,Dk;const y9=async()=>{try{const{data:t}=await Le.get("/api/user-menu"),e=t.menus;return ei.value=e,Vd=t.settings,Dk=t.user,Ay(e)}catch(t){return console.error(t),[]}},_9=(t,e)=>{Object.entries(e).forEach(([n,r])=>{t.component(n,r)})},Mk={async install(t,{componentsApp:e={},settings:n,routes:r=[]}){try{f9(),(n.sidebarDark??!0)&&(n.sidebarDark=!g9.includes(n.sidebarColor)),n.buttonColor||(n.buttonColor=m9.includes(n.sidebarColor)?n.sidebarColor:"blue");const d=(await y9()).filter(c=>c==null?void 0:c.component).map(c=>({...c,component:{...Ry,...e}[c==null?void 0:c.component]}));et.value={...et.value,...n,...(Vd==null?void 0:Vd.admin)||{}},_9(t,{...Ry,...e}),t.component("admin",KC);const{router:p}=await RT(d.concat(r));window.app={...t,router:p},window.v3plugin={...t.config.globalProperties,...Ny},t.config.globalProperties={...t.config.globalProperties,$componentsConfig:{...wx,componentsApp:e},$router:p,$v3plugin:Ny,$utils:{reloadCardPage:nh},$settings:Vd,$adminSettings:et.value,$user:Dk},t.use(p)}catch(o){console.error(o)}},components:Ry,plugins:Ny};typeof window<"u"&&(window.v3Admin=Mk);const b9={data(){return{formValues:{},scheme:null,table:"",token:"",style:null}},mounted(){this.getFormScheme()},computed:{color(){return et.value.buttonColor||"blue"}},methods:{flattenMenu(t){const e=[];return t.forEach(n=>{n.menu?e.push(...this.flattenMenu(n.menu)):e.push(n)}),e},async getFormScheme(){var r,o;const t=this.flattenMenu(ei.value);t!=null&&t.length||this.$router.replace("/404");const e=t==null?void 0:t.find(d=>{var p,c;return(d==null?void 0:d.path)==((c=(p=this.$route)==null?void 0:p.query)==null?void 0:c.table)});e||this.$router.replace("/404");const n=e==null?void 0:e.table;this.table=n;try{const{data:{form:d}}=await Le.get(`/api/template/table/${n}`),{data:p}=await Le.get(`/api/table/${this.table}/${(o=(r=this.$route)==null?void 0:r.query)==null?void 0:o.id}`);this.token=(p==null?void 0:p.token)||"",this.formValues=p||{};const{data:c}=await Le.get(`/api/template/form/${d}`);this.scheme=(c==null?void 0:c.schema)||c,this.style=(c==null?void 0:c.style)||null}catch{}},async onlyEditObject(){var e,n,r,o,d,p,c,b,k,E,C;const t=(n=(e=this.$refs.form)==null?void 0:e.$refs)==null?void 0:n.form;try{await t.doValidation(),await Le.put(`/api/table/${this.token}`,this.formValues),await this.$notify({title:"Успішно!",message:"Об'єкт успішно створено",type:"success"})}catch(T){const I=((r=T==null?void 0:T.response)==null?void 0:r.data)||"";let N=((c=(p=(d=(o=Object.entries(t==null?void 0:t.formErrors))==null?void 0:o[0])==null?void 0:d[1])==null?void 0:p[0])==null?void 0:c.message)==="Це поле обов'язкове"?"Заповніть обов'язкові поля":(C=(E=(k=(b=Object.entries(t==null?void 0:t.formErrors))==null?void 0:b[0])==null?void 0:k[1])==null?void 0:E[0])==null?void 0:C.message;this.$notify({title:"Помилка!",message:I||N||"Сталася помилка валідаціі",type:"error"})}},getGroupedErrorNotification(t,e){if(!t||!e)return"";const n={};return Object.entries(t).forEach(([o,d])=>{var c;const p=((c=e[o])==null?void 0:c.ua)||o;d.forEach(b=>{const k=b.message;n[k]||(n[k]=[]),n[k].push(`"${p}"`)})}),Object.entries(n).map(([o,d])=>`<b>${o}:</b> ${d.join(", ")}`).join("<br>")||"Сталася помилка валідації"},async editObjectAndRedirect(t=!0){var n,r;const e=(r=(n=this.$refs.form)==null?void 0:n.$refs)==null?void 0:r.form;try{t&&await e.doValidation(),await Le.put(`/api/table/${this.token}${t?"":"?draft=1"}`,this.formValues),await this.$router.back(),await this.$notify({title:"Успішно!",message:"Об'єкт успішно створено",type:"success"})}catch{const d=this.getGroupedErrorNotification(e==null?void 0:e.formErrors,e==null?void 0:e.scheme);this.$notify({title:"Помилка!",message:d,type:"error"})}}}},x9={class:"bg-gray-100 lg:w-[calc(100vw-260px)] w-[100vw]"},v9={class:"h-[76px] mt-[15px] flex items-center justify-between mx-[20px] px-[20px] bg-white rounded-xl"},w9={class:"flex items-center gap-[6px]"},k9={class:"bg-white w-full rounded-xl"};function E9(t,e,n,r,o,d){var c,b,k;const p=a.resolveComponent("VsFormWithNavigation");return a.openBlock(),a.createElementBlock("div",x9,[a.createElementVNode("div",v9,[e[4]||(e[4]=a.createElementVNode("h2",{class:"text-xl font-medium"},"Редагувати",-1)),a.createElementVNode("div",w9,[a.createElementVNode("button",{onClick:e[0]||(e[0]=E=>t.$router.back()),class:"flex items-center px-3 py-2 text-sm font-medium text-gray-800 duration-300 bg-white border border-gray-100 rounded-lg shadow gap-x-2 focus:outline-none hover:bg-gray-50 hover:border-gray-100"}," Скасувати "),(c=o.style)!=null&&c.draft?(a.openBlock(),a.createElementBlock("button",{key:0,onClick:e[1]||(e[1]=E=>d.editObjectAndRedirect(!1)),class:a.normalizeClass(`inline-flex items-center px-3 py-2 text-sm font-medium text-white duration-300 bg-${d.color}-700 border border-transparent rounded-lg gap-x-2 hover:bg-${d.color}-800 hover:text-white`)}," Зберегти DRAFT ",2)):a.createCommentVNode("",!0),a.createElementVNode("button",{onClick:e[2]||(e[2]=(...E)=>d.editObjectAndRedirect&&d.editObjectAndRedirect(...E)),class:a.normalizeClass(`inline-flex items-center px-3 py-2 text-sm font-medium text-white duration-300 bg-${d.color}-700 border border-transparent rounded-lg gap-x-2 hover:bg-${d.color}-800 hover:text-white`)}," Зберегти ",2)])]),a.createElementVNode("div",{style:a.normalizeStyle({height:((b=t.$adminSettings)==null?void 0:b.header)===!1?"calc(100vh - 91px)":"calc(100vh - 150px)"}),class:"bg-gray-100 p-[20px] flex lg:w-[calc(100vw-260px)] w-[100vw] overflow-hidden"},[a.createElementVNode("div",k9,[o.scheme?(a.openBlock(),a.createBlock(p,{key:0,ref:"form",scheme:o.scheme,columns:(k=o.style)==null?void 0:k.columns,style:a.normalizeStyle(o.style),modelValue:o.formValues,"onUpdate:modelValue":e[3]||(e[3]=E=>o.formValues=E),class:"p-[20px] h-full"},null,8,["scheme","columns","style","modelValue"])):a.createCommentVNode("",!0)])],4)])}const C9=Object.freeze(Object.defineProperty({__proto__:null,default:Oe(b9,[["render",E9]])},Symbol.toStringTag,{value:"Module"})),S9={data(){return{formValues:{},scheme:null,table:"",token:"",api:"",style:null}},mounted(){this.getFormScheme()},computed:{color(){return et.value.buttonColor||"blue"}},methods:{flattenMenu(t){const e=[];return t.forEach(n=>{n.menu?e.push(...this.flattenMenu(n.menu)):e.push(n)}),e},async getFormScheme(){var r,o;const t=this.flattenMenu(ei.value);t!=null&&t.length||this.$router.replace("/404");const e=t==null?void 0:t.find(d=>{var p,c;return(d==null?void 0:d.path)==((c=(p=this.$route)==null?void 0:p.query)==null?void 0:c.table)});e||this.$router.replace("/404");const n=e==null?void 0:e.table;this.table=n;try{const d=await Le.get(`/api/table-data/${n}`),{data:p}=await Le.get(`/api/template/form/${(r=d==null?void 0:d.data)==null?void 0:r.form}`);this.scheme=(p==null?void 0:p.schema)||p,this.style=(p==null?void 0:p.style)||null,this.api=(p==null?void 0:p.api)||"",this.token=((o=d==null?void 0:d.data)==null?void 0:o.addToken)||""}catch{}},getGroupedErrorNotification(t,e){if(!t||!e)return"";const n={};return Object.entries(t).forEach(([o,d])=>{var c;const p=((c=e[o])==null?void 0:c.ua)||o;d.forEach(b=>{const k=b.message;n[k]||(n[k]=[]),n[k].push(`"${p}"`)})}),Object.entries(n).map(([o,d])=>`<b>${o}:</b> ${d.join(", ")}`).join("<br>")||"Сталася помилка валідації"},async createObject(){var e,n,r;const t=(n=(e=this.$refs.form)==null?void 0:e.$refs)==null?void 0:n.form;try{await t.doValidation(),await Le.post(this.api||`/api/table/${this.token}`,this.formValues),await this.$router.back(),await this.$notify({title:"Успішно!",message:"Об'єкт успішно створено",type:"success"})}catch(o){const d=this.getGroupedErrorNotification(t==null?void 0:t.formErrors,t==null?void 0:t.scheme);this.$notify({title:"Помилка!",message:((r=o==null?void 0:o.response)==null?void 0:r.data)||d,type:"error"})}}}},T9={class:"bg-gray-100 lg:w-[calc(100vw-260px)] w-[100vw]"},A9={class:"h-[76px] mt-[15px] flex items-center justify-between mx-[20px] px-[20px] bg-white rounded-xl"},D9={class:"flex items-center gap-[6px]"},M9={class:"bg-white w-full rounded-xl"};function I9(t,e,n,r,o,d){var c;const p=a.resolveComponent("VsFormWithNavigation");return a.openBlock(),a.createElementBlock("div",T9,[a.createElementVNode("div",A9,[e[3]||(e[3]=a.createElementVNode("h2",{class:"text-xl font-medium"},"Створити",-1)),a.createElementVNode("div",D9,[a.createElementVNode("button",{onClick:e[0]||(e[0]=b=>t.$router.back()),class:"flex items-center px-3 py-2 text-sm font-medium text-gray-800 duration-300 bg-white border border-gray-100 rounded-lg shadow gap-x-2 focus:outline-none hover:bg-gray-50 hover:border-gray-100"}," Скасувати "),a.createElementVNode("button",{onClick:e[1]||(e[1]=(...b)=>d.createObject&&d.createObject(...b)),class:a.normalizeClass(`inline-flex items-center px-3 py-2 text-sm font-medium text-white duration-300 bg-${d.color}-700 border border-transparent rounded-lg gap-x-2 hover:bg-${d.color}-800 hover:text-white`)}," Зберегти ",2)])]),a.createElementVNode("div",{style:a.normalizeStyle({height:((c=t.$adminSettings)==null?void 0:c.header)===!1?"calc(100vh - 91px)":"calc(100vh - 150px)"}),class:"bg-gray-100 p-[20px] flex lg:w-[calc(100vw-260px)] w-[100vw] overflow-hidden"},[a.createElementVNode("div",M9,[o.scheme?(a.openBlock(),a.createBlock(p,{key:0,ref:"form",scheme:o.scheme,style:a.normalizeStyle(o.style),modelValue:o.formValues,"onUpdate:modelValue":e[2]||(e[2]=b=>o.formValues=b),class:"h-full p-[20px]"},null,8,["scheme","style","modelValue"])):a.createCommentVNode("",!0)])],4)])}const P9=Object.freeze(Object.defineProperty({__proto__:null,default:Oe(S9,[["render",I9]])},Symbol.toStringTag,{value:"Module"})),R9=a.ref(null),N9={data(){return{formScheme:null,formValues:{}}},mounted(){this.getFormScheme()},computed:{userData(){return R9.value}},methods:{async updateUser(){var t;try{await Le.put(`/user/${(t=this.userData.user)==null?void 0:t.uid}`,this.formValues),await this.$notify({title:"Успішно!",message:"Дані успішно оновлені",type:"success"})}catch{this.$notify({title:"Помилка!",message:"Сталася помилка",type:"error"})}},async getFormScheme(){var t,e,n,r;try{const{data:o}=await Le.get("/api/template/form/admin.profile.form");console.log(this.userData);for(const d in o==null?void 0:o.schema)(e=(t=this.userData)==null?void 0:t.user)!=null&&e[d]&&(this.formValues[d]=(r=(n=this.userData)==null?void 0:n.user)==null?void 0:r[d]);this.formScheme=o.schema}catch(o){console.error(o)}}}},B9={class:"flex justify-center pt-[20px] pb-[20px] pl-[20px] h-[calc(100vh-58px)]"},V9={class:"bg-white rounded-xl p-[20px]"},z9={class:"flex-1 overflow-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},O9={class:"flex"};function L9(t,e,n,r,o,d){const p=a.resolveComponent("VsForm");return a.openBlock(),a.createElementBlock("div",B9,[a.createElementVNode("div",V9,[e[2]||(e[2]=a.createElementVNode("h2",{class:"mb-[20px] text-center"},"Профіль",-1)),a.createElementVNode("div",z9,[o.formScheme?(a.openBlock(),a.createBlock(p,{key:0,scheme:o.formScheme,modelValue:o.formValues,"onUpdate:modelValue":e[0]||(e[0]=c=>o.formValues=c),class:"pb-0"},null,8,["scheme","modelValue"])):a.createCommentVNode("",!0),a.createElementVNode("div",O9,[a.createElementVNode("button",{onClick:e[1]||(e[1]=(...c)=>d.updateUser&&d.updateUser(...c)),class:"ml-auto text-[18px] bg-blue-500 text-white px-[8px] py-[4px] rounded hover:bg-blue-700 duration-300"}," Зберегти ")])])])])}const F9=Object.freeze(Object.defineProperty({__proto__:null,default:Oe(N9,[["render",L9]])},Symbol.toStringTag,{value:"Module"})),$9={};function j9(t,e,n,r,o,d){const p=a.resolveComponent("router-view");return a.openBlock(),a.createBlock(p)}const Ik=Object.freeze(Object.defineProperty({__proto__:null,default:Oe($9,[["render",j9]])},Symbol.toStringTag,{value:"Module"})),U9={},H9={xmlns:"http://www.w3.org/2000/svg",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-logout"};function W9(t,e,n,r,o,d){return a.openBlock(),a.createElementBlock("svg",H9,e[0]||(e[0]=[a.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),a.createElementVNode("path",{d:"M14 8v-2a2 2 0 0 0 -2 -2h-7a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h7a2 2 0 0 0 2 -2v-2"},null,-1),a.createElementVNode("path",{d:"M9 12h12l-3 -3"},null,-1),a.createElementVNode("path",{d:"M18 15l3 -3"},null,-1)]))}const By=Oe(U9,[["render",W9]]),q9={},G9={viewBox:"0 0 1823 249",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Z9(t,e,n,r,o,d){return a.openBlock(),a.createElementBlock("svg",G9,e[0]||(e[0]=[a.createStaticVNode('<path d="M218.88 96.05C223.55 99.19 228.69 101.56 234.09 103.07V145.42C212.05 151.54 195.83 171.79 195.83 195.75C195.83 200.22 196.41 204.65 197.53 208.94L160.92 230.08C156.82 226.06 152.08 222.73 146.91 220.24V171.62C164.83 163.13 176.59 145.06 176.59 124.48C176.59 123.17 176.54 121.86 176.44 120.56L218.88 96.05ZM220.32 79.09L160.97 113.36C162.04 116.88 162.61 120.61 162.61 124.48C162.61 142.66 149.93 157.87 132.93 161.76V230.05C143.4 232.46 152.23 239.16 157.46 248.21L215 214.99C211.7 209.34 209.81 202.77 209.81 195.75C209.81 174.62 226.94 157.49 248.07 157.49V91.02C237.14 91.02 227.29 86.43 220.32 79.09Z" fill="#CE3936"></path><path d="M161.39 19.13L197.44 39.94C196.39 44.11 195.84 48.42 195.84 52.75C195.84 54.21 195.9 55.65 196.02 57.1L153.9 81.42C145.27 75.5 134.95 72.24 124.36 72.24C113.83 72.24 103.57 75.47 94.96 81.32L52.71 56.93C52.82 55.55 52.88 54.16 52.88 52.76C52.88 48.43 52.34 44.12 51.28 39.95L87.3 19.16C96.98 28.89 110.26 34.58 124.34 34.58C138.42 34.57 151.7 28.87 161.39 19.13ZM157.77 0.919983C151.24 12.66 138.71 20.6 124.33 20.6C109.95 20.6 97.44 12.67 90.9 0.939983L33.9 33.85C37.08 39.43 38.91 45.88 38.91 52.76C38.91 56.71 38.31 60.52 37.2 64.11L96.46 98.32C103.44 90.87 113.36 86.22 124.37 86.22C135.44 86.22 145.41 90.93 152.39 98.44L211.59 64.27C210.45 60.64 209.83 56.78 209.83 52.77C209.83 45.89 211.65 39.44 214.84 33.86L157.77 0.919983Z" fill="#CE3936"></path><path d="M29.97 95.95L72.28 120.38C72.17 121.74 72.12 123.1 72.12 124.47C72.12 145.02 83.86 163.08 101.74 171.58V220.23C96.58 222.71 91.84 226.04 87.75 230.05L51.17 208.93C52.29 204.64 52.87 200.21 52.87 195.74C52.87 171.78 36.65 151.53 14.61 145.41V103.06C20.07 101.55 25.27 99.14 29.97 95.95ZM28.5 78.97C21.52 86.38 11.63 91.02 0.640015 91.02V157.49C21.77 157.49 38.9 174.62 38.9 195.75C38.9 202.77 37 209.33 33.71 214.99L91.2 248.18C96.43 239.14 105.25 232.45 115.71 230.04V161.73C98.74 157.81 86.09 142.62 86.09 124.46C86.09 120.54 86.68 116.75 87.78 113.18L28.5 78.97Z" fill="#CE3936"></path><path d="M498.39 177.5V144.88C498.39 128.55 485.11 115.27 468.78 115.27H343.22C342.69 115.27 342.18 115.32 341.67 115.4H337.19C332.35 115.4 328.42 111.46 328.42 106.63V74C328.42 69.16 332.36 65.23 337.19 65.23H486.33C492.08 65.23 496.75 60.57 496.75 54.81C496.75 49.06 492.08 44.39 486.33 44.39H337.19C320.86 44.39 307.58 57.67 307.58 74V106.62C307.58 122.95 320.86 136.23 337.19 136.23H462.75C463.28 136.23 463.79 136.18 464.3 136.1H468.78C473.62 136.1 477.55 140.04 477.55 144.87V177.49C477.55 182.33 473.61 186.26 468.78 186.26H319.64C313.89 186.26 309.22 190.92 309.22 196.68C309.22 202.43 313.89 207.1 319.64 207.1H468.78C485.11 207.11 498.39 193.83 498.39 177.5Z" fill="#CE3935"></path><path d="M710.7 177.32V75.24C710.7 58.91 697.42 45.63 681.09 45.63H550.05C533.72 45.63 520.44 58.91 520.44 75.24V177.32C520.44 193.65 533.72 206.93 550.05 206.93H681.1C697.42 206.93 710.7 193.65 710.7 177.32ZM541.27 75.24C541.27 70.4 545.21 66.47 550.04 66.47H681.09C685.93 66.47 689.86 70.41 689.86 75.24V177.32C689.86 182.16 685.92 186.09 681.09 186.09H550.05C545.21 186.09 541.28 182.15 541.28 177.32V75.24H541.27Z" fill="#CE3935"></path><path d="M1823 177.32V75.24C1823 58.91 1809.72 45.63 1793.39 45.63H1662.34C1646.01 45.63 1632.73 58.91 1632.73 75.24V177.32C1632.73 193.65 1646.01 206.93 1662.34 206.93H1793.39C1809.72 206.93 1823 193.65 1823 177.32ZM1653.57 75.24C1653.57 70.4 1657.51 66.47 1662.34 66.47H1793.39C1798.23 66.47 1802.16 70.41 1802.16 75.24V177.32C1802.16 182.16 1798.22 186.09 1793.39 186.09H1662.34C1657.5 186.09 1653.57 182.15 1653.57 177.32V75.24Z" fill="#CE3935"></path><path d="M756.76 196.51V152H849.42C855.17 152 859.84 147.34 859.84 141.58C859.84 135.83 855.17 131.16 849.42 131.16H756.76V75.23C756.76 70.39 760.7 66.46 765.53 66.46H893.29C899.04 66.46 903.71 61.8 903.71 56.04C903.71 50.29 899.04 45.62 893.29 45.62H765.53C749.2 45.62 735.92 58.9 735.92 75.23V196.5C735.92 202.25 740.59 206.92 746.34 206.92C752.09 206.93 756.76 202.27 756.76 196.51Z" fill="#CE3935"></path><path d="M933.86 66.47H1006.51V194.32C1006.51 200.07 1011.18 204.74 1016.93 204.74C1022.68 204.74 1027.35 200.07 1027.35 194.32V66.47H1100C1105.75 66.47 1110.42 61.81 1110.42 56.05C1110.42 50.3 1105.76 45.63 1100 45.63H933.86C928.11 45.63 923.44 50.29 923.44 56.05C923.45 61.81 928.11 66.47 933.86 66.47Z" fill="#CE3935"></path><path d="M1218.44 204.19C1224.19 204.19 1228.86 199.53 1228.86 193.77V152H1368.13C1384.46 152 1397.74 138.72 1397.74 122.39V75.24C1397.74 58.91 1384.46 45.63 1368.13 45.63H1237.63C1221.3 45.63 1208.02 58.91 1208.02 75.24V193.77C1208.02 199.53 1212.68 204.19 1218.44 204.19ZM1237.63 66.47H1368.13C1372.97 66.47 1376.9 70.41 1376.9 75.24V122.39C1376.9 127.23 1372.96 131.16 1368.13 131.16H1228.86V75.23C1228.86 70.41 1232.79 66.47 1237.63 66.47Z" fill="#CE3935"></path><path d="M1430.64 204.19C1436.39 204.19 1441.06 199.53 1441.06 193.77V152H1523.95C1524.57 153.18 1525.42 154.26 1526.51 155.17L1581.89 201.23C1583.83 202.85 1586.2 203.64 1588.55 203.64C1591.54 203.64 1594.5 202.36 1596.57 199.88C1600.25 195.46 1599.64 188.89 1595.22 185.21L1555.29 152H1580.33C1596.66 152 1609.94 138.72 1609.94 122.39V75.24C1609.94 58.91 1596.66 45.63 1580.33 45.63H1449.83C1433.5 45.63 1420.22 58.91 1420.22 75.24V193.77C1420.22 199.53 1424.88 204.19 1430.64 204.19ZM1449.83 66.47H1580.33C1585.17 66.47 1589.1 70.41 1589.1 75.24V122.39C1589.1 127.23 1585.17 131.16 1580.33 131.16H1441.06V75.23C1441.05 70.41 1444.99 66.47 1449.83 66.47Z" fill="#CE3935"></path>',10)]))}const Pk=Oe(q9,[["render",Z9]]),Y9={components:{IconChevronDown:Bd},props:{route:Object,searchable:String},mounted(){var t,e;(e=(t=this.route)==null?void 0:t.menu)!=null&&e.some(n=>{var r,o;return(n==null?void 0:n.path)===this.$route.path.replace("/","")||((o=(r=this.$route)==null?void 0:r.params)==null?void 0:o.table)===(n==null?void 0:n.table)&&(n==null?void 0:n.table)})&&(this.isOpen=!0)},watch:{route:{immediate:!0,handler(t){t!=null&&t.open&&(this.isOpen=!0)}}},data(){return{isOpen:!1,arr:[]}},computed:{darkMode(){var t;return(t=et==null?void 0:et.value)==null?void 0:t.sidebarDark}},methods:{highLight(t){if(!this.searchable)return t;const e=this.searchable.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=new RegExp(`(${e})(\\s*)`,"gi");return t.replace(n,(r,o,d)=>`<span style="color:#1989fa;">${o}</span>${d}`)}}},X9={key:0,class:""},K9={key:0,class:"py-0.5 px-2 inline-flex items-center gap-x-1.5 text-xs font-medium bg-blue-100 text-blue-800 rounded-full dark:bg-blue-500/10 dark:text-blue-500"},J9={key:1},Q9=["innerHTML"];function eW(t,e,n,r,o,d){var b,k,E,C,T,I,N,$,F,q,J,Q,me,ke,Re;const p=a.resolveComponent("IconChevronDown"),c=a.resolveComponent("router-link");return(b=n.route)!=null&&b.menu?(a.openBlock(),a.createElementBlock("div",X9,[a.createElementVNode("button",{onClick:e[0]||(e[0]=Ee=>o.isOpen=!o.isOpen),class:a.normalizeClass(["flex items-center justify-start w-full px-3 py-2 text-sm text-left text-gray-800 duration-300 border-none rounded-lg cursor-pointer gap-x-3 focus:outline-none hover:bg-gray-100",[((E=(k=n.route)==null?void 0:k.menu)==null?void 0:E.some(Ee=>{var Ve,Be;return(Ee==null?void 0:Ee.path)===t.$route.path.replace("/","")||(Ee==null?void 0:Ee.table)===((Be=(Ve=t.$route)==null?void 0:Ve.params)==null?void 0:Be.table)&&(Ee==null?void 0:Ee.table)}))&&(d.darkMode?"bg-white/10":"bg-gray-100"),{"text-white/80 hover:bg-white/10 hover:text-white/80 focus:bg-white/10":d.darkMode,"text-gray-800 hover:bg-gray-100 hover:text-gray-800 focus:bg-gray-100":!d.darkMode}]])},[a.createTextVNode(a.toDisplayString((C=n.route)==null?void 0:C.ua)+" ",1),(T=n.route)!=null&&T.new?(a.openBlock(),a.createElementBlock("span",K9,"Нове")):a.createCommentVNode("",!0),a.createVNode(p,{class:a.normalizeClass([[o.isOpen&&"-rotate-180"],"ml-auto duration-300 flex-shrink-0"]),width:"14",height:"14"},null,8,["class"])],2),a.createVNode(a.Transition,{name:"fade"},{default:a.withCtx(()=>{var Ee;return[a.withDirectives(a.createElementVNode("ul",{class:a.normalizeClass(["ml-[28px] pt-[6px] before:block before:absolute relative w-[calc(100%-28px)] flex-col gap-y-1.5 inline-flex before:w-[2px] before:h-[100%] before:left-[-10px] cursor-pointer",d.darkMode?"before:bg-white/10":"before:bg-gray-100"])},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList((Ee=n.route)==null?void 0:Ee.menu,(Ve,Be)=>{var Ze,tt;return a.openBlock(),a.createElementBlock("li",{key:Be,class:"w-full"},[a.createVNode(c,{innerHTML:d.highLight(Ve==null?void 0:Ve.ua),to:"/"+(Ve==null?void 0:Ve.path),class:a.normalizeClass([[((Ve==null?void 0:Ve.path)===t.$route.path.replace("/","")||((tt=(Ze=t.$route)==null?void 0:Ze.params)==null?void 0:tt.table)===(Ve==null?void 0:Ve.table)&&(Ve==null?void 0:Ve.table))&&(d.darkMode?"bg-white/10":"bg-gray-100"),{"text-white/80 hover:bg-white/10 hover:text-white/80 focus:bg-white/10":d.darkMode,"text-gray-800 hover:bg-gray-100 hover:text-gray-800 focus:bg-gray-100":!d.darkMode}],"block px-3 py-2 text-sm rounded-lg focus:outline-none focus:bg-gray-100"])},null,8,["innerHTML","to","class"])])}),128))],2),[[a.vShow,o.isOpen]])]}),_:1})])):(I=n.route)!=null&&I.hidden?a.createCommentVNode("",!0):(a.openBlock(),a.createElementBlock("div",J9,[a.createVNode(c,{to:(($=(N=n.route)==null?void 0:N.path)==null?void 0:$[0])==="/"?(F=n.route)==null?void 0:F.path:"/"+((q=n.route)==null?void 0:q.path),class:a.normalizeClass([[(((J=n.route)==null?void 0:J.path.replace("/",""))===t.$route.path.replace("/","")||((me=(Q=t.$route)==null?void 0:Q.params)==null?void 0:me.table)===((ke=n.route)==null?void 0:ke.table)&&((Re=n.route)==null?void 0:Re.table))&&(d.darkMode?"bg-white/10":"bg-gray-100"),{"text-white/80 hover:bg-white/10 hover:text-white/80 focus:bg-white/10 ":d.darkMode,"text-gray-800 hover:bg-gray-100 hover:text-gray-800 focus:bg-gray-100 ":!d.darkMode}],"flex items-center w-full px-3 py-2 text-sm text-gray-800 duration-300 rounded-lg gap-x-3"])},{default:a.withCtx(()=>{var Ee;return[a.createElementVNode("span",{innerHTML:d.highLight((Ee=n.route)==null?void 0:Ee.ua)},null,8,Q9)]}),_:1},8,["to","class"])]))}const tW=Oe(Y9,[["render",eW]]),nW={},rW={class:"flex-shrink-0 size-4",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function iW(t,e,n,r,o,d){return a.openBlock(),a.createElementBlock("svg",rW,e[0]||(e[0]=[a.createElementVNode("circle",{cx:"12",cy:"12",r:"10"},null,-1),a.createElementVNode("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"},null,-1),a.createElementVNode("path",{d:"M12 17h.01"},null,-1)]))}const Rk=Oe(nW,[["render",iW]]),sW={},oW={class:"shrink-0 size-4 rounded-full",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512"};function aW(t,e,n,r,o,d){return a.openBlock(),a.createElementBlock("svg",oW,e[0]||(e[0]=[a.createStaticVNode('<g fill-rule="evenodd"><g stroke-width="1pt"><path fill="#bd3d44" d="M0 0h247v10H0zm0 20h247v10H0zm0 20h247v10H0zm0 20h247v10H0zm0 20h247v10H0zm0 20h247v10H0zm0 20h247v10H0z" transform="scale(3.9385)"></path><path fill="#fff" d="M0 10h247v10H0zm0 20h247v10H0zm0 20h247v10H0zm0 20h247v10H0zm0 20h247v10H0zm0 20h247v10H0z" transform="scale(3.9385)"></path></g><path fill="#192f5d" d="M0 0h98.8v70H0z" transform="scale(3.9385)"></path><path fill="#fff" d="M8.2 3l1 2.8H12L9.7 7.5l.9 2.7-2.4-1.7L6 10.2l.9-2.7-2.4-1.7h3zm16.5 0l.9 2.8h2.9l-2.4 1.7 1 2.7-2.4-1.7-2.4 1.7 1-2.7-2.4-1.7h2.9zm16.5 0l.9 2.8H45l-2.4 1.7 1 2.7-2.4-1.7-2.4 1.7 1-2.7-2.4-1.7h2.9zm16.4 0l1 2.8h2.8l-2.3 1.7.9 2.7-2.4-1.7-2.3 1.7.9-2.7-2.4-1.7h3zm16.5 0l.9 2.8h2.9l-2.4 1.7 1 2.7L74 8.5l-2.3 1.7.9-2.7-2.4-1.7h2.9zm16.5 0l.9 2.8h2.9L92 7.5l1 2.7-2.4-1.7-2.4 1.7 1-2.7-2.4-1.7h2.9zm-74.1 7l.9 2.8h2.9l-2.4 1.7 1 2.7-2.4-1.7-2.4 1.7 1-2.7-2.4-1.7h2.9zm16.4 0l1 2.8h2.8l-2.3 1.7.9 2.7-2.4-1.7-2.3 1.7.9-2.7-2.4-1.7h3zm16.5 0l.9 2.8h2.9l-2.4 1.7 1 2.7-2.4-1.7-2.4 1.7 1-2.7-2.4-1.7h2.9zm16.5 0l.9 2.8h2.9l-2.4 1.7 1 2.7-2.4-1.7-2.4 1.7 1-2.7-2.4-1.7H65zm16.4 0l1 2.8H86l-2.3 1.7.9 2.7-2.4-1.7-2.3 1.7.9-2.7-2.4-1.7h3zm-74 7l.8 2.8h3l-2.4 1.7.9 2.7-2.4-1.7L6 24.2l.9-2.7-2.4-1.7h3zm16.4 0l.9 2.8h2.9l-2.3 1.7.9 2.7-2.4-1.7-2.3 1.7.9-2.7-2.4-1.7h2.9zm16.5 0l.9 2.8H45l-2.4 1.7 1 2.7-2.4-1.7-2.4 1.7 1-2.7-2.4-1.7h2.9zm16.4 0l1 2.8h2.8l-2.3 1.7.9 2.7-2.4-1.7-2.3 1.7.9-2.7-2.4-1.7h3zm16.5 0l.9 2.8h2.9l-2.3 1.7.9 2.7-2.4-1.7-2.3 1.7.9-2.7-2.4-1.7h2.9zm16.5 0l.9 2.8h2.9L92 21.5l1 2.7-2.4-1.7-2.4 1.7 1-2.7-2.4-1.7h2.9zm-74.1 7l.9 2.8h2.9l-2.4 1.7 1 2.7-2.4-1.7-2.4 1.7 1-2.7-2.4-1.7h2.9zm16.4 0l1 2.8h2.8l-2.3 1.7.9 2.7-2.4-1.7-2.3 1.7.9-2.7-2.4-1.7h3zm16.5 0l.9 2.8h2.9l-2.3 1.7.9 2.7-2.4-1.7-2.3 1.7.9-2.7-2.4-1.7h2.9zm16.5 0l.9 2.8h2.9l-2.4 1.7 1 2.7-2.4-1.7-2.4 1.7 1-2.7-2.4-1.7H65zm16.4 0l1 2.8H86l-2.3 1.7.9 2.7-2.4-1.7-2.3 1.7.9-2.7-2.4-1.7h3zm-74 7l.8 2.8h3l-2.4 1.7.9 2.7-2.4-1.7L6 38.2l.9-2.7-2.4-1.7h3zm16.4 0l.9 2.8h2.9l-2.3 1.7.9 2.7-2.4-1.7-2.3 1.7.9-2.7-2.4-1.7h2.9zm16.5 0l.9 2.8H45l-2.4 1.7 1 2.7-2.4-1.7-2.4 1.7 1-2.7-2.4-1.7h2.9zm16.4 0l1 2.8h2.8l-2.3 1.7.9 2.7-2.4-1.7-2.3 1.7.9-2.7-2.4-1.7h3zm16.5 0l.9 2.8h2.9l-2.3 1.7.9 2.7-2.4-1.7-2.3 1.7.9-2.7-2.4-1.7h2.9zm16.5 0l.9 2.8h2.9L92 35.5l1 2.7-2.4-1.7-2.4 1.7 1-2.7-2.4-1.7h2.9zm-74.1 7l.9 2.8h2.9l-2.4 1.7 1 2.7-2.4-1.7-2.4 1.7 1-2.7-2.4-1.7h2.9zm16.4 0l1 2.8h2.8l-2.3 1.7.9 2.7-2.4-1.7-2.3 1.7.9-2.7-2.4-1.7h3zm16.5 0l.9 2.8h2.9l-2.3 1.7.9 2.7-2.4-1.7-2.3 1.7.9-2.7-2.4-1.7h2.9zm16.5 0l.9 2.8h2.9l-2.4 1.7 1 2.7-2.4-1.7-2.4 1.7 1-2.7-2.4-1.7H65zm16.4 0l1 2.8H86l-2.3 1.7.9 2.7-2.4-1.7-2.3 1.7.9-2.7-2.4-1.7h3zm-74 7l.8 2.8h3l-2.4 1.7.9 2.7-2.4-1.7L6 52.2l.9-2.7-2.4-1.7h3zm16.4 0l.9 2.8h2.9l-2.3 1.7.9 2.7-2.4-1.7-2.3 1.7.9-2.7-2.4-1.7h2.9zm16.5 0l.9 2.8H45l-2.4 1.7 1 2.7-2.4-1.7-2.4 1.7 1-2.7-2.4-1.7h2.9zm16.4 0l1 2.8h2.8l-2.3 1.7.9 2.7-2.4-1.7-2.3 1.7.9-2.7-2.4-1.7h3zm16.5 0l.9 2.8h2.9l-2.3 1.7.9 2.7-2.4-1.7-2.3 1.7.9-2.7-2.4-1.7h2.9zm16.5 0l.9 2.8h2.9L92 49.5l1 2.7-2.4-1.7-2.4 1.7 1-2.7-2.4-1.7h2.9zm-74.1 7l.9 2.8h2.9l-2.4 1.7 1 2.7-2.4-1.7-2.4 1.7 1-2.7-2.4-1.7h2.9zm16.4 0l1 2.8h2.8l-2.3 1.7.9 2.7-2.4-1.7-2.3 1.7.9-2.7-2.4-1.7h3zm16.5 0l.9 2.8h2.9l-2.3 1.7.9 2.7-2.4-1.7-2.3 1.7.9-2.7-2.4-1.7h2.9zm16.5 0l.9 2.8h2.9l-2.4 1.7 1 2.7-2.4-1.7-2.4 1.7 1-2.7-2.4-1.7H65zm16.4 0l1 2.8H86l-2.3 1.7.9 2.7-2.4-1.7-2.3 1.7.9-2.7-2.4-1.7h3zm-74 7l.8 2.8h3l-2.4 1.7.9 2.7-2.4-1.7L6 66.2l.9-2.7-2.4-1.7h3zm16.4 0l.9 2.8h2.9l-2.3 1.7.9 2.7-2.4-1.7-2.3 1.7.9-2.7-2.4-1.7h2.9zm16.5 0l.9 2.8H45l-2.4 1.7 1 2.7-2.4-1.7-2.4 1.7 1-2.7-2.4-1.7h2.9zm16.4 0l1 2.8h2.8l-2.3 1.7.9 2.7-2.4-1.7-2.3 1.7.9-2.7-2.4-1.7h3zm16.5 0l.9 2.8h2.9l-2.3 1.7.9 2.7-2.4-1.7-2.3 1.7.9-2.7-2.4-1.7h2.9zm16.5 0l.9 2.8h2.9L92 63.5l1 2.7-2.4-1.7-2.4 1.7 1-2.7-2.4-1.7h2.9z" transform="scale(3.9385)"></path></g>',1)]))}const lW=Oe(sW,[["render",aW]]),cW={},dW={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1",width:"256",height:"256",viewBox:"0 0 256 256","xml:space":"preserve"};function uW(t,e,n,r,o,d){return a.openBlock(),a.createElementBlock("svg",dW,e[0]||(e[0]=[a.createElementVNode("defs",null,null,-1),a.createElementVNode("g",{style:{stroke:"none","stroke-width":"0","stroke-dasharray":"none","stroke-linecap":"butt","stroke-linejoin":"miter","stroke-miterlimit":"10",fill:"none","fill-rule":"nonzero",opacity:"1"},transform:"translate(1.4065934065934016 1.4065934065934016) scale(2.81 2.81)"},[a.createElementVNode("path",{d:"M 45 90 C 20.147 90 0 69.853 0 45 h 90 C 90 69.853 69.853 90 45 90 z",style:{stroke:"none","stroke-width":"1","stroke-dasharray":"none","stroke-linecap":"butt","stroke-linejoin":"miter","stroke-miterlimit":"10",fill:"rgb(255,213,0)","fill-rule":"nonzero",opacity:"1"},transform:" matrix(1 0 0 1 0 0) ","stroke-linecap":"round"}),a.createElementVNode("path",{d:"M 45 0 C 20.147 0 0 20.147 0 45 h 90 C 90 20.147 69.853 0 45 0 z",style:{stroke:"none","stroke-width":"1","stroke-dasharray":"none","stroke-linecap":"butt","stroke-linejoin":"miter","stroke-miterlimit":"10",fill:"rgb(0,91,187)","fill-rule":"nonzero",opacity:"1"},transform:" matrix(1 0 0 1 0 0) ","stroke-linecap":"round"})],-1)]))}const hW=Oe(cW,[["render",uW]]),pW={},fW={class:"shrink-0 size-3.5 text-gray-800 dark:text-neutral-200",xmlns:"http:.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"};function mW(t,e,n,r,o,d){return a.openBlock(),a.createElementBlock("svg",fW,e[0]||(e[0]=[a.createElementVNode("polyline",{points:"20 6 9 17 4 12"},null,-1)]))}const gW={components:{IconQuestion:Rk,IconUSA:lW,IconUkraine:hW,IconTick:Oe(pW,[["render",mW]])},props:["docs","languages"],data(){return{currentLang:"ukraine",languagesOptions:[{titleEN:"English",titleUA:"Англійська",id:"english",icon:"IconUSA"},{titleEN:"Ukraine",titleUA:"Українська",id:"ukraine",icon:"IconUkraine"}]}},computed:{selectedLang(){return this.languagesOptions.find(t=>t.id===this.currentLang)},darkMode(){var t;return(t=et==null?void 0:et.value)==null?void 0:t.sidebarDark}},methods:{changeLang(t){this.$refs.langPopover.togglePopover(),this.currentLang=t}}},yW={class:"flex justify-center items-center gap-x-2"},_W=["onClick"],bW={class:"text-gray-800"},xW={class:"ms-auto"},vW={class:"truncate"};function wW(t,e,n,r,o,d){const p=a.resolveComponent("IconTick"),c=a.resolveComponent("VsPopover");return n.docs||n.languages?(a.openBlock(),a.createElementBlock("div",{key:0,class:a.normalizeClass(["py-2 px-5 border-t dark:border-neutral-700",d.darkMode?"border-white/10 ":"border-gray-200"])},[a.createElementVNode("div",yW,[a.createVNode(c,{trigger:"click",placement:"top",ref:"langPopover"},{reference:a.withCtx(()=>{var b,k,E;return[a.createElementVNode("button",{type:"button","aria-expanded":"false",class:a.normalizeClass(["relative py-2 px-3 flex items-center gap-x-2 text-nowrap w-full cursor-pointer border rounded-full text-start text-sm text-gray-800 focus:outline-none",d.darkMode?"border-white/10 bg-transparent text-white/80 hover:bg-white/10 focus:bg-white/10":"border-gray-200 bg-white hover:bg-gray-100 focus:bg-gray-100"])},[a.createElementVNode("div",null,[(a.openBlock(),a.createBlock(a.resolveDynamicComponent((b=d.selectedLang)==null?void 0:b.icon),{class:"w-[16px] h-[16px] rounded-full"}))]),a.createElementVNode("span",vW,a.toDisplayString(o.currentLang==="ukraine"?(k=d.selectedLang)==null?void 0:k.titleUA:(E=d.selectedLang)==null?void 0:E.titleEN),1)],2)]}),default:a.withCtx(()=>[a.createElementVNode("div",null,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(o.languagesOptions,b=>(a.openBlock(),a.createElementBlock("button",{key:b.id,type:"button",onClick:k=>d.changeLang(b.id),class:a.normalizeClass(["flex items-center gap-x-2 cursor-pointer dark:hs-selected:bg-neutral-800 py-2 px-4 w-full text-sm text-gray-800 hover:bg-gray-100 rounded-lg focus:outline-none focus:bg-gray-100 dark:text-neutral-300 dark:hover:bg-neutral-800 dark:focus:bg-neutral-800 selected",(b==null?void 0:b.id)===o.currentLang?"bg-gray-100":""])},[(a.openBlock(),a.createBlock(a.resolveDynamicComponent(b==null?void 0:b.icon),{class:"w-[16px] h-[16px] rounded-full"})),a.createElementVNode("div",bW,a.toDisplayString(o.currentLang==="ukraine"?b==null?void 0:b.titleUA:b==null?void 0:b.titleEN),1),a.createElementVNode("span",xW,[(b==null?void 0:b.id)===o.currentLang?(a.openBlock(),a.createBlock(p,{key:0})):a.createCommentVNode("",!0)])],10,_W))),128))])]),_:1},512)])],2)):a.createCommentVNode("",!0)}const Nk=Oe(gW,[["render",wW]]),kW={components:{IconLogout:By,NavbarItem:tW,IconLogo:Pk,IconSearch:Mp,NavbarFooter:Nk},data(){return{activeIndex:null,searchValue:""}},computed:{data(){var t;return(t=this.searchValue)!=null&&t.trim()?this.filterMenu(ei.value,this.searchValue):ei.value},logo(){var t,e,n;return((e=(t=this.$settings)==null?void 0:t.admin)==null?void 0:e.logo)||((n=et.value)==null?void 0:n.logo)||"/assets/logo.svg"},docs(){var t;return(t=et==null?void 0:et.value)==null?void 0:t.docs},languages(){var t;return(t=et==null?void 0:et.value)==null?void 0:t.languages},darkMode(){var t;return((t=et==null?void 0:et.value)==null?void 0:t.sidebarDark)||!1},darkColor(){var e,n,r;const t=((e=et==null?void 0:et.value)==null?void 0:e.sidebarColor)||((n=et==null?void 0:et.value)==null?void 0:n.color)||((r=et==null?void 0:et.value)!=null&&r.sidebarDark?"blue":"white");return t.includes("-")||t.includes("[")?t:t+"-950"}},watch:{"$route.path"(){this.$parent.showMenu=!1}},methods:{filterMenu(t,e){return t.map(n=>{var r,o;if(n.menu){const d=this.filterMenu(n.menu,e);if(d.length>0)return{...n,menu:d,open:!0}}else if((o=(r=n.ua)==null?void 0:r.toLowerCase())!=null&&o.includes(e.toLowerCase()))return n;return null}).filter(Boolean)}}},EW={class:"h-[46px] w-full px-5 lg:px-8 mb-[10px]"},CW={href:"/"},SW=["src"],TW={class:"px-2 lg:px-5"},AW={class:"px-2 lg:px-5 flex flex-col flex-wrap w-full pb-3"},DW={key:0,class:"flex flex-col gap-y-1"};function MW(t,e,n,r,o,d){var k;const p=a.resolveComponent("VsText"),c=a.resolveComponent("NavbarItem"),b=a.resolveComponent("NavbarFooter");return a.openBlock(),a.createElementBlock("div",{class:a.normalizeClass(["lg:flex lg:relative lg:left-0 flex-col h-[100vh] pt-3 border-r w-[260px] top-0 bottom-0 shrink-0 absolute transition left-[-100%] z-[11]",{"left-0":t.$parent.showMenu,["bg-"+d.darkColor]:d.darkColor,"bg-white":!d.darkMode&&!d.darkColor}])},[a.createElementVNode("div",EW,[a.createElementVNode("a",CW,[a.createElementVNode("img",{src:d.logo,class:"object-contain w-full h-full"},null,8,SW)])]),a.createElementVNode("div",TW,[a.createVNode(p,{type:"text",modelValue:o.searchValue,"onUpdate:modelValue":e[0]||(e[0]=E=>o.searchValue=E),clearable:!0,icon:"search","icon-position":"left",placeholder:"Пошук по меню",class:a.normalizeClass(["[&>input]:h-[38px]",{"[&>input]:bg-[#172554] [&>input]:text-white/80 [&>input]:placeholder:text-white/40 [&>input]:border [&>input]:border-white/50":d.darkMode,["[&>input]:bg-"+d.darkColor]:d.darkColor,["focus:[&>input]:border-"+d.darkColor+"-500"]:d.darkMode}])},null,8,["modelValue","class"])]),a.createElementVNode("div",{class:a.normalizeClass(["py-[10px] overflow-y-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500",d.languages||d.docs?"h-[calc(100vh-161px)]":"h-[calc(100vh-110px)]"])},[a.createElementVNode("nav",AW,[(k=d.data)!=null&&k.length?(a.openBlock(),a.createElementBlock("ul",DW,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(d.data,(E,C)=>(a.openBlock(),a.createElementBlock("li",{key:C,class:"flex flex-col gap-[6px]"},[a.createVNode(c,{route:E,searchable:o.searchValue},null,8,["route","searchable"])]))),128))])):(a.openBlock(),a.createElementBlock("div",{key:1,class:a.normalizeClass(["text-lg mt-[20px]",{"text-white/80":d.darkMode,"text-gray-800":!d.darkMode}])}," Не знайдено ",2))])],2),d.docs||d.languages?(a.openBlock(),a.createBlock(b,{key:0,docs:d.docs,languages:d.languages},null,8,["docs","languages"])):a.createCommentVNode("",!0)],2)}const Bk=Oe(kW,[["render",MW],["__scopeId","data-v-7817bab2"]]),IW={components:{IconChevronDown:Bd},props:{route:Object,searchable:String},mounted(){var t,e;(e=(t=this.route)==null?void 0:t.menu)!=null&&e.some(n=>{var r,o;return(n==null?void 0:n.path)===this.$route.path.replace("/","")||((o=(r=this.$route)==null?void 0:r.params)==null?void 0:o.table)===(n==null?void 0:n.table)&&(n==null?void 0:n.table)})&&(this.isOpen=!0)},watch:{route:{immediate:!0,handler(t){t!=null&&t.open&&(this.isOpen=!0)}}},data(){return{isOpen:!1,arr:[]}},computed:{darkMode(){var t;return(t=et==null?void 0:et.value)==null?void 0:t.sidebarDark}},methods:{highLight(t){if(!this.searchable)return t;const e=this.searchable.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=new RegExp(`(${e})(\\s*)`,"gi");return t.replace(n,(r,o,d)=>`<span style="color:#1989fa;">${o}</span>${d}`)}}},PW={key:0,class:""},RW={key:0,class:"py-0.5 px-2 inline-flex items-center gap-x-1.5 text-xs font-medium bg-blue-100 text-blue-800 rounded-full dark:bg-blue-500/10 dark:text-blue-500"},NW={class:"ml-[28px] pt-[6px] before:block before:absolute relative w-[calc(100%-28px)] before:bg-gray-200 flex-col gap-y-1.5 inline-flex before:w-[2px] before:h-[100%] before:left-[-10px] cursor-pointer"},BW={key:1},VW=["innerHTML"];function zW(t,e,n,r,o,d){var b,k,E,C,T,I,N,$,F,q,J,Q,me,ke,Re;const p=a.resolveComponent("IconChevronDown"),c=a.resolveComponent("router-link");return(b=n.route)!=null&&b.menu?(a.openBlock(),a.createElementBlock("div",PW,[a.createElementVNode("button",{onClick:e[0]||(e[0]=Ee=>o.isOpen=!o.isOpen),class:a.normalizeClass(["flex items-center justify-start w-full px-3 py-2 text-sm text-left text-gray-800 duration-300 border-none rounded-lg cursor-pointer gap-x-3 focus:outline-none hover:bg-gray-200",[((E=(k=n.route)==null?void 0:k.menu)==null?void 0:E.some(Ee=>{var Ve,Be;return(Ee==null?void 0:Ee.path)===t.$route.path.replace("/","")||(Ee==null?void 0:Ee.table)===((Be=(Ve=t.$route)==null?void 0:Ve.params)==null?void 0:Be.table)&&(Ee==null?void 0:Ee.table)}))&&"bg-gray-200"]])},[a.createTextVNode(a.toDisplayString((C=n.route)==null?void 0:C.ua)+" ",1),(T=n.route)!=null&&T.new?(a.openBlock(),a.createElementBlock("span",RW,"Нове")):a.createCommentVNode("",!0),a.createVNode(p,{class:a.normalizeClass([[o.isOpen&&"-rotate-180"],"ml-auto duration-300"]),width:"14",height:"14"},null,8,["class"])],2),a.createVNode(a.Transition,{name:"fade"},{default:a.withCtx(()=>{var Ee;return[a.withDirectives(a.createElementVNode("ul",NW,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList((Ee=n.route)==null?void 0:Ee.menu,(Ve,Be)=>{var Ze,tt;return a.openBlock(),a.createElementBlock("li",{key:Be,class:"w-full"},[a.createVNode(c,{innerHTML:d.highLight(Ve==null?void 0:Ve.ua),to:"/"+(Ve==null?void 0:Ve.path),class:a.normalizeClass([[((Ve==null?void 0:Ve.path)===t.$route.path.replace("/","")||((tt=(Ze=t.$route)==null?void 0:Ze.params)==null?void 0:tt.table)===(Ve==null?void 0:Ve.table)&&(Ve==null?void 0:Ve.table))&&"bg-gray-200"],"block px-3 py-2 text-sm rounded-lg focus:outline-none hover:bg-gray-200 focus:bg-gray-200"])},null,8,["innerHTML","to","class"])])}),128))],512),[[a.vShow,o.isOpen]])]}),_:1})])):(I=n.route)!=null&&I.hidden?a.createCommentVNode("",!0):(a.openBlock(),a.createElementBlock("div",BW,[a.createVNode(c,{to:(($=(N=n.route)==null?void 0:N.path)==null?void 0:$[0])==="/"?(F=n.route)==null?void 0:F.path:"/"+((q=n.route)==null?void 0:q.path),class:a.normalizeClass([[(((J=n.route)==null?void 0:J.path.replace("/",""))===t.$route.path.replace("/","")||((me=(Q=t.$route)==null?void 0:Q.params)==null?void 0:me.table)===((ke=n.route)==null?void 0:ke.table)&&((Re=n.route)==null?void 0:Re.table))&&"bg-gray-200"],"flex items-center w-full px-3 py-2 text-sm text-gray-800 duration-300 rounded-lg gap-x-3 hover:bg-gray-200 focus:bg-gray-200"])},{default:a.withCtx(()=>{var Ee;return[a.createElementVNode("span",{innerHTML:d.highLight((Ee=n.route)==null?void 0:Ee.ua)},null,8,VW)]}),_:1},8,["to","class"])]))}const OW=Oe(IW,[["render",zW]]),LW={class:"relative w-fit mx-auto"},FW={key:0,class:"w-60 duration absolute top-full left-0 z-20 bg-white rounded-xl shadow-xl block"},$W={class:"p-1"},jW={__name:"navbar-gray-dropdown",setup(t){const e=a.ref(!1);return a.onMounted(()=>{document.addEventListener("click",n=>{n.target.closest(".navbar-gray-dropdown")||(e.value=!1)})}),(n,r)=>{var d;const o=a.resolveComponent("router-link");return a.openBlock(),a.createElementBlock("div",LW,[a.createElementVNode("button",{onClick:r[0]||(r[0]=p=>e.value=!e.value),type:"button",class:"py-1 px-2 navbar-gray-dropdown inline-flex justify-center items-center gap-x-1 font-semibold rounded-lg text-gray-800 hover:text-purple-600 focus:outline-hidden focus:text-purple-600 disabled:opacity-50 disabled:pointer-events-none dark:text-neutral-300 dark:hover:text-purple-500 dark:focus:text-purple-500"},[a.createTextVNode(a.toDisplayString((d=n.$user)==null?void 0:d.user_name)+" ",1),a.createVNode(Ip,{width:"16",height:"16"})]),e.value?(a.openBlock(),a.createElementBlock("div",FW,[a.createElementVNode("div",$W,[r[2]||(r[2]=a.createElementVNode("a",{class:"flex items-center gap-x-3 py-2 px-3 rounded-lg text-sm text-gray-800 hover:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-hidden focus:bg-gray-100 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",href:"#"}," Профіль ",-1)),a.createVNode(o,{class:"flex items-center gap-x-3 py-2 px-3 rounded-lg text-sm text-gray-800 hover:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-hidden focus:bg-gray-100 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",to:"/admin.settings"},{default:a.withCtx(()=>r[1]||(r[1]=[a.createTextVNode(" Налаштування ",-1)])),_:1,__:[1]})]),r[3]||(r[3]=a.createElementVNode("div",{class:"p-1 border-t border-gray-200 dark:border-neutral-700"},[a.createElementVNode("a",{class:"flex items-center gap-x-3 py-2 px-3 rounded-lg text-sm text-gray-800 hover:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-hidden focus:bg-gray-100 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",href:"/logout"}," Вийти ")],-1))])):a.createCommentVNode("",!0)])}}},UW={class:"p-4 flex flex-col justify-center border-b relative max-h-[192px]"},HW={components:{IconLogout:By,NavbarItem:OW,IconLogo:Pk,IconSearch:Mp,NavbarFooter:Nk,NavbarUser:{__name:"navbar-gray-user",setup(t){return(e,n)=>(a.openBlock(),a.createElementBlock("div",UW,[a.createVNode(fg,{class:"!absolute top-[8px] right-[8px]",placement:"left"}),n[0]||(n[0]=a.createElementVNode("div",{class:"flex size-24 justify-center items-center shrink-0 rounded-full overflow-hidden mx-auto mb-2"},[a.createElementVNode("img",{class:"object-cover h-[130px] w-[130px]",src:"https://media.istockphoto.com/id/1337144146/vector/default-avatar-profile-icon-vector.jpg?s=612x612&w=0&k=20&c=BIbFwuv7FxTWvh5S3vB6bkT0Qv8Vn8N5Ffseq84ClGI=",alt:"Avatar"})],-1)),a.createVNode(jW)]))}}},data(){return{activeIndex:null,searchValue:""}},computed:{data(){var t;return(t=this.searchValue)!=null&&t.trim()?this.filterMenu(ei.value,this.searchValue):ei.value},logo(){var t,e,n;return((e=(t=this.$settings)==null?void 0:t.admin)==null?void 0:e.logo)||((n=et.value)==null?void 0:n.logo)||"/assets/logo.svg"},docs(){var t;return(t=et==null?void 0:et.value)==null?void 0:t.docs},languages(){var t;return(t=et==null?void 0:et.value)==null?void 0:t.languages},darkMode(){var t;return((t=et==null?void 0:et.value)==null?void 0:t.sidebarDark)||!1},darkColor(){var e,n,r;const t=((e=et==null?void 0:et.value)==null?void 0:e.sidebarColor)||((n=et==null?void 0:et.value)==null?void 0:n.color)||((r=et==null?void 0:et.value)!=null&&r.sidebarDark?"blue":"white");return t.includes("-")||t.includes("[")?t:t+"-950"}},watch:{"$route.path"(){this.$parent.showMenu=!1}},methods:{filterMenu(t,e){return t.map(n=>{var r,o;if(n.menu){const d=this.filterMenu(n.menu,e);if(d.length>0)return{...n,menu:d,open:!0}}else if((o=(r=n.ua)==null?void 0:r.toLowerCase())!=null&&o.includes(e.toLowerCase()))return n;return null}).filter(Boolean)}}},WW={class:"px-2 lg:px-5 flex flex-col flex-wrap w-full pb-3"},qW={key:0,class:"flex flex-col gap-y-1"},GW={class:"h-[55px] border-t w-full px-5 shrink-0 lg:px-5 flex items-center"},ZW={href:"/"},YW=["src"];function XW(t,e,n,r,o,d){var b;const p=a.resolveComponent("NavbarUser"),c=a.resolveComponent("NavbarItem");return a.openBlock(),a.createElementBlock("div",{class:a.normalizeClass(["lg:flex lg:relative lg:left-0 flex-col h-[100vh] border-r w-[260px] bg-gray-100 top-0 bottom-0 shrink-0 absolute transition left-[-100%] z-[11]",{"left-0":t.$parent.showMenu}])},[a.createVNode(p),a.createElementVNode("div",{class:a.normalizeClass(["py-[10px] overflow-y-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500",d.languages||d.docs?"h-[calc(100vh-161px)]":"h-[calc(100vh-110px)]"])},[a.createElementVNode("nav",WW,[(b=d.data)!=null&&b.length?(a.openBlock(),a.createElementBlock("ul",qW,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(d.data,(k,E)=>(a.openBlock(),a.createElementBlock("li",{key:E,class:"flex flex-col gap-[6px]"},[a.createVNode(c,{route:k,searchable:o.searchValue},null,8,["route","searchable"])]))),128))])):(a.openBlock(),a.createElementBlock("div",{key:1,class:a.normalizeClass(["text-lg mt-[20px]",{"text-white/80":d.darkMode,"text-gray-800":!d.darkMode}])}," Не знайдено ",2))])],2),a.createElementVNode("div",GW,[a.createElementVNode("a",ZW,[a.createElementVNode("img",{src:d.logo,class:"object-contain max-h-[40px]"},null,8,YW)])])],2)}const KW=Oe(HW,[["render",XW],["__scopeId","data-v-3cea82a7"]]),JW={__name:"navbar",setup(t){const e={default:Bk,gray:KW},n=a.computed(()=>{var r;return e[(r=et.value)==null?void 0:r.navbar]||Bk});return(r,o)=>(a.openBlock(),a.createBlock(a.resolveDynamicComponent(n.value)))}},QW={components:{IconQuestion:Rk,IconUser:Pv,AdminNotification:fg,IconUserOutline:Av,IconLogout:By},data(){return{userData:null,isVisible:!1}},computed:{headerBadgeTitle(){var t;return(t=et.value)==null?void 0:t.headerBadge},headerBadgeColor(){var t;return(t=et.value)==null?void 0:t.headerBadgeColor}},watch:{isVisible(t){t?setTimeout(()=>window.addEventListener("click",this.closeOnOutsideClick),0):window.removeEventListener("click",this.closeOnOutsideClick)}},created(){this.userData=this.$user,My.value=this.$settings},methods:{async logout(){try{await Le.get("/logout"),await window.history.pushState({},"","/login"),await location.reload(),localStorage.removeItem("user")}catch{}},closeOnOutsideClick(){this.isVisible=!1}},beforeUnmount(){window.removeEventListener("click",this.closeOnOutsideClick)}},eq={class:"flex items-center gap-[6px]"},tq={href:"/docs-user",class:"size-[38px] inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent text-gray-500 hover:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-100 dark:text-neutral-400 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},nq={href:"/docs-user",class:"size-[38px] inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent text-gray-500 hover:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-100 dark:text-neutral-400 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},rq={class:"relative"},iq=["src"],sq={key:1,class:"size-[40px] rounded-full bg-gray-200 flex items-center justify-center"},oq=["src"],aq={key:1,class:"flex items-center justify-center bg-gray-200 rounded-full size-10"},lq={class:"grow"},cq={class:"block text-sm font-medium text-gray-800 dark:text-neutral-200"},dq={class:"text-xs text-gray-500 dark:text-neutral-500"},uq={class:"flex flex-col space-y-0.5"};function hq(t,e,n,r,o,d){const p=a.resolveComponent("IconQuestion"),c=a.resolveComponent("VsPopover"),b=a.resolveComponent("AdminNotification"),k=a.resolveComponent("IconUser"),E=a.resolveComponent("router-link"),C=a.resolveComponent("IconUserOutline"),T=a.resolveComponent("IconLogout");return a.openBlock(),a.createElementBlock("div",{class:a.normalizeClass(["h-[58px] border-b flex items-center px-[20px]",d.headerBadgeTitle?"justify-between":"justify-end"])},[d.headerBadgeTitle?(a.openBlock(),a.createElementBlock("div",{key:0,class:a.normalizeClass(["py-1.5 px-2.5 flex justify-center items-center text-white hover:bg-gray-900 focus:bg-gray-900 dark:bg-neutral-100 dark:text-neutral-800 dark:hover:bg-white dark:focus:bg-white.class text-nowrap text-xs sm:text-[13px] rounded-lg disabled:opacity-50 disabled:pointer-events-none focus:outline-none dark:text-neutral-400",{["bg-"+d.headerBadgeColor]:d.headerBadgeColor,"bg-gray-800":!d.headerBadgeColor}])},a.toDisplayString(d.headerBadgeTitle),3)):a.createCommentVNode("",!0),a.createElementVNode("div",{class:"flex lg:hidden",onClick:e[0]||(e[0]=I=>t.$parent.showMenu=!0)},e[4]||(e[4]=[a.createStaticVNode('<svg 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" class="icon icon-tabler icons-tabler-outline icon-tabler-menu-2"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M4 6l16 0"></path><path d="M4 12l16 0"></path><path d="M4 18l16 0"></path></svg>',1)])),a.createElementVNode("div",eq,[a.createVNode(c,{trigger:"hover"},{reference:a.withCtx(()=>[a.createElementVNode("a",tq,[a.createVNode(p,{height:"24",width:"24"})])]),default:a.withCtx(()=>[e[5]||(e[5]=a.createTextVNode(" Допомога ",-1))]),_:1,__:[5]}),a.createVNode(c,{trigger:"hover"},{reference:a.withCtx(()=>[a.createElementVNode("a",nq,[a.createVNode(b)])]),default:a.withCtx(()=>[e[6]||(e[6]=a.createTextVNode(" Сповіщення ",-1))]),_:1,__:[6]}),e[12]||(e[12]=a.createElementVNode("div",{class:"h-[30px] w-[1px] bg-gray-200 ml-[10px] mr-[10px]"},null,-1)),a.createElementVNode("div",rq,[a.createElementVNode("div",{onClick:e[1]||(e[1]=I=>o.isVisible=!0),class:"cursor-pointer"},[a.createVNode(c,{trigger:"hover"},{reference:a.withCtx(()=>{var I,N,$,F;return[(N=(I=o.userData)==null?void 0:I.user)!=null&&N.avatar?(a.openBlock(),a.createElementBlock("img",{key:0,class:"flex-shrink-0 size-[30px] rounded-full",src:(F=($=o.userData)==null?void 0:$.user)==null?void 0:F.avatar,alt:"Image Description"},null,8,iq)):(a.openBlock(),a.createElementBlock("div",sq,[a.createVNode(k)]))]}),default:a.withCtx(()=>[e[7]||(e[7]=a.createTextVNode(" Профіль ",-1))]),_:1,__:[7]})]),o.isVisible?(a.openBlock(),a.createElementBlock("div",{key:0,onClick:e[3]||(e[3]=a.withModifiers(()=>{},["stop"])),class:"fixed p-2 bg-white w-[240px] top-[55px] right-[20px] rounded-xl z-[1] shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] dark:shadow-[0_10px_40px_10px_rgba(0,0,0,0.2)] dark:bg-neutral-900 block"},[a.createVNode(E,{to:"profile",disabled:!0,class:"py-2 px-2.5 flex items-center gap-3 rounded-lg hover:bg-gray-100 focus:outline-none focus:bg-gray-100 dark:hover:bg-neutral-800 dark:focus:bg-neutral-800"},{default:a.withCtx(()=>{var I,N,$,F,q,J,Q,me,ke,Re;return[(N=(I=o.userData)==null?void 0:I.user)!=null&&N.avatar?(a.openBlock(),a.createElementBlock("img",{key:0,class:"rounded-full shrink-0 size-10",src:(F=($=o.userData)==null?void 0:$.user)==null?void 0:F.avatar,alt:"Image Description"},null,8,oq)):(a.openBlock(),a.createElementBlock("div",aq,[a.createVNode(k,{class:"w-[16px]"})])),a.createElementVNode("div",lq,[a.createElementVNode("span",cq,a.toDisplayString(((J=(q=o.userData)==null?void 0:q.user)==null?void 0:J.username)||((me=(Q=o.userData)==null?void 0:Q.user)==null?void 0:me.user_name)||"User User"),1),a.createElementVNode("p",dq,a.toDisplayString(((Re=(ke=o.userData)==null?void 0:ke.user)==null?void 0:Re.email)||"email не вказано"),1)])]}),_:1}),e[10]||(e[10]=a.createElementVNode("div",{class:"my-2 mx-2.5 h-px bg-gray-200 dark:bg-neutral-700"},null,-1)),a.createElementVNode("ul",uq,[a.createElementVNode("li",null,[a.createVNode(E,{to:"profile",class:"w-full flex items-center gap-x-3.5 py-2 px-2.5 text-sm text-gray-800 rounded-lg hover:bg-gray-100 focus:outline-none focus:bg-gray-100 dark:text-white dark:hover:bg-neutral-800 dark:focus:bg-neutral-800",disabled:"true"},{default:a.withCtx(()=>[a.createVNode(C,{class:"size-4"}),e[8]||(e[8]=a.createTextVNode(" Профіль ",-1))]),_:1,__:[8]})])]),e[11]||(e[11]=a.createElementVNode("div",{class:"my-2 mx-2.5 h-px bg-gray-200 dark:bg-neutral-700"},null,-1)),a.createElementVNode("p",null,[a.createElementVNode("button",{type:"button",onClick:e[2]||(e[2]=(...I)=>d.logout&&d.logout(...I)),class:"w-full flex items-center gap-x-3.5 py-2 px-2.5 text-sm text-gray-800 rounded-lg hover:bg-gray-100 hover:text-red-500 focus:outline-none focus:bg-gray-100 focus:text-red-500 dark:text-white dark:hover:bg-neutral-800 dark:focus:bg-neutral-800 dark:hover:text-red-500 dark:focus:text-red-500"},[a.createVNode(T,{class:"size-4"}),e[9]||(e[9]=a.createTextVNode(" Вийти ",-1))])])])):a.createCommentVNode("",!0)])])],2)}const pq={components:{navbar:JW,AdminHeader:Oe(QW,[["render",hq]])},data(){return{showMenu:!1}},computed:{isMenu(){return ei.value||null},header(){var t,e;return((t=et.value)==null?void 0:t.header)===!1?!1:((e=et.value)==null?void 0:e.header)||"admin-header"}}},fq={class:"admin-wrapper"},mq={class:"flex flex-col w-full"};function gq(t,e,n,r,o,d){const p=a.resolveComponent("navbar"),c=a.resolveComponent("router-view");return a.openBlock(),a.createElementBlock("div",fq,[a.createVNode(p),o.showMenu?(a.openBlock(),a.createElementBlock("div",{key:0,onClick:e[0]||(e[0]=b=>o.showMenu=!1),class:"z-[10] lg:hidden transition duration fixed inset-0 bg-gray-900 bg-opacity-50 dark:bg-opacity-80 dark:bg-neutral-900"})):a.createCommentVNode("",!0),a.createElementVNode("div",mq,[d.isMenu?(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},[d.header?(a.openBlock(),a.createBlock(a.resolveDynamicComponent(d.header),{key:0})):a.createCommentVNode("",!0),a.createVNode(c)],64)):a.createCommentVNode("",!0)])])}const yq=Object.freeze(Object.defineProperty({__proto__:null,default:Oe(pq,[["render",gq],["__scopeId","data-v-804a7309"]])},Symbol.toStringTag,{value:"Module"})),_q={data(){return{currentSort:""}},props:{data:{type:Object,default:()=>null},activeColumn:{type:String}},mounted(){this.$emit("update-ref",this.$refs.column)},computed:{label(){var t,e;return((t=this.data)==null?void 0:t.ua)||((e=this.data)==null?void 0:e.label)||this.data.title||"null"},selectedSortParam(){var t,e;return(e=(t=this.$route)==null?void 0:t.query)==null?void 0:e.sort},getVisibleIcon(){return this.data.format!=="image"&&this.data.format!=="verify"}},watch:{activeColumn(t){t!==this.data.name&&(this.currentSort="")}},methods:{changeCurrentSort(t){switch(t){case"":return"asc";case"asc":return"desc";case"desc":return"";default:return""}},handleClickSortBtn(t){this.$emit("change-active",this.data.name),this.currentSort=this.changeCurrentSort(t);const e=this.$route.query,{sort:n,...r}=e,o=this.currentSort?`${this.data.name}-${this.currentSort}`:"";this.$router.replace({query:{...r,...o&&{sort:o}}})},isValueEqualToSelected(t){return`${this.data.name}-${t}`===this.selectedSortParam}}},bq={scope:"col",class:"text-start",ref:"column"},xq={class:"w-[24px]"},vq={key:1,class:"flex items-center px-1 py-3 font-medium text-gray-800 text-start gap-x-1 dark:text-neutral-200"};function wq(t,e,n,r,o,d){return a.openBlock(),a.createElementBlock("th",bq,[d.getVisibleIcon?(a.openBlock(),a.createElementBlock("button",{key:0,type:"button",class:"flex items-center px-1 py-2 font-medium text-gray-800 text-start gap-x-1 dark:text-neutral-200",onClick:e[0]||(e[0]=p=>d.handleClickSortBtn(o.currentSort))},[a.createTextVNode(a.toDisplayString(d.label)+" ",1),a.createElementVNode("span",xq,[o.currentSort?(a.openBlock(),a.createElementBlock("svg",{key:0,class:a.normalizeClass(["shrink-0 size-3.5",{"rotate-180":o.currentSort==="asc"}]),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"},e[1]||(e[1]=[a.createElementVNode("path",{d:"m5 12 7-7 7 7"},null,-1),a.createElementVNode("path",{d:"M12 19V5"},null,-1)]),2)):a.createCommentVNode("",!0)])])):(a.openBlock(),a.createElementBlock("p",vq,a.toDisplayString(d.label),1))],512)}const kq=Oe(_q,[["render",wq]]),Eq={},Cq={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",class:"icon icon-tabler icons-tabler-outline icon-tabler-link"};function Sq(t,e){return a.openBlock(),a.createElementBlock("svg",Cq,e[0]||(e[0]=[a.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),a.createElementVNode("path",{d:"M9 15l6 -6"},null,-1),a.createElementVNode("path",{d:"M11 6l.463 -.536a5 5 0 0 1 7.071 7.072l-.534 .464"},null,-1),a.createElementVNode("path",{d:"M13 18l-.397 .534a5.068 5.068 0 0 1 -7.127 0a4.972 4.972 0 0 1 0 -7.071l.524 -.463"},null,-1)]))}const Tq={components:{IconMore:dg,IconDelete:ug,IconEdit:hg,IconLink:Oe(Eq,[["render",Sq]])},emits:["updateTable"],props:{item:Object,table:String,isForm:null,actions:Array,default:()=>[]},data(){return{formVisible:!1,isDeleteConfirm:!1,formValue:{},top:0,left:0}},computed:{getCustomActions(){return this.actions.filter(t=>typeof t=="object")}},methods:{openConfirm(){this.isDeleteConfirm=!0,document.querySelector("body").click()},async getData(){var t;try{const{data:e}=await Le.get(`/api/table/${this.table}/${(t=this.item)==null?void 0:t.id}`);this.formValue=e}catch(e){console.error(e)}},doSomethingOnCancel(){this.formVisible=!1},async deleteElement(){var t,e;try{const{data:n}=await Le.get(`/api/table/${this.table}/${(t=this.item)==null?void 0:t.id}`);await Le.delete(`/api/table/${n==null?void 0:n.token}`),await this.$notify({title:"Успішно!",message:"Об`єкт успішно видалeно",type:"success"}),await this.$emit("update-table")}catch(n){this.$notify({title:"Помилка!",message:(e=n==null?void 0:n.response)==null?void 0:e.data,type:"error"})}finally{this.isDeleteConfirm=!1}},async customButtonAction(t){var e,n,r;document.querySelector("body").click(),t!=null&&t.form?(await this.$v3plugin.$form({form:t==null?void 0:t.form,id:(e=this.item)==null?void 0:e.id,api:t==null?void 0:t.api,title:t==null?void 0:t.title}),await this.$emit("update-table")):t!=null&&t.api?(await this.$v3plugin.$api({confirm:t==null?void 0:t.confirm,api:t==null?void 0:t.api,method:t==null?void 0:t.method,id:(n=this.item)==null?void 0:n.id,isId:(t==null?void 0:t.isId)||!1}),await this.$emit("update-table")):t!=null&&t.href&&this.$router.push((t==null?void 0:t.href)+((r=this.item)==null?void 0:r.id))}}},Aq={class:"inline-flex"},Dq={class:"inline-flex items-center justify-center bg-white border rounded-lg shadow-sm size-7 gap-x-2 border-stone-200 text-stone-800 hover:bg-stone-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-stone-50"},Mq={class:"flex flex-col items-start"},Iq=["onClick"],Pq={class:"text-gray-800"},Rq={key:1,class:"h-[1px] w-[80%] bg-gray-200 ml-auto mr-auto"},Nq={class:"flex justify-end p-[16px] pr-0 gap-x-3"};function Bq(t,e,n,r,o,d){const p=a.resolveComponent("IconMore"),c=a.resolveComponent("IconEdit"),b=a.resolveComponent("router-link"),k=a.resolveComponent("IconLink"),E=a.resolveComponent("IconDelete"),C=a.resolveComponent("VsPopover"),T=a.resolveComponent("VsConfirm");return a.openBlock(),a.createElementBlock(a.Fragment,null,[a.createElementVNode("div",Aq,[a.createVNode(C,{trigger:"click",placement:"bottom-left"},{reference:a.withCtx(()=>[a.createElementVNode("button",Dq,[a.createVNode(p,{height:"16",width:"16"})])]),default:a.withCtx(()=>{var I,N,$,F,q;return[a.createElementVNode("div",Mq,[(I=n.actions)!=null&&I.includes("edit")&&n.isForm?(a.openBlock(),a.createBlock(b,{key:0,to:`/edit?table=${($=(N=t.$route)==null?void 0:N.params)==null?void 0:$.catchAll}&id=${(F=n.item)==null?void 0:F.id}`,class:"w-full flex items-center gap-x-3 py-1.5 px-2 rounded-lg text-[13px] text-stone-800 hover:bg-stone-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-stone-100"},{default:a.withCtx(()=>[a.createVNode(c,{color:"#000"}),e[4]||(e[4]=a.createTextVNode(" Редагувати ",-1))]),_:1,__:[4]},8,["to"])):a.createCommentVNode("",!0),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(d.getCustomActions,(J,Q)=>(a.openBlock(),a.createElementBlock("button",{key:Q,onClick:me=>d.customButtonAction(J),class:"w-full flex items-center gap-x-3 py-1.5 px-2 rounded-lg text-[13px] text-stone-800 hover:bg-stone-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-stone-100"},[J!=null&&J.href?(a.openBlock(),a.createBlock(k,{key:0,class:"size-3.5"})):a.createCommentVNode("",!0),a.createElementVNode("span",Pq,a.toDisplayString(J==null?void 0:J.label),1)],8,Iq))),128)),n.isForm?(a.openBlock(),a.createElementBlock("div",Rq)):a.createCommentVNode("",!0),(q=n.actions)!=null&&q.includes("del")?(a.openBlock(),a.createElementBlock("button",{key:2,onClick:e[0]||(e[0]=a.withModifiers((...J)=>d.openConfirm&&d.openConfirm(...J),["stop"])),class:"w-full flex items-center gap-x-3 py-1.5 px-2 rounded-lg text-[13px] text-stone-800 hover:bg-stone-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-stone-100"},[a.createVNode(E),e[5]||(e[5]=a.createElementVNode("span",{class:"text-gray-800"},"Видалити",-1))])):a.createCommentVNode("",!0)])]}),_:1})]),a.createVNode(T,{visible:o.isDeleteConfirm,"onUpdate:visible":e[3]||(e[3]=I=>o.isDeleteConfirm=I),size:"small",title:"Ви впевнені?"},{default:a.withCtx(()=>[e[6]||(e[6]=a.createElementVNode("p",{class:"mt-1 text-sm text-gray-600 dark:text-neutral-400"}," Ви впевнені, що хочете видалити цей об'єкт? ",-1)),a.createElementVNode("div",Nq,[a.createElementVNode("button",{type:"button",class:"inline-flex items-center px-3 py-2 text-xs font-medium duration-300 border rounded-lg shadow-sm hover:bg-gray-100 gap-x-2 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50",onClick:e[1]||(e[1]=I=>o.isDeleteConfirm=!1)}," Скасувати "),a.createElementVNode("button",{type:"button",class:"inline-flex items-center px-3 py-2 text-xs font-medium text-white duration-300 bg-red-500 rounded-lg gap-x-2 hover:bg-red-700 disabled:opacity-50 disabled:pointer-events-none",onClick:e[2]||(e[2]=(...I)=>d.deleteElement&&d.deleteElement(...I))}," Так, я впевнена(ий) ")])]),_:1,__:[6]},8,["visible"])],64)}const Vq=Oe(Tq,[["render",Bq]]),zq={},Oq={class:"flex-shrink-0 mt-0.5 size-3.5",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function Lq(t,e,n,r,o,d){return a.openBlock(),a.createElementBlock("svg",Oq,e[0]||(e[0]=[a.createElementVNode("path",{d:"m3 16 4 4 4-4"},null,-1),a.createElementVNode("path",{d:"M7 20V4"},null,-1),a.createElementVNode("path",{d:"m21 8-4-4-4 4"},null,-1),a.createElementVNode("path",{d:"M17 4v16"},null,-1)]))}const Fq=Oe(zq,[["render",Lq]]),$q={},jq={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",class:"icon icon-tabler icons-tabler-outline icon-tabler-rosette-discount-check"};function Uq(t,e,n,r,o,d){return a.openBlock(),a.createElementBlock("svg",jq,e[0]||(e[0]=[a.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),a.createElementVNode("path",{d:"M5 7.2a2.2 2.2 0 0 1 2.2 -2.2h1a2.2 2.2 0 0 0 1.55 -.64l.7 -.7a2.2 2.2 0 0 1 3.12 0l.7 .7c.412 .41 .97 .64 1.55 .64h1a2.2 2.2 0 0 1 2.2 2.2v1c0 .58 .23 1.138 .64 1.55l.7 .7a2.2 2.2 0 0 1 0 3.12l-.7 .7a2.2 2.2 0 0 0 -.64 1.55v1a2.2 2.2 0 0 1 -2.2 2.2h-1a2.2 2.2 0 0 0 -1.55 .64l-.7 .7a2.2 2.2 0 0 1 -3.12 0l-.7 -.7a2.2 2.2 0 0 0 -1.55 -.64h-1a2.2 2.2 0 0 1 -2.2 -2.2v-1a2.2 2.2 0 0 0 -.64 -1.55l-.7 -.7a2.2 2.2 0 0 1 0 -3.12l.7 -.7a2.2 2.2 0 0 0 .64 -1.55v-1"},null,-1),a.createElementVNode("path",{d:"M9 12l2 2l4 -4"},null,-1)]))}const Hq={components:{IconExport:Fq,IconChevronDown:Bd,IconSuccess:Oe($q,[["render",Uq]])},props:{table:String,columns:Array,page:[String,Number],filterCustom:String,filterState:String,filters:String},data(){return{isOpen:!1,tableFormats:["json","csv","xlsx"],format:"",cols:[],activeAction:"",isSuccessTemplate:!1,actions:[{name:"choceAll",function:this.choceAll,label:"Вибрати усі"},{name:"choceVisible",function:this.choceVisible,label:"Вибрати поточні"},{name:"clearAll",function:this.clearAll,label:"Жодного"}],es:null,progress:0}},watch:{isOpen(t){t||(this.format="",this.cols=[],this.activeAction="",this.isSuccessTemplate=!1)}},computed:{color(){return et.value.buttonColor||"blue"}},methods:{async downloadBlob(t){const e=await Le.get(t||"/api/export",{params:{table:this.table,format:this.format,cols:this.cols.join(","),page:this.page,filter:this.filters||null,state:this.filterState||null,custom:this.filterCustom||null},responseType:"blob"}),n=new Blob([e.data],{type:"application/octet-stream"}),r=document.createElement("a");r.href=URL.createObjectURL(n),r.download=`${this.table.split(".")[0]}.${this.format}`,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(r.href),this.isSuccessTemplate=!0,this.$notify({type:"success",title:"Експорт",message:"Файл успішно експортовано!"})},async exportTable(){var e;try{await Le.get("/api/export",{params:{table:this.table,format:this.format,cols:this.cols.join(","),page:this.page,filter:this.filters||null,state:this.filterState||null,custom:this.filterCustom||null,stream:!0},validateStatus:n=>n===200}),await this.downloadBlob();return}catch{}const t=new URLSearchParams({table:this.table,format:this.format,cols:this.cols.join(","),page:this.page,filter:this.filters||"",state:this.filterState||"",custom:this.filterCustom||""});(e=this.es)==null||e.close(),this.es=new EventSource(`/api/export?${t.toString()}`),this.es.addEventListener("progress",n=>{try{const{percent:r}=JSON.parse(n.data);this.progress=r}catch{console.log("progress",n.data)}}),this.es.addEventListener("done",async n=>{this.es.close(),this.es=null;const{url:r}=JSON.parse(n.data||"{}");await this.downloadBlob(r)}),this.es.onerror=n=>{var r;console.error("SSE error",n),this.$notify({type:"error",title:"Помилка",message:"Потік експорту перервано."}),(r=this.es)==null||r.close()}},selectFormat(t){this.format=t},choceAll(){var t;this.cols=(t=this.columns)==null?void 0:t.map(e=>e==null?void 0:e.name),this.activeAction="choceAll"},clearAll(){this.cols=[],this.activeAction="clearAll"},choceVisible(){var t,e;this.cols=(e=(t=this.columns)==null?void 0:t.filter(n=>(n==null?void 0:n.hidden)!==!0))==null?void 0:e.map(n=>n==null?void 0:n.name),this.activeAction="choceVisible"}}},Wq={key:0,class:"flex flex-col items-center"},qq={key:1,class:"p-4"},Gq={class:"pb-5 mb-5 border-b border-gray-200 last:pb-0 last:mb-0 last:border-b-0 dark:border-neutral-700"},Zq={class:"flex items-center gap-[10px] -ml-[10px] my-[10px]"},Yq=["onClick"],Xq={key:0,class:"block h-[8px] w-[8px] rounded-full bg-blue-500"},Kq={class:"mt-2 flex row flex-wrap gap-y-[5px] gap-x-[10px]"},Jq={class:"pb-5 mb-5 border-b border-gray-200 last:pb-0 last:mb-0 last:border-b-0 dark:border-neutral-700"},Qq={class:"mt-2 space-y-2"},eG=["id","onChange"],tG=["for"],nG={key:0,class:"flex w-full justify-end p-[20px] gap-[6px] border-t"},rG={key:1,class:"flex w-full justify-end p-[20px] gap-[6px] border-t"};function iG(t,e,n,r,o,d){const p=a.resolveComponent("IconExport"),c=a.resolveComponent("IconSuccess"),b=a.resolveComponent("VsCheckbox"),k=a.resolveComponent("VsDialog");return a.openBlock(),a.createElementBlock(a.Fragment,null,[a.createElementVNode("button",{onClick:e[0]||(e[0]=E=>o.isOpen=!0),class:"py-2 max-h-[34px] px-2.5 md:inline-flex hidden items-center gap-x-1.5 text-xs font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},[a.createVNode(p,{height:"16",width:"16"}),e[7]||(e[7]=a.createTextVNode(" Експорт ",-1))]),a.createVNode(k,{visible:o.isOpen,"onUpdate:visible":e[6]||(e[6]=E=>o.isOpen=E),title:"Експорт таблиці",size:"small",closeClickBack:!0},{footer:a.withCtx(()=>[o.isSuccessTemplate?(a.openBlock(),a.createElementBlock("div",nG,[a.createElementVNode("button",{type:"button",class:"inline-flex items-center justify-center px-3 py-2 text-sm font-medium text-gray-800 align-middle bg-white border border-gray-200 rounded-lg shadow-sm text-nowrap text-start hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:e[2]||(e[2]=E=>o.isOpen=!1)}," Закрити "),a.createElementVNode("button",{type:"button",class:"inline-flex items-center justify-center px-3 py-2 text-sm font-medium text-white align-middle bg-blue-600 border border-blue-600 rounded-lg shadow-sm text-nowrap gap-x-2 text-start hover:bg-blue-700 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:ring-1 focus:ring-blue-300 dark:focus:ring-blue-500",onClick:e[3]||(e[3]=E=>o.isSuccessTemplate=!1)}," Вигрузити ще ")])):(a.openBlock(),a.createElementBlock("div",rG,[a.createElementVNode("button",{type:"button",class:"inline-flex items-center justify-center px-3 py-2 text-sm font-medium text-gray-800 align-middle bg-white border border-gray-200 rounded-lg shadow-sm text-nowrap text-start hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:e[4]||(e[4]=E=>o.isOpen=!1)}," Скасувати "),a.createElementVNode("button",{type:"button",class:a.normalizeClass(`inline-flex items-center justify-center px-3 py-2 text-sm font-medium text-white align-middle bg-${d.color}-700 rounded-lg shadow-sm text-nowrap gap-x-2 text-start hover:bg-${d.color}-800 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:ring-1 focus:ring-${d.color}-300 dark:focus:ring-${d.color}-500`),onClick:e[5]||(e[5]=(...E)=>d.exportTable&&d.exportTable(...E))}," Завантажити таблицю ",2)]))]),default:a.withCtx(()=>[o.isSuccessTemplate?(a.openBlock(),a.createElementBlock("div",Wq,[a.createVNode(c,{height:"100",width:"100",class:"text-green-200 mb-[20px]"}),e[8]||(e[8]=a.createElementVNode("h2",null,"Звіт сформовано і збережено",-1))])):(a.openBlock(),a.createElementBlock("div",qq,[a.createElementVNode("div",Gq,[e[9]||(e[9]=a.createElementVNode("h2",{class:"text-sm font-[600] text-gray-500"}," Виберіть стовпці таблиці для експорту: ",-1)),a.createElementVNode("div",Zq,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(o.actions,E=>(a.openBlock(),a.createElementBlock("button",{key:E==null?void 0:E.name,onClick:E==null?void 0:E.function,class:"inline-flex items-center gap-[8px] justify-center px-3 py-2 text-sm font-medium text-gray-800 align-middle bg-white border-gray-200 text-nowrap text-start"},[a.createElementVNode("span",{class:a.normalizeClass(["h-[14px] w-[14px] border rounded-full flex items-center justify-center",{"border-blue-500":(E==null?void 0:E.name)===o.activeAction}])},[(E==null?void 0:E.name)===o.activeAction?(a.openBlock(),a.createElementBlock("span",Xq)):a.createCommentVNode("",!0)],2),a.createTextVNode(" "+a.toDisplayString(E==null?void 0:E.label),1)],8,Yq))),128))]),a.createElementVNode("div",Kq,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(n.columns,(E,C)=>(a.openBlock(),a.createElementBlock("div",{class:"flex items-center",key:C,style:{width:"calc((100% - 10px) / 2)"}},[a.createVNode(b,{class:"[&>label]:text-sm [&>label]:text-gray-800 [&>label]:ms-3 !gap-x-[1px] !p-0",modelValue:o.cols,"onUpdate:modelValue":e[1]||(e[1]=T=>o.cols=T),value:E==null?void 0:E.name,label:E==null?void 0:E.ua},null,8,["modelValue","value","label"])]))),128))])]),a.createElementVNode("div",Jq,[e[10]||(e[10]=a.createElementVNode("h2",{class:"text-sm font-[600] text-gray-500"}," Виберіть формат таблиці: ",-1)),a.createElementVNode("div",Qq,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(o.tableFormats,(E,C)=>(a.openBlock(),a.createElementBlock("div",{class:"flex items-center",key:C},[a.createElementVNode("input",{type:"radio",name:"hs-pro-duecmfm",class:"text-blue-600 border-gray-300 rounded-full shrink-0 focus:ring-blue-500 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-500 dark:checked:bg-blue-500 dark:checked:border-blue-500 dark:focus:ring-offset-gray-800",id:E,onChange:T=>d.selectFormat(E)},null,40,eG),a.createElementVNode("label",{for:E,class:"text-sm text-gray-800 ms-3 dark:text-neutral-400"}," Формат "+a.toDisplayString(E),9,tG)]))),128))])])]))]),_:1},8,["visible"])],64)}const sG=Oe(Hq,[["render",iG]]),oG={},aG={xmlns:"http://www.w3.org/2000/svg",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-minus"};function lG(t,e,n,r,o,d){return a.openBlock(),a.createElementBlock("svg",aG,e[0]||(e[0]=[a.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),a.createElementVNode("path",{d:"M5 12l14 0"},null,-1)]))}const cG={components:{IconPlus:$l,IconMinus:Oe(oG,[["render",lG]])},props:{title:String,defaultValue:{type:Boolean,default:()=>!1}},data(){return{expanded:this.defaultValue}}},dG={class:"hs-accordion"},uG={class:"py-0.5 flex items-center gap-x-0.5 w-full"},hG={class:"text-sm font-medium"},pG={class:"relative inline-block w-full duration-150 cursor-pointer before:block before:absolute b"};function fG(t,e,n,r,o,d){const p=a.resolveComponent("IconPlus"),c=a.resolveComponent("IconMinus");return a.openBlock(),a.createElementBlock("div",null,[a.createElementVNode("div",null,[a.createElementVNode("div",dG,[a.createElementVNode("div",uG,[a.createElementVNode("div",{onClick:e[0]||(e[0]=b=>o.expanded=!o.expanded),class:"rounded-md cursor-pointer grow"},[a.createElementVNode("span",hG,a.toDisplayString(n.title),1)]),a.createElementVNode("button",{class:"flex items-center justify-center rounded-md size-6 hover:bg-gray-100",onClick:e[1]||(e[1]=b=>o.expanded=!o.expanded)},[o.expanded?(a.openBlock(),a.createBlock(c,{key:1,width:"14"})):(a.openBlock(),a.createBlock(p,{key:0}))])]),a.createVNode(a.Transition,{name:"fade"},{default:a.withCtx(()=>[a.withDirectives(a.createElementVNode("div",pG,[a.renderSlot(t.$slots,"default",{},void 0,!0)],512),[[a.vShow,o.expanded]])]),_:3})])])])}const mG={components:{AdminComponentIs:vd,AdminTree:Oe(cG,[["render",fG],["__scopeId","data-v-e1f274c9"]]),VsNoData:Ha,VsWidgetComments:Sv,VsWidgetMap:Fm,VsWidgetFileList:Cv},props:{table:String,columns:Array,row:Object}},gG={class:"pl-2 hs-accordion w-[360px] shrink-0 overflow-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar:horizontal]:h-[8px] [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500",style:{height:"calc(100vh - 229px)"}},yG={style:{height:"calc(100vh - 360px)"},class:"pl-2"},_G={class:"flow-root mt-[10px]"},bG={class:"divide-y divide-gray-100 text-[12px]"},xG={class:"grid grid-cols-1 gap-1 py-3 even:bg-gray-50 sm:grid-cols-3 sm:gap-4"},vG={class:"font-medium text-gray-900"},wG={class:"text-gray-700 sm:col-span-2"};function kG(t,e,n,r,o,d){var k,E,C,T;const p=a.resolveComponent("AdminComponentIs"),c=a.resolveComponent("VsWidgetFileList"),b=a.resolveComponent("VsNoData");return a.openBlock(),a.createElementBlock("div",gG,[e[0]||(e[0]=a.createElementVNode("div",{class:"pl-[10px] py-[9px]"},[a.createElementVNode("h2",{class:"text-sm font-medium text-center"},"Інформація про об'єкт")],-1)),a.createElementVNode("div",yG,[(E=(k=t.$route)==null?void 0:k.query)!=null&&E.card?(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},[a.createElementVNode("div",_G,[a.createElementVNode("dl",bG,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(n.columns,I=>(a.openBlock(),a.createElementBlock("div",xG,[a.createElementVNode("dt",vG,a.toDisplayString((I==null?void 0:I.ua)||(I==null?void 0:I.title)),1),a.createElementVNode("dd",wG,[a.createVNode(p,{row:n.row,column:I,table:n.table},null,8,["row","column","table"])])]))),256))])]),(a.openBlock(),a.createBlock(c,{key:(C=n.row)==null?void 0:C.id,id:(T=n.row)==null?void 0:T.id,class:"mt-10"},null,8,["id"]))],64)):(a.openBlock(),a.createBlock(b,{key:1,text:"Оберіть один з об'єктів в таблиці для відображення інформаціі про нього"}))])])}const EG=Oe(mG,[["render",kG]]),CG={emits:["filterChange"],props:{scheme:{type:Object},onFilters:{type:Number},table:{type:String}},components:{IconFilter:Dv},data(){return{isFilters:!1}},methods:{closeFilter({target:t}){this.isFilters&&t.classList.contains("filter-container")&&(this.isFilters=!1)}}},SG={key:0,class:"px-[7px] text-[10px] py-[1px] font-[700] text-white bg-blue-500 rounded-full"},TG={class:"filter-content h-screen bg-white w-[400px] overflow-x-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar:horizontal]:h-[8px] [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"};function AG(t,e,n,r,o,d){const p=a.resolveComponent("IconFilter"),c=a.resolveComponent("VsFilter");return a.openBlock(),a.createElementBlock(a.Fragment,null,[a.createElementVNode("button",{onClick:e[0]||(e[0]=b=>o.isFilters=!o.isFilters),class:"py-2 px-2.5 max-h-[34px] inline-flex items-center gap-x-1.5 text-xs font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none"},[a.createVNode(p,{height:"16",width:"16"}),e[4]||(e[4]=a.createTextVNode(" Фільтри ",-1)),n.onFilters?(a.openBlock(),a.createElementBlock("span",SG,a.toDisplayString(n.onFilters),1)):a.createCommentVNode("",!0)]),a.createVNode(a.Transition,{name:"fade"},{default:a.withCtx(()=>{var b;return[(a.openBlock(),a.createBlock(a.Teleport,{to:"#modal"},[a.withDirectives(a.createElementVNode("div",{onClick:e[3]||(e[3]=(...k)=>d.closeFilter&&d.closeFilter(...k)),style:{height:"100vh"},class:"fixed filter-container top-0 flex justify-end items-center z-[12] right-0 left-0 bottom-0 bg-[rgba(0,0,0,0.2)]"},[a.createElementVNode("div",TG,[(b=n.scheme)!=null&&b.length?(a.openBlock(),a.createBlock(c,{key:0,ref:"filter",scheme:n.scheme,layout:"default","apply-vue-router":"",history:"",name:"filter",footer:!0,background:!0,onFilterChange:e[1]||(e[1]=k=>t.$emit("filterChange",k)),closeFilterBtn:!0,onFilterClose:e[2]||(e[2]=k=>o.isFilters=!1)},null,8,["scheme"])):a.createCommentVNode("",!0)])],512),[[a.vShow,o.isFilters]])]))]}),_:1})],64)}const DG=Oe(CG,[["render",AG]]),MG={props:{tabsList:{type:Array,default:()=>[]},filterState:String}},IG={class:"relative flex space-x-1 mb-[20px] after:absolute after:w-[99%] after:bottom-0 after:inset-x-0 after:border-b-2 after:border-gray-200 dark:after:border-neutral-700","aria-label":"Tabs",role:"tablist","aria-orientation":"horizontal"},PG=["onClick"];function RG(t,e,n,r,o,d){return a.openBlock(),a.createElementBlock("nav",IG,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(n.tabsList,p=>(a.openBlock(),a.createElementBlock("button",{onClick:c=>t.$emit("update:filterState",p==null?void 0:p.name),class:a.normalizeClass(["hs-tab-active:after:bg-gray-800 hs-tab-active:text-gray-800 px-2.5 py-1.5 mb-2 relative inline-flex justify-center items-center gap-x-2 hover:bg-gray-100 text-gray-500 hover:text-gray-800 text-sm rounded-lg disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-100 after:absolute after:-bottom-2 after:inset-x-0 after:z-10 after:h-0.5 after:pointer-events-none dark:hs-tab-active:text-neutral-200 dark:hs-tab-active:after:bg-neutral-400 dark:text-neutral-500 dark:hover:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700 active",{" font-semibold after:absolute after:bottom-[-8px] after:left-2.5 after:right-2.5 after:z-10 after:h-0.5 after:bg-gray-800":(p==null?void 0:p.name)===n.filterState}])},a.toDisplayString(p==null?void 0:p.label),11,PG))),256))])}const NG=Oe(MG,[["render",RG]]),BG={},VG={xmlns:"http://www.w3.org/2000/svg",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-filter"};function zG(t,e,n,r,o,d){return a.openBlock(),a.createElementBlock("svg",VG,e[0]||(e[0]=[a.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),a.createElementVNode("path",{d:"M4 4h16v2.172a2 2 0 0 1 -.586 1.414l-4.414 4.414v7l-6 2v-8.5l-4.48 -4.928a2 2 0 0 1 -.52 -1.345v-2.227z"},null,-1)]))}const OG={components:{IconFilter2:Oe(BG,[["render",zG]]),IconCheck2:kl},props:{filterCustom:String,customList:Array}},LG={class:"py-2 max-h-[34px] px-2.5 inline-flex items-center gap-x-1.5 text-xs font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},FG={class:"flex flex-col p-[2px] gap-[2px] w-[170px]"},$G=["onClick"],jG={class:"text-sm text-gray-800"};function UG(t,e,n,r,o,d){const p=a.resolveComponent("IconFilter2"),c=a.resolveComponent("IconCheck2"),b=a.resolveComponent("VsPopover");return a.openBlock(),a.createBlock(b,{ref:"popover",placement:"bottom"},{reference:a.withCtx(()=>[a.createElementVNode("button",LG,[a.createVNode(p,{height:"20",width:"20"})])]),default:a.withCtx(()=>[a.createElementVNode("div",FG,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(n.customList,(k,E)=>(a.openBlock(),a.createElementBlock("button",{onClick:C=>{var T;t.$emit("update:filterCustom",k==null?void 0:k.name),(T=t.$refs)==null||T.popover.togglePopover()},key:E,class:a.normalizeClass(["flex items-center px-3 py-1 rounded-md cursor-pointer group hover:bg-gray-100",{"bg-gray-100":n.filterCustom===(k==null?void 0:k.name)}])},[a.createElementVNode("span",jG,a.toDisplayString(k==null?void 0:k.label),1),n.filterCustom===(k==null?void 0:k.name)?(a.openBlock(),a.createBlock(c,{key:0,class:"ml-auto size-3 shrink-0"})):a.createCommentVNode("",!0)],10,$G))),128)),a.createElementVNode("button",{class:"flex items-center px-3 py-1 rounded-md cursor-pointer group hover:bg-gray-100",onClick:e[0]||(e[0]=k=>{var E;t.$emit("update:filterCustom",void 0),(E=t.$refs)==null||E.popover.togglePopover()})}," Скинути фільтри ")])]),_:1},512)}const HG=Oe(OG,[["render",UG]]),WG={class:"flex items-center gap-x-2"},qG={__name:"admin-table-custom-buttons",props:{slots:Object,data:Object},setup(t){var c,b,k,E,C;const{asyncTemplateSlot:e}=(C=(E=(k=(b=(c=a.getCurrentInstance())==null?void 0:c.appContext)==null?void 0:b.app)==null?void 0:k.config)==null?void 0:E.globalProperties)==null?void 0:C.utils,n=a.ref(""),r=a.ref(""),o=t,d=()=>{var T,I,N,$,F;if((T=o.slots)!=null&&T.panelLeft||(r.value="div"),(N=(I=o.slots)==null?void 0:I.panelLeft)!=null&&N.includes("<")){const q=e("PanelLeft",($=o.slots)==null?void 0:$.panelLeft,["name"]);r.value=q}else r.value=(F=o.slots)==null?void 0:F.panelLeft},p=()=>{var T,I,N,$,F;if((T=o.slots)!=null&&T.panelRight||(n.value="div"),(N=(I=o.slots)==null?void 0:I.panelRight)!=null&&N.includes("<")){const q=e("PanelRight",($=o.slots)==null?void 0:$.panelRight,["name"]);n.value=q}else n.value=(F=o.slots)==null?void 0:F.panelRight};return d(),p(),(T,I)=>(a.openBlock(),a.createElementBlock("div",WG,[(a.openBlock(),a.createBlock(a.resolveDynamicComponent(r.value),{data:t.data},null,8,["data"])),(a.openBlock(),a.createBlock(a.resolveDynamicComponent(n.value),{data:t.data},null,8,["data"]))]))}},GG={__name:"admin-custom-button-add",props:{slots:Object},setup(t){var d,p,c,b,k;const{asyncTemplateSlot:e}=(k=(b=(c=(p=(d=a.getCurrentInstance())==null?void 0:d.appContext)==null?void 0:p.app)==null?void 0:c.config)==null?void 0:b.globalProperties)==null?void 0:k.utils,n=a.ref(""),r=t;return(()=>{var E,C,T,I,N;if((E=r.slots)!=null&&E.addButton||(n.value="div"),(T=(C=r.slots)==null?void 0:C.addButton)!=null&&T.includes("<")){const $=e("addButton",(I=r.slots)==null?void 0:I.addButton,["IconPlus"]);n.value=$}else n.value=(N=r.slots)==null?void 0:N.addButton})(),(E,C)=>n.value?(a.openBlock(),a.createBlock(a.resolveDynamicComponent(n.value),{key:0,IconPlus:$l})):a.createCommentVNode("",!0)}},ZG={key:0,class:"px-1 py-3 text-gray-800 font-[500]"},YG={key:1,class:"px-1 py-3 text-gray-800 font-[700]"},XG={__name:"admin-table-totals-list",props:{columns:{type:Array,default:()=>[]},agg:{type:Object,default:()=>{}}},setup(t){return(e,n)=>(a.openBlock(),a.createElementBlock("tr",null,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(t.columns,r=>{var o;return a.openBlock(),a.createElementBlock(a.Fragment,{key:r==null?void 0:r.name},[(o=t.agg)!=null&&o[r==null?void 0:r.name]?(a.openBlock(),a.createElementBlock("td",ZG,[a.createVNode(vd,{column:r,row:t.agg},null,8,["column","row"])])):(a.openBlock(),a.createElementBlock("td",YG))],64)}),128))]))}},KG={},JG={xmlns:"http://www.w3.org/2000/svg",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-check"};function QG(t,e,n,r,o,d){return a.openBlock(),a.createElementBlock("svg",JG,e[0]||(e[0]=[a.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),a.createElementVNode("path",{d:"M5 12l5 5l10 -10"},null,-1)]))}const eZ=Oe(KG,[["render",QG]]),tZ=a.defineComponent({components:{IconChevronDown:Ip,IconCheck:eZ},props:{total:{type:Number,default:()=>0},pageSize:{type:Number,default:()=>20},maxPages:{type:Number,default:()=>10},defaultPage:{type:Number,default:()=>1},pageSizes:{type:Array,default:[]}},data(){return{page:1,pages:[],isDropdownOpen:!1,pageSizeLocal:null}},mounted(){this.pageSizeLocal=this.pageSize},watch:{total:{immediate:!0,handler(){this.initPages()}},defaultPage:{immediate:!0,handler(t){this.page=t,this.updatePages(t)}},pageSizeLocal(t,e){e&&(this.isDropdownOpen=!1,this.setCurrentPage(1))}},computed:{pagesCount(){return Math.ceil(this.total/this.pageSizeLocal)},disableNextClick(){return this.page>=this.pagesCount},disablePrevClick(){return this.page<=1}},methods:{initPages(){if(this.total<=0){this.pages=[1];return}this.updatePages(this.page)},handleSetPage(t){const e=t.replace(/\D/g,"");if(e>this.pagesCount){this.$refs.currentPage.innerText=this.page;return}else this.$refs.currentPage.innerText=e;this.setCurrentPage(e)},updatePages(t){const e=Math.floor(this.maxPages/2);let n=Math.max(t-e,1),r=n+this.maxPages-1;r>this.pagesCount&&(r=this.pagesCount,n=Math.max(r-this.maxPages+1,1)),this.pages=Array.from({length:r-n+1},(o,d)=>n+d)},handleClickPrev(){this.disablePrevClick||(this.setCurrentPage(this.page-1),this.updatePages(this.page),this.$emit("prevClick"))},handleClickNext(){this.disableNextClick||(this.setCurrentPage(parseInt(this.page)+1),this.updatePages(this.page),this.$emit("nextClick"))},setCurrentPage(t){this.page=t,this.$emit("pageChange",this.page,this.pageSizeLocal),this.updatePages(t)},keydownEnter(t){t.preventDefault(),t.target.blur()}}}),nZ={class:"flex items-center w-full"},rZ={class:"flex items-center mx-[8px]"},iZ={class:"min-h-[38px] flex justify-center items-center text-stone-500 py-2 px-1.5 text-sm"},sZ={key:0,class:"flex items-center justify-center ml-3 gap-x-5"},oZ={class:"relative"},aZ={class:"z-50 bg-white shadow-md rounded-lg p-1 space-y-0.5 dark:bg-neutral-800 dark:border dark:border-neutral-700 dark:divide-neutral-700 absolute bottom-[100%]"},lZ=["onClick"];function cZ(t,e,n,r,o,d){const p=a.resolveComponent("IconChevronDown"),c=a.resolveComponent("IconCheck");return a.openBlock(),a.createElementBlock("nav",nZ,[a.createElementVNode("button",{type:"button",onClick:e[0]||(e[0]=(...b)=>t.handleClickPrev&&t.handleClickPrev(...b)),class:a.normalizeClass(["min-h-[38px] min-w-[38px] py-2 px-2.5 inline-flex justify-center items-center gap-x-2 text-sm rounded-lg text-stone-800 hover:bg-stone-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-stone-100",{"opacity-50 pointer-events-none":t.disablePrevClick}])},[a.createVNode(p,{height:"16",width:"16",class:"rotate-90"})],2),a.createElementVNode("div",rZ,[a.createElementVNode("span",{ref:"currentPage",contenteditable:"true",onKeydown:e[1]||(e[1]=a.withKeys((...b)=>t.keydownEnter&&t.keydownEnter(...b),["enter"])),onBlur:e[2]||(e[2]=b=>t.handleSetPage(b.target.innerText)),class:"min-h-[38px] max-h-[38px] overflow-hidden min-w-[38px] flex justify-center items-center bg-stone-100 text-stone-800 py-2 px-3 outline-blue-600 text-sm rounded-lg disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:text-white"},a.toDisplayString(t.page),545),e[5]||(e[5]=a.createElementVNode("span",{class:"min-h-[38px] flex justify-center items-center text-stone-500 py-2 px-1.5 text-sm"},"з",-1)),a.createElementVNode("span",iZ,a.toDisplayString(t.pagesCount),1)]),a.createElementVNode("button",{type:"button",onClick:e[3]||(e[3]=(...b)=>t.handleClickNext&&t.handleClickNext(...b)),class:a.normalizeClass([{"opacity-50 pointer-events-none":t.disableNextClick},"min-h-[38px] min-w-[38px] py-2 px-2.5 inline-flex justify-center items-center gap-x-2 text-sm rounded-lg text-stone-800 hover:bg-stone-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-stone-100"])},[a.createVNode(p,{height:"16",width:"16",class:"-rotate-90"})],2),t.pageSizes.length?(a.openBlock(),a.createElementBlock("div",sZ,[a.createElementVNode("div",oZ,[a.withDirectives(a.createElementVNode("div",aZ,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(t.pageSizes,b=>(a.openBlock(),a.createElementBlock("button",{type:"button",class:"w-full flex items-center gap-x-3.5 py-2 px-3 rounded-lg text-sm",onClick:k=>t.pageSizeLocal=b},[a.createTextVNode(a.toDisplayString(b)+" ",1),b===t.pageSizeLocal?(a.openBlock(),a.createBlock(c,{key:0,width:"14",height:"14",class:"text-blue-600"})):a.createCommentVNode("",!0)],8,lZ))),256))],512),[[a.vShow,t.isDropdownOpen]]),t.pageSizes.length?(a.openBlock(),a.createElementBlock("button",{key:0,type:"button",class:"text-sm h-[32px] min-w-8 py-3 px-3.5 inline-flex items-center gap-x-1 rounded-lg border border-gray-200 text-gray-800 shadow-sm hover:bg-gray-50 focus:outline-none focus:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none dark:border-neutral-700 dark:text-white dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:e[4]||(e[4]=b=>t.isDropdownOpen=!t.isDropdownOpen)},[a.createTextVNode(a.toDisplayString(t.pageSizeLocal)+" ",1),a.createVNode(p,{height:"16",width:"16"})])):a.createCommentVNode("",!0)])])):a.createCommentVNode("",!0)])}const dZ={props:{table:String,title:String,search:String},components:{AdminTableControl:Vq,AdminTableExport:sG,AdminTableColumnsHidden:Iv,AdminTableColumn:kq,AdminNodata:pg,IconPlus:$l,IconSearch:Mp,AdminTableCardInfo:EG,IconOpenCard:Ek,AdminComponentIs:vd,AdminTableFilters:DG,AdminTableTabs:NG,AdminTableCustomFilters:HG,AdminTableCustomButtons:qG,AdminCustomButtonAdd:GG,AdminTableTotalsList:XG,AdminTablePagination:Oe(tZ,[["render",cZ]])},data(){return{tableData:{},filterScheme:[],page:1,searchValue:"",limit:0,filters:null,activeColumn:"",isVisibleCardInfo:!1,onFilters:0,filterState:null,filterCustom:null,visibleColumns:[],initialHiddenColumns:"",columnsWidth:{}}},async mounted(){await this.checkUrlMounted(),await this.getTableData(),await this.getFilters(),window.addEventListener("reloadTablePage",this.getTableData)},unmounted(){window.removeEventListener("reloadTablePage",this.getTableData)},computed:{color(){return et.value.buttonColor||"blue"},fontSize(){return`text-[${et.value.fontSize||13}px]`},defaultPage(){var t,e;return((e=(t=this.$route)==null?void 0:t.query)==null?void 0:e.page)||1},columns(){var t,e;return(e=(t=this.tableData)==null?void 0:t.columns)==null?void 0:e.filter(n=>(n==null?void 0:n.hidden)!==!0)},isForm(){var t,e,n,r,o;return((t=this.tableData)==null?void 0:t.form)&&(((n=(e=this.tableData)==null?void 0:e.actions)==null?void 0:n.includes("add"))||((o=(r=this.tableData)==null?void 0:r.actions)==null?void 0:o.includes("edit")))},isNoData(){var t,e;return!((t=this.tableData)!=null&&t.rows)||!((e=this.columns)!=null&&e.length)},activeCardRow(){var t,e;return((e=(t=this.tableData)==null?void 0:t.rows)==null?void 0:e.find(n=>{var r,o;return(n==null?void 0:n.id)===((o=(r=this.$route)==null?void 0:r.query)==null?void 0:o.card)}))||{}},getActions(){var t;return(t=this.tableData)==null?void 0:t.actions}},watch:{searchValue:{handler:Iy(async function(t){var e;this.page=1,await this.getTableData(),this.$router.push({...this.$route,query:{...(e=this.$route)==null?void 0:e.query,search:t||void 0,page:1}})},500)},$route:{async handler(t,e){var n,r;((n=t==null?void 0:t.params)==null?void 0:n.catchAll)!==((r=e==null?void 0:e.params)==null?void 0:r.catchAll)&&(this.visibleColumns=[],this.tableData=null,this.columnsWidth={},this.unmountedData(),this.getFilters(),await this.getTableData())},deep:!0},limit(t){var e;this.$router.replace({...this.$route,query:{...(e=this.$route)==null?void 0:e.query,limit:t}})},filterState(t){var e;t&&(this.$router.replace({...this.$route,query:{...(e=this.$route)==null?void 0:e.query,state:t}}),this.getTableData())},filterCustom(t){var e;this.$router.replace({...this.$route,query:{...(e=this.$route)==null?void 0:e.query,custom:t}}),this.getTableData()},columns(t){var e,n,r,o;this.visibleColumns=t==null?void 0:t.map(d=>d==null?void 0:d.name),this.initialHiddenColumns===((e=this.visibleColumns)==null?void 0:e.join(","))&&(this.visibleColumns=[]),this.$router.replace({...this.$route,query:{...(n=this.$route)==null?void 0:n.query,columns:(r=this.visibleColumns)!=null&&r.length?(o=this.visibleColumns)==null?void 0:o.join(","):void 0}})}},methods:{async checkUrlMounted(){var t,e,n,r,o,d,p,c,b,k,E,C,T,I,N,$,F,q,J,Q,me;this.page=((e=(t=this.$route)==null?void 0:t.query)==null?void 0:e.page)||1,this.limit=((r=(n=this.$route)==null?void 0:n.query)==null?void 0:r.limit)||20,(d=(o=this.$route)==null?void 0:o.query)!=null&&d.filter&&(this.filters=((b=decodeURI((c=(p=this.$route)==null?void 0:p.query)==null?void 0:c.filter))==null?void 0:b.replaceAll("+"," "))||null),this.filters&&(this.onFilters=((E=(k=this.filters)==null?void 0:k.split("="))==null?void 0:E.length)-1),this.filterState=((T=(C=this.$route)==null?void 0:C.query)==null?void 0:T.state)||null,this.filterCustom=((N=(I=this.$route)==null?void 0:I.query)==null?void 0:N.custom)||null,this.searchValue=((F=($=this.$route)==null?void 0:$.query)==null?void 0:F.search)||"",this.visibleColumns=((Q=(J=(q=this.$route)==null?void 0:q.query)==null?void 0:J.columns)==null?void 0:Q.split(","))||[],(me=this.$route)!=null&&me.query.card&&(this.isVisibleCardInfo=!0)},rowWidth(t){var n,r;const e=(r=(n=this.tableData)==null?void 0:n.columns)==null?void 0:r.find(o=>o.name===t);if(e){const o=e==null?void 0:e.width;return typeof o=="number"?`${o}px`:o!=null&&o.includes("px")?o:`${o}px`}},unmountedData(){this.page=1,this.visibleColumns=[],this.filterCustom=null,this.filterState=null,this.isVisibleCardInfo=!1,this.filterScheme=null,this.filters=null,this.onFilters=0,this.searchValue=""},async getTableData(){var t,e,n,r,o,d,p,c,b,k,E;try{const{data:C}=await Le.get(`/api/template/table/${this.table}`),T=await Le.get(`/api/table-data/${this.table}`,{params:{page:this.page,search:this.searchValue||null,limit:this.limit,filter:this.filters||null,order:((e=(t=this.$route)==null?void 0:t.query)==null?void 0:e.sort)||null,state:this.filterState||null,custom:this.filterCustom||null}});this.tableData={...C,...(T==null?void 0:T.data)||{}},this.initialHiddenColumns=(d=(o=(r=(n=this.tableData)==null?void 0:n.columns)==null?void 0:r.filter(I=>(I==null?void 0:I.hidden)!==!0))==null?void 0:o.map(I=>I==null?void 0:I.name))==null?void 0:d.join(","),(p=this.visibleColumns)!=null&&p.length?(c=this.tableData)==null||c.columns.forEach(I=>{var N;(N=this.visibleColumns)!=null&&N.includes(I==null?void 0:I.name)?I.hidden=!1:I.hidden=!0}):this.visibleColumns=(E=(k=(b=this.tableData)==null?void 0:b.columns)==null?void 0:k.filter(I=>(I==null?void 0:I.hidden)!==!0))==null?void 0:E.map(I=>I==null?void 0:I.name),setTimeout(()=>{var I,N;(N=(I=this.tableData)==null?void 0:I.columns)==null||N.forEach(({name:$})=>{var F,q,J,Q,me,ke;(q=(F=this.columnsWidth)==null?void 0:F[$])!=null&&q.ref&&(this.columnsWidth[$].width=parseInt((ke=(me=(Q=(J=this.columnsWidth)==null?void 0:J[$])==null?void 0:Q.ref)==null?void 0:me.getBoundingClientRect())==null?void 0:ke.width)+"px")})})}catch{}},async getFilters(){var t;try{const{data:e}=await Le.get(`/api/table-filter/${this.table}`);this.filterScheme=(t=e==null?void 0:e.list)==null?void 0:t.map(n=>({...n,label:(n==null?void 0:n.label)||(n==null?void 0:n.ua)}))}catch{}},async handlePageChange(t,e){const n=this.$route.query;this.page=t,this.limit=e,await this.$router.replace({query:{...n,page:t,limit:e}}),await this.getTableData()},async filterChange({url:t,state:e}){var n;this.filters=t!=="no-url"?t:null,this.onFilters=(n=Object.entries(e))==null?void 0:n.length,this.page=1,await this.getTableData()},changeActiveColumn(t){this.activeColumn=t,this.getTableData()},pushToCard(t){var e;((e=this.tableData)==null?void 0:e.card)===!1||this.$router.push(`/card/${this.table}/${t}`)},pushToLinkCard(t,e){t!=null&&t.link&&this.$router.push(`/card/${t==null?void 0:t.link}/${e==null?void 0:e[t==null?void 0:t.name]}`)},changeActiveCardInfo(t){var e;this.isVisibleCardInfo&&this.$router.push({...this.$route,query:{...(e=this.$route)==null?void 0:e.query,card:t}})},toggleCardInfo(){var t;this.isVisibleCardInfo=!this.isVisibleCardInfo,this.isVisibleCardInfo||this.$router.push({...this.$route,query:{...(t=this.$route)==null?void 0:t.query,card:void 0}})},getCustomStyles(t){return[t!=null&&t.link?" text-blue-800 hover:underline decoration-1":"",t!=null&&t.align?` text-${(t==null?void 0:t.align)||"left"}`:"",`text-${(t==null?void 0:t.wrap)||"wrap"}`]}}},uZ={class:"w-[calc(100vw - 320px)] bg-gray-100"},hZ={class:"h-[76px] mt-[15px] flex items-center justify-between mx-[20px] px-[20px] bg-white rounded-xl"},pZ={class:"text-lg font-semibold text-gray-800 dark:text-neutral-200"},fZ={class:"bg-white w-full rounded-xl p-[20px] pr-0"},mZ={class:"flex"},gZ={class:"flex gap-[6px] ml-auto"},yZ={class:"inline-block w-full align-middle"},_Z={class:"sticky top-[-1px] z-[2] bg-white w-full after:absolute after:content-[''] after:block after:w-full after:h-px after:bg-stone-200"},bZ={class:"right-0"},xZ={key:0,class:"w-[70px] sticky right-0 top-0"},vZ={class:"divide-y divide-gray-200 z-[1] relative text-gray-600"},wZ=["onClick"],kZ=["onClick"],EZ=["onClick"],CZ={class:"flex items-center justify-start w-full px-1 py-2"},SZ={class:"w-[200px] md:inline-flex hidden"},TZ={class:"text-sm text-gray-600 dark:text-neutral-400"},AZ={class:"font-semibold text-gray-800 dark:text-neutral-200"},DZ={key:0};function MZ(t,e,n,r,o,d){var Be,Ze,tt,Xe,ot,ue,Ut,wt,$t,an,xn,mn,hn,vn,Dn,In,Hn,Wn,Te,Ke,nt,yt,qt,ln,Vt,Bt,pn,Ce,Vn,Ps,Qt,zn,Rs;const p=a.resolveComponent("AdminCustomButtonAdd"),c=a.resolveComponent("IconPlus"),b=a.resolveComponent("router-link"),k=a.resolveComponent("AdminTableTabs"),E=a.resolveComponent("IconSearch"),C=a.resolveComponent("VsText"),T=a.resolveComponent("AdminTableCustomButtons"),I=a.resolveComponent("AdminTableCustomFilters"),N=a.resolveComponent("AdminTableColumnsHidden"),$=a.resolveComponent("AdminTableExport"),F=a.resolveComponent("AdminTableFilters"),q=a.resolveComponent("IconOpenCard"),J=a.resolveComponent("AdminTableColumn"),Q=a.resolveComponent("AdminComponentIs"),me=a.resolveComponent("AdminTableControl"),ke=a.resolveComponent("AdminTableTotalsList"),Re=a.resolveComponent("AdminNodata"),Ee=a.resolveComponent("AdminTablePagination"),Ve=a.resolveComponent("AdminTableCardInfo");return a.openBlock(),a.createElementBlock("div",uZ,[a.createElementVNode("div",hZ,[a.createElementVNode("h2",pZ,a.toDisplayString(n.title),1),d.isForm?(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},[(Ze=(Be=o.tableData)==null?void 0:Be.slots)!=null&&Ze.addButton?(a.openBlock(),a.createBlock(p,{key:0,slots:(tt=o.tableData)==null?void 0:tt.slots},null,8,["slots"])):(a.openBlock(),a.createBlock(b,{key:1,to:`/add?table=${(ot=(Xe=t.$route)==null?void 0:Xe.params)==null?void 0:ot.catchAll}`,class:a.normalizeClass(`inline-flex items-center px-3 py-2 text-sm font-medium text-white duration-300 bg-${d.color}-700 border border-transparent rounded-lg gap-x-2 hover:bg-${d.color}-800 hover:text-white`)},{default:a.withCtx(()=>[a.createVNode(c,{height:"16",width:"16"}),e[5]||(e[5]=a.createTextVNode(" Додати ",-1))]),_:1,__:[5]},8,["to","class"]))],64)):a.createCommentVNode("",!0)]),a.createElementVNode("div",{style:a.normalizeStyle({height:((ue=t.$adminSettings)==null?void 0:ue.header)===!1?"calc(100vh - 91px)":"calc(100vh - 155px)"}),class:"bg-gray-100 p-[20px] flex pt-[10px] lg:w-[calc(100vw-260px)] w-[100vw]"},[a.createElementVNode("div",fZ,[(wt=(Ut=o.tableData)==null?void 0:Ut.filterState)!=null&&wt.length?(a.openBlock(),a.createBlock(k,{key:0,tabsList:($t=o.tableData)==null?void 0:$t.filterState,filterState:o.filterState,"onUpdate:filterState":e[0]||(e[0]=ut=>o.filterState=ut)},null,8,["tabsList","filterState"])):a.createCommentVNode("",!0),a.createElementVNode("div",mZ,[a.createElementVNode("div",{class:a.normalizeClass([o.isVisibleCardInfo?"w-[calc(100%-360px)]":"w-full"])},[a.createElementVNode("div",{class:a.normalizeClass(["flex sm:grid sm:grid-cols-2 gap-x-2 sm:gap-x-5 mb-[10px] relative",{"pr-[20px]":!o.isVisibleCardInfo}])},[a.createVNode(E,{height:"14",width:"14",class:"absolute top-[10px] left-[14px] text-gray-500 z-[1]"}),a.createVNode(C,{modelValue:o.searchValue,"onUpdate:modelValue":e[1]||(e[1]=ut=>o.searchValue=ut),placeholder:n.search||"Пошук...",clearable:!0,class:"[&>input]:py-[7px] [&>input]:max-h-[36px] [&>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"},null,8,["modelValue","placeholder"]),a.createElementVNode("div",gZ,[(an=o.tableData)!=null&&an.slots?(a.openBlock(),a.createBlock(T,{key:0,data:o.tableData,slots:(xn=o.tableData)==null?void 0:xn.slots},null,8,["data","slots"])):a.createCommentVNode("",!0),(hn=(mn=o.tableData)==null?void 0:mn.filterCustom)!=null&&hn.length?(a.openBlock(),a.createBlock(I,{key:1,customList:(vn=o.tableData)==null?void 0:vn.filterCustom,filterCustom:o.filterCustom,"onUpdate:filterCustom":e[2]||(e[2]=ut=>o.filterCustom=ut)},null,8,["customList","filterCustom"])):a.createCommentVNode("",!0),a.createVNode(N,{columns:(Dn=o.tableData)==null?void 0:Dn.columns,onUpdateColumns:e[3]||(e[3]=ut=>o.tableData.columns=ut)},null,8,["columns"]),((In=o.tableData)==null?void 0:In.export)!==!1?(a.openBlock(),a.createBlock($,{key:2,table:n.table,columns:(Hn=o.tableData)==null?void 0:Hn.columns,page:o.page,"filter-state":o.filterState,"filter-custom":o.filterCustom,filters:o.filters},null,8,["table","columns","page","filter-state","filter-custom","filters"])):a.createCommentVNode("",!0),(Wn=o.filterScheme)!=null&&Wn.length?(a.openBlock(),a.createBlock(F,{key:3,scheme:o.filterScheme,onFilters:o.onFilters,table:n.table,onFilterChange:d.filterChange},null,8,["scheme","onFilters","table","onFilterChange"])):a.createCommentVNode("",!0),a.createElementVNode("button",{onClick:e[4]||(e[4]=(...ut)=>d.toggleCardInfo&&d.toggleCardInfo(...ut)),class:"py-2 px-2.5 max-h-[34px] md:inline-flex hidden items-center gap-x-1.5 text-xs font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},[a.createVNode(q,{class:a.normalizeClass({"rotate-180 duration-300":!o.isVisibleCardInfo})},null,8,["class"])])])],2),a.createElementVNode("div",{class:a.normalizeClass(["flex items-start justify-start w-full space-y-5",{"pr-[20px]":!o.isVisibleCardInfo}])},[a.createElementVNode("div",{style:a.normalizeStyle({height:`calc(100vh - ${((Te=t.$adminSettings)==null?void 0:Te.header)===!1?(nt=(Ke=o.tableData)==null?void 0:Ke.filterState)!=null&&nt.length?330:270:(qt=(yt=o.tableData)==null?void 0:yt.filterState)!=null&&qt.length?380:320}px)`}),class:"overflow-x-auto w-full [&::-webkit-scrollbar]:h-2 [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-stone-100 [&::-webkit-scrollbar-thumb]:bg-stone-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},[a.createElementVNode("div",yZ,[d.isNoData?(a.openBlock(),a.createBlock(Re,{key:1})):(a.openBlock(),a.createElementBlock("table",{key:0,class:a.normalizeClass([d.fontSize,"relative min-w-full my-2 divide-y divide-gray-200 table-fixed w-max dark:divide-neutral-700"])},[a.createElementVNode("thead",_Z,[a.createElementVNode("tr",bZ,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(d.columns,ut=>{var Cr,yi;return a.openBlock(),a.createBlock(J,{key:ut.name,style:a.normalizeStyle({width:((yi=(Cr=o.columnsWidth)==null?void 0:Cr[ut==null?void 0:ut.name])==null?void 0:yi.width)||d.rowWidth(ut==null?void 0:ut.name),textAlign:ut==null?void 0:ut.align,wordBreak:ut==null?void 0:ut.wrap}),data:ut,activeColumn:o.activeColumn,onUpdateRef:br=>{var Mi,Ii;(Ii=(Mi=o.columnsWidth)==null?void 0:Mi[ut==null?void 0:ut.name])!=null&&Ii.ref||(o.columnsWidth[ut.name]={ref:br})},onChangeActive:d.changeActiveColumn},null,8,["style","data","activeColumn","onUpdateRef","onChangeActive"])}),128)),(Vt=(ln=d.getActions)==null?void 0:ln.filter(ut=>ut!=="add"&&ut!=="view"))!=null&&Vt.length?(a.openBlock(),a.createElementBlock("th",xZ)):a.createCommentVNode("",!0)])]),a.createElementVNode("tbody",vZ,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList((Bt=o.tableData)==null?void 0:Bt.rows,(ut,Cr)=>{var yi,br,Mi,Ii,je,ti,pr,ni,Pi,He,Ot,At,xr,Hr;return a.openBlock(),a.createElementBlock("tr",{key:(ut==null?void 0:ut.id)||Cr,class:a.normalizeClass({"bg-gray-100":((br=(yi=t.$route)==null?void 0:yi.query)==null?void 0:br.card)===(ut==null?void 0:ut.id),"odd:bg-gray-50":((Ii=(Mi=t.$route)==null?void 0:Mi.query)==null?void 0:Ii.card)!==(ut==null?void 0:ut.id)})},[a.createElementVNode("td",{class:a.normalizeClass(["px-1 py-2.5 pr-5",[(je=d.columns[0])!=null&&je.align?`text-${((ti=d.columns[0])==null?void 0:ti.align)||"left"}`:""]]),onClick:Et=>d.changeActiveCardInfo(ut==null?void 0:ut.id)},[a.createElementVNode("button",{onClick:Et=>{d.pushToCard(ut==null?void 0:ut.id),d.pushToLinkCard(d.columns[0],ut)},class:a.normalizeClass(["font-medium text-start",[...d.getCustomStyles(d.columns[0]),((pr=this.tableData)==null?void 0:pr.card)===!1?"":` text-${d.color}-800 decoration-2 focus:outline-none focus:underline hover:text-${d.color}-700 hover:underline`]])},[a.createVNode(Q,{row:ut,column:d.columns[0],table:n.table,onUpdateTable:d.getTableData},null,8,["row","column","table","onUpdateTable"])],10,kZ)],10,wZ),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList((ni=d.columns)==null?void 0:ni.slice(1),Et=>(a.openBlock(),a.createElementBlock("td",{onClick:Ri=>{d.changeActiveCardInfo(ut==null?void 0:ut.id),d.pushToLinkCard(Et,ut)},class:a.normalizeClass(["px-1 py-2.5 pr-5",d.getCustomStyles(Et)]),key:Et.name},[a.createVNode(Q,{row:ut,column:Et,table:n.table,onUpdateTable:d.getTableData},null,8,["row","column","table","onUpdateTable"])],10,EZ))),128)),(He=(Pi=d.getActions)==null?void 0:Pi.filter(Et=>Et!=="add"&&Et!=="view"))!=null&&He.length?(a.openBlock(),a.createElementBlock("td",{key:0,class:a.normalizeClass(["text-center sticky right-0 w-[80px] px-[10px]",{"bg-gray-50":((At=(Ot=t.$route)==null?void 0:Ot.query)==null?void 0:At.card)===(ut==null?void 0:ut.id)||!(Cr%2),"bg-white":((Hr=(xr=t.$route)==null?void 0:xr.query)==null?void 0:Hr.card)!==(ut==null?void 0:ut.id)&&Cr%2}])},[a.createVNode(me,{actions:d.getActions,isForm:d.isForm,item:ut,table:n.table,onUpdateTable:d.getTableData},null,8,["actions","isForm","item","table","onUpdateTable"])],2)):a.createCommentVNode("",!0)],2)}),128))]),a.createVNode(ke,{columns:d.columns,agg:(pn=o.tableData)==null?void 0:pn.agg},null,8,["columns","agg"])],2))])],4)],2),a.createElementVNode("div",CZ,[a.createElementVNode("div",SZ,[a.createElementVNode("p",TZ,[a.createElementVNode("span",AZ,[a.createTextVNode(" Об'єктів: "+a.toDisplayString(Intl.NumberFormat("ua").format(o.limit<((Ce=o.tableData)==null?void 0:Ce.filtered)?o.limit:((Vn=o.tableData)==null?void 0:Vn.filtered)||0))+" ",1),o.limit<((Ps=o.tableData)==null?void 0:Ps.filtered)?(a.openBlock(),a.createElementBlock("span",DZ," з "+a.toDisplayString(Intl.NumberFormat("ua").format(((Qt=o.tableData)==null?void 0:Qt.filtered)||0)),1)):a.createCommentVNode("",!0)])])]),Math.ceil((zn=o.tableData)==null?void 0:zn.filtered)>10?(a.openBlock(),a.createBlock(Ee,{key:0,class:"justify-end mr-10","default-page":parseInt(d.defaultPage),total:((Rs=o.tableData)==null?void 0:Rs.filtered)||0,onPageChange:d.handlePageChange,pageSize:parseInt(o.limit),pageSizes:[10,20,50,100]},null,8,["default-page","total","onPageChange","pageSize"])):a.createCommentVNode("",!0)])],2),a.createVNode(a.Transition,{name:"slide-fade"},{default:a.withCtx(()=>{var ut;return[o.isVisibleCardInfo?(a.openBlock(),a.createBlock(Ve,{key:0,table:n.table,columns:(ut=o.tableData)==null?void 0:ut.columns,row:d.activeCardRow},null,8,["table","columns","row"])):a.createCommentVNode("",!0)]}),_:1})])])],4)])}const IZ={components:{AdminTable:Oe(dZ,[["render",MZ],["__scopeId","data-v-ca941f11"]])},data(){return{table:!1,interface:"",search:""}},watch:{$route:{async handler(){ei!=null&&ei.value||await this.getMenu(),await this.checkPageType()},deep:!0},title(t){var e;t&&(document.title=(((e=et.value)==null?void 0:e.titlePrefix)||"")+t)}},async mounted(){await this.checkPageType()},methods:{flattenMenu(t){const e=[];return t.forEach(n=>{n.menu?e.push(...this.flattenMenu(n.menu)):e.push(n)}),e},async checkPageType(){var r,o;const t=this.flattenMenu(ei.value);t!=null&&t.length||this.$router.replace("/404");const e=t==null?void 0:t.find(d=>{var p,c;return(d==null?void 0:d.path)==((c=(p=this.$route)==null?void 0:p.params)==null?void 0:c.catchAll)});this.title=e==null?void 0:e.ua,e||this.$router.replace("/404"),e!=null&&e.component&&this.$router.replace((o=(r=this.$route)==null?void 0:r.params)==null?void 0:o.catchAll);const n=e==null?void 0:e.table;this.table=n||!1,this.search=(e==null?void 0:e.search)||"",!n&&this.getInterface()},async getInterface(){var t,e;try{const{data:n}=await Le.get(`/api/template/interface/${((e=(t=this.$route)==null?void 0:t.params)==null?void 0:e.catchAll)||""}`);this.interface=n||""}catch{this.interface=""}}}},PZ=["innerHTML"];function RZ(t,e,n,r,o,d){const p=a.resolveComponent("AdminTable");return o.table?(a.openBlock(),a.createBlock(p,{key:0,table:o.table,title:t.title,search:o.search},null,8,["table","title","search"])):(a.openBlock(),a.createElementBlock("div",{key:1,class:"w-full bg-gray-50",style:{height:"calc(100vh - 120px)"},innerHTML:o.interface},null,8,PZ))}const NZ=Object.freeze(Object.defineProperty({__proto__:null,default:Oe(IZ,[["render",RZ]])},Symbol.toStringTag,{value:"Module"}));return Mk});
|
660
|
+
`}).mount(n)}};window.addEventListener("click",t=>{var n,r,o;const e=(n=t==null?void 0:t.target)==null?void 0:n.closest("[_href]");if(e&&(e==null?void 0:e.tagName)==="A"){const d=e==null?void 0:e.getAttribute("_href");(o=(r=window==null?void 0:window.app)==null?void 0:r.router)==null||o.push(d),t==null||t.preventDefault()}});const f9=()=>{const t=a.defineCustomElement(Py);customElements.define("admin-info",t)},m9=["black","gray","red","yellow","green","blue","indigo","purple","pink","rose","amber","lime","emerald","teal","cyan","sky","violet","fuchsia","lavender","zinc","neutral","stone"],g9=["white"];let Vd,Dk;const y9=async()=>{try{const{data:t}=await Le.get("/api/user-menu"),e=t.menus;return ei.value=e,Vd=t.settings,Dk=t.user,Ay(e)}catch(t){return console.error(t),[]}},_9=(t,e)=>{Object.entries(e).forEach(([n,r])=>{t.component(n,r)})},Mk={async install(t,{componentsApp:e={},settings:n,routes:r=[]}){try{f9(),(n.sidebarDark??!0)&&(n.sidebarDark=!g9.includes(n.sidebarColor)),n.buttonColor||(n.buttonColor=m9.includes(n.sidebarColor)?n.sidebarColor:"blue");const d=(await y9()).filter(c=>c==null?void 0:c.component).map(c=>({...c,component:{...Ry,...e}[c==null?void 0:c.component]}));et.value={...et.value,...n,...(Vd==null?void 0:Vd.admin)||{}},_9(t,{...Ry,...e}),t.component("admin",KC);const{router:p}=await RT(d.concat(r));window.app={...t,router:p},window.v3plugin={...t.config.globalProperties,...Ny},t.config.globalProperties={...t.config.globalProperties,$componentsConfig:{...wx,componentsApp:e},$router:p,$v3plugin:Ny,$utils:{reloadCardPage:nh},$settings:Vd,$adminSettings:et.value,$user:Dk},t.use(p)}catch(o){console.error(o)}},components:Ry,plugins:Ny};typeof window<"u"&&(window.v3Admin=Mk);const b9={data(){return{formValues:{},scheme:null,table:"",token:"",style:null}},mounted(){this.getFormScheme()},computed:{color(){return et.value.buttonColor||"blue"}},methods:{flattenMenu(t){const e=[];return t.forEach(n=>{n.menu?e.push(...this.flattenMenu(n.menu)):e.push(n)}),e},async getFormScheme(){var r,o;const t=this.flattenMenu(ei.value);t!=null&&t.length||this.$router.replace("/404");const e=t==null?void 0:t.find(d=>{var p,c;return(d==null?void 0:d.path)==((c=(p=this.$route)==null?void 0:p.query)==null?void 0:c.table)});e||this.$router.replace("/404");const n=e==null?void 0:e.table;this.table=n;try{const{data:{form:d}}=await Le.get(`/api/template/table/${n}`),{data:p}=await Le.get(`/api/table/${this.table}/${(o=(r=this.$route)==null?void 0:r.query)==null?void 0:o.id}`);this.token=(p==null?void 0:p.token)||"",this.formValues=p||{};const{data:c}=await Le.get(`/api/template/form/${d}`);this.scheme=(c==null?void 0:c.schema)||c,this.style=(c==null?void 0:c.style)||null}catch{}},async onlyEditObject(){var e,n,r,o,d,p,c,b,k,E,C;const t=(n=(e=this.$refs.form)==null?void 0:e.$refs)==null?void 0:n.form;try{await t.doValidation(),await Le.put(`/api/table/${this.token}`,this.formValues),await this.$notify({title:"Успішно!",message:"Об'єкт успішно створено",type:"success"})}catch(T){const I=((r=T==null?void 0:T.response)==null?void 0:r.data)||"";let N=((c=(p=(d=(o=Object.entries(t==null?void 0:t.formErrors))==null?void 0:o[0])==null?void 0:d[1])==null?void 0:p[0])==null?void 0:c.message)==="Це поле обов'язкове"?"Заповніть обов'язкові поля":(C=(E=(k=(b=Object.entries(t==null?void 0:t.formErrors))==null?void 0:b[0])==null?void 0:k[1])==null?void 0:E[0])==null?void 0:C.message;this.$notify({title:"Помилка!",message:I||N||"Сталася помилка валідаціі",type:"error"})}},getGroupedErrorNotification(t,e){if(!t||!e)return"";const n={};return Object.entries(t).forEach(([o,d])=>{var c;const p=((c=e[o])==null?void 0:c.ua)||o;d.forEach(b=>{const k=b.message;n[k]||(n[k]=[]),n[k].push(`"${p}"`)})}),Object.entries(n).map(([o,d])=>`<b>${o}:</b> ${d.join(", ")}`).join("<br>")||"Сталася помилка валідації"},async editObjectAndRedirect(t=!0){var n,r;const e=(r=(n=this.$refs.form)==null?void 0:n.$refs)==null?void 0:r.form;try{t&&await e.doValidation(),await Le.put(`/api/table/${this.token}${t?"":"?draft=1"}`,this.formValues),await this.$router.back(),await this.$notify({title:"Успішно!",message:"Об'єкт успішно створено",type:"success"})}catch{const d=this.getGroupedErrorNotification(e==null?void 0:e.formErrors,e==null?void 0:e.scheme);this.$notify({title:"Помилка!",message:d,type:"error"})}}}},x9={class:"bg-gray-100 lg:w-[calc(100vw-260px)] w-[100vw]"},v9={class:"h-[76px] mt-[15px] flex items-center justify-between mx-[20px] px-[20px] bg-white rounded-xl"},w9={class:"flex items-center gap-[6px]"},k9={class:"bg-white w-full rounded-xl"};function E9(t,e,n,r,o,d){var c,b,k;const p=a.resolveComponent("VsFormWithNavigation");return a.openBlock(),a.createElementBlock("div",x9,[a.createElementVNode("div",v9,[e[4]||(e[4]=a.createElementVNode("h2",{class:"text-xl font-medium"},"Редагувати",-1)),a.createElementVNode("div",w9,[a.createElementVNode("button",{onClick:e[0]||(e[0]=E=>t.$router.back()),class:"flex items-center px-3 py-2 text-sm font-medium text-gray-800 duration-300 bg-white border border-gray-100 rounded-lg shadow gap-x-2 focus:outline-none hover:bg-gray-50 hover:border-gray-100"}," Скасувати "),(c=o.style)!=null&&c.draft?(a.openBlock(),a.createElementBlock("button",{key:0,onClick:e[1]||(e[1]=E=>d.editObjectAndRedirect(!1)),class:a.normalizeClass(`inline-flex items-center px-3 py-2 text-sm font-medium text-white duration-300 bg-${d.color}-700 border border-transparent rounded-lg gap-x-2 hover:bg-${d.color}-800 hover:text-white`)}," Зберегти DRAFT ",2)):a.createCommentVNode("",!0),a.createElementVNode("button",{onClick:e[2]||(e[2]=(...E)=>d.editObjectAndRedirect&&d.editObjectAndRedirect(...E)),class:a.normalizeClass(`inline-flex items-center px-3 py-2 text-sm font-medium text-white duration-300 bg-${d.color}-700 border border-transparent rounded-lg gap-x-2 hover:bg-${d.color}-800 hover:text-white`)}," Зберегти ",2)])]),a.createElementVNode("div",{style:a.normalizeStyle({height:((b=t.$adminSettings)==null?void 0:b.header)===!1?"calc(100vh - 91px)":"calc(100vh - 150px)"}),class:"bg-gray-100 p-[20px] flex lg:w-[calc(100vw-260px)] w-[100vw] overflow-hidden"},[a.createElementVNode("div",k9,[o.scheme?(a.openBlock(),a.createBlock(p,{key:0,ref:"form",scheme:o.scheme,columns:(k=o.style)==null?void 0:k.columns,style:a.normalizeStyle(o.style),modelValue:o.formValues,"onUpdate:modelValue":e[3]||(e[3]=E=>o.formValues=E),class:"p-[20px] h-full"},null,8,["scheme","columns","style","modelValue"])):a.createCommentVNode("",!0)])],4)])}const C9=Object.freeze(Object.defineProperty({__proto__:null,default:Oe(b9,[["render",E9]])},Symbol.toStringTag,{value:"Module"})),S9={data(){return{formValues:{},scheme:null,table:"",token:"",api:"",style:null}},mounted(){this.getFormScheme()},computed:{color(){return et.value.buttonColor||"blue"}},methods:{flattenMenu(t){const e=[];return t.forEach(n=>{n.menu?e.push(...this.flattenMenu(n.menu)):e.push(n)}),e},async getFormScheme(){var r,o;const t=this.flattenMenu(ei.value);t!=null&&t.length||this.$router.replace("/404");const e=t==null?void 0:t.find(d=>{var p,c;return(d==null?void 0:d.path)==((c=(p=this.$route)==null?void 0:p.query)==null?void 0:c.table)});e||this.$router.replace("/404");const n=e==null?void 0:e.table;this.table=n;try{const d=await Le.get(`/api/table-data/${n}`),{data:p}=await Le.get(`/api/template/form/${(r=d==null?void 0:d.data)==null?void 0:r.form}`);this.scheme=(p==null?void 0:p.schema)||p,this.style=(p==null?void 0:p.style)||null,this.api=(p==null?void 0:p.api)||"",this.token=((o=d==null?void 0:d.data)==null?void 0:o.addToken)||""}catch{}},getGroupedErrorNotification(t,e){if(!t||!e)return"";const n={};return Object.entries(t).forEach(([o,d])=>{var c;const p=((c=e[o])==null?void 0:c.ua)||o;d.forEach(b=>{const k=b.message;n[k]||(n[k]=[]),n[k].push(`"${p}"`)})}),Object.entries(n).map(([o,d])=>`<b>${o}:</b> ${d.join(", ")}`).join("<br>")||"Сталася помилка валідації"},async createObject(){var e,n,r;const t=(n=(e=this.$refs.form)==null?void 0:e.$refs)==null?void 0:n.form;try{await t.doValidation(),await Le.post(this.api||`/api/table/${this.token}`,this.formValues),await this.$router.back(),await this.$notify({title:"Успішно!",message:"Об'єкт успішно створено",type:"success"})}catch(o){const d=this.getGroupedErrorNotification(t==null?void 0:t.formErrors,t==null?void 0:t.scheme);this.$notify({title:"Помилка!",message:((r=o==null?void 0:o.response)==null?void 0:r.data)||d,type:"error"})}}}},T9={class:"bg-gray-100 lg:w-[calc(100vw-260px)] w-[100vw]"},A9={class:"h-[76px] mt-[15px] flex items-center justify-between mx-[20px] px-[20px] bg-white rounded-xl"},D9={class:"flex items-center gap-[6px]"},M9={class:"bg-white w-full rounded-xl"};function I9(t,e,n,r,o,d){var c;const p=a.resolveComponent("VsFormWithNavigation");return a.openBlock(),a.createElementBlock("div",T9,[a.createElementVNode("div",A9,[e[3]||(e[3]=a.createElementVNode("h2",{class:"text-xl font-medium"},"Створити",-1)),a.createElementVNode("div",D9,[a.createElementVNode("button",{onClick:e[0]||(e[0]=b=>t.$router.back()),class:"flex items-center px-3 py-2 text-sm font-medium text-gray-800 duration-300 bg-white border border-gray-100 rounded-lg shadow gap-x-2 focus:outline-none hover:bg-gray-50 hover:border-gray-100"}," Скасувати "),a.createElementVNode("button",{onClick:e[1]||(e[1]=(...b)=>d.createObject&&d.createObject(...b)),class:a.normalizeClass(`inline-flex items-center px-3 py-2 text-sm font-medium text-white duration-300 bg-${d.color}-700 border border-transparent rounded-lg gap-x-2 hover:bg-${d.color}-800 hover:text-white`)}," Зберегти ",2)])]),a.createElementVNode("div",{style:a.normalizeStyle({height:((c=t.$adminSettings)==null?void 0:c.header)===!1?"calc(100vh - 91px)":"calc(100vh - 150px)"}),class:"bg-gray-100 p-[20px] flex lg:w-[calc(100vw-260px)] w-[100vw] overflow-hidden"},[a.createElementVNode("div",M9,[o.scheme?(a.openBlock(),a.createBlock(p,{key:0,ref:"form",scheme:o.scheme,style:a.normalizeStyle(o.style),modelValue:o.formValues,"onUpdate:modelValue":e[2]||(e[2]=b=>o.formValues=b),class:"h-full p-[20px]"},null,8,["scheme","style","modelValue"])):a.createCommentVNode("",!0)])],4)])}const P9=Object.freeze(Object.defineProperty({__proto__:null,default:Oe(S9,[["render",I9]])},Symbol.toStringTag,{value:"Module"})),R9=a.ref(null),N9={data(){return{formScheme:null,formValues:{}}},mounted(){this.getFormScheme()},computed:{userData(){return R9.value}},methods:{async updateUser(){var t;try{await Le.put(`/user/${(t=this.userData.user)==null?void 0:t.uid}`,this.formValues),await this.$notify({title:"Успішно!",message:"Дані успішно оновлені",type:"success"})}catch{this.$notify({title:"Помилка!",message:"Сталася помилка",type:"error"})}},async getFormScheme(){var t,e,n,r;try{const{data:o}=await Le.get("/api/template/form/admin.profile.form");console.log(this.userData);for(const d in o==null?void 0:o.schema)(e=(t=this.userData)==null?void 0:t.user)!=null&&e[d]&&(this.formValues[d]=(r=(n=this.userData)==null?void 0:n.user)==null?void 0:r[d]);this.formScheme=o.schema}catch(o){console.error(o)}}}},B9={class:"flex justify-center pt-[20px] pb-[20px] pl-[20px] h-[calc(100vh-58px)]"},V9={class:"bg-white rounded-xl p-[20px]"},z9={class:"flex-1 overflow-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},O9={class:"flex"};function L9(t,e,n,r,o,d){const p=a.resolveComponent("VsForm");return a.openBlock(),a.createElementBlock("div",B9,[a.createElementVNode("div",V9,[e[2]||(e[2]=a.createElementVNode("h2",{class:"mb-[20px] text-center"},"Профіль",-1)),a.createElementVNode("div",z9,[o.formScheme?(a.openBlock(),a.createBlock(p,{key:0,scheme:o.formScheme,modelValue:o.formValues,"onUpdate:modelValue":e[0]||(e[0]=c=>o.formValues=c),class:"pb-0"},null,8,["scheme","modelValue"])):a.createCommentVNode("",!0),a.createElementVNode("div",O9,[a.createElementVNode("button",{onClick:e[1]||(e[1]=(...c)=>d.updateUser&&d.updateUser(...c)),class:"ml-auto text-[18px] bg-blue-500 text-white px-[8px] py-[4px] rounded hover:bg-blue-700 duration-300"}," Зберегти ")])])])])}const F9=Object.freeze(Object.defineProperty({__proto__:null,default:Oe(N9,[["render",L9]])},Symbol.toStringTag,{value:"Module"})),$9={};function j9(t,e,n,r,o,d){const p=a.resolveComponent("router-view");return a.openBlock(),a.createBlock(p)}const Ik=Object.freeze(Object.defineProperty({__proto__:null,default:Oe($9,[["render",j9]])},Symbol.toStringTag,{value:"Module"})),U9={},H9={xmlns:"http://www.w3.org/2000/svg",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-logout"};function W9(t,e,n,r,o,d){return a.openBlock(),a.createElementBlock("svg",H9,e[0]||(e[0]=[a.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),a.createElementVNode("path",{d:"M14 8v-2a2 2 0 0 0 -2 -2h-7a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h7a2 2 0 0 0 2 -2v-2"},null,-1),a.createElementVNode("path",{d:"M9 12h12l-3 -3"},null,-1),a.createElementVNode("path",{d:"M18 15l3 -3"},null,-1)]))}const By=Oe(U9,[["render",W9]]),q9={},G9={viewBox:"0 0 1823 249",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Z9(t,e,n,r,o,d){return a.openBlock(),a.createElementBlock("svg",G9,e[0]||(e[0]=[a.createStaticVNode('<path d="M218.88 96.05C223.55 99.19 228.69 101.56 234.09 103.07V145.42C212.05 151.54 195.83 171.79 195.83 195.75C195.83 200.22 196.41 204.65 197.53 208.94L160.92 230.08C156.82 226.06 152.08 222.73 146.91 220.24V171.62C164.83 163.13 176.59 145.06 176.59 124.48C176.59 123.17 176.54 121.86 176.44 120.56L218.88 96.05ZM220.32 79.09L160.97 113.36C162.04 116.88 162.61 120.61 162.61 124.48C162.61 142.66 149.93 157.87 132.93 161.76V230.05C143.4 232.46 152.23 239.16 157.46 248.21L215 214.99C211.7 209.34 209.81 202.77 209.81 195.75C209.81 174.62 226.94 157.49 248.07 157.49V91.02C237.14 91.02 227.29 86.43 220.32 79.09Z" fill="#CE3936"></path><path d="M161.39 19.13L197.44 39.94C196.39 44.11 195.84 48.42 195.84 52.75C195.84 54.21 195.9 55.65 196.02 57.1L153.9 81.42C145.27 75.5 134.95 72.24 124.36 72.24C113.83 72.24 103.57 75.47 94.96 81.32L52.71 56.93C52.82 55.55 52.88 54.16 52.88 52.76C52.88 48.43 52.34 44.12 51.28 39.95L87.3 19.16C96.98 28.89 110.26 34.58 124.34 34.58C138.42 34.57 151.7 28.87 161.39 19.13ZM157.77 0.919983C151.24 12.66 138.71 20.6 124.33 20.6C109.95 20.6 97.44 12.67 90.9 0.939983L33.9 33.85C37.08 39.43 38.91 45.88 38.91 52.76C38.91 56.71 38.31 60.52 37.2 64.11L96.46 98.32C103.44 90.87 113.36 86.22 124.37 86.22C135.44 86.22 145.41 90.93 152.39 98.44L211.59 64.27C210.45 60.64 209.83 56.78 209.83 52.77C209.83 45.89 211.65 39.44 214.84 33.86L157.77 0.919983Z" fill="#CE3936"></path><path d="M29.97 95.95L72.28 120.38C72.17 121.74 72.12 123.1 72.12 124.47C72.12 145.02 83.86 163.08 101.74 171.58V220.23C96.58 222.71 91.84 226.04 87.75 230.05L51.17 208.93C52.29 204.64 52.87 200.21 52.87 195.74C52.87 171.78 36.65 151.53 14.61 145.41V103.06C20.07 101.55 25.27 99.14 29.97 95.95ZM28.5 78.97C21.52 86.38 11.63 91.02 0.640015 91.02V157.49C21.77 157.49 38.9 174.62 38.9 195.75C38.9 202.77 37 209.33 33.71 214.99L91.2 248.18C96.43 239.14 105.25 232.45 115.71 230.04V161.73C98.74 157.81 86.09 142.62 86.09 124.46C86.09 120.54 86.68 116.75 87.78 113.18L28.5 78.97Z" fill="#CE3936"></path><path d="M498.39 177.5V144.88C498.39 128.55 485.11 115.27 468.78 115.27H343.22C342.69 115.27 342.18 115.32 341.67 115.4H337.19C332.35 115.4 328.42 111.46 328.42 106.63V74C328.42 69.16 332.36 65.23 337.19 65.23H486.33C492.08 65.23 496.75 60.57 496.75 54.81C496.75 49.06 492.08 44.39 486.33 44.39H337.19C320.86 44.39 307.58 57.67 307.58 74V106.62C307.58 122.95 320.86 136.23 337.19 136.23H462.75C463.28 136.23 463.79 136.18 464.3 136.1H468.78C473.62 136.1 477.55 140.04 477.55 144.87V177.49C477.55 182.33 473.61 186.26 468.78 186.26H319.64C313.89 186.26 309.22 190.92 309.22 196.68C309.22 202.43 313.89 207.1 319.64 207.1H468.78C485.11 207.11 498.39 193.83 498.39 177.5Z" fill="#CE3935"></path><path d="M710.7 177.32V75.24C710.7 58.91 697.42 45.63 681.09 45.63H550.05C533.72 45.63 520.44 58.91 520.44 75.24V177.32C520.44 193.65 533.72 206.93 550.05 206.93H681.1C697.42 206.93 710.7 193.65 710.7 177.32ZM541.27 75.24C541.27 70.4 545.21 66.47 550.04 66.47H681.09C685.93 66.47 689.86 70.41 689.86 75.24V177.32C689.86 182.16 685.92 186.09 681.09 186.09H550.05C545.21 186.09 541.28 182.15 541.28 177.32V75.24H541.27Z" fill="#CE3935"></path><path d="M1823 177.32V75.24C1823 58.91 1809.72 45.63 1793.39 45.63H1662.34C1646.01 45.63 1632.73 58.91 1632.73 75.24V177.32C1632.73 193.65 1646.01 206.93 1662.34 206.93H1793.39C1809.72 206.93 1823 193.65 1823 177.32ZM1653.57 75.24C1653.57 70.4 1657.51 66.47 1662.34 66.47H1793.39C1798.23 66.47 1802.16 70.41 1802.16 75.24V177.32C1802.16 182.16 1798.22 186.09 1793.39 186.09H1662.34C1657.5 186.09 1653.57 182.15 1653.57 177.32V75.24Z" fill="#CE3935"></path><path d="M756.76 196.51V152H849.42C855.17 152 859.84 147.34 859.84 141.58C859.84 135.83 855.17 131.16 849.42 131.16H756.76V75.23C756.76 70.39 760.7 66.46 765.53 66.46H893.29C899.04 66.46 903.71 61.8 903.71 56.04C903.71 50.29 899.04 45.62 893.29 45.62H765.53C749.2 45.62 735.92 58.9 735.92 75.23V196.5C735.92 202.25 740.59 206.92 746.34 206.92C752.09 206.93 756.76 202.27 756.76 196.51Z" fill="#CE3935"></path><path d="M933.86 66.47H1006.51V194.32C1006.51 200.07 1011.18 204.74 1016.93 204.74C1022.68 204.74 1027.35 200.07 1027.35 194.32V66.47H1100C1105.75 66.47 1110.42 61.81 1110.42 56.05C1110.42 50.3 1105.76 45.63 1100 45.63H933.86C928.11 45.63 923.44 50.29 923.44 56.05C923.45 61.81 928.11 66.47 933.86 66.47Z" fill="#CE3935"></path><path d="M1218.44 204.19C1224.19 204.19 1228.86 199.53 1228.86 193.77V152H1368.13C1384.46 152 1397.74 138.72 1397.74 122.39V75.24C1397.74 58.91 1384.46 45.63 1368.13 45.63H1237.63C1221.3 45.63 1208.02 58.91 1208.02 75.24V193.77C1208.02 199.53 1212.68 204.19 1218.44 204.19ZM1237.63 66.47H1368.13C1372.97 66.47 1376.9 70.41 1376.9 75.24V122.39C1376.9 127.23 1372.96 131.16 1368.13 131.16H1228.86V75.23C1228.86 70.41 1232.79 66.47 1237.63 66.47Z" fill="#CE3935"></path><path d="M1430.64 204.19C1436.39 204.19 1441.06 199.53 1441.06 193.77V152H1523.95C1524.57 153.18 1525.42 154.26 1526.51 155.17L1581.89 201.23C1583.83 202.85 1586.2 203.64 1588.55 203.64C1591.54 203.64 1594.5 202.36 1596.57 199.88C1600.25 195.46 1599.64 188.89 1595.22 185.21L1555.29 152H1580.33C1596.66 152 1609.94 138.72 1609.94 122.39V75.24C1609.94 58.91 1596.66 45.63 1580.33 45.63H1449.83C1433.5 45.63 1420.22 58.91 1420.22 75.24V193.77C1420.22 199.53 1424.88 204.19 1430.64 204.19ZM1449.83 66.47H1580.33C1585.17 66.47 1589.1 70.41 1589.1 75.24V122.39C1589.1 127.23 1585.17 131.16 1580.33 131.16H1441.06V75.23C1441.05 70.41 1444.99 66.47 1449.83 66.47Z" fill="#CE3935"></path>',10)]))}const Pk=Oe(q9,[["render",Z9]]),Y9={components:{IconChevronDown:Bd},props:{route:Object,searchable:String},mounted(){var t,e;(e=(t=this.route)==null?void 0:t.menu)!=null&&e.some(n=>{var r,o;return(n==null?void 0:n.path)===this.$route.path.replace("/","")||((o=(r=this.$route)==null?void 0:r.params)==null?void 0:o.table)===(n==null?void 0:n.table)&&(n==null?void 0:n.table)})&&(this.isOpen=!0)},watch:{route:{immediate:!0,handler(t){t!=null&&t.open&&(this.isOpen=!0)}}},data(){return{isOpen:!1,arr:[]}},computed:{darkMode(){var t;return(t=et==null?void 0:et.value)==null?void 0:t.sidebarDark}},methods:{highLight(t){if(!this.searchable)return t;const e=this.searchable.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=new RegExp(`(${e})(\\s*)`,"gi");return t.replace(n,(r,o,d)=>`<span style="color:#1989fa;">${o}</span>${d}`)}}},X9={key:0,class:""},K9={key:0,class:"py-0.5 px-2 inline-flex items-center gap-x-1.5 text-xs font-medium bg-blue-100 text-blue-800 rounded-full dark:bg-blue-500/10 dark:text-blue-500"},J9={key:1},Q9=["innerHTML"];function eW(t,e,n,r,o,d){var b,k,E,C,T,I,N,$,F,q,J,Q,me,ke,Re;const p=a.resolveComponent("IconChevronDown"),c=a.resolveComponent("router-link");return(b=n.route)!=null&&b.menu?(a.openBlock(),a.createElementBlock("div",X9,[a.createElementVNode("button",{onClick:e[0]||(e[0]=Ee=>o.isOpen=!o.isOpen),class:a.normalizeClass(["flex items-center justify-start w-full px-3 py-2 text-sm text-left text-gray-800 duration-300 border-none rounded-lg cursor-pointer gap-x-3 focus:outline-none hover:bg-gray-100",[((E=(k=n.route)==null?void 0:k.menu)==null?void 0:E.some(Ee=>{var Ve,Be;return(Ee==null?void 0:Ee.path)===t.$route.path.replace("/","")||(Ee==null?void 0:Ee.table)===((Be=(Ve=t.$route)==null?void 0:Ve.params)==null?void 0:Be.table)&&(Ee==null?void 0:Ee.table)}))&&(d.darkMode?"bg-white/10":"bg-gray-100"),{"text-white/80 hover:bg-white/10 hover:text-white/80 focus:bg-white/10":d.darkMode,"text-gray-800 hover:bg-gray-100 hover:text-gray-800 focus:bg-gray-100":!d.darkMode}]])},[a.createTextVNode(a.toDisplayString((C=n.route)==null?void 0:C.ua)+" ",1),(T=n.route)!=null&&T.new?(a.openBlock(),a.createElementBlock("span",K9,"Нове")):a.createCommentVNode("",!0),a.createVNode(p,{class:a.normalizeClass([[o.isOpen&&"-rotate-180"],"ml-auto duration-300 flex-shrink-0"]),width:"14",height:"14"},null,8,["class"])],2),a.createVNode(a.Transition,{name:"fade"},{default:a.withCtx(()=>{var Ee;return[a.withDirectives(a.createElementVNode("ul",{class:a.normalizeClass(["ml-[28px] pt-[6px] before:block before:absolute relative w-[calc(100%-28px)] flex-col gap-y-1.5 inline-flex before:w-[2px] before:h-[100%] before:left-[-10px] cursor-pointer",d.darkMode?"before:bg-white/10":"before:bg-gray-100"])},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList((Ee=n.route)==null?void 0:Ee.menu,(Ve,Be)=>{var Ze,tt;return a.openBlock(),a.createElementBlock("li",{key:Be,class:"w-full"},[a.createVNode(c,{innerHTML:d.highLight(Ve==null?void 0:Ve.ua),to:"/"+(Ve==null?void 0:Ve.path),class:a.normalizeClass([[((Ve==null?void 0:Ve.path)===t.$route.path.replace("/","")||((tt=(Ze=t.$route)==null?void 0:Ze.params)==null?void 0:tt.table)===(Ve==null?void 0:Ve.table)&&(Ve==null?void 0:Ve.table))&&(d.darkMode?"bg-white/10":"bg-gray-100"),{"text-white/80 hover:bg-white/10 hover:text-white/80 focus:bg-white/10":d.darkMode,"text-gray-800 hover:bg-gray-100 hover:text-gray-800 focus:bg-gray-100":!d.darkMode}],"block px-3 py-2 text-sm rounded-lg focus:outline-none focus:bg-gray-100"])},null,8,["innerHTML","to","class"])])}),128))],2),[[a.vShow,o.isOpen]])]}),_:1})])):(I=n.route)!=null&&I.hidden?a.createCommentVNode("",!0):(a.openBlock(),a.createElementBlock("div",J9,[a.createVNode(c,{to:(($=(N=n.route)==null?void 0:N.path)==null?void 0:$[0])==="/"?(F=n.route)==null?void 0:F.path:"/"+((q=n.route)==null?void 0:q.path),class:a.normalizeClass([[(((J=n.route)==null?void 0:J.path.replace("/",""))===t.$route.path.replace("/","")||((me=(Q=t.$route)==null?void 0:Q.params)==null?void 0:me.table)===((ke=n.route)==null?void 0:ke.table)&&((Re=n.route)==null?void 0:Re.table))&&(d.darkMode?"bg-white/10":"bg-gray-100"),{"text-white/80 hover:bg-white/10 hover:text-white/80 focus:bg-white/10 ":d.darkMode,"text-gray-800 hover:bg-gray-100 hover:text-gray-800 focus:bg-gray-100 ":!d.darkMode}],"flex items-center w-full px-3 py-2 text-sm text-gray-800 duration-300 rounded-lg gap-x-3"])},{default:a.withCtx(()=>{var Ee;return[a.createElementVNode("span",{innerHTML:d.highLight((Ee=n.route)==null?void 0:Ee.ua)},null,8,Q9)]}),_:1},8,["to","class"])]))}const tW=Oe(Y9,[["render",eW]]),nW={},rW={class:"flex-shrink-0 size-4",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function iW(t,e,n,r,o,d){return a.openBlock(),a.createElementBlock("svg",rW,e[0]||(e[0]=[a.createElementVNode("circle",{cx:"12",cy:"12",r:"10"},null,-1),a.createElementVNode("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"},null,-1),a.createElementVNode("path",{d:"M12 17h.01"},null,-1)]))}const Rk=Oe(nW,[["render",iW]]),sW={},oW={class:"shrink-0 size-4 rounded-full",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512"};function aW(t,e,n,r,o,d){return a.openBlock(),a.createElementBlock("svg",oW,e[0]||(e[0]=[a.createStaticVNode('<g fill-rule="evenodd"><g stroke-width="1pt"><path fill="#bd3d44" d="M0 0h247v10H0zm0 20h247v10H0zm0 20h247v10H0zm0 20h247v10H0zm0 20h247v10H0zm0 20h247v10H0zm0 20h247v10H0z" transform="scale(3.9385)"></path><path fill="#fff" d="M0 10h247v10H0zm0 20h247v10H0zm0 20h247v10H0zm0 20h247v10H0zm0 20h247v10H0zm0 20h247v10H0z" transform="scale(3.9385)"></path></g><path fill="#192f5d" d="M0 0h98.8v70H0z" transform="scale(3.9385)"></path><path fill="#fff" d="M8.2 3l1 2.8H12L9.7 7.5l.9 2.7-2.4-1.7L6 10.2l.9-2.7-2.4-1.7h3zm16.5 0l.9 2.8h2.9l-2.4 1.7 1 2.7-2.4-1.7-2.4 1.7 1-2.7-2.4-1.7h2.9zm16.5 0l.9 2.8H45l-2.4 1.7 1 2.7-2.4-1.7-2.4 1.7 1-2.7-2.4-1.7h2.9zm16.4 0l1 2.8h2.8l-2.3 1.7.9 2.7-2.4-1.7-2.3 1.7.9-2.7-2.4-1.7h3zm16.5 0l.9 2.8h2.9l-2.4 1.7 1 2.7L74 8.5l-2.3 1.7.9-2.7-2.4-1.7h2.9zm16.5 0l.9 2.8h2.9L92 7.5l1 2.7-2.4-1.7-2.4 1.7 1-2.7-2.4-1.7h2.9zm-74.1 7l.9 2.8h2.9l-2.4 1.7 1 2.7-2.4-1.7-2.4 1.7 1-2.7-2.4-1.7h2.9zm16.4 0l1 2.8h2.8l-2.3 1.7.9 2.7-2.4-1.7-2.3 1.7.9-2.7-2.4-1.7h3zm16.5 0l.9 2.8h2.9l-2.4 1.7 1 2.7-2.4-1.7-2.4 1.7 1-2.7-2.4-1.7h2.9zm16.5 0l.9 2.8h2.9l-2.4 1.7 1 2.7-2.4-1.7-2.4 1.7 1-2.7-2.4-1.7H65zm16.4 0l1 2.8H86l-2.3 1.7.9 2.7-2.4-1.7-2.3 1.7.9-2.7-2.4-1.7h3zm-74 7l.8 2.8h3l-2.4 1.7.9 2.7-2.4-1.7L6 24.2l.9-2.7-2.4-1.7h3zm16.4 0l.9 2.8h2.9l-2.3 1.7.9 2.7-2.4-1.7-2.3 1.7.9-2.7-2.4-1.7h2.9zm16.5 0l.9 2.8H45l-2.4 1.7 1 2.7-2.4-1.7-2.4 1.7 1-2.7-2.4-1.7h2.9zm16.4 0l1 2.8h2.8l-2.3 1.7.9 2.7-2.4-1.7-2.3 1.7.9-2.7-2.4-1.7h3zm16.5 0l.9 2.8h2.9l-2.3 1.7.9 2.7-2.4-1.7-2.3 1.7.9-2.7-2.4-1.7h2.9zm16.5 0l.9 2.8h2.9L92 21.5l1 2.7-2.4-1.7-2.4 1.7 1-2.7-2.4-1.7h2.9zm-74.1 7l.9 2.8h2.9l-2.4 1.7 1 2.7-2.4-1.7-2.4 1.7 1-2.7-2.4-1.7h2.9zm16.4 0l1 2.8h2.8l-2.3 1.7.9 2.7-2.4-1.7-2.3 1.7.9-2.7-2.4-1.7h3zm16.5 0l.9 2.8h2.9l-2.3 1.7.9 2.7-2.4-1.7-2.3 1.7.9-2.7-2.4-1.7h2.9zm16.5 0l.9 2.8h2.9l-2.4 1.7 1 2.7-2.4-1.7-2.4 1.7 1-2.7-2.4-1.7H65zm16.4 0l1 2.8H86l-2.3 1.7.9 2.7-2.4-1.7-2.3 1.7.9-2.7-2.4-1.7h3zm-74 7l.8 2.8h3l-2.4 1.7.9 2.7-2.4-1.7L6 38.2l.9-2.7-2.4-1.7h3zm16.4 0l.9 2.8h2.9l-2.3 1.7.9 2.7-2.4-1.7-2.3 1.7.9-2.7-2.4-1.7h2.9zm16.5 0l.9 2.8H45l-2.4 1.7 1 2.7-2.4-1.7-2.4 1.7 1-2.7-2.4-1.7h2.9zm16.4 0l1 2.8h2.8l-2.3 1.7.9 2.7-2.4-1.7-2.3 1.7.9-2.7-2.4-1.7h3zm16.5 0l.9 2.8h2.9l-2.3 1.7.9 2.7-2.4-1.7-2.3 1.7.9-2.7-2.4-1.7h2.9zm16.5 0l.9 2.8h2.9L92 35.5l1 2.7-2.4-1.7-2.4 1.7 1-2.7-2.4-1.7h2.9zm-74.1 7l.9 2.8h2.9l-2.4 1.7 1 2.7-2.4-1.7-2.4 1.7 1-2.7-2.4-1.7h2.9zm16.4 0l1 2.8h2.8l-2.3 1.7.9 2.7-2.4-1.7-2.3 1.7.9-2.7-2.4-1.7h3zm16.5 0l.9 2.8h2.9l-2.3 1.7.9 2.7-2.4-1.7-2.3 1.7.9-2.7-2.4-1.7h2.9zm16.5 0l.9 2.8h2.9l-2.4 1.7 1 2.7-2.4-1.7-2.4 1.7 1-2.7-2.4-1.7H65zm16.4 0l1 2.8H86l-2.3 1.7.9 2.7-2.4-1.7-2.3 1.7.9-2.7-2.4-1.7h3zm-74 7l.8 2.8h3l-2.4 1.7.9 2.7-2.4-1.7L6 52.2l.9-2.7-2.4-1.7h3zm16.4 0l.9 2.8h2.9l-2.3 1.7.9 2.7-2.4-1.7-2.3 1.7.9-2.7-2.4-1.7h2.9zm16.5 0l.9 2.8H45l-2.4 1.7 1 2.7-2.4-1.7-2.4 1.7 1-2.7-2.4-1.7h2.9zm16.4 0l1 2.8h2.8l-2.3 1.7.9 2.7-2.4-1.7-2.3 1.7.9-2.7-2.4-1.7h3zm16.5 0l.9 2.8h2.9l-2.3 1.7.9 2.7-2.4-1.7-2.3 1.7.9-2.7-2.4-1.7h2.9zm16.5 0l.9 2.8h2.9L92 49.5l1 2.7-2.4-1.7-2.4 1.7 1-2.7-2.4-1.7h2.9zm-74.1 7l.9 2.8h2.9l-2.4 1.7 1 2.7-2.4-1.7-2.4 1.7 1-2.7-2.4-1.7h2.9zm16.4 0l1 2.8h2.8l-2.3 1.7.9 2.7-2.4-1.7-2.3 1.7.9-2.7-2.4-1.7h3zm16.5 0l.9 2.8h2.9l-2.3 1.7.9 2.7-2.4-1.7-2.3 1.7.9-2.7-2.4-1.7h2.9zm16.5 0l.9 2.8h2.9l-2.4 1.7 1 2.7-2.4-1.7-2.4 1.7 1-2.7-2.4-1.7H65zm16.4 0l1 2.8H86l-2.3 1.7.9 2.7-2.4-1.7-2.3 1.7.9-2.7-2.4-1.7h3zm-74 7l.8 2.8h3l-2.4 1.7.9 2.7-2.4-1.7L6 66.2l.9-2.7-2.4-1.7h3zm16.4 0l.9 2.8h2.9l-2.3 1.7.9 2.7-2.4-1.7-2.3 1.7.9-2.7-2.4-1.7h2.9zm16.5 0l.9 2.8H45l-2.4 1.7 1 2.7-2.4-1.7-2.4 1.7 1-2.7-2.4-1.7h2.9zm16.4 0l1 2.8h2.8l-2.3 1.7.9 2.7-2.4-1.7-2.3 1.7.9-2.7-2.4-1.7h3zm16.5 0l.9 2.8h2.9l-2.3 1.7.9 2.7-2.4-1.7-2.3 1.7.9-2.7-2.4-1.7h2.9zm16.5 0l.9 2.8h2.9L92 63.5l1 2.7-2.4-1.7-2.4 1.7 1-2.7-2.4-1.7h2.9z" transform="scale(3.9385)"></path></g>',1)]))}const lW=Oe(sW,[["render",aW]]),cW={},dW={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1",width:"256",height:"256",viewBox:"0 0 256 256","xml:space":"preserve"};function uW(t,e,n,r,o,d){return a.openBlock(),a.createElementBlock("svg",dW,e[0]||(e[0]=[a.createElementVNode("defs",null,null,-1),a.createElementVNode("g",{style:{stroke:"none","stroke-width":"0","stroke-dasharray":"none","stroke-linecap":"butt","stroke-linejoin":"miter","stroke-miterlimit":"10",fill:"none","fill-rule":"nonzero",opacity:"1"},transform:"translate(1.4065934065934016 1.4065934065934016) scale(2.81 2.81)"},[a.createElementVNode("path",{d:"M 45 90 C 20.147 90 0 69.853 0 45 h 90 C 90 69.853 69.853 90 45 90 z",style:{stroke:"none","stroke-width":"1","stroke-dasharray":"none","stroke-linecap":"butt","stroke-linejoin":"miter","stroke-miterlimit":"10",fill:"rgb(255,213,0)","fill-rule":"nonzero",opacity:"1"},transform:" matrix(1 0 0 1 0 0) ","stroke-linecap":"round"}),a.createElementVNode("path",{d:"M 45 0 C 20.147 0 0 20.147 0 45 h 90 C 90 20.147 69.853 0 45 0 z",style:{stroke:"none","stroke-width":"1","stroke-dasharray":"none","stroke-linecap":"butt","stroke-linejoin":"miter","stroke-miterlimit":"10",fill:"rgb(0,91,187)","fill-rule":"nonzero",opacity:"1"},transform:" matrix(1 0 0 1 0 0) ","stroke-linecap":"round"})],-1)]))}const hW=Oe(cW,[["render",uW]]),pW={},fW={class:"shrink-0 size-3.5 text-gray-800 dark:text-neutral-200",xmlns:"http:.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"};function mW(t,e,n,r,o,d){return a.openBlock(),a.createElementBlock("svg",fW,e[0]||(e[0]=[a.createElementVNode("polyline",{points:"20 6 9 17 4 12"},null,-1)]))}const gW={components:{IconQuestion:Rk,IconUSA:lW,IconUkraine:hW,IconTick:Oe(pW,[["render",mW]])},props:["docs","languages"],data(){return{currentLang:"ukraine",languagesOptions:[{titleEN:"English",titleUA:"Англійська",id:"english",icon:"IconUSA"},{titleEN:"Ukraine",titleUA:"Українська",id:"ukraine",icon:"IconUkraine"}]}},computed:{selectedLang(){return this.languagesOptions.find(t=>t.id===this.currentLang)},darkMode(){var t;return(t=et==null?void 0:et.value)==null?void 0:t.sidebarDark}},methods:{changeLang(t){this.$refs.langPopover.togglePopover(),this.currentLang=t}}},yW={class:"flex justify-center items-center gap-x-2"},_W=["onClick"],bW={class:"text-gray-800"},xW={class:"ms-auto"},vW={class:"truncate"};function wW(t,e,n,r,o,d){const p=a.resolveComponent("IconTick"),c=a.resolveComponent("VsPopover");return n.docs||n.languages?(a.openBlock(),a.createElementBlock("div",{key:0,class:a.normalizeClass(["py-2 px-5 border-t dark:border-neutral-700",d.darkMode?"border-white/10 ":"border-gray-200"])},[a.createElementVNode("div",yW,[a.createVNode(c,{trigger:"click",placement:"top",ref:"langPopover"},{reference:a.withCtx(()=>{var b,k,E;return[a.createElementVNode("button",{type:"button","aria-expanded":"false",class:a.normalizeClass(["relative py-2 px-3 flex items-center gap-x-2 text-nowrap w-full cursor-pointer border rounded-full text-start text-sm text-gray-800 focus:outline-none",d.darkMode?"border-white/10 bg-transparent text-white/80 hover:bg-white/10 focus:bg-white/10":"border-gray-200 bg-white hover:bg-gray-100 focus:bg-gray-100"])},[a.createElementVNode("div",null,[(a.openBlock(),a.createBlock(a.resolveDynamicComponent((b=d.selectedLang)==null?void 0:b.icon),{class:"w-[16px] h-[16px] rounded-full"}))]),a.createElementVNode("span",vW,a.toDisplayString(o.currentLang==="ukraine"?(k=d.selectedLang)==null?void 0:k.titleUA:(E=d.selectedLang)==null?void 0:E.titleEN),1)],2)]}),default:a.withCtx(()=>[a.createElementVNode("div",null,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(o.languagesOptions,b=>(a.openBlock(),a.createElementBlock("button",{key:b.id,type:"button",onClick:k=>d.changeLang(b.id),class:a.normalizeClass(["flex items-center gap-x-2 cursor-pointer dark:hs-selected:bg-neutral-800 py-2 px-4 w-full text-sm text-gray-800 hover:bg-gray-100 rounded-lg focus:outline-none focus:bg-gray-100 dark:text-neutral-300 dark:hover:bg-neutral-800 dark:focus:bg-neutral-800 selected",(b==null?void 0:b.id)===o.currentLang?"bg-gray-100":""])},[(a.openBlock(),a.createBlock(a.resolveDynamicComponent(b==null?void 0:b.icon),{class:"w-[16px] h-[16px] rounded-full"})),a.createElementVNode("div",bW,a.toDisplayString(o.currentLang==="ukraine"?b==null?void 0:b.titleUA:b==null?void 0:b.titleEN),1),a.createElementVNode("span",xW,[(b==null?void 0:b.id)===o.currentLang?(a.openBlock(),a.createBlock(p,{key:0})):a.createCommentVNode("",!0)])],10,_W))),128))])]),_:1},512)])],2)):a.createCommentVNode("",!0)}const Nk=Oe(gW,[["render",wW]]),kW={components:{IconLogout:By,NavbarItem:tW,IconLogo:Pk,IconSearch:Mp,NavbarFooter:Nk},data(){return{activeIndex:null,searchValue:""}},computed:{data(){var t;return(t=this.searchValue)!=null&&t.trim()?this.filterMenu(ei.value,this.searchValue):ei.value},logo(){var t,e,n;return((e=(t=this.$settings)==null?void 0:t.admin)==null?void 0:e.logo)||((n=et.value)==null?void 0:n.logo)||"/assets/logo.svg"},docs(){var t;return(t=et==null?void 0:et.value)==null?void 0:t.docs},languages(){var t;return(t=et==null?void 0:et.value)==null?void 0:t.languages},darkMode(){var t;return((t=et==null?void 0:et.value)==null?void 0:t.sidebarDark)||!1},darkColor(){var e,n,r;const t=((e=et==null?void 0:et.value)==null?void 0:e.sidebarColor)||((n=et==null?void 0:et.value)==null?void 0:n.color)||((r=et==null?void 0:et.value)!=null&&r.sidebarDark?"blue":"white");return t.includes("-")||t.includes("[")?t:t+"-950"}},watch:{"$route.path"(){this.$parent.showMenu=!1}},methods:{filterMenu(t,e){return t.map(n=>{var r,o;if(n.menu){const d=this.filterMenu(n.menu,e);if(d.length>0)return{...n,menu:d,open:!0}}else if((o=(r=n.ua)==null?void 0:r.toLowerCase())!=null&&o.includes(e.toLowerCase()))return n;return null}).filter(Boolean)}}},EW={class:"h-[46px] w-full px-5 lg:px-8 mb-[10px]"},CW={href:"/"},SW=["src"],TW={class:"px-2 lg:px-5"},AW={class:"px-2 lg:px-5 flex flex-col flex-wrap w-full pb-3"},DW={key:0,class:"flex flex-col gap-y-1"};function MW(t,e,n,r,o,d){var k;const p=a.resolveComponent("VsText"),c=a.resolveComponent("NavbarItem"),b=a.resolveComponent("NavbarFooter");return a.openBlock(),a.createElementBlock("div",{class:a.normalizeClass(["lg:flex lg:relative lg:left-0 flex-col h-[100vh] pt-3 border-r w-[260px] top-0 bottom-0 shrink-0 absolute transition left-[-100%] z-[11]",{"left-0":t.$parent.showMenu,["bg-"+d.darkColor]:d.darkColor,"bg-white":!d.darkMode&&!d.darkColor}])},[a.createElementVNode("div",EW,[a.createElementVNode("a",CW,[a.createElementVNode("img",{src:d.logo,class:"object-contain w-full h-full"},null,8,SW)])]),a.createElementVNode("div",TW,[a.createVNode(p,{type:"text",modelValue:o.searchValue,"onUpdate:modelValue":e[0]||(e[0]=E=>o.searchValue=E),clearable:!0,icon:"search","icon-position":"left",placeholder:"Пошук по меню",class:a.normalizeClass(["[&>input]:h-[38px]",{"[&>input]:bg-[#172554] [&>input]:text-white/80 [&>input]:placeholder:text-white/40 [&>input]:border [&>input]:border-white/50":d.darkMode,["[&>input]:bg-"+d.darkColor]:d.darkColor,["focus:[&>input]:border-"+d.darkColor+"-500"]:d.darkMode}])},null,8,["modelValue","class"])]),a.createElementVNode("div",{class:a.normalizeClass(["py-[10px] overflow-y-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500",d.languages||d.docs?"h-[calc(100vh-161px)]":"h-[calc(100vh-110px)]"])},[a.createElementVNode("nav",AW,[(k=d.data)!=null&&k.length?(a.openBlock(),a.createElementBlock("ul",DW,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(d.data,(E,C)=>(a.openBlock(),a.createElementBlock("li",{key:C,class:"flex flex-col gap-[6px]"},[a.createVNode(c,{route:E,searchable:o.searchValue},null,8,["route","searchable"])]))),128))])):(a.openBlock(),a.createElementBlock("div",{key:1,class:a.normalizeClass(["text-lg mt-[20px]",{"text-white/80":d.darkMode,"text-gray-800":!d.darkMode}])}," Не знайдено ",2))])],2),d.docs||d.languages?(a.openBlock(),a.createBlock(b,{key:0,docs:d.docs,languages:d.languages},null,8,["docs","languages"])):a.createCommentVNode("",!0)],2)}const Bk=Oe(kW,[["render",MW],["__scopeId","data-v-7817bab2"]]),IW={components:{IconChevronDown:Bd},props:{route:Object,searchable:String},mounted(){var t,e;(e=(t=this.route)==null?void 0:t.menu)!=null&&e.some(n=>{var r,o;return(n==null?void 0:n.path)===this.$route.path.replace("/","")||((o=(r=this.$route)==null?void 0:r.params)==null?void 0:o.table)===(n==null?void 0:n.table)&&(n==null?void 0:n.table)})&&(this.isOpen=!0)},watch:{route:{immediate:!0,handler(t){t!=null&&t.open&&(this.isOpen=!0)}}},data(){return{isOpen:!1,arr:[]}},computed:{darkMode(){var t;return(t=et==null?void 0:et.value)==null?void 0:t.sidebarDark}},methods:{highLight(t){if(!this.searchable)return t;const e=this.searchable.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=new RegExp(`(${e})(\\s*)`,"gi");return t.replace(n,(r,o,d)=>`<span style="color:#1989fa;">${o}</span>${d}`)}}},PW={key:0,class:""},RW={key:0,class:"py-0.5 px-2 inline-flex items-center gap-x-1.5 text-xs font-medium bg-blue-100 text-blue-800 rounded-full dark:bg-blue-500/10 dark:text-blue-500"},NW={class:"ml-[28px] pt-[6px] before:block before:absolute relative w-[calc(100%-28px)] before:bg-gray-200 flex-col gap-y-1.5 inline-flex before:w-[2px] before:h-[100%] before:left-[-10px] cursor-pointer"},BW={key:1},VW=["innerHTML"];function zW(t,e,n,r,o,d){var b,k,E,C,T,I,N,$,F,q,J,Q,me,ke,Re;const p=a.resolveComponent("IconChevronDown"),c=a.resolveComponent("router-link");return(b=n.route)!=null&&b.menu?(a.openBlock(),a.createElementBlock("div",PW,[a.createElementVNode("button",{onClick:e[0]||(e[0]=Ee=>o.isOpen=!o.isOpen),class:a.normalizeClass(["flex items-center justify-start w-full px-3 py-2 text-sm text-left text-gray-800 duration-300 border-none rounded-lg cursor-pointer gap-x-3 focus:outline-none hover:bg-gray-200",[((E=(k=n.route)==null?void 0:k.menu)==null?void 0:E.some(Ee=>{var Ve,Be;return(Ee==null?void 0:Ee.path)===t.$route.path.replace("/","")||(Ee==null?void 0:Ee.table)===((Be=(Ve=t.$route)==null?void 0:Ve.params)==null?void 0:Be.table)&&(Ee==null?void 0:Ee.table)}))&&"bg-gray-200"]])},[a.createTextVNode(a.toDisplayString((C=n.route)==null?void 0:C.ua)+" ",1),(T=n.route)!=null&&T.new?(a.openBlock(),a.createElementBlock("span",RW,"Нове")):a.createCommentVNode("",!0),a.createVNode(p,{class:a.normalizeClass([[o.isOpen&&"-rotate-180"],"ml-auto duration-300"]),width:"14",height:"14"},null,8,["class"])],2),a.createVNode(a.Transition,{name:"fade"},{default:a.withCtx(()=>{var Ee;return[a.withDirectives(a.createElementVNode("ul",NW,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList((Ee=n.route)==null?void 0:Ee.menu,(Ve,Be)=>{var Ze,tt;return a.openBlock(),a.createElementBlock("li",{key:Be,class:"w-full"},[a.createVNode(c,{innerHTML:d.highLight(Ve==null?void 0:Ve.ua),to:"/"+(Ve==null?void 0:Ve.path),class:a.normalizeClass([[((Ve==null?void 0:Ve.path)===t.$route.path.replace("/","")||((tt=(Ze=t.$route)==null?void 0:Ze.params)==null?void 0:tt.table)===(Ve==null?void 0:Ve.table)&&(Ve==null?void 0:Ve.table))&&"bg-gray-200"],"block px-3 py-2 text-sm rounded-lg focus:outline-none hover:bg-gray-200 focus:bg-gray-200"])},null,8,["innerHTML","to","class"])])}),128))],512),[[a.vShow,o.isOpen]])]}),_:1})])):(I=n.route)!=null&&I.hidden?a.createCommentVNode("",!0):(a.openBlock(),a.createElementBlock("div",BW,[a.createVNode(c,{to:(($=(N=n.route)==null?void 0:N.path)==null?void 0:$[0])==="/"?(F=n.route)==null?void 0:F.path:"/"+((q=n.route)==null?void 0:q.path),class:a.normalizeClass([[(((J=n.route)==null?void 0:J.path.replace("/",""))===t.$route.path.replace("/","")||((me=(Q=t.$route)==null?void 0:Q.params)==null?void 0:me.table)===((ke=n.route)==null?void 0:ke.table)&&((Re=n.route)==null?void 0:Re.table))&&"bg-gray-200"],"flex items-center w-full px-3 py-2 text-sm text-gray-800 duration-300 rounded-lg gap-x-3 hover:bg-gray-200 focus:bg-gray-200"])},{default:a.withCtx(()=>{var Ee;return[a.createElementVNode("span",{innerHTML:d.highLight((Ee=n.route)==null?void 0:Ee.ua)},null,8,VW)]}),_:1},8,["to","class"])]))}const OW=Oe(IW,[["render",zW]]),LW={class:"relative w-fit mx-auto"},FW={key:0,class:"w-60 duration absolute top-full left-0 z-20 bg-white rounded-xl shadow-xl block"},$W={class:"p-1"},jW={__name:"navbar-gray-dropdown",setup(t){const e=a.ref(!1);return a.onMounted(()=>{document.addEventListener("click",n=>{n.target.closest(".navbar-gray-dropdown")||(e.value=!1)})}),(n,r)=>{var d;const o=a.resolveComponent("router-link");return a.openBlock(),a.createElementBlock("div",LW,[a.createElementVNode("button",{onClick:r[0]||(r[0]=p=>e.value=!e.value),type:"button",class:"py-1 px-2 navbar-gray-dropdown inline-flex justify-center items-center gap-x-1 font-semibold rounded-lg text-gray-800 hover:text-purple-600 focus:outline-hidden focus:text-purple-600 disabled:opacity-50 disabled:pointer-events-none dark:text-neutral-300 dark:hover:text-purple-500 dark:focus:text-purple-500"},[a.createTextVNode(a.toDisplayString((d=n.$user)==null?void 0:d.user_name)+" ",1),a.createVNode(Ip,{width:"16",height:"16"})]),e.value?(a.openBlock(),a.createElementBlock("div",FW,[a.createElementVNode("div",$W,[r[2]||(r[2]=a.createElementVNode("a",{class:"flex items-center gap-x-3 py-2 px-3 rounded-lg text-sm text-gray-800 hover:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-hidden focus:bg-gray-100 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",href:"#"}," Профіль ",-1)),a.createVNode(o,{class:"flex items-center gap-x-3 py-2 px-3 rounded-lg text-sm text-gray-800 hover:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-hidden focus:bg-gray-100 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",to:"/admin.settings"},{default:a.withCtx(()=>r[1]||(r[1]=[a.createTextVNode(" Налаштування ",-1)])),_:1,__:[1]})]),r[3]||(r[3]=a.createElementVNode("div",{class:"p-1 border-t border-gray-200 dark:border-neutral-700"},[a.createElementVNode("a",{class:"flex items-center gap-x-3 py-2 px-3 rounded-lg text-sm text-gray-800 hover:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-hidden focus:bg-gray-100 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",href:"/logout"}," Вийти ")],-1))])):a.createCommentVNode("",!0)])}}},UW={class:"p-4 flex flex-col justify-center border-b relative max-h-[192px]"},HW={components:{IconLogout:By,NavbarItem:OW,IconLogo:Pk,IconSearch:Mp,NavbarFooter:Nk,NavbarUser:{__name:"navbar-gray-user",setup(t){return(e,n)=>(a.openBlock(),a.createElementBlock("div",UW,[a.createVNode(fg,{class:"!absolute top-[8px] right-[8px]",placement:"left"}),n[0]||(n[0]=a.createElementVNode("div",{class:"flex size-24 justify-center items-center shrink-0 rounded-full overflow-hidden mx-auto mb-2"},[a.createElementVNode("img",{class:"object-cover h-[130px] w-[130px]",src:"https://media.istockphoto.com/id/1337144146/vector/default-avatar-profile-icon-vector.jpg?s=612x612&w=0&k=20&c=BIbFwuv7FxTWvh5S3vB6bkT0Qv8Vn8N5Ffseq84ClGI=",alt:"Avatar"})],-1)),a.createVNode(jW)]))}}},data(){return{activeIndex:null,searchValue:""}},computed:{data(){var t;return(t=this.searchValue)!=null&&t.trim()?this.filterMenu(ei.value,this.searchValue):ei.value},logo(){var t,e,n;return((e=(t=this.$settings)==null?void 0:t.admin)==null?void 0:e.logo)||((n=et.value)==null?void 0:n.logo)||"/assets/logo.svg"},docs(){var t;return(t=et==null?void 0:et.value)==null?void 0:t.docs},languages(){var t;return(t=et==null?void 0:et.value)==null?void 0:t.languages},darkMode(){var t;return((t=et==null?void 0:et.value)==null?void 0:t.sidebarDark)||!1},darkColor(){var e,n,r;const t=((e=et==null?void 0:et.value)==null?void 0:e.sidebarColor)||((n=et==null?void 0:et.value)==null?void 0:n.color)||((r=et==null?void 0:et.value)!=null&&r.sidebarDark?"blue":"white");return t.includes("-")||t.includes("[")?t:t+"-950"}},watch:{"$route.path"(){this.$parent.showMenu=!1}},methods:{filterMenu(t,e){return t.map(n=>{var r,o;if(n.menu){const d=this.filterMenu(n.menu,e);if(d.length>0)return{...n,menu:d,open:!0}}else if((o=(r=n.ua)==null?void 0:r.toLowerCase())!=null&&o.includes(e.toLowerCase()))return n;return null}).filter(Boolean)}}},WW={class:"px-2 lg:px-5 flex flex-col flex-wrap w-full pb-3"},qW={key:0,class:"flex flex-col gap-y-1"},GW={class:"h-[55px] border-t w-full px-5 shrink-0 lg:px-5 flex items-center"},ZW={href:"/"},YW=["src"];function XW(t,e,n,r,o,d){var b;const p=a.resolveComponent("NavbarUser"),c=a.resolveComponent("NavbarItem");return a.openBlock(),a.createElementBlock("div",{class:a.normalizeClass(["lg:flex lg:relative lg:left-0 flex-col h-[100vh] border-r w-[260px] bg-gray-100 top-0 bottom-0 shrink-0 absolute transition left-[-100%] z-[11]",{"left-0":t.$parent.showMenu}])},[a.createVNode(p),a.createElementVNode("div",{class:a.normalizeClass(["py-[10px] overflow-y-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500",d.languages||d.docs?"h-[calc(100vh-161px)]":"h-[calc(100vh-110px)]"])},[a.createElementVNode("nav",WW,[(b=d.data)!=null&&b.length?(a.openBlock(),a.createElementBlock("ul",qW,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(d.data,(k,E)=>(a.openBlock(),a.createElementBlock("li",{key:E,class:"flex flex-col gap-[6px]"},[a.createVNode(c,{route:k,searchable:o.searchValue},null,8,["route","searchable"])]))),128))])):(a.openBlock(),a.createElementBlock("div",{key:1,class:a.normalizeClass(["text-lg mt-[20px]",{"text-white/80":d.darkMode,"text-gray-800":!d.darkMode}])}," Не знайдено ",2))])],2),a.createElementVNode("div",GW,[a.createElementVNode("a",ZW,[a.createElementVNode("img",{src:d.logo,class:"object-contain max-h-[40px]"},null,8,YW)])])],2)}const KW=Oe(HW,[["render",XW],["__scopeId","data-v-3cea82a7"]]),JW={__name:"navbar",setup(t){const e={default:Bk,gray:KW},n=a.computed(()=>{var r;return e[(r=et.value)==null?void 0:r.navbar]||Bk});return(r,o)=>(a.openBlock(),a.createBlock(a.resolveDynamicComponent(n.value)))}},QW={components:{IconQuestion:Rk,IconUser:Pv,AdminNotification:fg,IconUserOutline:Av,IconLogout:By},data(){return{userData:null,isVisible:!1}},computed:{headerBadgeTitle(){var t;return(t=et.value)==null?void 0:t.headerBadge},headerBadgeColor(){var t;return(t=et.value)==null?void 0:t.headerBadgeColor}},watch:{isVisible(t){t?setTimeout(()=>window.addEventListener("click",this.closeOnOutsideClick),0):window.removeEventListener("click",this.closeOnOutsideClick)}},created(){this.userData=this.$user,My.value=this.$settings},methods:{async logout(){try{await Le.get("/logout"),await window.history.pushState({},"","/login"),await location.reload(),localStorage.removeItem("user")}catch{}},closeOnOutsideClick(){this.isVisible=!1}},beforeUnmount(){window.removeEventListener("click",this.closeOnOutsideClick)}},eq={class:"flex items-center gap-[6px]"},tq={href:"/docs-user",class:"size-[38px] inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent text-gray-500 hover:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-100 dark:text-neutral-400 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},nq={href:"/docs-user",class:"size-[38px] inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent text-gray-500 hover:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-100 dark:text-neutral-400 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},rq={class:"relative"},iq=["src"],sq={key:1,class:"size-[40px] rounded-full bg-gray-200 flex items-center justify-center"},oq=["src"],aq={key:1,class:"flex items-center justify-center bg-gray-200 rounded-full size-10"},lq={class:"grow"},cq={class:"block text-sm font-medium text-gray-800 dark:text-neutral-200"},dq={class:"text-xs text-gray-500 dark:text-neutral-500"},uq={class:"flex flex-col space-y-0.5"};function hq(t,e,n,r,o,d){const p=a.resolveComponent("IconQuestion"),c=a.resolveComponent("VsPopover"),b=a.resolveComponent("AdminNotification"),k=a.resolveComponent("IconUser"),E=a.resolveComponent("router-link"),C=a.resolveComponent("IconUserOutline"),T=a.resolveComponent("IconLogout");return a.openBlock(),a.createElementBlock("div",{class:a.normalizeClass(["h-[58px] border-b flex items-center px-[20px]",d.headerBadgeTitle?"justify-between":"justify-end"])},[d.headerBadgeTitle?(a.openBlock(),a.createElementBlock("div",{key:0,class:a.normalizeClass(["py-1.5 px-2.5 flex justify-center items-center text-white hover:bg-gray-900 focus:bg-gray-900 dark:bg-neutral-100 dark:text-neutral-800 dark:hover:bg-white dark:focus:bg-white.class text-nowrap text-xs sm:text-[13px] rounded-lg disabled:opacity-50 disabled:pointer-events-none focus:outline-none dark:text-neutral-400",{["bg-"+d.headerBadgeColor]:d.headerBadgeColor,"bg-gray-800":!d.headerBadgeColor}])},a.toDisplayString(d.headerBadgeTitle),3)):a.createCommentVNode("",!0),a.createElementVNode("div",{class:"flex lg:hidden",onClick:e[0]||(e[0]=I=>t.$parent.showMenu=!0)},e[4]||(e[4]=[a.createStaticVNode('<svg 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" class="icon icon-tabler icons-tabler-outline icon-tabler-menu-2"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M4 6l16 0"></path><path d="M4 12l16 0"></path><path d="M4 18l16 0"></path></svg>',1)])),a.createElementVNode("div",eq,[a.createVNode(c,{trigger:"hover"},{reference:a.withCtx(()=>[a.createElementVNode("a",tq,[a.createVNode(p,{height:"24",width:"24"})])]),default:a.withCtx(()=>[e[5]||(e[5]=a.createTextVNode(" Допомога ",-1))]),_:1,__:[5]}),a.createVNode(c,{trigger:"hover"},{reference:a.withCtx(()=>[a.createElementVNode("a",nq,[a.createVNode(b)])]),default:a.withCtx(()=>[e[6]||(e[6]=a.createTextVNode(" Сповіщення ",-1))]),_:1,__:[6]}),e[12]||(e[12]=a.createElementVNode("div",{class:"h-[30px] w-[1px] bg-gray-200 ml-[10px] mr-[10px]"},null,-1)),a.createElementVNode("div",rq,[a.createElementVNode("div",{onClick:e[1]||(e[1]=I=>o.isVisible=!0),class:"cursor-pointer"},[a.createVNode(c,{trigger:"hover"},{reference:a.withCtx(()=>{var I,N,$,F;return[(N=(I=o.userData)==null?void 0:I.user)!=null&&N.avatar?(a.openBlock(),a.createElementBlock("img",{key:0,class:"flex-shrink-0 size-[30px] rounded-full",src:(F=($=o.userData)==null?void 0:$.user)==null?void 0:F.avatar,alt:"Image Description"},null,8,iq)):(a.openBlock(),a.createElementBlock("div",sq,[a.createVNode(k)]))]}),default:a.withCtx(()=>[e[7]||(e[7]=a.createTextVNode(" Профіль ",-1))]),_:1,__:[7]})]),o.isVisible?(a.openBlock(),a.createElementBlock("div",{key:0,onClick:e[3]||(e[3]=a.withModifiers(()=>{},["stop"])),class:"fixed p-2 bg-white w-[240px] top-[55px] right-[20px] rounded-xl z-[1] shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] dark:shadow-[0_10px_40px_10px_rgba(0,0,0,0.2)] dark:bg-neutral-900 block"},[a.createVNode(E,{to:"profile",disabled:!0,class:"py-2 px-2.5 flex items-center gap-3 rounded-lg hover:bg-gray-100 focus:outline-none focus:bg-gray-100 dark:hover:bg-neutral-800 dark:focus:bg-neutral-800"},{default:a.withCtx(()=>{var I,N,$,F,q,J,Q,me,ke,Re;return[(N=(I=o.userData)==null?void 0:I.user)!=null&&N.avatar?(a.openBlock(),a.createElementBlock("img",{key:0,class:"rounded-full shrink-0 size-10",src:(F=($=o.userData)==null?void 0:$.user)==null?void 0:F.avatar,alt:"Image Description"},null,8,oq)):(a.openBlock(),a.createElementBlock("div",aq,[a.createVNode(k,{class:"w-[16px]"})])),a.createElementVNode("div",lq,[a.createElementVNode("span",cq,a.toDisplayString(((J=(q=o.userData)==null?void 0:q.user)==null?void 0:J.username)||((me=(Q=o.userData)==null?void 0:Q.user)==null?void 0:me.user_name)||"User User"),1),a.createElementVNode("p",dq,a.toDisplayString(((Re=(ke=o.userData)==null?void 0:ke.user)==null?void 0:Re.email)||"email не вказано"),1)])]}),_:1}),e[10]||(e[10]=a.createElementVNode("div",{class:"my-2 mx-2.5 h-px bg-gray-200 dark:bg-neutral-700"},null,-1)),a.createElementVNode("ul",uq,[a.createElementVNode("li",null,[a.createVNode(E,{to:"profile",class:"w-full flex items-center gap-x-3.5 py-2 px-2.5 text-sm text-gray-800 rounded-lg hover:bg-gray-100 focus:outline-none focus:bg-gray-100 dark:text-white dark:hover:bg-neutral-800 dark:focus:bg-neutral-800",disabled:"true"},{default:a.withCtx(()=>[a.createVNode(C,{class:"size-4"}),e[8]||(e[8]=a.createTextVNode(" Профіль ",-1))]),_:1,__:[8]})])]),e[11]||(e[11]=a.createElementVNode("div",{class:"my-2 mx-2.5 h-px bg-gray-200 dark:bg-neutral-700"},null,-1)),a.createElementVNode("p",null,[a.createElementVNode("button",{type:"button",onClick:e[2]||(e[2]=(...I)=>d.logout&&d.logout(...I)),class:"w-full flex items-center gap-x-3.5 py-2 px-2.5 text-sm text-gray-800 rounded-lg hover:bg-gray-100 hover:text-red-500 focus:outline-none focus:bg-gray-100 focus:text-red-500 dark:text-white dark:hover:bg-neutral-800 dark:focus:bg-neutral-800 dark:hover:text-red-500 dark:focus:text-red-500"},[a.createVNode(T,{class:"size-4"}),e[9]||(e[9]=a.createTextVNode(" Вийти ",-1))])])])):a.createCommentVNode("",!0)])])],2)}const pq={components:{navbar:JW,AdminHeader:Oe(QW,[["render",hq]])},data(){return{showMenu:!1}},computed:{isMenu(){return ei.value||null},header(){var t,e;return((t=et.value)==null?void 0:t.header)===!1?!1:((e=et.value)==null?void 0:e.header)||"admin-header"}}},fq={class:"admin-wrapper"},mq={class:"flex flex-col w-full"};function gq(t,e,n,r,o,d){const p=a.resolveComponent("navbar"),c=a.resolveComponent("router-view");return a.openBlock(),a.createElementBlock("div",fq,[a.createVNode(p),o.showMenu?(a.openBlock(),a.createElementBlock("div",{key:0,onClick:e[0]||(e[0]=b=>o.showMenu=!1),class:"z-[10] lg:hidden transition duration fixed inset-0 bg-gray-900 bg-opacity-50 dark:bg-opacity-80 dark:bg-neutral-900"})):a.createCommentVNode("",!0),a.createElementVNode("div",mq,[d.isMenu?(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},[d.header?(a.openBlock(),a.createBlock(a.resolveDynamicComponent(d.header),{key:0})):a.createCommentVNode("",!0),a.createVNode(c)],64)):a.createCommentVNode("",!0)])])}const yq=Object.freeze(Object.defineProperty({__proto__:null,default:Oe(pq,[["render",gq],["__scopeId","data-v-804a7309"]])},Symbol.toStringTag,{value:"Module"})),_q={data(){return{currentSort:""}},props:{data:{type:Object,default:()=>null},activeColumn:{type:String}},mounted(){this.$emit("update-ref",this.$refs.column)},computed:{label(){var t,e;return((t=this.data)==null?void 0:t.ua)||((e=this.data)==null?void 0:e.label)||this.data.title||"null"},selectedSortParam(){var t,e;return(e=(t=this.$route)==null?void 0:t.query)==null?void 0:e.sort},getVisibleIcon(){return this.data.format!=="image"&&this.data.format!=="verify"}},watch:{activeColumn(t){t!==this.data.name&&(this.currentSort="")}},methods:{changeCurrentSort(t){switch(t){case"":return"asc";case"asc":return"desc";case"desc":return"";default:return""}},handleClickSortBtn(t){this.$emit("change-active",this.data.name),this.currentSort=this.changeCurrentSort(t);const e=this.$route.query,{sort:n,...r}=e,o=this.currentSort?`${this.data.name}-${this.currentSort}`:"";this.$router.replace({query:{...r,...o&&{sort:o}}})},isValueEqualToSelected(t){return`${this.data.name}-${t}`===this.selectedSortParam}}},bq={scope:"col",class:"text-start",ref:"column"},xq={class:"w-[24px]"},vq={key:1,class:"flex items-center px-1 py-3 font-medium text-gray-800 text-start gap-x-1 dark:text-neutral-200"};function wq(t,e,n,r,o,d){return a.openBlock(),a.createElementBlock("th",bq,[d.getVisibleIcon?(a.openBlock(),a.createElementBlock("button",{key:0,type:"button",class:"flex items-center px-1 py-2 font-medium text-gray-800 text-start gap-x-1 dark:text-neutral-200",onClick:e[0]||(e[0]=p=>d.handleClickSortBtn(o.currentSort))},[a.createTextVNode(a.toDisplayString(d.label)+" ",1),a.createElementVNode("span",xq,[o.currentSort?(a.openBlock(),a.createElementBlock("svg",{key:0,class:a.normalizeClass(["shrink-0 size-3.5",{"rotate-180":o.currentSort==="asc"}]),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"},e[1]||(e[1]=[a.createElementVNode("path",{d:"m5 12 7-7 7 7"},null,-1),a.createElementVNode("path",{d:"M12 19V5"},null,-1)]),2)):a.createCommentVNode("",!0)])])):(a.openBlock(),a.createElementBlock("p",vq,a.toDisplayString(d.label),1))],512)}const kq=Oe(_q,[["render",wq]]),Eq={},Cq={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",class:"icon icon-tabler icons-tabler-outline icon-tabler-link"};function Sq(t,e){return a.openBlock(),a.createElementBlock("svg",Cq,e[0]||(e[0]=[a.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),a.createElementVNode("path",{d:"M9 15l6 -6"},null,-1),a.createElementVNode("path",{d:"M11 6l.463 -.536a5 5 0 0 1 7.071 7.072l-.534 .464"},null,-1),a.createElementVNode("path",{d:"M13 18l-.397 .534a5.068 5.068 0 0 1 -7.127 0a4.972 4.972 0 0 1 0 -7.071l.524 -.463"},null,-1)]))}const Tq={components:{IconMore:dg,IconDelete:ug,IconEdit:hg,IconLink:Oe(Eq,[["render",Sq]])},emits:["updateTable"],props:{item:Object,table:String,isForm:null,actions:Array,default:()=>[]},data(){return{formVisible:!1,isDeleteConfirm:!1,formValue:{},top:0,left:0}},computed:{getCustomActions(){return this.actions.filter(t=>typeof t=="object")}},methods:{openConfirm(){this.isDeleteConfirm=!0,document.querySelector("body").click()},async getData(){var t;try{const{data:e}=await Le.get(`/api/table/${this.table}/${(t=this.item)==null?void 0:t.id}`);this.formValue=e}catch(e){console.error(e)}},doSomethingOnCancel(){this.formVisible=!1},async deleteElement(){var t,e;try{const{data:n}=await Le.get(`/api/table/${this.table}/${(t=this.item)==null?void 0:t.id}`);await Le.delete(`/api/table/${n==null?void 0:n.token}`),await this.$notify({title:"Успішно!",message:"Об`єкт успішно видалeно",type:"success"}),await this.$emit("update-table")}catch(n){this.$notify({title:"Помилка!",message:(e=n==null?void 0:n.response)==null?void 0:e.data,type:"error"})}finally{this.isDeleteConfirm=!1}},async customButtonAction(t){var e,n,r;document.querySelector("body").click(),t!=null&&t.form?(await this.$v3plugin.$form({form:t==null?void 0:t.form,id:(e=this.item)==null?void 0:e.id,api:t==null?void 0:t.api,title:t==null?void 0:t.title}),await this.$emit("update-table")):t!=null&&t.api?(await this.$v3plugin.$api({confirm:t==null?void 0:t.confirm,api:t==null?void 0:t.api,method:t==null?void 0:t.method,id:(n=this.item)==null?void 0:n.id,isId:(t==null?void 0:t.isId)||!1}),await this.$emit("update-table")):t!=null&&t.href&&this.$router.push((t==null?void 0:t.href)+((r=this.item)==null?void 0:r.id))}}},Aq={class:"inline-flex"},Dq={class:"inline-flex items-center justify-center bg-white border rounded-lg shadow-sm size-7 gap-x-2 border-stone-200 text-stone-800 hover:bg-stone-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-stone-50"},Mq={class:"flex flex-col items-start"},Iq=["onClick"],Pq={class:"text-gray-800"},Rq={key:1,class:"h-[1px] w-[80%] bg-gray-200 ml-auto mr-auto"},Nq={class:"flex justify-end p-[16px] pr-0 gap-x-3"};function Bq(t,e,n,r,o,d){const p=a.resolveComponent("IconMore"),c=a.resolveComponent("IconEdit"),b=a.resolveComponent("router-link"),k=a.resolveComponent("IconLink"),E=a.resolveComponent("IconDelete"),C=a.resolveComponent("VsPopover"),T=a.resolveComponent("VsConfirm");return a.openBlock(),a.createElementBlock(a.Fragment,null,[a.createElementVNode("div",Aq,[a.createVNode(C,{trigger:"click",placement:"bottom-left"},{reference:a.withCtx(()=>[a.createElementVNode("button",Dq,[a.createVNode(p,{height:"16",width:"16"})])]),default:a.withCtx(()=>{var I,N,$,F,q;return[a.createElementVNode("div",Mq,[(I=n.actions)!=null&&I.includes("edit")&&n.isForm?(a.openBlock(),a.createBlock(b,{key:0,to:`/edit?table=${($=(N=t.$route)==null?void 0:N.params)==null?void 0:$.catchAll}&id=${(F=n.item)==null?void 0:F.id}`,class:"w-full flex items-center gap-x-3 py-1.5 px-2 rounded-lg text-[13px] text-stone-800 hover:bg-stone-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-stone-100"},{default:a.withCtx(()=>[a.createVNode(c,{color:"#000"}),e[4]||(e[4]=a.createTextVNode(" Редагувати ",-1))]),_:1,__:[4]},8,["to"])):a.createCommentVNode("",!0),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(d.getCustomActions,(J,Q)=>(a.openBlock(),a.createElementBlock("button",{key:Q,onClick:me=>d.customButtonAction(J),class:"w-full flex items-center gap-x-3 py-1.5 px-2 rounded-lg text-[13px] text-stone-800 hover:bg-stone-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-stone-100"},[J!=null&&J.href?(a.openBlock(),a.createBlock(k,{key:0,class:"size-3.5"})):a.createCommentVNode("",!0),a.createElementVNode("span",Pq,a.toDisplayString(J==null?void 0:J.label),1)],8,Iq))),128)),n.isForm?(a.openBlock(),a.createElementBlock("div",Rq)):a.createCommentVNode("",!0),(q=n.actions)!=null&&q.includes("del")?(a.openBlock(),a.createElementBlock("button",{key:2,onClick:e[0]||(e[0]=a.withModifiers((...J)=>d.openConfirm&&d.openConfirm(...J),["stop"])),class:"w-full flex items-center gap-x-3 py-1.5 px-2 rounded-lg text-[13px] text-stone-800 hover:bg-stone-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-stone-100"},[a.createVNode(E),e[5]||(e[5]=a.createElementVNode("span",{class:"text-gray-800"},"Видалити",-1))])):a.createCommentVNode("",!0)])]}),_:1})]),a.createVNode(T,{visible:o.isDeleteConfirm,"onUpdate:visible":e[3]||(e[3]=I=>o.isDeleteConfirm=I),size:"small",title:"Ви впевнені?"},{default:a.withCtx(()=>[e[6]||(e[6]=a.createElementVNode("p",{class:"mt-1 text-sm text-gray-600 dark:text-neutral-400"}," Ви впевнені, що хочете видалити цей об'єкт? ",-1)),a.createElementVNode("div",Nq,[a.createElementVNode("button",{type:"button",class:"inline-flex items-center px-3 py-2 text-xs font-medium duration-300 border rounded-lg shadow-sm hover:bg-gray-100 gap-x-2 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50",onClick:e[1]||(e[1]=I=>o.isDeleteConfirm=!1)}," Скасувати "),a.createElementVNode("button",{type:"button",class:"inline-flex items-center px-3 py-2 text-xs font-medium text-white duration-300 bg-red-500 rounded-lg gap-x-2 hover:bg-red-700 disabled:opacity-50 disabled:pointer-events-none",onClick:e[2]||(e[2]=(...I)=>d.deleteElement&&d.deleteElement(...I))}," Так, я впевнена(ий) ")])]),_:1,__:[6]},8,["visible"])],64)}const Vq=Oe(Tq,[["render",Bq]]),zq={},Oq={class:"flex-shrink-0 mt-0.5 size-3.5",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function Lq(t,e,n,r,o,d){return a.openBlock(),a.createElementBlock("svg",Oq,e[0]||(e[0]=[a.createElementVNode("path",{d:"m3 16 4 4 4-4"},null,-1),a.createElementVNode("path",{d:"M7 20V4"},null,-1),a.createElementVNode("path",{d:"m21 8-4-4-4 4"},null,-1),a.createElementVNode("path",{d:"M17 4v16"},null,-1)]))}const Fq=Oe(zq,[["render",Lq]]),$q={},jq={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",class:"icon icon-tabler icons-tabler-outline icon-tabler-rosette-discount-check"};function Uq(t,e,n,r,o,d){return a.openBlock(),a.createElementBlock("svg",jq,e[0]||(e[0]=[a.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),a.createElementVNode("path",{d:"M5 7.2a2.2 2.2 0 0 1 2.2 -2.2h1a2.2 2.2 0 0 0 1.55 -.64l.7 -.7a2.2 2.2 0 0 1 3.12 0l.7 .7c.412 .41 .97 .64 1.55 .64h1a2.2 2.2 0 0 1 2.2 2.2v1c0 .58 .23 1.138 .64 1.55l.7 .7a2.2 2.2 0 0 1 0 3.12l-.7 .7a2.2 2.2 0 0 0 -.64 1.55v1a2.2 2.2 0 0 1 -2.2 2.2h-1a2.2 2.2 0 0 0 -1.55 .64l-.7 .7a2.2 2.2 0 0 1 -3.12 0l-.7 -.7a2.2 2.2 0 0 0 -1.55 -.64h-1a2.2 2.2 0 0 1 -2.2 -2.2v-1a2.2 2.2 0 0 0 -.64 -1.55l-.7 -.7a2.2 2.2 0 0 1 0 -3.12l.7 -.7a2.2 2.2 0 0 0 .64 -1.55v-1"},null,-1),a.createElementVNode("path",{d:"M9 12l2 2l4 -4"},null,-1)]))}const Hq={components:{IconExport:Fq,IconChevronDown:Bd,IconSuccess:Oe($q,[["render",Uq]])},props:{table:String,columns:Array,page:[String,Number],filterCustom:String,filterState:String,filters:String},data(){return{isOpen:!1,tableFormats:["json","csv","xlsx"],format:"",cols:[],activeAction:"",isSuccessTemplate:!1,actions:[{name:"choceAll",function:this.choceAll,label:"Вибрати усі"},{name:"choceVisible",function:this.choceVisible,label:"Вибрати поточні"},{name:"clearAll",function:this.clearAll,label:"Жодного"}],es:null,progress:0}},watch:{isOpen(t){t||(this.format="",this.cols=[],this.activeAction="",this.isSuccessTemplate=!1)}},computed:{color(){return et.value.buttonColor||"blue"}},methods:{async downloadBlob(t){const e=await Le.get(t||"/api/export",{params:{table:this.table,format:this.format,cols:this.cols.join(","),page:this.page,filter:this.filters||null,state:this.filterState||null,custom:this.filterCustom||null},responseType:"blob"}),n=new Blob([e.data],{type:"application/octet-stream"}),r=document.createElement("a");r.href=URL.createObjectURL(n),r.download=`${this.table.split(".")[0]}.${this.format}`,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(r.href),this.isSuccessTemplate=!0,this.$notify({type:"success",title:"Експорт",message:"Файл успішно експортовано!"})},async exportTable(){var e;try{await Le.get("/api/export",{params:{table:this.table,format:this.format,cols:this.cols.join(","),page:this.page,filter:this.filters||null,state:this.filterState||null,custom:this.filterCustom||null,stream:!0},validateStatus:n=>n===200}),await this.downloadBlob();return}catch{}const t=new URLSearchParams({table:this.table,format:this.format,cols:this.cols.join(","),page:this.page,filter:this.filters||"",state:this.filterState||"",custom:this.filterCustom||""});(e=this.es)==null||e.close(),this.es=new EventSource(`/api/export?${t.toString()}`),this.es.addEventListener("progress",n=>{try{const{percent:r}=JSON.parse(n.data);this.progress=r}catch{console.log("progress",n.data)}}),this.es.addEventListener("done",async n=>{this.es.close(),this.es=null;const{url:r}=JSON.parse(n.data||"{}");await this.downloadBlob(r)}),this.es.onerror=n=>{var r;console.error("SSE error",n),this.$notify({type:"error",title:"Помилка",message:"Потік експорту перервано."}),(r=this.es)==null||r.close()}},selectFormat(t){this.format=t},choceAll(){var t;this.cols=(t=this.columns)==null?void 0:t.map(e=>e==null?void 0:e.name),this.activeAction="choceAll"},clearAll(){this.cols=[],this.activeAction="clearAll"},choceVisible(){var t,e;this.cols=(e=(t=this.columns)==null?void 0:t.filter(n=>(n==null?void 0:n.hidden)!==!0))==null?void 0:e.map(n=>n==null?void 0:n.name),this.activeAction="choceVisible"}}},Wq={key:0,class:"flex flex-col items-center"},qq={key:1,class:"p-4"},Gq={class:"pb-5 mb-5 border-b border-gray-200 last:pb-0 last:mb-0 last:border-b-0 dark:border-neutral-700"},Zq={class:"flex items-center gap-[10px] -ml-[10px] my-[10px]"},Yq=["onClick"],Xq={key:0,class:"block h-[8px] w-[8px] rounded-full bg-blue-500"},Kq={class:"mt-2 flex row flex-wrap gap-y-[5px] gap-x-[10px]"},Jq={class:"pb-5 mb-5 border-b border-gray-200 last:pb-0 last:mb-0 last:border-b-0 dark:border-neutral-700"},Qq={class:"mt-2 space-y-2"},eG=["id","onChange"],tG=["for"],nG={key:0,class:"flex w-full justify-end p-[20px] gap-[6px] border-t"},rG={key:1,class:"flex w-full justify-end p-[20px] gap-[6px] border-t"};function iG(t,e,n,r,o,d){const p=a.resolveComponent("IconExport"),c=a.resolveComponent("IconSuccess"),b=a.resolveComponent("VsCheckbox"),k=a.resolveComponent("VsDialog");return a.openBlock(),a.createElementBlock(a.Fragment,null,[a.createElementVNode("button",{onClick:e[0]||(e[0]=E=>o.isOpen=!0),class:"py-2 max-h-[34px] px-2.5 md:inline-flex hidden items-center gap-x-1.5 text-xs font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},[a.createVNode(p,{height:"16",width:"16"}),e[7]||(e[7]=a.createTextVNode(" Експорт ",-1))]),a.createVNode(k,{visible:o.isOpen,"onUpdate:visible":e[6]||(e[6]=E=>o.isOpen=E),title:"Експорт таблиці",size:"small",closeClickBack:!0},{footer:a.withCtx(()=>[o.isSuccessTemplate?(a.openBlock(),a.createElementBlock("div",nG,[a.createElementVNode("button",{type:"button",class:"inline-flex items-center justify-center px-3 py-2 text-sm font-medium text-gray-800 align-middle bg-white border border-gray-200 rounded-lg shadow-sm text-nowrap text-start hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:e[2]||(e[2]=E=>o.isOpen=!1)}," Закрити "),a.createElementVNode("button",{type:"button",class:"inline-flex items-center justify-center px-3 py-2 text-sm font-medium text-white align-middle bg-blue-600 border border-blue-600 rounded-lg shadow-sm text-nowrap gap-x-2 text-start hover:bg-blue-700 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:ring-1 focus:ring-blue-300 dark:focus:ring-blue-500",onClick:e[3]||(e[3]=E=>o.isSuccessTemplate=!1)}," Вигрузити ще ")])):(a.openBlock(),a.createElementBlock("div",rG,[a.createElementVNode("button",{type:"button",class:"inline-flex items-center justify-center px-3 py-2 text-sm font-medium text-gray-800 align-middle bg-white border border-gray-200 rounded-lg shadow-sm text-nowrap text-start hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:e[4]||(e[4]=E=>o.isOpen=!1)}," Скасувати "),a.createElementVNode("button",{type:"button",class:a.normalizeClass(`inline-flex items-center justify-center px-3 py-2 text-sm font-medium text-white align-middle bg-${d.color}-700 rounded-lg shadow-sm text-nowrap gap-x-2 text-start hover:bg-${d.color}-800 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:ring-1 focus:ring-${d.color}-300 dark:focus:ring-${d.color}-500`),onClick:e[5]||(e[5]=(...E)=>d.exportTable&&d.exportTable(...E))}," Завантажити таблицю ",2)]))]),default:a.withCtx(()=>[o.isSuccessTemplate?(a.openBlock(),a.createElementBlock("div",Wq,[a.createVNode(c,{height:"100",width:"100",class:"text-green-200 mb-[20px]"}),e[8]||(e[8]=a.createElementVNode("h2",null,"Звіт сформовано і збережено",-1))])):(a.openBlock(),a.createElementBlock("div",qq,[a.createElementVNode("div",Gq,[e[9]||(e[9]=a.createElementVNode("h2",{class:"text-sm font-[600] text-gray-500"}," Виберіть стовпці таблиці для експорту: ",-1)),a.createElementVNode("div",Zq,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(o.actions,E=>(a.openBlock(),a.createElementBlock("button",{key:E==null?void 0:E.name,onClick:E==null?void 0:E.function,class:"inline-flex items-center gap-[8px] justify-center px-3 py-2 text-sm font-medium text-gray-800 align-middle bg-white border-gray-200 text-nowrap text-start"},[a.createElementVNode("span",{class:a.normalizeClass(["h-[14px] w-[14px] border rounded-full flex items-center justify-center",{"border-blue-500":(E==null?void 0:E.name)===o.activeAction}])},[(E==null?void 0:E.name)===o.activeAction?(a.openBlock(),a.createElementBlock("span",Xq)):a.createCommentVNode("",!0)],2),a.createTextVNode(" "+a.toDisplayString(E==null?void 0:E.label),1)],8,Yq))),128))]),a.createElementVNode("div",Kq,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(n.columns,(E,C)=>(a.openBlock(),a.createElementBlock("div",{class:"flex items-center",key:C,style:{width:"calc((100% - 10px) / 2)"}},[a.createVNode(b,{class:"[&>label]:text-sm [&>label]:text-gray-800 [&>label]:ms-3 !gap-x-[1px] !p-0",modelValue:o.cols,"onUpdate:modelValue":e[1]||(e[1]=T=>o.cols=T),value:E==null?void 0:E.name,label:E==null?void 0:E.ua},null,8,["modelValue","value","label"])]))),128))])]),a.createElementVNode("div",Jq,[e[10]||(e[10]=a.createElementVNode("h2",{class:"text-sm font-[600] text-gray-500"}," Виберіть формат таблиці: ",-1)),a.createElementVNode("div",Qq,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(o.tableFormats,(E,C)=>(a.openBlock(),a.createElementBlock("div",{class:"flex items-center",key:C},[a.createElementVNode("input",{type:"radio",name:"hs-pro-duecmfm",class:"text-blue-600 border-gray-300 rounded-full shrink-0 focus:ring-blue-500 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-500 dark:checked:bg-blue-500 dark:checked:border-blue-500 dark:focus:ring-offset-gray-800",id:E,onChange:T=>d.selectFormat(E)},null,40,eG),a.createElementVNode("label",{for:E,class:"text-sm text-gray-800 ms-3 dark:text-neutral-400"}," Формат "+a.toDisplayString(E),9,tG)]))),128))])])]))]),_:1},8,["visible"])],64)}const sG=Oe(Hq,[["render",iG]]),oG={},aG={xmlns:"http://www.w3.org/2000/svg",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-minus"};function lG(t,e,n,r,o,d){return a.openBlock(),a.createElementBlock("svg",aG,e[0]||(e[0]=[a.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),a.createElementVNode("path",{d:"M5 12l14 0"},null,-1)]))}const cG={components:{IconPlus:$l,IconMinus:Oe(oG,[["render",lG]])},props:{title:String,defaultValue:{type:Boolean,default:()=>!1}},data(){return{expanded:this.defaultValue}}},dG={class:"hs-accordion"},uG={class:"py-0.5 flex items-center gap-x-0.5 w-full"},hG={class:"text-sm font-medium"},pG={class:"relative inline-block w-full duration-150 cursor-pointer before:block before:absolute b"};function fG(t,e,n,r,o,d){const p=a.resolveComponent("IconPlus"),c=a.resolveComponent("IconMinus");return a.openBlock(),a.createElementBlock("div",null,[a.createElementVNode("div",null,[a.createElementVNode("div",dG,[a.createElementVNode("div",uG,[a.createElementVNode("div",{onClick:e[0]||(e[0]=b=>o.expanded=!o.expanded),class:"rounded-md cursor-pointer grow"},[a.createElementVNode("span",hG,a.toDisplayString(n.title),1)]),a.createElementVNode("button",{class:"flex items-center justify-center rounded-md size-6 hover:bg-gray-100",onClick:e[1]||(e[1]=b=>o.expanded=!o.expanded)},[o.expanded?(a.openBlock(),a.createBlock(c,{key:1,width:"14"})):(a.openBlock(),a.createBlock(p,{key:0}))])]),a.createVNode(a.Transition,{name:"fade"},{default:a.withCtx(()=>[a.withDirectives(a.createElementVNode("div",pG,[a.renderSlot(t.$slots,"default",{},void 0,!0)],512),[[a.vShow,o.expanded]])]),_:3})])])])}const mG={components:{AdminComponentIs:vd,AdminTree:Oe(cG,[["render",fG],["__scopeId","data-v-c6318482"]]),VsNoData:Ha,VsWidgetComments:Sv,VsWidgetMap:Fm,VsWidgetFileList:Cv},props:{table:String,columns:Array,row:Object}},gG={class:"pl-2 hs-accordion w-[360px] shrink-0 overflow-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar:horizontal]:h-[8px] [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500",style:{height:"calc(100vh - 229px)"}},yG={style:{height:"calc(100vh - 360px)"},class:"pl-2"},_G={class:"flow-root mt-[10px]"},bG={class:"divide-y divide-gray-100 text-[12px]"},xG={class:"grid grid-cols-1 gap-1 py-3 even:bg-gray-50 sm:grid-cols-3 sm:gap-4"},vG={class:"font-medium text-gray-900"},wG={class:"text-gray-700 sm:col-span-2"};function kG(t,e,n,r,o,d){var k,E,C,T;const p=a.resolveComponent("AdminComponentIs"),c=a.resolveComponent("VsWidgetFileList"),b=a.resolveComponent("VsNoData");return a.openBlock(),a.createElementBlock("div",gG,[e[0]||(e[0]=a.createElementVNode("div",{class:"pl-[10px] py-[9px]"},[a.createElementVNode("h2",{class:"text-sm font-medium text-center"},"Інформація про об'єкт")],-1)),a.createElementVNode("div",yG,[(E=(k=t.$route)==null?void 0:k.query)!=null&&E.card?(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},[a.createElementVNode("div",_G,[a.createElementVNode("dl",bG,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(n.columns,I=>(a.openBlock(),a.createElementBlock("div",xG,[a.createElementVNode("dt",vG,a.toDisplayString((I==null?void 0:I.ua)||(I==null?void 0:I.title)),1),a.createElementVNode("dd",wG,[a.createVNode(p,{row:n.row,column:I,table:n.table},null,8,["row","column","table"])])]))),256))])]),(a.openBlock(),a.createBlock(c,{key:(C=n.row)==null?void 0:C.id,id:(T=n.row)==null?void 0:T.id,class:"mt-10"},null,8,["id"]))],64)):(a.openBlock(),a.createBlock(b,{key:1,text:"Оберіть один з об'єктів в таблиці для відображення інформаціі про нього"}))])])}const EG=Oe(mG,[["render",kG]]),CG={emits:["filterChange"],props:{scheme:{type:Object},onFilters:{type:Number},table:{type:String}},components:{IconFilter:Dv},data(){return{isFilters:!1}},methods:{closeFilter({target:t}){this.isFilters&&t.classList.contains("filter-container")&&(this.isFilters=!1)}}},SG={key:0,class:"px-[7px] text-[10px] py-[1px] font-[700] text-white bg-blue-500 rounded-full"},TG={class:"filter-content h-screen bg-white w-[400px] overflow-x-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar:horizontal]:h-[8px] [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"};function AG(t,e,n,r,o,d){const p=a.resolveComponent("IconFilter"),c=a.resolveComponent("VsFilter");return a.openBlock(),a.createElementBlock(a.Fragment,null,[a.createElementVNode("button",{onClick:e[0]||(e[0]=b=>o.isFilters=!o.isFilters),class:"py-2 px-2.5 max-h-[34px] inline-flex items-center gap-x-1.5 text-xs font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none"},[a.createVNode(p,{height:"16",width:"16"}),e[4]||(e[4]=a.createTextVNode(" Фільтри ",-1)),n.onFilters?(a.openBlock(),a.createElementBlock("span",SG,a.toDisplayString(n.onFilters),1)):a.createCommentVNode("",!0)]),a.createVNode(a.Transition,{name:"fade"},{default:a.withCtx(()=>{var b;return[(a.openBlock(),a.createBlock(a.Teleport,{to:"#modal"},[a.withDirectives(a.createElementVNode("div",{onClick:e[3]||(e[3]=(...k)=>d.closeFilter&&d.closeFilter(...k)),style:{height:"100vh"},class:"fixed filter-container top-0 flex justify-end items-center z-[12] right-0 left-0 bottom-0 bg-[rgba(0,0,0,0.2)]"},[a.createElementVNode("div",TG,[(b=n.scheme)!=null&&b.length?(a.openBlock(),a.createBlock(c,{key:0,ref:"filter",scheme:n.scheme,layout:"default","apply-vue-router":"",history:"",name:"filter",footer:!0,background:!0,onFilterChange:e[1]||(e[1]=k=>t.$emit("filterChange",k)),closeFilterBtn:!0,onFilterClose:e[2]||(e[2]=k=>o.isFilters=!1)},null,8,["scheme"])):a.createCommentVNode("",!0)])],512),[[a.vShow,o.isFilters]])]))]}),_:1})],64)}const DG=Oe(CG,[["render",AG]]),MG={props:{tabsList:{type:Array,default:()=>[]},filterState:String}},IG={class:"relative flex space-x-1 mb-[20px] after:absolute after:w-[99%] after:bottom-0 after:inset-x-0 after:border-b-2 after:border-gray-200 dark:after:border-neutral-700","aria-label":"Tabs",role:"tablist","aria-orientation":"horizontal"},PG=["onClick"];function RG(t,e,n,r,o,d){return a.openBlock(),a.createElementBlock("nav",IG,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(n.tabsList,p=>(a.openBlock(),a.createElementBlock("button",{onClick:c=>t.$emit("update:filterState",p==null?void 0:p.name),class:a.normalizeClass(["hs-tab-active:after:bg-gray-800 hs-tab-active:text-gray-800 px-2.5 py-1.5 mb-2 relative inline-flex justify-center items-center gap-x-2 hover:bg-gray-100 text-gray-500 hover:text-gray-800 text-sm rounded-lg disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-100 after:absolute after:-bottom-2 after:inset-x-0 after:z-10 after:h-0.5 after:pointer-events-none dark:hs-tab-active:text-neutral-200 dark:hs-tab-active:after:bg-neutral-400 dark:text-neutral-500 dark:hover:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700 active",{" font-semibold after:absolute after:bottom-[-8px] after:left-2.5 after:right-2.5 after:z-10 after:h-0.5 after:bg-gray-800":(p==null?void 0:p.name)===n.filterState}])},a.toDisplayString(p==null?void 0:p.label),11,PG))),256))])}const NG=Oe(MG,[["render",RG]]),BG={},VG={xmlns:"http://www.w3.org/2000/svg",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-filter"};function zG(t,e,n,r,o,d){return a.openBlock(),a.createElementBlock("svg",VG,e[0]||(e[0]=[a.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),a.createElementVNode("path",{d:"M4 4h16v2.172a2 2 0 0 1 -.586 1.414l-4.414 4.414v7l-6 2v-8.5l-4.48 -4.928a2 2 0 0 1 -.52 -1.345v-2.227z"},null,-1)]))}const OG={components:{IconFilter2:Oe(BG,[["render",zG]]),IconCheck2:kl},props:{filterCustom:String,customList:Array}},LG={class:"py-2 max-h-[34px] px-2.5 inline-flex items-center gap-x-1.5 text-xs font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},FG={class:"flex flex-col p-[2px] gap-[2px] w-[170px]"},$G=["onClick"],jG={class:"text-sm text-gray-800"};function UG(t,e,n,r,o,d){const p=a.resolveComponent("IconFilter2"),c=a.resolveComponent("IconCheck2"),b=a.resolveComponent("VsPopover");return a.openBlock(),a.createBlock(b,{ref:"popover",placement:"bottom"},{reference:a.withCtx(()=>[a.createElementVNode("button",LG,[a.createVNode(p,{height:"20",width:"20"})])]),default:a.withCtx(()=>[a.createElementVNode("div",FG,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(n.customList,(k,E)=>(a.openBlock(),a.createElementBlock("button",{onClick:C=>{var T;t.$emit("update:filterCustom",k==null?void 0:k.name),(T=t.$refs)==null||T.popover.togglePopover()},key:E,class:a.normalizeClass(["flex items-center px-3 py-1 rounded-md cursor-pointer group hover:bg-gray-100",{"bg-gray-100":n.filterCustom===(k==null?void 0:k.name)}])},[a.createElementVNode("span",jG,a.toDisplayString(k==null?void 0:k.label),1),n.filterCustom===(k==null?void 0:k.name)?(a.openBlock(),a.createBlock(c,{key:0,class:"ml-auto size-3 shrink-0"})):a.createCommentVNode("",!0)],10,$G))),128)),a.createElementVNode("button",{class:"flex items-center px-3 py-1 rounded-md cursor-pointer group hover:bg-gray-100",onClick:e[0]||(e[0]=k=>{var E;t.$emit("update:filterCustom",void 0),(E=t.$refs)==null||E.popover.togglePopover()})}," Скинути фільтри ")])]),_:1},512)}const HG=Oe(OG,[["render",UG]]),WG={class:"flex items-center gap-x-2"},qG={__name:"admin-table-custom-buttons",props:{slots:Object,data:Object},setup(t){var c,b,k,E,C;const{asyncTemplateSlot:e}=(C=(E=(k=(b=(c=a.getCurrentInstance())==null?void 0:c.appContext)==null?void 0:b.app)==null?void 0:k.config)==null?void 0:E.globalProperties)==null?void 0:C.utils,n=a.ref(""),r=a.ref(""),o=t,d=()=>{var T,I,N,$,F;if((T=o.slots)!=null&&T.panelLeft||(r.value="div"),(N=(I=o.slots)==null?void 0:I.panelLeft)!=null&&N.includes("<")){const q=e("PanelLeft",($=o.slots)==null?void 0:$.panelLeft,["name"]);r.value=q}else r.value=(F=o.slots)==null?void 0:F.panelLeft},p=()=>{var T,I,N,$,F;if((T=o.slots)!=null&&T.panelRight||(n.value="div"),(N=(I=o.slots)==null?void 0:I.panelRight)!=null&&N.includes("<")){const q=e("PanelRight",($=o.slots)==null?void 0:$.panelRight,["name"]);n.value=q}else n.value=(F=o.slots)==null?void 0:F.panelRight};return d(),p(),(T,I)=>(a.openBlock(),a.createElementBlock("div",WG,[(a.openBlock(),a.createBlock(a.resolveDynamicComponent(r.value),{data:t.data},null,8,["data"])),(a.openBlock(),a.createBlock(a.resolveDynamicComponent(n.value),{data:t.data},null,8,["data"]))]))}},GG={__name:"admin-custom-button-add",props:{slots:Object},setup(t){var d,p,c,b,k;const{asyncTemplateSlot:e}=(k=(b=(c=(p=(d=a.getCurrentInstance())==null?void 0:d.appContext)==null?void 0:p.app)==null?void 0:c.config)==null?void 0:b.globalProperties)==null?void 0:k.utils,n=a.ref(""),r=t;return(()=>{var E,C,T,I,N;if((E=r.slots)!=null&&E.addButton||(n.value="div"),(T=(C=r.slots)==null?void 0:C.addButton)!=null&&T.includes("<")){const $=e("addButton",(I=r.slots)==null?void 0:I.addButton,["IconPlus"]);n.value=$}else n.value=(N=r.slots)==null?void 0:N.addButton})(),(E,C)=>n.value?(a.openBlock(),a.createBlock(a.resolveDynamicComponent(n.value),{key:0,IconPlus:$l})):a.createCommentVNode("",!0)}},ZG={key:0,class:"px-1 py-3 text-gray-800 font-[500]"},YG={key:1,class:"px-1 py-3 text-gray-800 font-[700]"},XG={__name:"admin-table-totals-list",props:{columns:{type:Array,default:()=>[]},agg:{type:Object,default:()=>{}}},setup(t){return(e,n)=>(a.openBlock(),a.createElementBlock("tr",null,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(t.columns,r=>{var o;return a.openBlock(),a.createElementBlock(a.Fragment,{key:r==null?void 0:r.name},[(o=t.agg)!=null&&o[r==null?void 0:r.name]?(a.openBlock(),a.createElementBlock("td",ZG,[a.createVNode(vd,{column:r,row:t.agg},null,8,["column","row"])])):(a.openBlock(),a.createElementBlock("td",YG))],64)}),128))]))}},KG={},JG={xmlns:"http://www.w3.org/2000/svg",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-check"};function QG(t,e,n,r,o,d){return a.openBlock(),a.createElementBlock("svg",JG,e[0]||(e[0]=[a.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),a.createElementVNode("path",{d:"M5 12l5 5l10 -10"},null,-1)]))}const eZ=Oe(KG,[["render",QG]]),tZ=a.defineComponent({components:{IconChevronDown:Ip,IconCheck:eZ},props:{total:{type:Number,default:()=>0},pageSize:{type:Number,default:()=>20},maxPages:{type:Number,default:()=>10},defaultPage:{type:Number,default:()=>1},pageSizes:{type:Array,default:[]}},data(){return{page:1,pages:[],isDropdownOpen:!1,pageSizeLocal:null}},mounted(){this.pageSizeLocal=this.pageSize},watch:{total:{immediate:!0,handler(){this.initPages()}},defaultPage:{immediate:!0,handler(t){this.page=t,this.updatePages(t)}},pageSizeLocal(t,e){e&&(this.isDropdownOpen=!1,this.setCurrentPage(1))}},computed:{pagesCount(){return Math.ceil(this.total/this.pageSizeLocal)},disableNextClick(){return this.page>=this.pagesCount},disablePrevClick(){return this.page<=1}},methods:{initPages(){if(this.total<=0){this.pages=[1];return}this.updatePages(this.page)},handleSetPage(t){const e=t.replace(/\D/g,"");if(e>this.pagesCount){this.$refs.currentPage.innerText=this.page;return}else this.$refs.currentPage.innerText=e;this.setCurrentPage(e)},updatePages(t){const e=Math.floor(this.maxPages/2);let n=Math.max(t-e,1),r=n+this.maxPages-1;r>this.pagesCount&&(r=this.pagesCount,n=Math.max(r-this.maxPages+1,1)),this.pages=Array.from({length:r-n+1},(o,d)=>n+d)},handleClickPrev(){this.disablePrevClick||(this.setCurrentPage(this.page-1),this.updatePages(this.page),this.$emit("prevClick"))},handleClickNext(){this.disableNextClick||(this.setCurrentPage(parseInt(this.page)+1),this.updatePages(this.page),this.$emit("nextClick"))},setCurrentPage(t){this.page=t,this.$emit("pageChange",this.page,this.pageSizeLocal),this.updatePages(t)},keydownEnter(t){t.preventDefault(),t.target.blur()}}}),nZ={class:"flex items-center w-full"},rZ={class:"flex items-center mx-[8px]"},iZ={class:"min-h-[38px] flex justify-center items-center text-stone-500 py-2 px-1.5 text-sm"},sZ={key:0,class:"flex items-center justify-center ml-3 gap-x-5"},oZ={class:"relative"},aZ={class:"z-50 bg-white shadow-md rounded-lg p-1 space-y-0.5 dark:bg-neutral-800 dark:border dark:border-neutral-700 dark:divide-neutral-700 absolute bottom-[100%]"},lZ=["onClick"];function cZ(t,e,n,r,o,d){const p=a.resolveComponent("IconChevronDown"),c=a.resolveComponent("IconCheck");return a.openBlock(),a.createElementBlock("nav",nZ,[a.createElementVNode("button",{type:"button",onClick:e[0]||(e[0]=(...b)=>t.handleClickPrev&&t.handleClickPrev(...b)),class:a.normalizeClass(["min-h-[38px] min-w-[38px] py-2 px-2.5 inline-flex justify-center items-center gap-x-2 text-sm rounded-lg text-stone-800 hover:bg-stone-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-stone-100",{"opacity-50 pointer-events-none":t.disablePrevClick}])},[a.createVNode(p,{height:"16",width:"16",class:"rotate-90"})],2),a.createElementVNode("div",rZ,[a.createElementVNode("span",{ref:"currentPage",contenteditable:"true",onKeydown:e[1]||(e[1]=a.withKeys((...b)=>t.keydownEnter&&t.keydownEnter(...b),["enter"])),onBlur:e[2]||(e[2]=b=>t.handleSetPage(b.target.innerText)),class:"min-h-[38px] max-h-[38px] overflow-hidden min-w-[38px] flex justify-center items-center bg-stone-100 text-stone-800 py-2 px-3 outline-blue-600 text-sm rounded-lg disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:text-white"},a.toDisplayString(t.page),545),e[5]||(e[5]=a.createElementVNode("span",{class:"min-h-[38px] flex justify-center items-center text-stone-500 py-2 px-1.5 text-sm"},"з",-1)),a.createElementVNode("span",iZ,a.toDisplayString(t.pagesCount),1)]),a.createElementVNode("button",{type:"button",onClick:e[3]||(e[3]=(...b)=>t.handleClickNext&&t.handleClickNext(...b)),class:a.normalizeClass([{"opacity-50 pointer-events-none":t.disableNextClick},"min-h-[38px] min-w-[38px] py-2 px-2.5 inline-flex justify-center items-center gap-x-2 text-sm rounded-lg text-stone-800 hover:bg-stone-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-stone-100"])},[a.createVNode(p,{height:"16",width:"16",class:"-rotate-90"})],2),t.pageSizes.length?(a.openBlock(),a.createElementBlock("div",sZ,[a.createElementVNode("div",oZ,[a.withDirectives(a.createElementVNode("div",aZ,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(t.pageSizes,b=>(a.openBlock(),a.createElementBlock("button",{type:"button",class:"w-full flex items-center gap-x-3.5 py-2 px-3 rounded-lg text-sm",onClick:k=>t.pageSizeLocal=b},[a.createTextVNode(a.toDisplayString(b)+" ",1),b===t.pageSizeLocal?(a.openBlock(),a.createBlock(c,{key:0,width:"14",height:"14",class:"text-blue-600"})):a.createCommentVNode("",!0)],8,lZ))),256))],512),[[a.vShow,t.isDropdownOpen]]),t.pageSizes.length?(a.openBlock(),a.createElementBlock("button",{key:0,type:"button",class:"text-sm h-[32px] min-w-8 py-3 px-3.5 inline-flex items-center gap-x-1 rounded-lg border border-gray-200 text-gray-800 shadow-sm hover:bg-gray-50 focus:outline-none focus:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none dark:border-neutral-700 dark:text-white dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:e[4]||(e[4]=b=>t.isDropdownOpen=!t.isDropdownOpen)},[a.createTextVNode(a.toDisplayString(t.pageSizeLocal)+" ",1),a.createVNode(p,{height:"16",width:"16"})])):a.createCommentVNode("",!0)])])):a.createCommentVNode("",!0)])}const dZ={props:{table:String,title:String,search:String},components:{AdminTableControl:Vq,AdminTableExport:sG,AdminTableColumnsHidden:Iv,AdminTableColumn:kq,AdminNodata:pg,IconPlus:$l,IconSearch:Mp,AdminTableCardInfo:EG,IconOpenCard:Ek,AdminComponentIs:vd,AdminTableFilters:DG,AdminTableTabs:NG,AdminTableCustomFilters:HG,AdminTableCustomButtons:qG,AdminCustomButtonAdd:GG,AdminTableTotalsList:XG,AdminTablePagination:Oe(tZ,[["render",cZ]])},data(){return{tableData:{},filterScheme:[],page:1,searchValue:"",limit:0,filters:null,activeColumn:"",isVisibleCardInfo:!1,onFilters:0,filterState:null,filterCustom:null,visibleColumns:[],initialHiddenColumns:"",columnsWidth:{}}},async mounted(){await this.checkUrlMounted(),await this.getTableData(),await this.getFilters(),window.addEventListener("reloadTablePage",this.getTableData)},unmounted(){window.removeEventListener("reloadTablePage",this.getTableData)},computed:{color(){return et.value.buttonColor||"blue"},fontSize(){return`text-[${et.value.fontSize||13}px]`},defaultPage(){var t,e;return((e=(t=this.$route)==null?void 0:t.query)==null?void 0:e.page)||1},columns(){var t,e;return(e=(t=this.tableData)==null?void 0:t.columns)==null?void 0:e.filter(n=>(n==null?void 0:n.hidden)!==!0)},isForm(){var t,e,n,r,o;return((t=this.tableData)==null?void 0:t.form)&&(((n=(e=this.tableData)==null?void 0:e.actions)==null?void 0:n.includes("add"))||((o=(r=this.tableData)==null?void 0:r.actions)==null?void 0:o.includes("edit")))},isNoData(){var t,e;return!((t=this.tableData)!=null&&t.rows)||!((e=this.columns)!=null&&e.length)},activeCardRow(){var t,e;return((e=(t=this.tableData)==null?void 0:t.rows)==null?void 0:e.find(n=>{var r,o;return(n==null?void 0:n.id)===((o=(r=this.$route)==null?void 0:r.query)==null?void 0:o.card)}))||{}},getActions(){var t;return(t=this.tableData)==null?void 0:t.actions}},watch:{searchValue:{handler:Iy(async function(t){var e;this.page=1,await this.getTableData(),this.$router.push({...this.$route,query:{...(e=this.$route)==null?void 0:e.query,search:t||void 0,page:1}})},500)},$route:{async handler(t,e){var n,r;((n=t==null?void 0:t.params)==null?void 0:n.catchAll)!==((r=e==null?void 0:e.params)==null?void 0:r.catchAll)&&(this.visibleColumns=[],this.tableData=null,this.columnsWidth={},this.unmountedData(),this.getFilters(),await this.getTableData())},deep:!0},limit(t){var e;this.$router.replace({...this.$route,query:{...(e=this.$route)==null?void 0:e.query,limit:t}})},filterState(t){var e;t&&(this.$router.replace({...this.$route,query:{...(e=this.$route)==null?void 0:e.query,state:t}}),this.getTableData())},filterCustom(t){var e;this.$router.replace({...this.$route,query:{...(e=this.$route)==null?void 0:e.query,custom:t}}),this.getTableData()},columns(t){var e,n,r,o;this.visibleColumns=t==null?void 0:t.map(d=>d==null?void 0:d.name),this.initialHiddenColumns===((e=this.visibleColumns)==null?void 0:e.join(","))&&(this.visibleColumns=[]),this.$router.replace({...this.$route,query:{...(n=this.$route)==null?void 0:n.query,columns:(r=this.visibleColumns)!=null&&r.length?(o=this.visibleColumns)==null?void 0:o.join(","):void 0}})}},methods:{async checkUrlMounted(){var t,e,n,r,o,d,p,c,b,k,E,C,T,I,N,$,F,q,J,Q,me;this.page=((e=(t=this.$route)==null?void 0:t.query)==null?void 0:e.page)||1,this.limit=((r=(n=this.$route)==null?void 0:n.query)==null?void 0:r.limit)||20,(d=(o=this.$route)==null?void 0:o.query)!=null&&d.filter&&(this.filters=((b=decodeURI((c=(p=this.$route)==null?void 0:p.query)==null?void 0:c.filter))==null?void 0:b.replaceAll("+"," "))||null),this.filters&&(this.onFilters=((E=(k=this.filters)==null?void 0:k.split("="))==null?void 0:E.length)-1),this.filterState=((T=(C=this.$route)==null?void 0:C.query)==null?void 0:T.state)||null,this.filterCustom=((N=(I=this.$route)==null?void 0:I.query)==null?void 0:N.custom)||null,this.searchValue=((F=($=this.$route)==null?void 0:$.query)==null?void 0:F.search)||"",this.visibleColumns=((Q=(J=(q=this.$route)==null?void 0:q.query)==null?void 0:J.columns)==null?void 0:Q.split(","))||[],(me=this.$route)!=null&&me.query.card&&(this.isVisibleCardInfo=!0)},rowWidth(t){var n,r;const e=(r=(n=this.tableData)==null?void 0:n.columns)==null?void 0:r.find(o=>o.name===t);if(e){const o=e==null?void 0:e.width;return typeof o=="number"?`${o}px`:o!=null&&o.includes("px")?o:`${o}px`}},unmountedData(){this.page=1,this.visibleColumns=[],this.filterCustom=null,this.filterState=null,this.isVisibleCardInfo=!1,this.filterScheme=null,this.filters=null,this.onFilters=0,this.searchValue=""},async getTableData(){var t,e,n,r,o,d,p,c,b,k,E;try{const{data:C}=await Le.get(`/api/template/table/${this.table}`),T=await Le.get(`/api/table-data/${this.table}`,{params:{page:this.page,search:this.searchValue||null,limit:this.limit,filter:this.filters||null,order:((e=(t=this.$route)==null?void 0:t.query)==null?void 0:e.sort)||null,state:this.filterState||null,custom:this.filterCustom||null}});this.tableData={...C,...(T==null?void 0:T.data)||{}},this.initialHiddenColumns=(d=(o=(r=(n=this.tableData)==null?void 0:n.columns)==null?void 0:r.filter(I=>(I==null?void 0:I.hidden)!==!0))==null?void 0:o.map(I=>I==null?void 0:I.name))==null?void 0:d.join(","),(p=this.visibleColumns)!=null&&p.length?(c=this.tableData)==null||c.columns.forEach(I=>{var N;(N=this.visibleColumns)!=null&&N.includes(I==null?void 0:I.name)?I.hidden=!1:I.hidden=!0}):this.visibleColumns=(E=(k=(b=this.tableData)==null?void 0:b.columns)==null?void 0:k.filter(I=>(I==null?void 0:I.hidden)!==!0))==null?void 0:E.map(I=>I==null?void 0:I.name),setTimeout(()=>{var I,N;(N=(I=this.tableData)==null?void 0:I.columns)==null||N.forEach(({name:$})=>{var F,q,J,Q,me,ke;(q=(F=this.columnsWidth)==null?void 0:F[$])!=null&&q.ref&&(this.columnsWidth[$].width=parseInt((ke=(me=(Q=(J=this.columnsWidth)==null?void 0:J[$])==null?void 0:Q.ref)==null?void 0:me.getBoundingClientRect())==null?void 0:ke.width)+"px")})})}catch{}},async getFilters(){var t;try{const{data:e}=await Le.get(`/api/table-filter/${this.table}`);this.filterScheme=(t=e==null?void 0:e.list)==null?void 0:t.map(n=>({...n,label:(n==null?void 0:n.label)||(n==null?void 0:n.ua)}))}catch{}},async handlePageChange(t,e){const n=this.$route.query;this.page=t,this.limit=e,await this.$router.replace({query:{...n,page:t,limit:e}}),await this.getTableData()},async filterChange({url:t,state:e}){var n;this.filters=t!=="no-url"?t:null,this.onFilters=(n=Object.entries(e))==null?void 0:n.length,this.page=1,await this.getTableData()},changeActiveColumn(t){this.activeColumn=t,this.getTableData()},pushToCard(t){var e;((e=this.tableData)==null?void 0:e.card)===!1||this.$router.push(`/card/${this.table}/${t}`)},pushToLinkCard(t,e){t!=null&&t.link&&this.$router.push(`/card/${t==null?void 0:t.link}/${e==null?void 0:e[t==null?void 0:t.name]}`)},changeActiveCardInfo(t){var e;this.isVisibleCardInfo&&this.$router.push({...this.$route,query:{...(e=this.$route)==null?void 0:e.query,card:t}})},toggleCardInfo(){var t;this.isVisibleCardInfo=!this.isVisibleCardInfo,this.isVisibleCardInfo||this.$router.push({...this.$route,query:{...(t=this.$route)==null?void 0:t.query,card:void 0}})},getCustomStyles(t){return[t!=null&&t.link?" text-blue-800 hover:underline decoration-1":"",t!=null&&t.align?` text-${(t==null?void 0:t.align)||"left"}`:"",`text-${(t==null?void 0:t.wrap)||"wrap"}`]}}},uZ={class:"w-[calc(100vw - 320px)] bg-gray-100"},hZ={class:"h-[76px] mt-[15px] flex items-center justify-between mx-[20px] px-[20px] bg-white rounded-xl"},pZ={class:"text-lg font-semibold text-gray-800 dark:text-neutral-200"},fZ={class:"bg-white w-full rounded-xl p-[20px] pr-0"},mZ={class:"flex"},gZ={class:"flex gap-[6px] ml-auto"},yZ={class:"inline-block w-full align-middle"},_Z={class:"sticky top-[-1px] z-[2] bg-white w-full after:absolute after:content-[''] after:block after:w-full after:h-px after:bg-stone-200"},bZ={class:"right-0"},xZ={key:0,class:"w-[70px] sticky right-0 top-0"},vZ={class:"divide-y divide-gray-200 z-[1] relative text-gray-600"},wZ=["onClick"],kZ=["onClick"],EZ=["onClick"],CZ={class:"flex items-center justify-start w-full px-1 py-2"},SZ={class:"w-[200px] md:inline-flex hidden"},TZ={class:"text-sm text-gray-600 dark:text-neutral-400"},AZ={class:"font-semibold text-gray-800 dark:text-neutral-200"},DZ={key:0};function MZ(t,e,n,r,o,d){var Be,Ze,tt,Xe,ot,ue,Ut,wt,$t,an,xn,mn,hn,vn,Dn,In,Hn,Wn,Te,Ke,nt,yt,qt,ln,Vt,Bt,pn,Ce,Vn,Ps,Qt,zn,Rs;const p=a.resolveComponent("AdminCustomButtonAdd"),c=a.resolveComponent("IconPlus"),b=a.resolveComponent("router-link"),k=a.resolveComponent("AdminTableTabs"),E=a.resolveComponent("IconSearch"),C=a.resolveComponent("VsText"),T=a.resolveComponent("AdminTableCustomButtons"),I=a.resolveComponent("AdminTableCustomFilters"),N=a.resolveComponent("AdminTableColumnsHidden"),$=a.resolveComponent("AdminTableExport"),F=a.resolveComponent("AdminTableFilters"),q=a.resolveComponent("IconOpenCard"),J=a.resolveComponent("AdminTableColumn"),Q=a.resolveComponent("AdminComponentIs"),me=a.resolveComponent("AdminTableControl"),ke=a.resolveComponent("AdminTableTotalsList"),Re=a.resolveComponent("AdminNodata"),Ee=a.resolveComponent("AdminTablePagination"),Ve=a.resolveComponent("AdminTableCardInfo");return a.openBlock(),a.createElementBlock("div",uZ,[a.createElementVNode("div",hZ,[a.createElementVNode("h2",pZ,a.toDisplayString(n.title),1),d.isForm?(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},[(Ze=(Be=o.tableData)==null?void 0:Be.slots)!=null&&Ze.addButton?(a.openBlock(),a.createBlock(p,{key:0,slots:(tt=o.tableData)==null?void 0:tt.slots},null,8,["slots"])):(a.openBlock(),a.createBlock(b,{key:1,to:`/add?table=${(ot=(Xe=t.$route)==null?void 0:Xe.params)==null?void 0:ot.catchAll}`,class:a.normalizeClass(`inline-flex items-center px-3 py-2 text-sm font-medium text-white duration-300 bg-${d.color}-700 border border-transparent rounded-lg gap-x-2 hover:bg-${d.color}-800 hover:text-white`)},{default:a.withCtx(()=>[a.createVNode(c,{height:"16",width:"16"}),e[5]||(e[5]=a.createTextVNode(" Додати ",-1))]),_:1,__:[5]},8,["to","class"]))],64)):a.createCommentVNode("",!0)]),a.createElementVNode("div",{style:a.normalizeStyle({height:((ue=t.$adminSettings)==null?void 0:ue.header)===!1?"calc(100vh - 91px)":"calc(100vh - 155px)"}),class:"bg-gray-100 p-[20px] flex pt-[10px] lg:w-[calc(100vw-260px)] w-[100vw]"},[a.createElementVNode("div",fZ,[(wt=(Ut=o.tableData)==null?void 0:Ut.filterState)!=null&&wt.length?(a.openBlock(),a.createBlock(k,{key:0,tabsList:($t=o.tableData)==null?void 0:$t.filterState,filterState:o.filterState,"onUpdate:filterState":e[0]||(e[0]=ut=>o.filterState=ut)},null,8,["tabsList","filterState"])):a.createCommentVNode("",!0),a.createElementVNode("div",mZ,[a.createElementVNode("div",{class:a.normalizeClass([o.isVisibleCardInfo?"w-[calc(100%-360px)]":"w-full"])},[a.createElementVNode("div",{class:a.normalizeClass(["flex sm:grid sm:grid-cols-2 gap-x-2 sm:gap-x-5 mb-[10px] relative",{"pr-[20px]":!o.isVisibleCardInfo}])},[a.createVNode(E,{height:"14",width:"14",class:"absolute top-[10px] left-[14px] text-gray-500 z-[1]"}),a.createVNode(C,{modelValue:o.searchValue,"onUpdate:modelValue":e[1]||(e[1]=ut=>o.searchValue=ut),placeholder:n.search||"Пошук...",clearable:!0,class:"[&>input]:py-[7px] [&>input]:max-h-[36px] [&>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"},null,8,["modelValue","placeholder"]),a.createElementVNode("div",gZ,[(an=o.tableData)!=null&&an.slots?(a.openBlock(),a.createBlock(T,{key:0,data:o.tableData,slots:(xn=o.tableData)==null?void 0:xn.slots},null,8,["data","slots"])):a.createCommentVNode("",!0),(hn=(mn=o.tableData)==null?void 0:mn.filterCustom)!=null&&hn.length?(a.openBlock(),a.createBlock(I,{key:1,customList:(vn=o.tableData)==null?void 0:vn.filterCustom,filterCustom:o.filterCustom,"onUpdate:filterCustom":e[2]||(e[2]=ut=>o.filterCustom=ut)},null,8,["customList","filterCustom"])):a.createCommentVNode("",!0),a.createVNode(N,{columns:(Dn=o.tableData)==null?void 0:Dn.columns,onUpdateColumns:e[3]||(e[3]=ut=>o.tableData.columns=ut)},null,8,["columns"]),((In=o.tableData)==null?void 0:In.export)!==!1?(a.openBlock(),a.createBlock($,{key:2,table:n.table,columns:(Hn=o.tableData)==null?void 0:Hn.columns,page:o.page,"filter-state":o.filterState,"filter-custom":o.filterCustom,filters:o.filters},null,8,["table","columns","page","filter-state","filter-custom","filters"])):a.createCommentVNode("",!0),(Wn=o.filterScheme)!=null&&Wn.length?(a.openBlock(),a.createBlock(F,{key:3,scheme:o.filterScheme,onFilters:o.onFilters,table:n.table,onFilterChange:d.filterChange},null,8,["scheme","onFilters","table","onFilterChange"])):a.createCommentVNode("",!0),a.createElementVNode("button",{onClick:e[4]||(e[4]=(...ut)=>d.toggleCardInfo&&d.toggleCardInfo(...ut)),class:"py-2 px-2.5 max-h-[34px] md:inline-flex hidden items-center gap-x-1.5 text-xs font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},[a.createVNode(q,{class:a.normalizeClass({"rotate-180 duration-300":!o.isVisibleCardInfo})},null,8,["class"])])])],2),a.createElementVNode("div",{class:a.normalizeClass(["flex items-start justify-start w-full space-y-5",{"pr-[20px]":!o.isVisibleCardInfo}])},[a.createElementVNode("div",{style:a.normalizeStyle({height:`calc(100vh - ${((Te=t.$adminSettings)==null?void 0:Te.header)===!1?(nt=(Ke=o.tableData)==null?void 0:Ke.filterState)!=null&&nt.length?330:270:(qt=(yt=o.tableData)==null?void 0:yt.filterState)!=null&&qt.length?380:320}px)`}),class:"overflow-x-auto w-full [&::-webkit-scrollbar]:h-2 [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-stone-100 [&::-webkit-scrollbar-thumb]:bg-stone-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},[a.createElementVNode("div",yZ,[d.isNoData?(a.openBlock(),a.createBlock(Re,{key:1})):(a.openBlock(),a.createElementBlock("table",{key:0,class:a.normalizeClass([d.fontSize,"relative min-w-full my-2 divide-y divide-gray-200 table-fixed w-max dark:divide-neutral-700"])},[a.createElementVNode("thead",_Z,[a.createElementVNode("tr",bZ,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(d.columns,ut=>{var Cr,yi;return a.openBlock(),a.createBlock(J,{key:ut.name,style:a.normalizeStyle({width:((yi=(Cr=o.columnsWidth)==null?void 0:Cr[ut==null?void 0:ut.name])==null?void 0:yi.width)||d.rowWidth(ut==null?void 0:ut.name),textAlign:ut==null?void 0:ut.align,wordBreak:ut==null?void 0:ut.wrap}),data:ut,activeColumn:o.activeColumn,onUpdateRef:br=>{var Mi,Ii;(Ii=(Mi=o.columnsWidth)==null?void 0:Mi[ut==null?void 0:ut.name])!=null&&Ii.ref||(o.columnsWidth[ut.name]={ref:br})},onChangeActive:d.changeActiveColumn},null,8,["style","data","activeColumn","onUpdateRef","onChangeActive"])}),128)),(Vt=(ln=d.getActions)==null?void 0:ln.filter(ut=>ut!=="add"&&ut!=="view"))!=null&&Vt.length?(a.openBlock(),a.createElementBlock("th",xZ)):a.createCommentVNode("",!0)])]),a.createElementVNode("tbody",vZ,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList((Bt=o.tableData)==null?void 0:Bt.rows,(ut,Cr)=>{var yi,br,Mi,Ii,je,ti,pr,ni,Pi,He,Ot,At,xr,Hr;return a.openBlock(),a.createElementBlock("tr",{key:(ut==null?void 0:ut.id)||Cr,class:a.normalizeClass({"bg-gray-100":((br=(yi=t.$route)==null?void 0:yi.query)==null?void 0:br.card)===(ut==null?void 0:ut.id),"odd:bg-gray-50":((Ii=(Mi=t.$route)==null?void 0:Mi.query)==null?void 0:Ii.card)!==(ut==null?void 0:ut.id)})},[a.createElementVNode("td",{class:a.normalizeClass(["px-1 py-2.5 pr-5",[(je=d.columns[0])!=null&&je.align?`text-${((ti=d.columns[0])==null?void 0:ti.align)||"left"}`:""]]),onClick:Et=>d.changeActiveCardInfo(ut==null?void 0:ut.id)},[a.createElementVNode("button",{onClick:Et=>{d.pushToCard(ut==null?void 0:ut.id),d.pushToLinkCard(d.columns[0],ut)},class:a.normalizeClass(["font-medium text-start",[...d.getCustomStyles(d.columns[0]),((pr=this.tableData)==null?void 0:pr.card)===!1?"":` text-${d.color}-800 decoration-2 focus:outline-none focus:underline hover:text-${d.color}-700 hover:underline`]])},[a.createVNode(Q,{row:ut,column:d.columns[0],table:n.table,onUpdateTable:d.getTableData},null,8,["row","column","table","onUpdateTable"])],10,kZ)],10,wZ),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList((ni=d.columns)==null?void 0:ni.slice(1),Et=>(a.openBlock(),a.createElementBlock("td",{onClick:Ri=>{d.changeActiveCardInfo(ut==null?void 0:ut.id),d.pushToLinkCard(Et,ut)},class:a.normalizeClass(["px-1 py-2.5 pr-5",d.getCustomStyles(Et)]),key:Et.name},[a.createVNode(Q,{row:ut,column:Et,table:n.table,onUpdateTable:d.getTableData},null,8,["row","column","table","onUpdateTable"])],10,EZ))),128)),(He=(Pi=d.getActions)==null?void 0:Pi.filter(Et=>Et!=="add"&&Et!=="view"))!=null&&He.length?(a.openBlock(),a.createElementBlock("td",{key:0,class:a.normalizeClass(["text-center sticky right-0 w-[80px] px-[10px]",{"bg-gray-50":((At=(Ot=t.$route)==null?void 0:Ot.query)==null?void 0:At.card)===(ut==null?void 0:ut.id)||!(Cr%2),"bg-white":((Hr=(xr=t.$route)==null?void 0:xr.query)==null?void 0:Hr.card)!==(ut==null?void 0:ut.id)&&Cr%2}])},[a.createVNode(me,{actions:d.getActions,isForm:d.isForm,item:ut,table:n.table,onUpdateTable:d.getTableData},null,8,["actions","isForm","item","table","onUpdateTable"])],2)):a.createCommentVNode("",!0)],2)}),128))]),a.createVNode(ke,{columns:d.columns,agg:(pn=o.tableData)==null?void 0:pn.agg},null,8,["columns","agg"])],2))])],4)],2),a.createElementVNode("div",CZ,[a.createElementVNode("div",SZ,[a.createElementVNode("p",TZ,[a.createElementVNode("span",AZ,[a.createTextVNode(" Об'єктів: "+a.toDisplayString(Intl.NumberFormat("ua").format(o.limit<((Ce=o.tableData)==null?void 0:Ce.filtered)?o.limit:((Vn=o.tableData)==null?void 0:Vn.filtered)||0))+" ",1),o.limit<((Ps=o.tableData)==null?void 0:Ps.filtered)?(a.openBlock(),a.createElementBlock("span",DZ," з "+a.toDisplayString(Intl.NumberFormat("ua").format(((Qt=o.tableData)==null?void 0:Qt.filtered)||0)),1)):a.createCommentVNode("",!0)])])]),Math.ceil((zn=o.tableData)==null?void 0:zn.filtered)>10?(a.openBlock(),a.createBlock(Ee,{key:0,class:"justify-end mr-10","default-page":parseInt(d.defaultPage),total:((Rs=o.tableData)==null?void 0:Rs.filtered)||0,onPageChange:d.handlePageChange,pageSize:parseInt(o.limit),pageSizes:[10,20,50,100]},null,8,["default-page","total","onPageChange","pageSize"])):a.createCommentVNode("",!0)])],2),a.createVNode(a.Transition,{name:"slide-fade"},{default:a.withCtx(()=>{var ut;return[o.isVisibleCardInfo?(a.openBlock(),a.createBlock(Ve,{key:0,table:n.table,columns:(ut=o.tableData)==null?void 0:ut.columns,row:d.activeCardRow},null,8,["table","columns","row"])):a.createCommentVNode("",!0)]}),_:1})])])],4)])}const IZ={components:{AdminTable:Oe(dZ,[["render",MZ],["__scopeId","data-v-ca941f11"]])},data(){return{table:!1,interface:"",search:""}},watch:{$route:{async handler(){ei!=null&&ei.value||await this.getMenu(),await this.checkPageType()},deep:!0},title(t){var e;t&&(document.title=(((e=et.value)==null?void 0:e.titlePrefix)||"")+t)}},async mounted(){await this.checkPageType()},methods:{flattenMenu(t){const e=[];return t.forEach(n=>{n.menu?e.push(...this.flattenMenu(n.menu)):e.push(n)}),e},async checkPageType(){var r,o;const t=this.flattenMenu(ei.value);t!=null&&t.length||this.$router.replace("/404");const e=t==null?void 0:t.find(d=>{var p,c;return(d==null?void 0:d.path)==((c=(p=this.$route)==null?void 0:p.params)==null?void 0:c.catchAll)});this.title=e==null?void 0:e.ua,e||this.$router.replace("/404"),e!=null&&e.component&&this.$router.replace((o=(r=this.$route)==null?void 0:r.params)==null?void 0:o.catchAll);const n=e==null?void 0:e.table;this.table=n||!1,this.search=(e==null?void 0:e.search)||"",!n&&this.getInterface()},async getInterface(){var t,e;try{const{data:n}=await Le.get(`/api/template/interface/${((e=(t=this.$route)==null?void 0:t.params)==null?void 0:e.catchAll)||""}`);this.interface=n||""}catch{this.interface=""}}}},PZ=["innerHTML"];function RZ(t,e,n,r,o,d){const p=a.resolveComponent("AdminTable");return o.table?(a.openBlock(),a.createBlock(p,{key:0,table:o.table,title:t.title,search:o.search},null,8,["table","title","search"])):(a.openBlock(),a.createElementBlock("div",{key:1,class:"w-full bg-gray-50",style:{height:"calc(100vh - 120px)"},innerHTML:o.interface},null,8,PZ))}const NZ=Object.freeze(Object.defineProperty({__proto__:null,default:Oe(IZ,[["render",RZ]])},Symbol.toStringTag,{value:"Module"}));return Mk});
|