@opengis/admin 0.1.25 → 0.1.27
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 +29 -29
- package/config.js +4 -4
- package/dist/{IconSearch-DOCujn58.js → IconSearch-CTjruqP_.js} +1 -1
- package/dist/{add-page-YE2OHATZ.js → add-page-_f-u6pKm.js} +1 -1
- package/dist/{admin-interface-DhsF_Hxe.js → admin-interface-BEGo6Nou.js} +2 -2
- package/dist/{admin-view-QFp8Pseb.js → admin-view-KQUUMduA.js} +3 -3
- package/dist/admin.js +1 -1
- package/dist/admin.umd.cjs +2 -2
- package/dist/{card-page-D5KxxQww.js → card-page-aj2AtGvv.js} +2 -2
- package/dist/{card-view-C3M-hYVC.js → card-view-jKx2Oevk.js} +1 -1
- package/dist/{edit-page-C9nSZC01.js → edit-page-BuolDXZx.js} +1 -1
- package/dist/{import-file-DFHqs_6d.js → import-file-BB530Z8E.js} +9 -9
- package/dist/style.css +1 -1
- package/module/settings/card/admin.roles.table/access.hbs +27 -27
- package/module/settings/card/admin.roles.table/general_info.hbs +16 -16
- package/module/settings/card/admin.roles.table/index.yml +12 -12
- package/module/settings/card/admin.roles.table/users.hbs +27 -27
- package/module/settings/card/admin.routes.table/general_info.hbs +40 -40
- package/module/settings/card/admin.routes.table/index.yml +8 -8
- package/module/settings/card/admin.routes.table/users.hbs +33 -33
- package/module/settings/card/admin.users.table/general_info.hbs +25 -25
- package/module/settings/card/admin.users.table/index.yml +12 -12
- package/module/settings/card/admin.users.table/logs.hbs +30 -30
- package/module/settings/card/admin.users.table/user_roles.hbs +24 -24
- package/module/settings/cls/core.actions.json +13 -13
- 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/users.user_type.json +13 -13
- package/module/settings/form/admin.access.form.json +36 -36
- package/module/settings/form/admin.properties.form.json +15 -15
- package/module/settings/form/admin.roles.form.json +19 -19
- package/module/settings/form/admin.routes.form.json +25 -25
- package/module/settings/form/admin.user_properties.form.json +15 -15
- package/module/settings/form/admin.user_roles.form.json +21 -21
- package/module/settings/form/admin.users.form.json +164 -164
- package/module/settings/form/user.user_roles.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/menu.json +39 -39
- package/module/settings/select/core.roles.json +2 -2
- package/module/settings/select/core.user_uid.sql +1 -1
- package/module/settings/table/admin.access.table.json +77 -77
- package/module/settings/table/admin.properties.table.json +33 -33
- package/module/settings/table/admin.roles.table.json +58 -58
- package/module/settings/table/admin.routes.table.json +55 -55
- package/module/settings/table/admin.user_properties.table.json +28 -28
- package/module/settings/table/admin.user_roles.table.json +66 -66
- package/module/settings/table/admin.users.table.json +125 -125
- package/package.json +66 -66
- package/plugin.js +25 -25
- package/server/helpers/controllers/badge.js +11 -11
- package/server/helpers/controllers/hb.js +2 -2
- package/server/helpers/controllers/map.js +2 -2
- package/server/helpers/controllers/mls.js +2 -2
- package/server/helpers/controllers/vue.js +2 -2
- package/server/helpers/index.mjs +13 -13
- package/server/plugins/docs.js +28 -28
- package/server/plugins/hook.js +161 -161
- package/server/plugins/vite.js +69 -69
- package/server/routes/data/controllers/cardData.js +31 -31
- package/server/routes/data/controllers/funcs/getFilterSQL/index.js +85 -82
- package/server/routes/data/controllers/funcs/getFilterSQL/util/formatValue.js +142 -142
- package/server/routes/data/controllers/funcs/getFilterSQL/util/getCustomQuery.js +13 -13
- package/server/routes/data/controllers/funcs/getFilterSQL/util/getFilterQuery.js +67 -67
- package/server/routes/data/controllers/funcs/getFilterSQL/util/getOptimizedQuery.js +12 -12
- package/server/routes/data/controllers/funcs/getFilterSQL/util/getTableSql.js +34 -34
- package/server/routes/data/controllers/tableData.js +121 -121
- package/server/routes/data/controllers/tableDataId.js +27 -27
- package/server/routes/data/controllers/tableFilter.js +54 -54
- package/server/routes/data/controllers/utils/assignTokens.js +30 -30
- package/server/routes/data/controllers/utils/getColumns.js +21 -21
- package/server/routes/data/index.mjs +10 -10
- package/server/routes/menu/controllers/getMenu.js +33 -33
- package/server/routes/menu/index.mjs +5 -5
- package/server/routes/properties/controllers/admin.properties.get.js +29 -29
- package/server/routes/properties/controllers/user.properties.get.js +34 -34
- package/server/routes/properties/controllers/user.properties.post.js +30 -30
- package/server/routes/properties/funcs/getSettings.js +56 -56
- package/server/routes/properties/funcs/setSettings.js +44 -44
- package/server/routes/properties/funcs/utils/dataInsert.js +26 -26
- package/server/routes/properties/index.mjs +26 -26
- package/server/routes/root.mjs +3 -3
- package/server/routes/templates/controllers/getTemplate.js +14 -14
- package/server/routes/templates/index.mjs +14 -14
- 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/cp_building.form.json +32 -32
- 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/utils.js +8 -8
package/dist/admin.umd.cjs
CHANGED
|
@@ -621,9 +621,9 @@ uniform ${O} ${B} u_${U};
|
|
|
621
621
|
#endif
|
|
622
622
|
`}),staticAttributes:u,staticUniforms:k}}class dc{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(e,a,u,p,m,k,E,T,I){this.context=e;let O=this.boundPaintVertexBuffers.length!==p.length;for(let B=0;!O&&B<p.length;B++)this.boundPaintVertexBuffers[B]!==p[B]&&(O=!0);!this.vao||this.boundProgram!==a||this.boundLayoutVertexBuffer!==u||O||this.boundIndexBuffer!==m||this.boundVertexOffset!==k||this.boundDynamicVertexBuffer!==E||this.boundDynamicVertexBuffer2!==T||this.boundDynamicVertexBuffer3!==I?this.freshBind(a,u,p,m,k,E,T,I):(e.bindVertexArray.set(this.vao),E&&E.bind(),m&&m.dynamicDraw&&m.bind(),T&&T.bind(),I&&I.bind())}freshBind(e,a,u,p,m,k,E,T){const I=e.numAttributes,O=this.context,B=O.gl;this.vao&&this.destroy(),this.vao=O.createVertexArray(),O.bindVertexArray.set(this.vao),this.boundProgram=e,this.boundLayoutVertexBuffer=a,this.boundPaintVertexBuffers=u,this.boundIndexBuffer=p,this.boundVertexOffset=m,this.boundDynamicVertexBuffer=k,this.boundDynamicVertexBuffer2=E,this.boundDynamicVertexBuffer3=T,a.enableAttributes(B,e);for(const U of u)U.enableAttributes(B,e);k&&k.enableAttributes(B,e),E&&E.enableAttributes(B,e),T&&T.enableAttributes(B,e),a.bind(),a.setVertexAttribPointers(B,e,m);for(const U of u)U.bind(),U.setVertexAttribPointers(B,e,m);k&&(k.bind(),k.setVertexAttribPointers(B,e,m)),p&&p.bind(),E&&(E.bind(),E.setVertexAttribPointers(B,e,m)),T&&(T.bind(),T.setVertexAttribPointers(B,e,m)),O.currentNumAttributes=I}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}const pc=(g,e,a,u,p)=>({u_matrix:g,u_texture:0,u_ele_delta:e,u_fog_matrix:a,u_fog_color:u?u.properties.get("fog-color"):h.aM.white,u_fog_ground_blend:u?u.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:u?u.calculateFogBlendOpacity(p):0,u_horizon_color:u?u.properties.get("horizon-color"):h.aM.white,u_horizon_fog_blend:u?u.properties.get("horizon-fog-blend"):1});function to(g){const e=[];for(let a=0;a<g.length;a++){if(g[a]===null)continue;const u=g[a].split(" ");e.push(u.pop())}return e}class fc{constructor(e,a,u,p,m,k){const E=e.gl;this.program=E.createProgram();const T=to(a.staticAttributes),I=u?u.getBinderAttributes():[],O=T.concat(I),B=ss.prelude.staticUniforms?to(ss.prelude.staticUniforms):[],U=a.staticUniforms?to(a.staticUniforms):[],Z=u?u.getBinderUniforms():[],G=B.concat(U).concat(Z),Q=[];for(const xe of G)Q.indexOf(xe)<0&&Q.push(xe);const ne=u?u.defines():[];m&&ne.push("#define OVERDRAW_INSPECTOR;"),k&&ne.push("#define TERRAIN3D;");const re=ne.concat(ss.prelude.fragmentSource,a.fragmentSource).join(`
|
|
623
623
|
`),ae=ne.concat(ss.prelude.vertexSource,a.vertexSource).join(`
|
|
624
|
-
`),X=E.createShader(E.FRAGMENT_SHADER);if(E.isContextLost())return void(this.failedToCreate=!0);if(E.shaderSource(X,re),E.compileShader(X),!E.getShaderParameter(X,E.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${E.getShaderInfoLog(X)}`);E.attachShader(this.program,X);const ue=E.createShader(E.VERTEX_SHADER);if(E.isContextLost())return void(this.failedToCreate=!0);if(E.shaderSource(ue,ae),E.compileShader(ue),!E.getShaderParameter(ue,E.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${E.getShaderInfoLog(ue)}`);E.attachShader(this.program,ue),this.attributes={};const pe={};this.numAttributes=O.length;for(let xe=0;xe<this.numAttributes;xe++)O[xe]&&(E.bindAttribLocation(this.program,xe,O[xe]),this.attributes[O[xe]]=xe);if(E.linkProgram(this.program),!E.getProgramParameter(this.program,E.LINK_STATUS))throw new Error(`Program failed to link: ${E.getProgramInfoLog(this.program)}`);E.deleteShader(ue),E.deleteShader(X);for(let xe=0;xe<Q.length;xe++){const Ce=Q[xe];if(Ce&&!pe[Ce]){const Ae=E.getUniformLocation(this.program,Ce);Ae&&(pe[Ce]=Ae)}}this.fixedUniforms=p(e,pe),this.terrainUniforms=((xe,Ce)=>({u_depth:new h.aH(xe,Ce.u_depth),u_terrain:new h.aH(xe,Ce.u_terrain),u_terrain_dim:new h.aI(xe,Ce.u_terrain_dim),u_terrain_matrix:new h.aJ(xe,Ce.u_terrain_matrix),u_terrain_unpack:new h.aK(xe,Ce.u_terrain_unpack),u_terrain_exaggeration:new h.aI(xe,Ce.u_terrain_exaggeration)}))(e,pe),this.binderUniforms=u?u.getUniforms(e,pe):[]}draw(e,a,u,p,m,k,E,T,I,O,B,U,Z,G,Q,ne,re,ae){const X=e.gl;if(this.failedToCreate)return;if(e.program.set(this.program),e.setDepthMode(u),e.setStencilMode(p),e.setColorMode(m),e.setCullFace(k),T){e.activeTexture.set(X.TEXTURE2),X.bindTexture(X.TEXTURE_2D,T.depthTexture),e.activeTexture.set(X.TEXTURE3),X.bindTexture(X.TEXTURE_2D,T.texture);for(const pe in this.terrainUniforms)this.terrainUniforms[pe].set(T[pe])}for(const pe in this.fixedUniforms)this.fixedUniforms[pe].set(E[pe]);Q&&Q.setUniforms(e,this.binderUniforms,Z,{zoom:G});let ue=0;switch(a){case X.LINES:ue=2;break;case X.TRIANGLES:ue=3;break;case X.LINE_STRIP:ue=1}for(const pe of U.get()){const xe=pe.vaos||(pe.vaos={});(xe[I]||(xe[I]=new dc)).bind(e,this,O,Q?Q.getPaintVertexBuffers():[],B,pe.vertexOffset,ne,re,ae),X.drawElements(a,pe.primitiveLength*ue,X.UNSIGNED_SHORT,pe.primitiveOffset*ue*2)}}}function Wa(g,e,a){const u=1/Rt(a,1,e.transform.tileZoom),p=Math.pow(2,a.tileID.overscaledZ),m=a.tileSize*Math.pow(2,e.transform.tileZoom)/p,k=m*(a.tileID.canonical.x+a.tileID.wrap*p),E=m*a.tileID.canonical.y;return{u_image:0,u_texsize:a.imageAtlasTexture.size,u_scale:[u,g.fromScale,g.toScale],u_fade:g.t,u_pixel_coord_upper:[k>>16,E>>16],u_pixel_coord_lower:[65535&k,65535&E]}}const Qo=(g,e,a,u)=>{const p=e.style.light,m=p.properties.get("position"),k=[m.x,m.y,m.z],E=function(){var I=new h.A(9);return h.A!=Float32Array&&(I[1]=0,I[2]=0,I[3]=0,I[5]=0,I[6]=0,I[7]=0),I[0]=1,I[4]=1,I[8]=1,I}();p.properties.get("anchor")==="viewport"&&function(I,O){var B=Math.sin(O),U=Math.cos(O);I[0]=U,I[1]=B,I[2]=0,I[3]=-B,I[4]=U,I[5]=0,I[6]=0,I[7]=0,I[8]=1}(E,-e.transform.angle),function(I,O,B){var U=O[0],Z=O[1],G=O[2];I[0]=U*B[0]+Z*B[3]+G*B[6],I[1]=U*B[1]+Z*B[4]+G*B[7],I[2]=U*B[2]+Z*B[5]+G*B[8]}(k,k,E);const T=p.properties.get("color");return{u_matrix:g,u_lightpos:k,u_lightintensity:p.properties.get("intensity"),u_lightcolor:[T.r,T.g,T.b],u_vertical_gradient:+a,u_opacity:u}},Ga=(g,e,a,u,p,m,k)=>h.e(Qo(g,e,a,u),Wa(m,e,k),{u_height_factor:-Math.pow(2,p.overscaledZ)/k.tileSize/8}),io=g=>({u_matrix:g}),pu=(g,e,a,u)=>h.e(io(g),Wa(a,e,u)),Zp=(g,e)=>({u_matrix:g,u_world:e}),fu=(g,e,a,u,p)=>h.e(pu(g,e,a,u),{u_world:p}),Wp=(g,e,a,u)=>{const p=g.transform;let m,k;if(u.paint.get("circle-pitch-alignment")==="map"){const E=Rt(a,1,p.zoom);m=!0,k=[E,E]}else m=!1,k=p.pixelsToGLUnits;return{u_camera_to_center_distance:p.cameraToCenterDistance,u_scale_with_map:+(u.paint.get("circle-pitch-scale")==="map"),u_matrix:g.translatePosMatrix(e.posMatrix,a,u.paint.get("circle-translate"),u.paint.get("circle-translate-anchor")),u_pitch_with_map:+m,u_device_pixel_ratio:g.pixelRatio,u_extrude_scale:k}},Ps=(g,e,a)=>({u_matrix:g,u_inv_matrix:e,u_camera_to_center_distance:a.cameraToCenterDistance,u_viewport_size:[a.width,a.height]}),ea=(g,e,a=1)=>({u_matrix:g,u_color:e,u_overlay:0,u_overlay_scale:a}),xn=g=>({u_matrix:g}),bn=(g,e,a,u)=>({u_matrix:g,u_extrude_scale:Rt(e,1,a),u_intensity:u}),Ya=(g,e,a,u)=>{const p=h.H();h.aP(p,0,g.width,g.height,0,0,1);const m=g.context.gl;return{u_matrix:p,u_world:[m.drawingBufferWidth,m.drawingBufferHeight],u_image:a,u_color_ramp:u,u_opacity:e.paint.get("heatmap-opacity")}};function Xa(g,e){const a=Math.pow(2,e.canonical.z),u=e.canonical.y;return[new h.Z(0,u/a).toLngLat().lat,new h.Z(0,(u+1)/a).toLngLat().lat]}const Ka=(g,e,a,u)=>{const p=g.transform;return{u_matrix:yu(g,e,a,u),u_ratio:1/Rt(e,1,p.zoom),u_device_pixel_ratio:g.pixelRatio,u_units_to_pixels:[1/p.pixelsToGLUnits[0],1/p.pixelsToGLUnits[1]]}},mu=(g,e,a,u,p)=>h.e(Ka(g,e,a,p),{u_image:0,u_image_height:u}),no=(g,e,a,u,p)=>{const m=g.transform,k=gu(e,m);return{u_matrix:yu(g,e,a,p),u_texsize:e.imageAtlasTexture.size,u_ratio:1/Rt(e,1,m.zoom),u_device_pixel_ratio:g.pixelRatio,u_image:0,u_scale:[k,u.fromScale,u.toScale],u_fade:u.t,u_units_to_pixels:[1/m.pixelsToGLUnits[0],1/m.pixelsToGLUnits[1]]}},Gp=(g,e,a,u,p,m)=>{const k=g.lineAtlas,E=gu(e,g.transform),T=a.layout.get("line-cap")==="round",I=k.getDash(u.from,T),O=k.getDash(u.to,T),B=I.width*p.fromScale,U=O.width*p.toScale;return h.e(Ka(g,e,a,m),{u_patternscale_a:[E/B,-I.height/2],u_patternscale_b:[E/U,-O.height/2],u_sdfgamma:k.width/(256*Math.min(B,U)*g.pixelRatio)/2,u_image:0,u_tex_y_a:I.y,u_tex_y_b:O.y,u_mix:p.t})};function gu(g,e){return 1/Rt(g,1,e.tileZoom)}function yu(g,e,a,u){return g.translatePosMatrix(u?u.posMatrix:e.tileID.posMatrix,e,a.paint.get("line-translate"),a.paint.get("line-translate-anchor"))}const Yp=(g,e,a,u,p)=>{return{u_matrix:g,u_tl_parent:e,u_scale_parent:a,u_buffer_scale:1,u_fade_t:u.mix,u_opacity:u.opacity*p.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:p.paint.get("raster-brightness-min"),u_brightness_high:p.paint.get("raster-brightness-max"),u_saturation_factor:(k=p.paint.get("raster-saturation"),k>0?1-1/(1.001-k):-k),u_contrast_factor:(m=p.paint.get("raster-contrast"),m>0?1/(1-m):1+m),u_spin_weights:Xp(p.paint.get("raster-hue-rotate"))};var m,k};function Xp(g){g*=Math.PI/180;const e=Math.sin(g),a=Math.cos(g);return[(2*a+1)/3,(-Math.sqrt(3)*e-a+1)/3,(Math.sqrt(3)*e-a+1)/3]}const _u=(g,e,a,u,p,m,k,E,T,I,O,B,U,Z)=>{const G=k.transform;return{u_is_size_zoom_constant:+(g==="constant"||g==="source"),u_is_size_feature_constant:+(g==="constant"||g==="camera"),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:G.cameraToCenterDistance,u_pitch:G.pitch/360*2*Math.PI,u_rotate_symbol:+a,u_aspect_ratio:G.width/G.height,u_fade_change:k.options.fadeDuration?k.symbolFadeChange:1,u_matrix:E,u_label_plane_matrix:T,u_coord_matrix:I,u_is_text:+B,u_pitch_with_map:+u,u_is_along_line:p,u_is_variable_anchor:m,u_texsize:U,u_texture:0,u_translation:O,u_pitched_scale:Z}},ta=(g,e,a,u,p,m,k,E,T,I,O,B,U,Z,G)=>{const Q=k.transform;return h.e(_u(g,e,a,u,p,m,k,E,T,I,O,B,U,G),{u_gamma_scale:u?Math.cos(Q._pitch)*Q.cameraToCenterDistance:1,u_device_pixel_ratio:k.pixelRatio,u_is_halo:+Z})},mc=(g,e,a,u,p,m,k,E,T,I,O,B,U,Z)=>h.e(ta(g,e,a,u,p,m,k,E,T,I,O,!0,B,!0,Z),{u_texsize_icon:U,u_texture_icon:1}),Ja=(g,e,a)=>({u_matrix:g,u_opacity:e,u_color:a}),gc=(g,e,a,u,p,m)=>h.e(function(k,E,T,I){const O=T.imageManager.getPattern(k.from.toString()),B=T.imageManager.getPattern(k.to.toString()),{width:U,height:Z}=T.imageManager.getPixelSize(),G=Math.pow(2,I.tileID.overscaledZ),Q=I.tileSize*Math.pow(2,T.transform.tileZoom)/G,ne=Q*(I.tileID.canonical.x+I.tileID.wrap*G),re=Q*I.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:O.tl,u_pattern_br_a:O.br,u_pattern_tl_b:B.tl,u_pattern_br_b:B.br,u_texsize:[U,Z],u_mix:E.t,u_pattern_size_a:O.displaySize,u_pattern_size_b:B.displaySize,u_scale_a:E.fromScale,u_scale_b:E.toScale,u_tile_units_to_pixels:1/Rt(I,1,T.transform.tileZoom),u_pixel_coord_upper:[ne>>16,re>>16],u_pixel_coord_lower:[65535&ne,65535&re]}}(u,m,a,p),{u_matrix:g,u_opacity:e}),yc={fillExtrusion:(g,e)=>({u_matrix:new h.aJ(g,e.u_matrix),u_lightpos:new h.aN(g,e.u_lightpos),u_lightintensity:new h.aI(g,e.u_lightintensity),u_lightcolor:new h.aN(g,e.u_lightcolor),u_vertical_gradient:new h.aI(g,e.u_vertical_gradient),u_opacity:new h.aI(g,e.u_opacity)}),fillExtrusionPattern:(g,e)=>({u_matrix:new h.aJ(g,e.u_matrix),u_lightpos:new h.aN(g,e.u_lightpos),u_lightintensity:new h.aI(g,e.u_lightintensity),u_lightcolor:new h.aN(g,e.u_lightcolor),u_vertical_gradient:new h.aI(g,e.u_vertical_gradient),u_height_factor:new h.aI(g,e.u_height_factor),u_image:new h.aH(g,e.u_image),u_texsize:new h.aO(g,e.u_texsize),u_pixel_coord_upper:new h.aO(g,e.u_pixel_coord_upper),u_pixel_coord_lower:new h.aO(g,e.u_pixel_coord_lower),u_scale:new h.aN(g,e.u_scale),u_fade:new h.aI(g,e.u_fade),u_opacity:new h.aI(g,e.u_opacity)}),fill:(g,e)=>({u_matrix:new h.aJ(g,e.u_matrix)}),fillPattern:(g,e)=>({u_matrix:new h.aJ(g,e.u_matrix),u_image:new h.aH(g,e.u_image),u_texsize:new h.aO(g,e.u_texsize),u_pixel_coord_upper:new h.aO(g,e.u_pixel_coord_upper),u_pixel_coord_lower:new h.aO(g,e.u_pixel_coord_lower),u_scale:new h.aN(g,e.u_scale),u_fade:new h.aI(g,e.u_fade)}),fillOutline:(g,e)=>({u_matrix:new h.aJ(g,e.u_matrix),u_world:new h.aO(g,e.u_world)}),fillOutlinePattern:(g,e)=>({u_matrix:new h.aJ(g,e.u_matrix),u_world:new h.aO(g,e.u_world),u_image:new h.aH(g,e.u_image),u_texsize:new h.aO(g,e.u_texsize),u_pixel_coord_upper:new h.aO(g,e.u_pixel_coord_upper),u_pixel_coord_lower:new h.aO(g,e.u_pixel_coord_lower),u_scale:new h.aN(g,e.u_scale),u_fade:new h.aI(g,e.u_fade)}),circle:(g,e)=>({u_camera_to_center_distance:new h.aI(g,e.u_camera_to_center_distance),u_scale_with_map:new h.aH(g,e.u_scale_with_map),u_pitch_with_map:new h.aH(g,e.u_pitch_with_map),u_extrude_scale:new h.aO(g,e.u_extrude_scale),u_device_pixel_ratio:new h.aI(g,e.u_device_pixel_ratio),u_matrix:new h.aJ(g,e.u_matrix)}),collisionBox:(g,e)=>({u_matrix:new h.aJ(g,e.u_matrix),u_pixel_extrude_scale:new h.aO(g,e.u_pixel_extrude_scale)}),collisionCircle:(g,e)=>({u_matrix:new h.aJ(g,e.u_matrix),u_inv_matrix:new h.aJ(g,e.u_inv_matrix),u_camera_to_center_distance:new h.aI(g,e.u_camera_to_center_distance),u_viewport_size:new h.aO(g,e.u_viewport_size)}),debug:(g,e)=>({u_color:new h.aL(g,e.u_color),u_matrix:new h.aJ(g,e.u_matrix),u_overlay:new h.aH(g,e.u_overlay),u_overlay_scale:new h.aI(g,e.u_overlay_scale)}),clippingMask:(g,e)=>({u_matrix:new h.aJ(g,e.u_matrix)}),heatmap:(g,e)=>({u_extrude_scale:new h.aI(g,e.u_extrude_scale),u_intensity:new h.aI(g,e.u_intensity),u_matrix:new h.aJ(g,e.u_matrix)}),heatmapTexture:(g,e)=>({u_matrix:new h.aJ(g,e.u_matrix),u_world:new h.aO(g,e.u_world),u_image:new h.aH(g,e.u_image),u_color_ramp:new h.aH(g,e.u_color_ramp),u_opacity:new h.aI(g,e.u_opacity)}),hillshade:(g,e)=>({u_matrix:new h.aJ(g,e.u_matrix),u_image:new h.aH(g,e.u_image),u_latrange:new h.aO(g,e.u_latrange),u_light:new h.aO(g,e.u_light),u_shadow:new h.aL(g,e.u_shadow),u_highlight:new h.aL(g,e.u_highlight),u_accent:new h.aL(g,e.u_accent)}),hillshadePrepare:(g,e)=>({u_matrix:new h.aJ(g,e.u_matrix),u_image:new h.aH(g,e.u_image),u_dimension:new h.aO(g,e.u_dimension),u_zoom:new h.aI(g,e.u_zoom),u_unpack:new h.aK(g,e.u_unpack)}),line:(g,e)=>({u_matrix:new h.aJ(g,e.u_matrix),u_ratio:new h.aI(g,e.u_ratio),u_device_pixel_ratio:new h.aI(g,e.u_device_pixel_ratio),u_units_to_pixels:new h.aO(g,e.u_units_to_pixels)}),lineGradient:(g,e)=>({u_matrix:new h.aJ(g,e.u_matrix),u_ratio:new h.aI(g,e.u_ratio),u_device_pixel_ratio:new h.aI(g,e.u_device_pixel_ratio),u_units_to_pixels:new h.aO(g,e.u_units_to_pixels),u_image:new h.aH(g,e.u_image),u_image_height:new h.aI(g,e.u_image_height)}),linePattern:(g,e)=>({u_matrix:new h.aJ(g,e.u_matrix),u_texsize:new h.aO(g,e.u_texsize),u_ratio:new h.aI(g,e.u_ratio),u_device_pixel_ratio:new h.aI(g,e.u_device_pixel_ratio),u_image:new h.aH(g,e.u_image),u_units_to_pixels:new h.aO(g,e.u_units_to_pixels),u_scale:new h.aN(g,e.u_scale),u_fade:new h.aI(g,e.u_fade)}),lineSDF:(g,e)=>({u_matrix:new h.aJ(g,e.u_matrix),u_ratio:new h.aI(g,e.u_ratio),u_device_pixel_ratio:new h.aI(g,e.u_device_pixel_ratio),u_units_to_pixels:new h.aO(g,e.u_units_to_pixels),u_patternscale_a:new h.aO(g,e.u_patternscale_a),u_patternscale_b:new h.aO(g,e.u_patternscale_b),u_sdfgamma:new h.aI(g,e.u_sdfgamma),u_image:new h.aH(g,e.u_image),u_tex_y_a:new h.aI(g,e.u_tex_y_a),u_tex_y_b:new h.aI(g,e.u_tex_y_b),u_mix:new h.aI(g,e.u_mix)}),raster:(g,e)=>({u_matrix:new h.aJ(g,e.u_matrix),u_tl_parent:new h.aO(g,e.u_tl_parent),u_scale_parent:new h.aI(g,e.u_scale_parent),u_buffer_scale:new h.aI(g,e.u_buffer_scale),u_fade_t:new h.aI(g,e.u_fade_t),u_opacity:new h.aI(g,e.u_opacity),u_image0:new h.aH(g,e.u_image0),u_image1:new h.aH(g,e.u_image1),u_brightness_low:new h.aI(g,e.u_brightness_low),u_brightness_high:new h.aI(g,e.u_brightness_high),u_saturation_factor:new h.aI(g,e.u_saturation_factor),u_contrast_factor:new h.aI(g,e.u_contrast_factor),u_spin_weights:new h.aN(g,e.u_spin_weights)}),symbolIcon:(g,e)=>({u_is_size_zoom_constant:new h.aH(g,e.u_is_size_zoom_constant),u_is_size_feature_constant:new h.aH(g,e.u_is_size_feature_constant),u_size_t:new h.aI(g,e.u_size_t),u_size:new h.aI(g,e.u_size),u_camera_to_center_distance:new h.aI(g,e.u_camera_to_center_distance),u_pitch:new h.aI(g,e.u_pitch),u_rotate_symbol:new h.aH(g,e.u_rotate_symbol),u_aspect_ratio:new h.aI(g,e.u_aspect_ratio),u_fade_change:new h.aI(g,e.u_fade_change),u_matrix:new h.aJ(g,e.u_matrix),u_label_plane_matrix:new h.aJ(g,e.u_label_plane_matrix),u_coord_matrix:new h.aJ(g,e.u_coord_matrix),u_is_text:new h.aH(g,e.u_is_text),u_pitch_with_map:new h.aH(g,e.u_pitch_with_map),u_is_along_line:new h.aH(g,e.u_is_along_line),u_is_variable_anchor:new h.aH(g,e.u_is_variable_anchor),u_texsize:new h.aO(g,e.u_texsize),u_texture:new h.aH(g,e.u_texture),u_translation:new h.aO(g,e.u_translation),u_pitched_scale:new h.aI(g,e.u_pitched_scale)}),symbolSDF:(g,e)=>({u_is_size_zoom_constant:new h.aH(g,e.u_is_size_zoom_constant),u_is_size_feature_constant:new h.aH(g,e.u_is_size_feature_constant),u_size_t:new h.aI(g,e.u_size_t),u_size:new h.aI(g,e.u_size),u_camera_to_center_distance:new h.aI(g,e.u_camera_to_center_distance),u_pitch:new h.aI(g,e.u_pitch),u_rotate_symbol:new h.aH(g,e.u_rotate_symbol),u_aspect_ratio:new h.aI(g,e.u_aspect_ratio),u_fade_change:new h.aI(g,e.u_fade_change),u_matrix:new h.aJ(g,e.u_matrix),u_label_plane_matrix:new h.aJ(g,e.u_label_plane_matrix),u_coord_matrix:new h.aJ(g,e.u_coord_matrix),u_is_text:new h.aH(g,e.u_is_text),u_pitch_with_map:new h.aH(g,e.u_pitch_with_map),u_is_along_line:new h.aH(g,e.u_is_along_line),u_is_variable_anchor:new h.aH(g,e.u_is_variable_anchor),u_texsize:new h.aO(g,e.u_texsize),u_texture:new h.aH(g,e.u_texture),u_gamma_scale:new h.aI(g,e.u_gamma_scale),u_device_pixel_ratio:new h.aI(g,e.u_device_pixel_ratio),u_is_halo:new h.aH(g,e.u_is_halo),u_translation:new h.aO(g,e.u_translation),u_pitched_scale:new h.aI(g,e.u_pitched_scale)}),symbolTextAndIcon:(g,e)=>({u_is_size_zoom_constant:new h.aH(g,e.u_is_size_zoom_constant),u_is_size_feature_constant:new h.aH(g,e.u_is_size_feature_constant),u_size_t:new h.aI(g,e.u_size_t),u_size:new h.aI(g,e.u_size),u_camera_to_center_distance:new h.aI(g,e.u_camera_to_center_distance),u_pitch:new h.aI(g,e.u_pitch),u_rotate_symbol:new h.aH(g,e.u_rotate_symbol),u_aspect_ratio:new h.aI(g,e.u_aspect_ratio),u_fade_change:new h.aI(g,e.u_fade_change),u_matrix:new h.aJ(g,e.u_matrix),u_label_plane_matrix:new h.aJ(g,e.u_label_plane_matrix),u_coord_matrix:new h.aJ(g,e.u_coord_matrix),u_is_text:new h.aH(g,e.u_is_text),u_pitch_with_map:new h.aH(g,e.u_pitch_with_map),u_is_along_line:new h.aH(g,e.u_is_along_line),u_is_variable_anchor:new h.aH(g,e.u_is_variable_anchor),u_texsize:new h.aO(g,e.u_texsize),u_texsize_icon:new h.aO(g,e.u_texsize_icon),u_texture:new h.aH(g,e.u_texture),u_texture_icon:new h.aH(g,e.u_texture_icon),u_gamma_scale:new h.aI(g,e.u_gamma_scale),u_device_pixel_ratio:new h.aI(g,e.u_device_pixel_ratio),u_is_halo:new h.aH(g,e.u_is_halo),u_translation:new h.aO(g,e.u_translation),u_pitched_scale:new h.aI(g,e.u_pitched_scale)}),background:(g,e)=>({u_matrix:new h.aJ(g,e.u_matrix),u_opacity:new h.aI(g,e.u_opacity),u_color:new h.aL(g,e.u_color)}),backgroundPattern:(g,e)=>({u_matrix:new h.aJ(g,e.u_matrix),u_opacity:new h.aI(g,e.u_opacity),u_image:new h.aH(g,e.u_image),u_pattern_tl_a:new h.aO(g,e.u_pattern_tl_a),u_pattern_br_a:new h.aO(g,e.u_pattern_br_a),u_pattern_tl_b:new h.aO(g,e.u_pattern_tl_b),u_pattern_br_b:new h.aO(g,e.u_pattern_br_b),u_texsize:new h.aO(g,e.u_texsize),u_mix:new h.aI(g,e.u_mix),u_pattern_size_a:new h.aO(g,e.u_pattern_size_a),u_pattern_size_b:new h.aO(g,e.u_pattern_size_b),u_scale_a:new h.aI(g,e.u_scale_a),u_scale_b:new h.aI(g,e.u_scale_b),u_pixel_coord_upper:new h.aO(g,e.u_pixel_coord_upper),u_pixel_coord_lower:new h.aO(g,e.u_pixel_coord_lower),u_tile_units_to_pixels:new h.aI(g,e.u_tile_units_to_pixels)}),terrain:(g,e)=>({u_matrix:new h.aJ(g,e.u_matrix),u_texture:new h.aH(g,e.u_texture),u_ele_delta:new h.aI(g,e.u_ele_delta),u_fog_matrix:new h.aJ(g,e.u_fog_matrix),u_fog_color:new h.aL(g,e.u_fog_color),u_fog_ground_blend:new h.aI(g,e.u_fog_ground_blend),u_fog_ground_blend_opacity:new h.aI(g,e.u_fog_ground_blend_opacity),u_horizon_color:new h.aL(g,e.u_horizon_color),u_horizon_fog_blend:new h.aI(g,e.u_horizon_fog_blend)}),terrainDepth:(g,e)=>({u_matrix:new h.aJ(g,e.u_matrix),u_ele_delta:new h.aI(g,e.u_ele_delta)}),terrainCoords:(g,e)=>({u_matrix:new h.aJ(g,e.u_matrix),u_texture:new h.aH(g,e.u_texture),u_terrain_coords_id:new h.aI(g,e.u_terrain_coords_id),u_ele_delta:new h.aI(g,e.u_ele_delta)}),sky:(g,e)=>({u_sky_color:new h.aL(g,e.u_sky_color),u_horizon_color:new h.aL(g,e.u_horizon_color),u_horizon:new h.aI(g,e.u_horizon),u_sky_horizon_blend:new h.aI(g,e.u_sky_horizon_blend)})};class Pr{constructor(e,a,u){this.context=e;const p=e.gl;this.buffer=p.createBuffer(),this.dynamicDraw=!!u,this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),p.bufferData(p.ELEMENT_ARRAY_BUFFER,a.arrayBuffer,this.dynamicDraw?p.DYNAMIC_DRAW:p.STATIC_DRAW),this.dynamicDraw||delete a.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){const a=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),a.bufferSubData(a.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Kp={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class _c{constructor(e,a,u,p){this.length=a.length,this.attributes=u,this.itemSize=a.bytesPerElement,this.dynamicDraw=p,this.context=e;const m=e.gl;this.buffer=m.createBuffer(),e.bindVertexBuffer.set(this.buffer),m.bufferData(m.ARRAY_BUFFER,a.arrayBuffer,this.dynamicDraw?m.DYNAMIC_DRAW:m.STATIC_DRAW),this.dynamicDraw||delete a.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){if(e.length!==this.length)throw new Error(`Length of new data is ${e.length}, which doesn't match current length of ${this.length}`);const a=this.context.gl;this.bind(),a.bufferSubData(a.ARRAY_BUFFER,0,e.arrayBuffer)}enableAttributes(e,a){for(let u=0;u<this.attributes.length;u++){const p=a.attributes[this.attributes[u].name];p!==void 0&&e.enableVertexAttribArray(p)}}setVertexAttribPointers(e,a,u){for(let p=0;p<this.attributes.length;p++){const m=this.attributes[p],k=a.attributes[m.name];k!==void 0&&e.vertexAttribPointer(k,m.components,e[Kp[m.type]],!1,this.itemSize,m.offset+this.itemSize*(u||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Is=new WeakMap;function os(g){var e;if(Is.has(g))return Is.get(g);{const a=(e=g.getParameter(g.VERSION))===null||e===void 0?void 0:e.startsWith("WebGL 2.0");return Is.set(g,a),a}}class Yt{constructor(e){this.gl=e.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(e){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class Qa extends Yt{getDefault(){return h.aM.transparent}set(e){const a=this.current;(e.r!==a.r||e.g!==a.g||e.b!==a.b||e.a!==a.a||this.dirty)&&(this.gl.clearColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class Jp extends Yt{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}}class ro extends Yt{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}}class Qp extends Yt{getDefault(){return[!0,!0,!0,!0]}set(e){const a=this.current;(e[0]!==a[0]||e[1]!==a[1]||e[2]!==a[2]||e[3]!==a[3]||this.dirty)&&(this.gl.colorMask(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class xu extends Yt{getDefault(){return!0}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}}class ef extends Yt{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}}class bu extends Yt{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(e){const a=this.current;(e.func!==a.func||e.ref!==a.ref||e.mask!==a.mask||this.dirty)&&(this.gl.stencilFunc(e.func,e.ref,e.mask),this.current=e,this.dirty=!1)}}class xc extends Yt{getDefault(){const e=this.gl;return[e.KEEP,e.KEEP,e.KEEP]}set(e){const a=this.current;(e[0]!==a[0]||e[1]!==a[1]||e[2]!==a[2]||this.dirty)&&(this.gl.stencilOp(e[0],e[1],e[2]),this.current=e,this.dirty=!1)}}class vu extends Yt{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const a=this.gl;e?a.enable(a.STENCIL_TEST):a.disable(a.STENCIL_TEST),this.current=e,this.dirty=!1}}class wu extends Yt{getDefault(){return[0,1]}set(e){const a=this.current;(e[0]!==a[0]||e[1]!==a[1]||this.dirty)&&(this.gl.depthRange(e[0],e[1]),this.current=e,this.dirty=!1)}}class ku extends Yt{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const a=this.gl;e?a.enable(a.DEPTH_TEST):a.disable(a.DEPTH_TEST),this.current=e,this.dirty=!1}}class Su extends Yt{getDefault(){return this.gl.LESS}set(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}}class As extends Yt{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const a=this.gl;e?a.enable(a.BLEND):a.disable(a.BLEND),this.current=e,this.dirty=!1}}class Eu extends Yt{getDefault(){const e=this.gl;return[e.ONE,e.ZERO]}set(e){const a=this.current;(e[0]!==a[0]||e[1]!==a[1]||this.dirty)&&(this.gl.blendFunc(e[0],e[1]),this.current=e,this.dirty=!1)}}class tf extends Yt{getDefault(){return h.aM.transparent}set(e){const a=this.current;(e.r!==a.r||e.g!==a.g||e.b!==a.b||e.a!==a.a||this.dirty)&&(this.gl.blendColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class Tu extends Yt{getDefault(){return this.gl.FUNC_ADD}set(e){(e!==this.current||this.dirty)&&(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}}class ia extends Yt{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const a=this.gl;e?a.enable(a.CULL_FACE):a.disable(a.CULL_FACE),this.current=e,this.dirty=!1}}class nf extends Yt{getDefault(){return this.gl.BACK}set(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1)}}class el extends Yt{getDefault(){return this.gl.CCW}set(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1)}}class rf extends Yt{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}}class sf extends Yt{getDefault(){return this.gl.TEXTURE0}set(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}}class Cu extends Yt{getDefault(){const e=this.gl;return[0,0,e.drawingBufferWidth,e.drawingBufferHeight]}set(e){const a=this.current;(e[0]!==a[0]||e[1]!==a[1]||e[2]!==a[2]||e[3]!==a[3]||this.dirty)&&(this.gl.viewport(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class Mu extends Yt{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const a=this.gl;a.bindFramebuffer(a.FRAMEBUFFER,e),this.current=e,this.dirty=!1}}class Pu extends Yt{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const a=this.gl;a.bindRenderbuffer(a.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class bc extends Yt{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const a=this.gl;a.bindTexture(a.TEXTURE_2D,e),this.current=e,this.dirty=!1}}class Iu extends Yt{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const a=this.gl;a.bindBuffer(a.ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class tl extends Yt{getDefault(){return null}set(e){const a=this.gl;a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class Ur extends Yt{getDefault(){return null}set(e){var a;if(e===this.current&&!this.dirty)return;const u=this.gl;os(u)?u.bindVertexArray(e):(a=u.getExtension("OES_vertex_array_object"))===null||a===void 0||a.bindVertexArrayOES(e),this.current=e,this.dirty=!1}}class vc extends Yt{getDefault(){return 4}set(e){if(e===this.current&&!this.dirty)return;const a=this.gl;a.pixelStorei(a.UNPACK_ALIGNMENT,e),this.current=e,this.dirty=!1}}class wc extends Yt{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const a=this.gl;a.pixelStorei(a.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e),this.current=e,this.dirty=!1}}class kc extends Yt{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const a=this.gl;a.pixelStorei(a.UNPACK_FLIP_Y_WEBGL,e),this.current=e,this.dirty=!1}}class il extends Yt{constructor(e,a){super(e),this.context=e,this.parent=a}getDefault(){return null}}class Sc extends il{setDirty(){this.dirty=!0}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const a=this.gl;a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}}class Ds extends il{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const a=this.gl;a.framebufferRenderbuffer(a.FRAMEBUFFER,a.DEPTH_ATTACHMENT,a.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class Ec extends il{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const a=this.gl;a.framebufferRenderbuffer(a.FRAMEBUFFER,a.DEPTH_STENCIL_ATTACHMENT,a.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class of{constructor(e,a,u,p,m){this.context=e,this.width=a,this.height=u;const k=e.gl,E=this.framebuffer=k.createFramebuffer();if(this.colorAttachment=new Sc(e,E),p)this.depthAttachment=m?new Ec(e,E):new Ds(e,E);else if(m)throw new Error("Stencil cannot be set without depth");if(k.checkFramebufferStatus(k.FRAMEBUFFER)!==k.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer is not complete")}destroy(){const e=this.context.gl,a=this.colorAttachment.get();if(a&&e.deleteTexture(a),this.depthAttachment){const u=this.depthAttachment.get();u&&e.deleteRenderbuffer(u)}e.deleteFramebuffer(this.framebuffer)}}class Mi{constructor(e,a,u){this.blendFunction=e,this.blendColor=a,this.mask=u}}Mi.Replace=[1,0],Mi.disabled=new Mi(Mi.Replace,h.aM.transparent,[!1,!1,!1,!1]),Mi.unblended=new Mi(Mi.Replace,h.aM.transparent,[!0,!0,!0,!0]),Mi.alphaBlended=new Mi([1,771],h.aM.transparent,[!0,!0,!0,!0]);class af{constructor(e){var a,u;if(this.gl=e,this.clearColor=new Qa(this),this.clearDepth=new Jp(this),this.clearStencil=new ro(this),this.colorMask=new Qp(this),this.depthMask=new xu(this),this.stencilMask=new ef(this),this.stencilFunc=new bu(this),this.stencilOp=new xc(this),this.stencilTest=new vu(this),this.depthRange=new wu(this),this.depthTest=new ku(this),this.depthFunc=new Su(this),this.blend=new As(this),this.blendFunc=new Eu(this),this.blendColor=new tf(this),this.blendEquation=new Tu(this),this.cullFace=new ia(this),this.cullFaceSide=new nf(this),this.frontFace=new el(this),this.program=new rf(this),this.activeTexture=new sf(this),this.viewport=new Cu(this),this.bindFramebuffer=new Mu(this),this.bindRenderbuffer=new Pu(this),this.bindTexture=new bc(this),this.bindVertexBuffer=new Iu(this),this.bindElementBuffer=new tl(this),this.bindVertexArray=new Ur(this),this.pixelStoreUnpack=new vc(this),this.pixelStoreUnpackPremultiplyAlpha=new wc(this),this.pixelStoreUnpackFlipY=new kc(this),this.extTextureFilterAnisotropic=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=e.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE),os(e)){this.HALF_FLOAT=e.HALF_FLOAT;const p=e.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(a=e.RGBA16F)!==null&&a!==void 0?a:p==null?void 0:p.RGBA16F_EXT,this.RGB16F=(u=e.RGB16F)!==null&&u!==void 0?u:p==null?void 0:p.RGB16F_EXT,e.getExtension("EXT_color_buffer_float")}else{e.getExtension("EXT_color_buffer_half_float"),e.getExtension("OES_texture_half_float_linear");const p=e.getExtension("OES_texture_half_float");this.HALF_FLOAT=p==null?void 0:p.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(e,a){return new Pr(this,e,a)}createVertexBuffer(e,a,u){return new _c(this,e,a,u)}createRenderbuffer(e,a,u){const p=this.gl,m=p.createRenderbuffer();return this.bindRenderbuffer.set(m),p.renderbufferStorage(p.RENDERBUFFER,e,a,u),this.bindRenderbuffer.set(null),m}createFramebuffer(e,a,u,p){return new of(this,e,a,u,p)}clear({color:e,depth:a,stencil:u}){const p=this.gl;let m=0;e&&(m|=p.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),a!==void 0&&(m|=p.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(a),this.depthMask.set(!0)),u!==void 0&&(m|=p.STENCIL_BUFFER_BIT,this.clearStencil.set(u),this.stencilMask.set(255)),p.clear(m)}setCullFace(e){e.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(e.mode),this.frontFace.set(e.frontFace))}setDepthMode(e){e.func!==this.gl.ALWAYS||e.mask?(this.depthTest.set(!0),this.depthFunc.set(e.func),this.depthMask.set(e.mask),this.depthRange.set(e.range)):this.depthTest.set(!1)}setStencilMode(e){e.test.func!==this.gl.ALWAYS||e.mask?(this.stencilTest.set(!0),this.stencilMask.set(e.mask),this.stencilOp.set([e.fail,e.depthFail,e.pass]),this.stencilFunc.set({func:e.test.func,ref:e.ref,mask:e.test.mask})):this.stencilTest.set(!1)}setColorMode(e){h.aE(e.blendFunction,Mi.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(e.blendFunction),this.blendColor.set(e.blendColor)),this.colorMask.set(e.mask)}createVertexArray(){var e;return os(this.gl)?this.gl.createVertexArray():(e=this.gl.getExtension("OES_vertex_array_object"))===null||e===void 0?void 0:e.createVertexArrayOES()}deleteVertexArray(e){var a;return os(this.gl)?this.gl.deleteVertexArray(e):(a=this.gl.getExtension("OES_vertex_array_object"))===null||a===void 0?void 0:a.deleteVertexArrayOES(e)}unbindVAO(){this.bindVertexArray.set(null)}}class At{constructor(e,a,u){this.func=e,this.mask=a,this.range=u}}At.ReadOnly=!1,At.ReadWrite=!0,At.disabled=new At(519,At.ReadOnly,[0,1]);const nl=7680;class di{constructor(e,a,u,p,m,k){this.test=e,this.ref=a,this.mask=u,this.fail=p,this.depthFail=m,this.pass=k}}di.disabled=new di({func:519,mask:0},0,0,nl,nl,nl);class oi{constructor(e,a,u){this.enable=e,this.mode=a,this.frontFace=u}}let zs;function na(g,e,a,u,p){const m=g.context,k=m.gl,E=g.useProgram("collisionBox"),T=[];let I=0,O=0;for(let re=0;re<u.length;re++){const ae=u[re],X=e.getTile(ae).getBucket(a);if(!X)continue;const ue=p?X.textCollisionBox:X.iconCollisionBox,pe=X.collisionCircleArray;if(pe.length>0){const xe=h.H();h.aQ(xe,X.placementInvProjMatrix,g.transform.glCoordMatrix),h.aQ(xe,xe,X.placementViewportMatrix),T.push({circleArray:pe,circleOffset:O,transform:ae.posMatrix,invTransform:xe,coord:ae}),I+=pe.length/4,O=I}ue&&E.draw(m,k.LINES,At.disabled,di.disabled,g.colorModeForRenderPass(),oi.disabled,{u_matrix:ae.posMatrix,u_pixel_extrude_scale:[1/(B=g.transform).width,1/B.height]},g.style.map.terrain&&g.style.map.terrain.getTerrainData(ae),a.id,ue.layoutVertexBuffer,ue.indexBuffer,ue.segments,null,g.transform.zoom,null,null,ue.collisionVertexBuffer)}var B;if(!p||!T.length)return;const U=g.useProgram("collisionCircle"),Z=new h.aR;Z.resize(4*I),Z._trim();let G=0;for(const re of T)for(let ae=0;ae<re.circleArray.length/4;ae++){const X=4*ae,ue=re.circleArray[X+0],pe=re.circleArray[X+1],xe=re.circleArray[X+2],Ce=re.circleArray[X+3];Z.emplace(G++,ue,pe,xe,Ce,0),Z.emplace(G++,ue,pe,xe,Ce,1),Z.emplace(G++,ue,pe,xe,Ce,2),Z.emplace(G++,ue,pe,xe,Ce,3)}(!zs||zs.length<2*I)&&(zs=function(re){const ae=2*re,X=new h.aT;X.resize(ae),X._trim();for(let ue=0;ue<ae;ue++){const pe=6*ue;X.uint16[pe+0]=4*ue+0,X.uint16[pe+1]=4*ue+1,X.uint16[pe+2]=4*ue+2,X.uint16[pe+3]=4*ue+2,X.uint16[pe+4]=4*ue+3,X.uint16[pe+5]=4*ue+0}return X}(I));const Q=m.createIndexBuffer(zs,!0),ne=m.createVertexBuffer(Z,h.aS.members,!0);for(const re of T){const ae=Ps(re.transform,re.invTransform,g.transform);U.draw(m,k.TRIANGLES,At.disabled,di.disabled,g.colorModeForRenderPass(),oi.disabled,ae,g.style.map.terrain&&g.style.map.terrain.getTerrainData(re.coord),a.id,ne,Q,h.a0.simpleSegment(0,2*re.circleOffset,re.circleArray.length,re.circleArray.length/2),null,g.transform.zoom,null,null,null)}ne.destroy(),Q.destroy()}oi.disabled=new oi(!1,1029,2305),oi.backCCW=new oi(!0,1029,2305);const ra=h.an(new Float32Array(16));function Tc(g,e,a,u,p,m){const{horizontalAlign:k,verticalAlign:E}=h.au(g);return new h.P((-(k-.5)*e/p+u[0])*m,(-(E-.5)*a/p+u[1])*m)}function Ls(g,e,a,u,p,m){const k=e.tileAnchorPoint.add(new h.P(e.translation[0],e.translation[1]));if(e.pitchWithMap){let E=u.mult(m);a||(E=E.rotate(-p));const T=k.add(E);return te(T.x,T.y,e.labelPlaneMatrix,e.getElevation).point}if(a){const E=ke(e.tileAnchorPoint.x+1,e.tileAnchorPoint.y,e).point.sub(g),T=Math.atan(E.y/E.x)+(E.x<0?Math.PI:0);return g.add(u.rotate(T))}return g.add(u)}function so(g,e,a,u,p,m,k,E,T,I,O,B,U,Z){const G=g.text.placedSymbolArray,Q=g.text.dynamicLayoutVertexArray,ne=g.icon.dynamicLayoutVertexArray,re={};Q.clear();for(let ae=0;ae<G.length;ae++){const X=G.get(ae),ue=X.hidden||!X.crossTileID||g.allowVerticalPlacement&&!X.placedOrientation?null:u[X.crossTileID];if(ue){const pe=new h.P(X.anchorX,X.anchorY),xe={getElevation:Z,width:p.width,height:p.height,labelPlaneMatrix:m,lineVertexArray:null,pitchWithMap:a,projection:O,projectionCache:null,tileAnchorPoint:pe,translation:B,unwrappedTileID:U},Ce=a?te(pe.x,pe.y,k,Z):ke(pe.x,pe.y,xe),Ae=$(p.cameraToCenterDistance,Ce.signedDistanceFromCamera);let $e=h.ai(g.textSizeData,T,X)*Ae/h.ap;a&&($e*=g.tilePixelRatio/E);const{width:We,height:Oe,anchor:Re,textOffset:et,textBoxScale:bt}=ue,Fe=Tc(Re,We,Oe,et,bt,$e),Ue=O.getPitchedTextCorrection(p,pe.add(new h.P(B[0],B[1])),U),yt=Ls(Ce.point,xe,e,Fe,p.angle,Ue),gi=g.allowVerticalPlacement&&X.placedOrientation===h.ah.vertical?Math.PI/2:0;for(let Ct=0;Ct<X.numGlyphs;Ct++)h.aj(Q,yt,gi);I&&X.associatedIconIndex>=0&&(re[X.associatedIconIndex]={shiftedAnchor:yt,angle:gi})}else ct(X.numGlyphs,Q)}if(I){ne.clear();const ae=g.icon.placedSymbolArray;for(let X=0;X<ae.length;X++){const ue=ae.get(X);if(ue.hidden)ct(ue.numGlyphs,ne);else{const pe=re[X];if(pe)for(let xe=0;xe<ue.numGlyphs;xe++)h.aj(ne,pe.shiftedAnchor,pe.angle);else ct(ue.numGlyphs,ne)}}g.icon.dynamicLayoutVertexBuffer.updateData(ne)}g.text.dynamicLayoutVertexBuffer.updateData(Q)}function Wn(g,e,a){return a.iconsInText&&e?"symbolTextAndIcon":g?"symbolSDF":"symbolIcon"}function Cc(g,e,a,u,p,m,k,E,T,I,O,B){const U=g.context,Z=U.gl,G=g.transform,Q=Cs(),ne=E==="map",re=T==="map",ae=E!=="viewport"&&a.layout.get("symbol-placement")!=="point",X=ne&&!re&&!ae,ue=!re&&ae,pe=!a.layout.get("symbol-sort-key").isConstant();let xe=!1;const Ce=g.depthModeForSublayer(0,At.ReadOnly),Ae=a._unevaluatedLayout.hasValue("text-variable-anchor")||a._unevaluatedLayout.hasValue("text-variable-anchor-offset"),$e=[],We=Q.getCircleRadiusCorrection(G);for(const Oe of u){const Re=e.getTile(Oe),et=Re.getBucket(a);if(!et)continue;const bt=p?et.text:et.icon;if(!bt||!bt.segments.get().length||!bt.hasVisibleVertices)continue;const Fe=bt.programConfigurations.get(a.id),Ue=p||et.sdfIcons,yt=p?et.textSizeData:et.iconSizeData,gi=re||G.pitch!==0,Ct=g.useProgram(Wn(Ue,p,et),Fe),Ot=h.ag(yt,G.zoom),yi=g.style.map.terrain&&g.style.map.terrain.getTerrainData(Oe);let Qi,hr,_i,vn,un=[0,0],en=null;if(p)hr=Re.glyphAtlasTexture,_i=Z.LINEAR,Qi=Re.glyphAtlasTexture.size,et.iconsInText&&(un=Re.imageAtlasTexture.size,en=Re.imageAtlasTexture,vn=gi||g.options.rotating||g.options.zooming||yt.kind==="composite"||yt.kind==="camera"?Z.LINEAR:Z.NEAREST);else{const Ft=a.layout.get("icon-size").constantOr(0)!==1||et.iconsNeedLinear;hr=Re.imageAtlasTexture,_i=Ue||g.options.rotating||g.options.zooming||Ft||gi?Z.LINEAR:Z.NEAREST,Qi=Re.imageAtlasTexture.size}const dn=Rt(Re,1,g.transform.zoom),Dr=ue?Oe.posMatrix:ra,wo=rs(Dr,re,ne,g.transform,dn),wl=Mr(Dr,re,ne,g.transform,dn),ko=Mr(Oe.posMatrix,re,ne,g.transform,dn),Xn=Q.translatePosition(g.transform,Re,m,k),kl=Ae&&et.hasTextData(),Jc=a.layout.get("icon-text-fit")!=="none"&&kl&&et.hasIconData();if(ae){const Ft=g.style.map.terrain?(So,Eo)=>g.style.map.terrain.getElevation(Oe,So,Eo):null,Ns=a.layout.get("text-rotation-alignment")==="map";W(et,Oe.posMatrix,g,p,wo,ko,re,I,Ns,Q,Oe.toUnwrapped(),G.width,G.height,Xn,Ft)}const Kn=Oe.posMatrix,Jn=p&&Ae||Jc,as=ae||Jn?ra:wo,ur=wl,Gi=Ue&&a.paint.get(p?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let tn;tn=Ue?et.iconsInText?mc(yt.kind,Ot,X,re,ae,Jn,g,Kn,as,ur,Xn,Qi,un,We):ta(yt.kind,Ot,X,re,ae,Jn,g,Kn,as,ur,Xn,p,Qi,!0,We):_u(yt.kind,Ot,X,re,ae,Jn,g,Kn,as,ur,Xn,p,Qi,We);const On={program:Ct,buffers:bt,uniformValues:tn,atlasTexture:hr,atlasTextureIcon:en,atlasInterpolation:_i,atlasInterpolationIcon:vn,isSDF:Ue,hasHalo:Gi};if(pe&&et.canOverlap){xe=!0;const Ft=bt.segments.get();for(const Ns of Ft)$e.push({segments:new h.a0([Ns]),sortKey:Ns.sortKey,state:On,terrainData:yi})}else $e.push({segments:bt.segments,sortKey:0,state:On,terrainData:yi})}xe&&$e.sort((Oe,Re)=>Oe.sortKey-Re.sortKey);for(const Oe of $e){const Re=Oe.state;if(U.activeTexture.set(Z.TEXTURE0),Re.atlasTexture.bind(Re.atlasInterpolation,Z.CLAMP_TO_EDGE),Re.atlasTextureIcon&&(U.activeTexture.set(Z.TEXTURE1),Re.atlasTextureIcon&&Re.atlasTextureIcon.bind(Re.atlasInterpolationIcon,Z.CLAMP_TO_EDGE)),Re.isSDF){const et=Re.uniformValues;Re.hasHalo&&(et.u_is_halo=1,Mc(Re.buffers,Oe.segments,a,g,Re.program,Ce,O,B,et,Oe.terrainData)),et.u_is_halo=0}Mc(Re.buffers,Oe.segments,a,g,Re.program,Ce,O,B,Re.uniformValues,Oe.terrainData)}}function Mc(g,e,a,u,p,m,k,E,T,I){const O=u.context;p.draw(O,O.gl.TRIANGLES,m,k,E,oi.disabled,T,I,a.id,g.layoutVertexBuffer,g.indexBuffer,e,a.paint,u.transform.zoom,g.programConfigurations.get(a.id),g.dynamicLayoutVertexBuffer,g.opacityVertexBuffer)}function Pc(g,e,a,u){const p=g.context,m=p.gl,k=di.disabled,E=new Mi([m.ONE,m.ONE],h.aM.transparent,[!0,!0,!0,!0]),T=e.getBucket(a);if(!T)return;const I=u.key;let O=a.heatmapFbos.get(I);O||(O=sa(p,e.tileSize,e.tileSize),a.heatmapFbos.set(I,O)),p.bindFramebuffer.set(O.framebuffer),p.viewport.set([0,0,e.tileSize,e.tileSize]),p.clear({color:h.aM.transparent});const B=T.programConfigurations.get(a.id),U=g.useProgram("heatmap",B),Z=g.style.map.terrain.getTerrainData(u);U.draw(p,m.TRIANGLES,At.disabled,k,E,oi.disabled,bn(u.posMatrix,e,g.transform.zoom,a.paint.get("heatmap-intensity")),Z,a.id,T.layoutVertexBuffer,T.indexBuffer,T.segments,a.paint,g.transform.zoom,B)}function Rs(g,e,a){const u=g.context,p=u.gl;u.setColorMode(g.colorModeForRenderPass());const m=oa(u,e),k=a.key,E=e.heatmapFbos.get(k);E&&(u.activeTexture.set(p.TEXTURE0),p.bindTexture(p.TEXTURE_2D,E.colorAttachment.get()),u.activeTexture.set(p.TEXTURE1),m.bind(p.LINEAR,p.CLAMP_TO_EDGE),g.useProgram("heatmapTexture").draw(u,p.TRIANGLES,At.disabled,di.disabled,g.colorModeForRenderPass(),oi.disabled,Ya(g,e,0,1),null,e.id,g.rasterBoundsBuffer,g.quadTriangleIndexBuffer,g.rasterBoundsSegments,e.paint,g.transform.zoom),E.destroy(),e.heatmapFbos.delete(k))}function sa(g,e,a){var u,p;const m=g.gl,k=m.createTexture();m.bindTexture(m.TEXTURE_2D,k),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_S,m.CLAMP_TO_EDGE),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_T,m.CLAMP_TO_EDGE),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MIN_FILTER,m.LINEAR),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MAG_FILTER,m.LINEAR);const E=(u=g.HALF_FLOAT)!==null&&u!==void 0?u:m.UNSIGNED_BYTE,T=(p=g.RGBA16F)!==null&&p!==void 0?p:m.RGBA;m.texImage2D(m.TEXTURE_2D,0,T,e,a,0,m.RGBA,E,null);const I=g.createFramebuffer(e,a,!1,!1);return I.colorAttachment.set(k),I}function oa(g,e){return e.colorRampTexture||(e.colorRampTexture=new Et(g,e.colorRamp,g.gl.RGBA)),e.colorRampTexture}function oo(g,e,a,u,p){if(!a||!u||!u.imageAtlas)return;const m=u.imageAtlas.patternPositions;let k=m[a.to.toString()],E=m[a.from.toString()];if(!k&&E&&(k=E),!E&&k&&(E=k),!k||!E){const T=p.getPaintProperty(e);k=m[T],E=m[T]}k&&E&&g.setConstantPatternPositions(k,E)}function aa(g,e,a,u,p,m,k){const E=g.context.gl,T="fill-pattern",I=a.paint.get(T),O=I&&I.constantOr(1),B=a.getCrossfadeParameters();let U,Z,G,Q,ne;k?(Z=O&&!a.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",U=E.LINES):(Z=O?"fillPattern":"fill",U=E.TRIANGLES);const re=I.constantOr(null);for(const ae of u){const X=e.getTile(ae);if(O&&!X.patternsLoaded())continue;const ue=X.getBucket(a);if(!ue)continue;const pe=ue.programConfigurations.get(a.id),xe=g.useProgram(Z,pe),Ce=g.style.map.terrain&&g.style.map.terrain.getTerrainData(ae);O&&(g.context.activeTexture.set(E.TEXTURE0),X.imageAtlasTexture.bind(E.LINEAR,E.CLAMP_TO_EDGE),pe.updatePaintBuffers(B)),oo(pe,T,re,X,a);const Ae=Ce?ae:null,$e=g.translatePosMatrix(Ae?Ae.posMatrix:ae.posMatrix,X,a.paint.get("fill-translate"),a.paint.get("fill-translate-anchor"));if(k){Q=ue.indexBuffer2,ne=ue.segments2;const We=[E.drawingBufferWidth,E.drawingBufferHeight];G=Z==="fillOutlinePattern"&&O?fu($e,g,B,X,We):Zp($e,We)}else Q=ue.indexBuffer,ne=ue.segments,G=O?pu($e,g,B,X):io($e);xe.draw(g.context,U,p,g.stencilModeForClipping(ae),m,oi.disabled,G,Ce,a.id,ue.layoutVertexBuffer,Q,ne,a.paint,g.transform.zoom,pe)}}function rl(g,e,a,u,p,m,k){const E=g.context,T=E.gl,I="fill-extrusion-pattern",O=a.paint.get(I),B=O.constantOr(1),U=a.getCrossfadeParameters(),Z=a.paint.get("fill-extrusion-opacity"),G=O.constantOr(null);for(const Q of u){const ne=e.getTile(Q),re=ne.getBucket(a);if(!re)continue;const ae=g.style.map.terrain&&g.style.map.terrain.getTerrainData(Q),X=re.programConfigurations.get(a.id),ue=g.useProgram(B?"fillExtrusionPattern":"fillExtrusion",X);B&&(g.context.activeTexture.set(T.TEXTURE0),ne.imageAtlasTexture.bind(T.LINEAR,T.CLAMP_TO_EDGE),X.updatePaintBuffers(U)),oo(X,I,G,ne,a);const pe=g.translatePosMatrix(Q.posMatrix,ne,a.paint.get("fill-extrusion-translate"),a.paint.get("fill-extrusion-translate-anchor")),xe=a.paint.get("fill-extrusion-vertical-gradient"),Ce=B?Ga(pe,g,xe,Z,Q,U,ne):Qo(pe,g,xe,Z);ue.draw(E,E.gl.TRIANGLES,p,m,k,oi.backCCW,Ce,ae,a.id,re.layoutVertexBuffer,re.indexBuffer,re.segments,a.paint,g.transform.zoom,X,g.style.map.terrain&&re.centroidVertexBuffer)}}function ao(g,e,a,u,p,m,k){const E=g.context,T=E.gl,I=a.fbo;if(!I)return;const O=g.useProgram("hillshade"),B=g.style.map.terrain&&g.style.map.terrain.getTerrainData(e);E.activeTexture.set(T.TEXTURE0),T.bindTexture(T.TEXTURE_2D,I.colorAttachment.get()),O.draw(E,T.TRIANGLES,p,m,k,oi.disabled,((U,Z,G,Q)=>{const ne=G.paint.get("hillshade-shadow-color"),re=G.paint.get("hillshade-highlight-color"),ae=G.paint.get("hillshade-accent-color");let X=G.paint.get("hillshade-illumination-direction")*(Math.PI/180);G.paint.get("hillshade-illumination-anchor")==="viewport"&&(X-=U.transform.angle);const ue=!U.options.moving;return{u_matrix:Q?Q.posMatrix:U.transform.calculatePosMatrix(Z.tileID.toUnwrapped(),ue),u_image:0,u_latrange:Xa(0,Z.tileID),u_light:[G.paint.get("hillshade-exaggeration"),X],u_shadow:ne,u_highlight:re,u_accent:ae}})(g,a,u,B?e:null),B,u.id,g.rasterBoundsBuffer,g.quadTriangleIndexBuffer,g.rasterBoundsSegments)}function lo(g,e,a,u,p,m){const k=g.context,E=k.gl,T=e.dem;if(T&&T.data){const I=T.dim,O=T.stride,B=T.getPixels();if(k.activeTexture.set(E.TEXTURE1),k.pixelStoreUnpackPremultiplyAlpha.set(!1),e.demTexture=e.demTexture||g.getTileTexture(O),e.demTexture){const Z=e.demTexture;Z.update(B,{premultiply:!1}),Z.bind(E.NEAREST,E.CLAMP_TO_EDGE)}else e.demTexture=new Et(k,B,E.RGBA,{premultiply:!1}),e.demTexture.bind(E.NEAREST,E.CLAMP_TO_EDGE);k.activeTexture.set(E.TEXTURE0);let U=e.fbo;if(!U){const Z=new Et(k,{width:I,height:I,data:null},E.RGBA);Z.bind(E.LINEAR,E.CLAMP_TO_EDGE),U=e.fbo=k.createFramebuffer(I,I,!0,!1),U.colorAttachment.set(Z.texture)}k.bindFramebuffer.set(U.framebuffer),k.viewport.set([0,0,I,I]),g.useProgram("hillshadePrepare").draw(k,E.TRIANGLES,u,p,m,oi.disabled,((Z,G)=>{const Q=G.stride,ne=h.H();return h.aP(ne,0,h.X,-h.X,0,0,1),h.J(ne,ne,[0,-h.X,0]),{u_matrix:ne,u_image:1,u_dimension:[Q,Q],u_zoom:Z.overscaledZ,u_unpack:G.getUnpackVector()}})(e.tileID,T),null,a.id,g.rasterBoundsBuffer,g.quadTriangleIndexBuffer,g.rasterBoundsSegments),e.needsHillshadePrepare=!1}}function Au(g,e,a,u,p,m){const k=u.paint.get("raster-fade-duration");if(!m&&k>0){const E=z.now(),T=(E-g.timeAdded)/k,I=e?(E-e.timeAdded)/k:-1,O=a.getSource(),B=p.coveringZoomLevel({tileSize:O.tileSize,roundZoom:O.roundZoom}),U=!e||Math.abs(e.tileID.overscaledZ-B)>Math.abs(g.tileID.overscaledZ-B),Z=U&&g.refreshedUponExpiration?1:h.ac(U?T:1-I,0,1);return g.refreshedUponExpiration&&T>=1&&(g.refreshedUponExpiration=!1),e?{opacity:1,mix:1-Z}:{opacity:Z,mix:0}}return{opacity:1,mix:0}}const Ic=new h.aM(1,0,0,1),Ht=new h.aM(0,1,0,1),sl=new h.aM(0,0,1,1),lf=new h.aM(1,0,1,1),Du=new h.aM(0,1,1,1);function co(g,e,a,u){ol(g,0,e+a/2,g.transform.width,a,u)}function zu(g,e,a,u){ol(g,e-a/2,0,a,g.transform.height,u)}function ol(g,e,a,u,p,m){const k=g.context,E=k.gl;E.enable(E.SCISSOR_TEST),E.scissor(e*g.pixelRatio,a*g.pixelRatio,u*g.pixelRatio,p*g.pixelRatio),k.clear({color:m}),E.disable(E.SCISSOR_TEST)}function Lu(g,e,a){const u=g.context,p=u.gl,m=a.posMatrix,k=g.useProgram("debug"),E=At.disabled,T=di.disabled,I=g.colorModeForRenderPass(),O="$debug",B=g.style.map.terrain&&g.style.map.terrain.getTerrainData(a);u.activeTexture.set(p.TEXTURE0);const U=e.getTileByID(a.key).latestRawTileData,Z=Math.floor((U&&U.byteLength||0)/1024),G=e.getTile(a).tileSize,Q=512/Math.min(G,512)*(a.overscaledZ/g.transform.zoom)*.5;let ne=a.canonical.toString();a.overscaledZ!==a.canonical.z&&(ne+=` => ${a.overscaledZ}`),function(re,ae){re.initDebugOverlayCanvas();const X=re.debugOverlayCanvas,ue=re.context.gl,pe=re.debugOverlayCanvas.getContext("2d");pe.clearRect(0,0,X.width,X.height),pe.shadowColor="white",pe.shadowBlur=2,pe.lineWidth=1.5,pe.strokeStyle="white",pe.textBaseline="top",pe.font="bold 36px Open Sans, sans-serif",pe.fillText(ae,5,5),pe.strokeText(ae,5,5),re.debugOverlayTexture.update(X),re.debugOverlayTexture.bind(ue.LINEAR,ue.CLAMP_TO_EDGE)}(g,`${ne} ${Z}kB`),k.draw(u,p.TRIANGLES,E,T,Mi.alphaBlended,oi.disabled,ea(m,h.aM.transparent,Q),null,O,g.debugBuffer,g.quadTriangleIndexBuffer,g.debugSegments),k.draw(u,p.LINE_STRIP,E,T,I,oi.disabled,ea(m,h.aM.red),B,O,g.debugBuffer,g.tileBorderIndexBuffer,g.debugSegments)}function Ru(g,e,a){const u=g.context,p=u.gl,m=g.colorModeForRenderPass(),k=new At(p.LEQUAL,At.ReadWrite,g.depthRangeFor3D),E=g.useProgram("terrain"),T=e.getTerrainMesh();u.bindFramebuffer.set(null),u.viewport.set([0,0,g.width,g.height]);for(const I of a){const O=g.renderToTexture.getTexture(I),B=e.getTerrainData(I.tileID);u.activeTexture.set(p.TEXTURE0),p.bindTexture(p.TEXTURE_2D,O.texture);const U=g.transform.calculatePosMatrix(I.tileID.toUnwrapped()),Z=e.getMeshFrameDelta(g.transform.zoom),G=g.transform.calculateFogMatrix(I.tileID.toUnwrapped()),Q=pc(U,Z,G,g.style.sky,g.transform.pitch);E.draw(u,p.TRIANGLES,k,di.disabled,m,oi.backCCW,Q,B,"terrain",T.vertexBuffer,T.indexBuffer,T.segments)}}class al{constructor(e,a,u){this.vertexBuffer=e,this.indexBuffer=a,this.segments=u}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}class ll{constructor(e,a){this.context=new af(e),this.transform=a,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:h.an(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=ft.maxUnderzooming+ft.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new uc}resize(e,a,u){if(this.width=Math.floor(e*u),this.height=Math.floor(a*u),this.pixelRatio=u,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const p of this.style._order)this.style._layers[p].resize()}setup(){const e=this.context,a=new h.aX;a.emplaceBack(0,0),a.emplaceBack(h.X,0),a.emplaceBack(0,h.X),a.emplaceBack(h.X,h.X),this.tileExtentBuffer=e.createVertexBuffer(a,Ms.members),this.tileExtentSegments=h.a0.simpleSegment(0,0,4,2);const u=new h.aX;u.emplaceBack(0,0),u.emplaceBack(h.X,0),u.emplaceBack(0,h.X),u.emplaceBack(h.X,h.X),this.debugBuffer=e.createVertexBuffer(u,Ms.members),this.debugSegments=h.a0.simpleSegment(0,0,4,5);const p=new h.$;p.emplaceBack(0,0,0,0),p.emplaceBack(h.X,0,h.X,0),p.emplaceBack(0,h.X,0,h.X),p.emplaceBack(h.X,h.X,h.X,h.X),this.rasterBoundsBuffer=e.createVertexBuffer(p,is.members),this.rasterBoundsSegments=h.a0.simpleSegment(0,0,4,2);const m=new h.aX;m.emplaceBack(0,0),m.emplaceBack(1,0),m.emplaceBack(0,1),m.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(m,Ms.members),this.viewportSegments=h.a0.simpleSegment(0,0,4,2);const k=new h.aZ;k.emplaceBack(0),k.emplaceBack(1),k.emplaceBack(3),k.emplaceBack(2),k.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(k);const E=new h.aY;E.emplaceBack(0,1,2),E.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(E);const T=this.context.gl;this.stencilClearMode=new di({func:T.ALWAYS,mask:0},0,255,T.ZERO,T.ZERO,T.ZERO)}clearStencil(){const e=this.context,a=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const u=h.H();h.aP(u,0,this.width,this.height,0,0,1),h.K(u,u,[a.drawingBufferWidth,a.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(e,a.TRIANGLES,At.disabled,this.stencilClearMode,Mi.disabled,oi.disabled,xn(u),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(e,a){if(this.currentStencilSource===e.source||!e.isTileClipped()||!a||!a.length)return;this.currentStencilSource=e.source;const u=this.context,p=u.gl;this.nextStencilID+a.length>256&&this.clearStencil(),u.setColorMode(Mi.disabled),u.setDepthMode(At.disabled);const m=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const k of a){const E=this._tileClippingMaskIDs[k.key]=this.nextStencilID++,T=this.style.map.terrain&&this.style.map.terrain.getTerrainData(k);m.draw(u,p.TRIANGLES,At.disabled,new di({func:p.ALWAYS,mask:0},E,255,p.KEEP,p.KEEP,p.REPLACE),Mi.disabled,oi.disabled,xn(k.posMatrix),T,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const e=this.nextStencilID++,a=this.context.gl;return new di({func:a.NOTEQUAL,mask:255},e,255,a.KEEP,a.KEEP,a.REPLACE)}stencilModeForClipping(e){const a=this.context.gl;return new di({func:a.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,a.KEEP,a.KEEP,a.REPLACE)}stencilConfigForOverlap(e){const a=this.context.gl,u=e.sort((k,E)=>E.overscaledZ-k.overscaledZ),p=u[u.length-1].overscaledZ,m=u[0].overscaledZ-p+1;if(m>1){this.currentStencilSource=void 0,this.nextStencilID+m>256&&this.clearStencil();const k={};for(let E=0;E<m;E++)k[E+p]=new di({func:a.GEQUAL,mask:255},E+this.nextStencilID,255,a.KEEP,a.KEEP,a.REPLACE);return this.nextStencilID+=m,[k,u]}return[{[p]:di.disabled},u]}colorModeForRenderPass(){const e=this.context.gl;return this._showOverdrawInspector?new Mi([e.CONSTANT_COLOR,e.ONE],new h.aM(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Mi.unblended:Mi.alphaBlended}depthModeForSublayer(e,a,u){if(!this.opaquePassEnabledForLayer())return At.disabled;const p=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new At(u||this.context.gl.LEQUAL,a,[p,p])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(e,a){this.style=e,this.options=a,this.lineAtlas=e.lineAtlas,this.imageManager=e.imageManager,this.glyphManager=e.glyphManager,this.symbolFadeChange=e.placement.symbolFadeChange(z.now()),this.imageManager.beginFrame();const u=this.style._order,p=this.style.sourceCaches,m={},k={},E={};for(const T in p){const I=p[T];I.used&&I.prepare(this.context),m[T]=I.getVisibleCoordinates(),k[T]=m[T].slice().reverse(),E[T]=I.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let T=0;T<u.length;T++)if(this.style._layers[u[T]].is3D()){this.opaquePassCutoff=T;break}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const T of u){const I=this.style._layers[T];if(!I.hasOffscreenPass()||I.isHidden(this.transform.zoom))continue;const O=k[I.source];(I.type==="custom"||O.length)&&this.renderLayer(this,p[I.source],I,O)}if(this.context.bindFramebuffer.set(null),this.context.clear({color:a.showOverdrawInspector?h.aM.black:h.aM.transparent,depth:1}),this.clearStencil(),this.style.sky&&function(T,I){const O=T.context,B=O.gl,U=((re,ae,X)=>({u_sky_color:re.properties.get("sky-color"),u_horizon_color:re.properties.get("horizon-color"),u_horizon:(ae.height/2+ae.getHorizon())*X,u_sky_horizon_blend:re.properties.get("sky-horizon-blend")*ae.height/2*X}))(I,T.style.map.transform,T.pixelRatio),Z=new At(B.LEQUAL,At.ReadWrite,[0,1]),G=di.disabled,Q=T.colorModeForRenderPass(),ne=T.useProgram("sky");if(!I.mesh){const re=new h.aX;re.emplaceBack(-1,-1),re.emplaceBack(1,-1),re.emplaceBack(1,1),re.emplaceBack(-1,1);const ae=new h.aY;ae.emplaceBack(0,1,2),ae.emplaceBack(0,2,3),I.mesh=new al(O.createVertexBuffer(re,Ms.members),O.createIndexBuffer(ae),h.a0.simpleSegment(0,0,re.length,ae.length))}ne.draw(O,B.TRIANGLES,Z,G,Q,oi.disabled,U,void 0,"sky",I.mesh.vertexBuffer,I.mesh.indexBuffer,I.mesh.segments)}(this,this.style.sky),this._showOverdrawInspector=a.showOverdrawInspector,this.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=u.length-1;this.currentLayer>=0;this.currentLayer--){const T=this.style._layers[u[this.currentLayer]],I=p[T.source],O=m[T.source];this._renderTileClippingMasks(T,O),this.renderLayer(this,I,T,O)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<u.length;this.currentLayer++){const T=this.style._layers[u[this.currentLayer]],I=p[T.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(T))continue;const O=(T.type==="symbol"?E:k)[T.source];this._renderTileClippingMasks(T,m[T.source]),this.renderLayer(this,I,T,O)}if(this.options.showTileBoundaries){const T=function(I,O){let B=null;const U=Object.values(I._layers).flatMap(ne=>ne.source&&!ne.isHidden(O)?[I.sourceCaches[ne.source]]:[]),Z=U.filter(ne=>ne.getSource().type==="vector"),G=U.filter(ne=>ne.getSource().type!=="vector"),Q=ne=>{(!B||B.getSource().maxzoom<ne.getSource().maxzoom)&&(B=ne)};return Z.forEach(ne=>Q(ne)),B||G.forEach(ne=>Q(ne)),B}(this.style,this.transform.zoom);T&&function(I,O,B){for(let U=0;U<B.length;U++)Lu(I,O,B[U])}(this,T,T.getVisibleCoordinates())}this.options.showPadding&&function(T){const I=T.transform.padding;co(T,T.transform.height-(I.top||0),3,Ic),co(T,I.bottom||0,3,Ht),zu(T,I.left||0,3,sl),zu(T,T.transform.width-(I.right||0),3,lf);const O=T.transform.centerPoint;(function(B,U,Z,G){ol(B,U-1,Z-10,2,20,G),ol(B,U-10,Z-1,20,2,G)})(T,O.x,T.transform.height-O.y,Du)}(this),this.context.setDefault()}maybeDrawDepthAndCoords(e){if(!this.style||!this.style.map||!this.style.map.terrain)return;const a=this.terrainFacilitator.matrix,u=this.transform.modelViewProjectionMatrix;let p=this.terrainFacilitator.dirty;p||(p=e?!h.a_(a,u):!h.a$(a,u)),p||(p=this.style.map.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime).length>0),p&&(h.b0(a,u),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(m,k){const E=m.context,T=E.gl,I=Mi.unblended,O=new At(T.LEQUAL,At.ReadWrite,[0,1]),B=k.getTerrainMesh(),U=k.sourceCache.getRenderableTiles(),Z=m.useProgram("terrainDepth");E.bindFramebuffer.set(k.getFramebuffer("depth").framebuffer),E.viewport.set([0,0,m.width/devicePixelRatio,m.height/devicePixelRatio]),E.clear({color:h.aM.transparent,depth:1});for(const G of U){const Q=k.getTerrainData(G.tileID),ne={u_matrix:m.transform.calculatePosMatrix(G.tileID.toUnwrapped()),u_ele_delta:k.getMeshFrameDelta(m.transform.zoom)};Z.draw(E,T.TRIANGLES,O,di.disabled,I,oi.backCCW,ne,Q,"terrain",B.vertexBuffer,B.indexBuffer,B.segments)}E.bindFramebuffer.set(null),E.viewport.set([0,0,m.width,m.height])}(this,this.style.map.terrain),function(m,k){const E=m.context,T=E.gl,I=Mi.unblended,O=new At(T.LEQUAL,At.ReadWrite,[0,1]),B=k.getTerrainMesh(),U=k.getCoordsTexture(),Z=k.sourceCache.getRenderableTiles(),G=m.useProgram("terrainCoords");E.bindFramebuffer.set(k.getFramebuffer("coords").framebuffer),E.viewport.set([0,0,m.width/devicePixelRatio,m.height/devicePixelRatio]),E.clear({color:h.aM.transparent,depth:1}),k.coordsIndex=[];for(const Q of Z){const ne=k.getTerrainData(Q.tileID);E.activeTexture.set(T.TEXTURE0),T.bindTexture(T.TEXTURE_2D,U.texture);const re={u_matrix:m.transform.calculatePosMatrix(Q.tileID.toUnwrapped()),u_terrain_coords_id:(255-k.coordsIndex.length)/255,u_texture:0,u_ele_delta:k.getMeshFrameDelta(m.transform.zoom)};G.draw(E,T.TRIANGLES,O,di.disabled,I,oi.backCCW,re,ne,"terrain",B.vertexBuffer,B.indexBuffer,B.segments),k.coordsIndex.push(Q.tileID.key)}E.bindFramebuffer.set(null),E.viewport.set([0,0,m.width,m.height])}(this,this.style.map.terrain))}renderLayer(e,a,u,p){if(!u.isHidden(this.transform.zoom)&&(u.type==="background"||u.type==="custom"||(p||[]).length))switch(this.id=u.id,u.type){case"symbol":(function(m,k,E,T,I){if(m.renderPass!=="translucent")return;const O=di.disabled,B=m.colorModeForRenderPass();(E._unevaluatedLayout.hasValue("text-variable-anchor")||E._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(U,Z,G,Q,ne,re,ae,X,ue){const pe=Z.transform,xe=Cs(),Ce=ne==="map",Ae=re==="map";for(const $e of U){const We=Q.getTile($e),Oe=We.getBucket(G);if(!Oe||!Oe.text||!Oe.text.segments.get().length)continue;const Re=h.ag(Oe.textSizeData,pe.zoom),et=Rt(We,1,Z.transform.zoom),bt=rs($e.posMatrix,Ae,Ce,Z.transform,et),Fe=G.layout.get("icon-text-fit")!=="none"&&Oe.hasIconData();if(Re){const Ue=Math.pow(2,pe.zoom-We.tileID.overscaledZ),yt=Z.style.map.terrain?(Ct,Ot)=>Z.style.map.terrain.getElevation($e,Ct,Ot):null,gi=xe.translatePosition(pe,We,ae,X);so(Oe,Ce,Ae,ue,pe,bt,$e.posMatrix,Ue,Re,Fe,xe,gi,$e.toUnwrapped(),yt)}}}(T,m,E,k,E.layout.get("text-rotation-alignment"),E.layout.get("text-pitch-alignment"),E.paint.get("text-translate"),E.paint.get("text-translate-anchor"),I),E.paint.get("icon-opacity").constantOr(1)!==0&&Cc(m,k,E,T,!1,E.paint.get("icon-translate"),E.paint.get("icon-translate-anchor"),E.layout.get("icon-rotation-alignment"),E.layout.get("icon-pitch-alignment"),E.layout.get("icon-keep-upright"),O,B),E.paint.get("text-opacity").constantOr(1)!==0&&Cc(m,k,E,T,!0,E.paint.get("text-translate"),E.paint.get("text-translate-anchor"),E.layout.get("text-rotation-alignment"),E.layout.get("text-pitch-alignment"),E.layout.get("text-keep-upright"),O,B),k.map.showCollisionBoxes&&(na(m,k,E,T,!0),na(m,k,E,T,!1))})(e,a,u,p,this.style.placement.variableOffsets);break;case"circle":(function(m,k,E,T){if(m.renderPass!=="translucent")return;const I=E.paint.get("circle-opacity"),O=E.paint.get("circle-stroke-width"),B=E.paint.get("circle-stroke-opacity"),U=!E.layout.get("circle-sort-key").isConstant();if(I.constantOr(1)===0&&(O.constantOr(1)===0||B.constantOr(1)===0))return;const Z=m.context,G=Z.gl,Q=m.depthModeForSublayer(0,At.ReadOnly),ne=di.disabled,re=m.colorModeForRenderPass(),ae=[];for(let X=0;X<T.length;X++){const ue=T[X],pe=k.getTile(ue),xe=pe.getBucket(E);if(!xe)continue;const Ce=xe.programConfigurations.get(E.id),Ae=m.useProgram("circle",Ce),$e=xe.layoutVertexBuffer,We=xe.indexBuffer,Oe=m.style.map.terrain&&m.style.map.terrain.getTerrainData(ue),Re={programConfiguration:Ce,program:Ae,layoutVertexBuffer:$e,indexBuffer:We,uniformValues:Wp(m,ue,pe,E),terrainData:Oe};if(U){const et=xe.segments.get();for(const bt of et)ae.push({segments:new h.a0([bt]),sortKey:bt.sortKey,state:Re})}else ae.push({segments:xe.segments,sortKey:0,state:Re})}U&&ae.sort((X,ue)=>X.sortKey-ue.sortKey);for(const X of ae){const{programConfiguration:ue,program:pe,layoutVertexBuffer:xe,indexBuffer:Ce,uniformValues:Ae,terrainData:$e}=X.state;pe.draw(Z,G.TRIANGLES,Q,ne,re,oi.disabled,Ae,$e,E.id,xe,Ce,X.segments,E.paint,m.transform.zoom,ue)}})(e,a,u,p);break;case"heatmap":(function(m,k,E,T){if(E.paint.get("heatmap-opacity")===0)return;const I=m.context;if(m.style.map.terrain){for(const O of T){const B=k.getTile(O);k.hasRenderableParent(O)||(m.renderPass==="offscreen"?Pc(m,B,E,O):m.renderPass==="translucent"&&Rs(m,E,O))}I.viewport.set([0,0,m.width,m.height])}else m.renderPass==="offscreen"?function(O,B,U,Z){const G=O.context,Q=G.gl,ne=di.disabled,re=new Mi([Q.ONE,Q.ONE],h.aM.transparent,[!0,!0,!0,!0]);(function(ae,X,ue){const pe=ae.gl;ae.activeTexture.set(pe.TEXTURE1),ae.viewport.set([0,0,X.width/4,X.height/4]);let xe=ue.heatmapFbos.get(h.aU);xe?(pe.bindTexture(pe.TEXTURE_2D,xe.colorAttachment.get()),ae.bindFramebuffer.set(xe.framebuffer)):(xe=sa(ae,X.width/4,X.height/4),ue.heatmapFbos.set(h.aU,xe))})(G,O,U),G.clear({color:h.aM.transparent});for(let ae=0;ae<Z.length;ae++){const X=Z[ae];if(B.hasRenderableParent(X))continue;const ue=B.getTile(X),pe=ue.getBucket(U);if(!pe)continue;const xe=pe.programConfigurations.get(U.id),Ce=O.useProgram("heatmap",xe),{zoom:Ae}=O.transform;Ce.draw(G,Q.TRIANGLES,At.disabled,ne,re,oi.disabled,bn(X.posMatrix,ue,Ae,U.paint.get("heatmap-intensity")),null,U.id,pe.layoutVertexBuffer,pe.indexBuffer,pe.segments,U.paint,O.transform.zoom,xe)}G.viewport.set([0,0,O.width,O.height])}(m,k,E,T):m.renderPass==="translucent"&&function(O,B){const U=O.context,Z=U.gl;U.setColorMode(O.colorModeForRenderPass());const G=B.heatmapFbos.get(h.aU);G&&(U.activeTexture.set(Z.TEXTURE0),Z.bindTexture(Z.TEXTURE_2D,G.colorAttachment.get()),U.activeTexture.set(Z.TEXTURE1),oa(U,B).bind(Z.LINEAR,Z.CLAMP_TO_EDGE),O.useProgram("heatmapTexture").draw(U,Z.TRIANGLES,At.disabled,di.disabled,O.colorModeForRenderPass(),oi.disabled,Ya(O,B,0,1),null,B.id,O.viewportBuffer,O.quadTriangleIndexBuffer,O.viewportSegments,B.paint,O.transform.zoom))}(m,E)})(e,a,u,p);break;case"line":(function(m,k,E,T){if(m.renderPass!=="translucent")return;const I=E.paint.get("line-opacity"),O=E.paint.get("line-width");if(I.constantOr(1)===0||O.constantOr(1)===0)return;const B=m.depthModeForSublayer(0,At.ReadOnly),U=m.colorModeForRenderPass(),Z=E.paint.get("line-dasharray"),G=E.paint.get("line-pattern"),Q=G.constantOr(1),ne=E.paint.get("line-gradient"),re=E.getCrossfadeParameters(),ae=Q?"linePattern":Z?"lineSDF":ne?"lineGradient":"line",X=m.context,ue=X.gl;let pe=!0;for(const xe of T){const Ce=k.getTile(xe);if(Q&&!Ce.patternsLoaded())continue;const Ae=Ce.getBucket(E);if(!Ae)continue;const $e=Ae.programConfigurations.get(E.id),We=m.context.program.get(),Oe=m.useProgram(ae,$e),Re=pe||Oe.program!==We,et=m.style.map.terrain&&m.style.map.terrain.getTerrainData(xe),bt=G.constantOr(null);if(bt&&Ce.imageAtlas){const yt=Ce.imageAtlas,gi=yt.patternPositions[bt.to.toString()],Ct=yt.patternPositions[bt.from.toString()];gi&&Ct&&$e.setConstantPatternPositions(gi,Ct)}const Fe=et?xe:null,Ue=Q?no(m,Ce,E,re,Fe):Z?Gp(m,Ce,E,Z,re,Fe):ne?mu(m,Ce,E,Ae.lineClipsArray.length,Fe):Ka(m,Ce,E,Fe);if(Q)X.activeTexture.set(ue.TEXTURE0),Ce.imageAtlasTexture.bind(ue.LINEAR,ue.CLAMP_TO_EDGE),$e.updatePaintBuffers(re);else if(Z&&(Re||m.lineAtlas.dirty))X.activeTexture.set(ue.TEXTURE0),m.lineAtlas.bind(X);else if(ne){const yt=Ae.gradients[E.id];let gi=yt.texture;if(E.gradientVersion!==yt.version){let Ct=256;if(E.stepInterpolant){const Ot=k.getSource().maxzoom,yi=xe.canonical.z===Ot?Math.ceil(1<<m.transform.maxZoom-xe.canonical.z):1;Ct=h.ac(h.aV(Ae.maxLineLength/h.X*1024*yi),256,X.maxTextureSize)}yt.gradient=h.aW({expression:E.gradientExpression(),evaluationKey:"lineProgress",resolution:Ct,image:yt.gradient||void 0,clips:Ae.lineClipsArray}),yt.texture?yt.texture.update(yt.gradient):yt.texture=new Et(X,yt.gradient,ue.RGBA),yt.version=E.gradientVersion,gi=yt.texture}X.activeTexture.set(ue.TEXTURE0),gi.bind(E.stepInterpolant?ue.NEAREST:ue.LINEAR,ue.CLAMP_TO_EDGE)}Oe.draw(X,ue.TRIANGLES,B,m.stencilModeForClipping(xe),U,oi.disabled,Ue,et,E.id,Ae.layoutVertexBuffer,Ae.indexBuffer,Ae.segments,E.paint,m.transform.zoom,$e,Ae.layoutVertexBuffer2),pe=!1}})(e,a,u,p);break;case"fill":(function(m,k,E,T){const I=E.paint.get("fill-color"),O=E.paint.get("fill-opacity");if(O.constantOr(1)===0)return;const B=m.colorModeForRenderPass(),U=E.paint.get("fill-pattern"),Z=m.opaquePassEnabledForLayer()&&!U.constantOr(1)&&I.constantOr(h.aM.transparent).a===1&&O.constantOr(0)===1?"opaque":"translucent";if(m.renderPass===Z){const G=m.depthModeForSublayer(1,m.renderPass==="opaque"?At.ReadWrite:At.ReadOnly);aa(m,k,E,T,G,B,!1)}if(m.renderPass==="translucent"&&E.paint.get("fill-antialias")){const G=m.depthModeForSublayer(E.getPaintProperty("fill-outline-color")?2:0,At.ReadOnly);aa(m,k,E,T,G,B,!0)}})(e,a,u,p);break;case"fill-extrusion":(function(m,k,E,T){const I=E.paint.get("fill-extrusion-opacity");if(I!==0&&m.renderPass==="translucent"){const O=new At(m.context.gl.LEQUAL,At.ReadWrite,m.depthRangeFor3D);if(I!==1||E.paint.get("fill-extrusion-pattern").constantOr(1))rl(m,k,E,T,O,di.disabled,Mi.disabled),rl(m,k,E,T,O,m.stencilModeFor3D(),m.colorModeForRenderPass());else{const B=m.colorModeForRenderPass();rl(m,k,E,T,O,di.disabled,B)}}})(e,a,u,p);break;case"hillshade":(function(m,k,E,T){if(m.renderPass!=="offscreen"&&m.renderPass!=="translucent")return;const I=m.context,O=m.depthModeForSublayer(0,At.ReadOnly),B=m.colorModeForRenderPass(),[U,Z]=m.renderPass==="translucent"?m.stencilConfigForOverlap(T):[{},T];for(const G of Z){const Q=k.getTile(G);Q.needsHillshadePrepare!==void 0&&Q.needsHillshadePrepare&&m.renderPass==="offscreen"?lo(m,Q,E,O,di.disabled,B):m.renderPass==="translucent"&&ao(m,G,Q,E,O,U[G.overscaledZ],B)}I.viewport.set([0,0,m.width,m.height])})(e,a,u,p);break;case"raster":(function(m,k,E,T){if(m.renderPass!=="translucent"||E.paint.get("raster-opacity")===0||!T.length)return;const I=m.context,O=I.gl,B=k.getSource(),U=m.useProgram("raster"),Z=m.colorModeForRenderPass(),[G,Q]=B instanceof $r?[{},T]:m.stencilConfigForOverlap(T),ne=Q[Q.length-1].overscaledZ,re=!m.options.moving;for(const ae of Q){const X=m.depthModeForSublayer(ae.overscaledZ-ne,E.paint.get("raster-opacity")===1?At.ReadWrite:At.ReadOnly,O.LESS),ue=k.getTile(ae);ue.registerFadeDuration(E.paint.get("raster-fade-duration"));const pe=k.findLoadedParent(ae,0),xe=k.findLoadedSibling(ae),Ce=Au(ue,pe||xe||null,k,E,m.transform,m.style.map.terrain);let Ae,$e;const We=E.paint.get("raster-resampling")==="nearest"?O.NEAREST:O.LINEAR;I.activeTexture.set(O.TEXTURE0),ue.texture.bind(We,O.CLAMP_TO_EDGE,O.LINEAR_MIPMAP_NEAREST),I.activeTexture.set(O.TEXTURE1),pe?(pe.texture.bind(We,O.CLAMP_TO_EDGE,O.LINEAR_MIPMAP_NEAREST),Ae=Math.pow(2,pe.tileID.overscaledZ-ue.tileID.overscaledZ),$e=[ue.tileID.canonical.x*Ae%1,ue.tileID.canonical.y*Ae%1]):ue.texture.bind(We,O.CLAMP_TO_EDGE,O.LINEAR_MIPMAP_NEAREST),ue.texture.useMipmap&&I.extTextureFilterAnisotropic&&m.transform.pitch>20&&O.texParameterf(O.TEXTURE_2D,I.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,I.extTextureFilterAnisotropicMax);const Oe=m.style.map.terrain&&m.style.map.terrain.getTerrainData(ae),Re=Oe?ae:null,et=Re?Re.posMatrix:m.transform.calculatePosMatrix(ae.toUnwrapped(),re),bt=Yp(et,$e||[0,0],Ae||1,Ce,E);B instanceof $r?U.draw(I,O.TRIANGLES,X,di.disabled,Z,oi.disabled,bt,Oe,E.id,B.boundsBuffer,m.quadTriangleIndexBuffer,B.boundsSegments):U.draw(I,O.TRIANGLES,X,G[ae.overscaledZ],Z,oi.disabled,bt,Oe,E.id,m.rasterBoundsBuffer,m.quadTriangleIndexBuffer,m.rasterBoundsSegments)}})(e,a,u,p);break;case"background":(function(m,k,E,T){const I=E.paint.get("background-color"),O=E.paint.get("background-opacity");if(O===0)return;const B=m.context,U=B.gl,Z=m.transform,G=Z.tileSize,Q=E.paint.get("background-pattern");if(m.isPatternMissing(Q))return;const ne=!Q&&I.a===1&&O===1&&m.opaquePassEnabledForLayer()?"opaque":"translucent";if(m.renderPass!==ne)return;const re=di.disabled,ae=m.depthModeForSublayer(0,ne==="opaque"?At.ReadWrite:At.ReadOnly),X=m.colorModeForRenderPass(),ue=m.useProgram(Q?"backgroundPattern":"background"),pe=T||Z.coveringTiles({tileSize:G,terrain:m.style.map.terrain});Q&&(B.activeTexture.set(U.TEXTURE0),m.imageManager.bind(m.context));const xe=E.getCrossfadeParameters();for(const Ce of pe){const Ae=T?Ce.posMatrix:m.transform.calculatePosMatrix(Ce.toUnwrapped()),$e=Q?gc(Ae,O,m,Q,{tileID:Ce,tileSize:G},xe):Ja(Ae,O,I),We=m.style.map.terrain&&m.style.map.terrain.getTerrainData(Ce);ue.draw(B,U.TRIANGLES,ae,re,X,oi.disabled,$e,We,E.id,m.tileExtentBuffer,m.quadTriangleIndexBuffer,m.tileExtentSegments)}})(e,0,u,p);break;case"custom":(function(m,k,E){const T=m.context,I=E.implementation;if(m.renderPass==="offscreen"){const O=I.prerender;O&&(m.setCustomLayerDefaults(),T.setColorMode(m.colorModeForRenderPass()),O.call(I,T.gl,m.transform.customLayerMatrix()),T.setDirty(),m.setBaseState())}else if(m.renderPass==="translucent"){m.setCustomLayerDefaults(),T.setColorMode(m.colorModeForRenderPass()),T.setStencilMode(di.disabled);const O=I.renderingMode==="3d"?new At(m.context.gl.LEQUAL,At.ReadWrite,m.depthRangeFor3D):m.depthModeForSublayer(0,At.ReadOnly);T.setDepthMode(O),I.render(T.gl,m.transform.customLayerMatrix(),{farZ:m.transform.farZ,nearZ:m.transform.nearZ,fov:m.transform._fov,modelViewProjectionMatrix:m.transform.modelViewProjectionMatrix,projectionMatrix:m.transform.projectionMatrix}),T.setDirty(),m.setBaseState(),T.bindFramebuffer.set(null)}})(e,0,u)}}translatePosMatrix(e,a,u,p,m){if(!u[0]&&!u[1])return e;const k=m?p==="map"?this.transform.angle:0:p==="viewport"?-this.transform.angle:0;if(k){const I=Math.sin(k),O=Math.cos(k);u=[u[0]*O-u[1]*I,u[0]*I+u[1]*O]}const E=[m?u[0]:Rt(a,u[0],this.transform.zoom),m?u[1]:Rt(a,u[1],this.transform.zoom),0],T=new Float32Array(16);return h.J(T,e,E),T}saveTileTexture(e){const a=this._tileTextures[e.size[0]];a?a.push(e):this._tileTextures[e.size[0]]=[e]}getTileTexture(e){const a=this._tileTextures[e];return a&&a.length>0?a.pop():null}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;const a=this.imageManager.getPattern(e.from.toString()),u=this.imageManager.getPattern(e.to.toString());return!a||!u}useProgram(e,a){this.cache=this.cache||{};const u=e+(a?a.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[u]||(this.cache[u]=new fc(this.context,ss[e],a,yc[e],this._showOverdrawInspector,this.style.map.terrain)),this.cache[u]}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 e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new Et(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:e,drawingBufferHeight:a}=this.context.gl;return this.width!==e||this.height!==a}}class ho{constructor(e,a){this.points=e,this.planes=a}static fromInvProjectionMatrix(e,a,u){const p=Math.pow(2,u),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(E=>{const T=1/(E=h.af([],E,e))[3]/a*p;return h.b1(E,E,[T,T,1/E[3],T])}),k=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(E=>{const T=function(U,Z){var G=Z[0],Q=Z[1],ne=Z[2],re=G*G+Q*Q+ne*ne;return re>0&&(re=1/Math.sqrt(re)),U[0]=Z[0]*re,U[1]=Z[1]*re,U[2]=Z[2]*re,U}([],function(U,Z,G){var Q=Z[0],ne=Z[1],re=Z[2],ae=G[0],X=G[1],ue=G[2];return U[0]=ne*ue-re*X,U[1]=re*ae-Q*ue,U[2]=Q*X-ne*ae,U}([],Ve([],m[E[0]],m[E[1]]),Ve([],m[E[2]],m[E[1]]))),I=-((O=T)[0]*(B=m[E[1]])[0]+O[1]*B[1]+O[2]*B[2]);var O,B;return T.concat(I)});return new ho(m,k)}}class uo{constructor(e,a){this.min=e,this.max=a,this.center=function(u,p,m){return u[0]=.5*p[0],u[1]=.5*p[1],u[2]=.5*p[2],u}([],function(u,p,m){return u[0]=p[0]+m[0],u[1]=p[1]+m[1],u[2]=p[2]+m[2],u}([],this.min,this.max))}quadrant(e){const a=[e%2==0,e<2],u=tt(this.min),p=tt(this.max);for(let m=0;m<a.length;m++)u[m]=a[m]?this.min[m]:this.center[m],p[m]=a[m]?this.center[m]:this.max[m];return p[2]=this.max[2],new uo(u,p)}distanceX(e){return Math.max(Math.min(this.max[0],e[0]),this.min[0])-e[0]}distanceY(e){return Math.max(Math.min(this.max[1],e[1]),this.min[1])-e[1]}intersects(e){const a=[[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 u=!0;for(let p=0;p<e.planes.length;p++){const m=e.planes[p];let k=0;for(let E=0;E<a.length;E++)h.b2(m,a[E])>=0&&k++;if(k===0)return 0;k!==a.length&&(u=!1)}if(u)return 2;for(let p=0;p<3;p++){let m=Number.MAX_VALUE,k=-Number.MAX_VALUE;for(let E=0;E<e.points.length;E++){const T=e.points[E][p]-this.min[p];m=Math.min(m,T),k=Math.max(k,T)}if(k<0||m>this.max[p]-this.min[p])return 0}return 1}}class po{constructor(e=0,a=0,u=0,p=0){if(isNaN(e)||e<0||isNaN(a)||a<0||isNaN(u)||u<0||isNaN(p)||p<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=e,this.bottom=a,this.left=u,this.right=p}interpolate(e,a,u){return a.top!=null&&e.top!=null&&(this.top=h.y.number(e.top,a.top,u)),a.bottom!=null&&e.bottom!=null&&(this.bottom=h.y.number(e.bottom,a.bottom,u)),a.left!=null&&e.left!=null&&(this.left=h.y.number(e.left,a.left,u)),a.right!=null&&e.right!=null&&(this.right=h.y.number(e.right,a.right,u)),this}getCenter(e,a){const u=h.ac((this.left+e-this.right)/2,0,e),p=h.ac((this.top+a-this.bottom)/2,0,a);return new h.P(u,p)}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new po(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const Ac=85.051129;class fo{constructor(e,a,u,p,m){this.tileSize=512,this._renderWorldCopies=m===void 0||!!m,this._minZoom=e||0,this._maxZoom=a||22,this._minPitch=u??0,this._maxPitch=p??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new h.N(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new po,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={},this.minElevationForCurrentTile=0}clone(){const e=new fo(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return e.apply(this),e}apply(e){this.tileSize=e.tileSize,this.latRange=e.latRange,this.lngRange=e.lngRange,this.width=e.width,this.height=e.height,this._center=e._center,this._elevation=e._elevation,this.minElevationForCurrentTile=e.minElevationForCurrentTile,this.zoom=e.zoom,this.angle=e.angle,this._fov=e._fov,this._pitch=e._pitch,this._unmodified=e._unmodified,this._edgeInsets=e._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(e){this._minZoom!==e&&(this._minZoom=e,this.zoom=Math.max(this.zoom,e))}get maxZoom(){return this._maxZoom}set maxZoom(e){this._maxZoom!==e&&(this._maxZoom=e,this.zoom=Math.min(this.zoom,e))}get minPitch(){return this._minPitch}set minPitch(e){this._minPitch!==e&&(this._minPitch=e,this.pitch=Math.max(this.pitch,e))}get maxPitch(){return this._maxPitch}set maxPitch(e){this._maxPitch!==e&&(this._maxPitch=e,this.pitch=Math.min(this.pitch,e))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(e){e===void 0?e=!0:e===null&&(e=!1),this._renderWorldCopies=e}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new h.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(e){const a=-h.b3(e,-180,180)*Math.PI/180;this.angle!==a&&(this._unmodified=!1,this.angle=a,this._calcMatrices(),this.rotationMatrix=function(){var u=new h.A(4);return h.A!=Float32Array&&(u[1]=0,u[2]=0),u[0]=1,u[3]=1,u}(),function(u,p,m){var k=p[0],E=p[1],T=p[2],I=p[3],O=Math.sin(m),B=Math.cos(m);u[0]=k*B+T*O,u[1]=E*B+I*O,u[2]=k*-O+T*B,u[3]=E*-O+I*B}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(e){const a=h.ac(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==a&&(this._unmodified=!1,this._pitch=a,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(e){e=Math.max(.01,Math.min(60,e)),this._fov!==e&&(this._unmodified=!1,this._fov=e/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(e){const a=Math.min(Math.max(e,this.minZoom),this.maxZoom);this._zoom!==a&&(this._unmodified=!1,this._zoom=a,this.tileZoom=Math.max(0,Math.floor(a)),this.scale=this.zoomScale(a),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(e){e.lat===this._center.lat&&e.lng===this._center.lng||(this._unmodified=!1,this._center=e,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(e){e!==this._elevation&&(this._elevation=e,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(e){this._edgeInsets.equals(e)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,e,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(e){return this._edgeInsets.equals(e)}interpolatePadding(e,a,u){this._unmodified=!1,this._edgeInsets.interpolate(e,a,u),this._constrain(),this._calcMatrices()}coveringZoomLevel(e){const a=(e.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/e.tileSize));return Math.max(0,a)}getVisibleUnwrappedCoordinates(e){const a=[new h.b4(0,e)];if(this._renderWorldCopies){const u=this.pointCoordinate(new h.P(0,0)),p=this.pointCoordinate(new h.P(this.width,0)),m=this.pointCoordinate(new h.P(this.width,this.height)),k=this.pointCoordinate(new h.P(0,this.height)),E=Math.floor(Math.min(u.x,p.x,m.x,k.x)),T=Math.floor(Math.max(u.x,p.x,m.x,k.x)),I=1;for(let O=E-I;O<=T+I;O++)O!==0&&a.push(new h.b4(O,e))}return a}coveringTiles(e){var a,u;let p=this.coveringZoomLevel(e);const m=p;if(e.minzoom!==void 0&&p<e.minzoom)return[];e.maxzoom!==void 0&&p>e.maxzoom&&(p=e.maxzoom);const k=this.pointCoordinate(this.getCameraPoint()),E=h.Z.fromLngLat(this.center),T=Math.pow(2,p),I=[T*k.x,T*k.y,0],O=[T*E.x,T*E.y,0],B=ho.fromInvProjectionMatrix(this.invModelViewProjectionMatrix,this.worldSize,p);let U=e.minzoom||0;!e.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(U=p);const Z=e.terrain?2/Math.min(this.tileSize,e.tileSize)*this.tileSize:3,G=X=>({aabb:new uo([X*T,0,0],[(X+1)*T,T,0]),zoom:0,x:0,y:0,wrap:X,fullyVisible:!1}),Q=[],ne=[],re=p,ae=e.reparseOverscaled?m:p;if(this._renderWorldCopies)for(let X=1;X<=3;X++)Q.push(G(-X)),Q.push(G(X));for(Q.push(G(0));Q.length>0;){const X=Q.pop(),ue=X.x,pe=X.y;let xe=X.fullyVisible;if(!xe){const Oe=X.aabb.intersects(B);if(Oe===0)continue;xe=Oe===2}const Ce=e.terrain?I:O,Ae=X.aabb.distanceX(Ce),$e=X.aabb.distanceY(Ce),We=Math.max(Math.abs(Ae),Math.abs($e));if(X.zoom===re||We>Z+(1<<re-X.zoom)-2&&X.zoom>=U){const Oe=re-X.zoom,Re=I[0]-.5-(ue<<Oe),et=I[1]-.5-(pe<<Oe);ne.push({tileID:new h.S(X.zoom===re?ae:X.zoom,X.wrap,X.zoom,ue,pe),distanceSq:rt([O[0]-.5-ue,O[1]-.5-pe]),tileDistanceToCamera:Math.sqrt(Re*Re+et*et)})}else for(let Oe=0;Oe<4;Oe++){const Re=(ue<<1)+Oe%2,et=(pe<<1)+(Oe>>1),bt=X.zoom+1;let Fe=X.aabb.quadrant(Oe);if(e.terrain){const Ue=new h.S(bt,X.wrap,bt,Re,et),yt=e.terrain.getMinMaxElevation(Ue),gi=(a=yt.minElevation)!==null&&a!==void 0?a:this.elevation,Ct=(u=yt.maxElevation)!==null&&u!==void 0?u:this.elevation;Fe=new uo([Fe.min[0],Fe.min[1],gi],[Fe.max[0],Fe.max[1],Ct])}Q.push({aabb:Fe,zoom:bt,x:Re,y:et,wrap:X.wrap,fullyVisible:xe})}}return ne.sort((X,ue)=>X.distanceSq-ue.distanceSq).map(X=>X.tileID)}resize(e,a){this.width=e,this.height=a,this.pixelsToGLUnits=[2/e,-2/a],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(e){return Math.pow(2,e)}scaleZoom(e){return Math.log(e)/Math.LN2}project(e){const a=h.ac(e.lat,-85.051129,Ac);return new h.P(h.O(e.lng)*this.worldSize,h.Q(a)*this.worldSize)}unproject(e){return new h.Z(e.x/this.worldSize,e.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(e){const a=this.elevation,u=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,p=this.pointLocation(this.centerPoint,e),m=e.getElevationForLngLatZoom(p,this.tileZoom);if(!(this.elevation-m))return;const k=u+a-m,E=Math.cos(this._pitch)*this.cameraToCenterDistance/k/h.b5(1,p.lat),T=this.scaleZoom(E/this.tileSize);this._elevation=m,this._center=p,this.zoom=T}setLocationAtPoint(e,a){const u=this.pointCoordinate(a),p=this.pointCoordinate(this.centerPoint),m=this.locationCoordinate(e),k=new h.Z(m.x-(u.x-p.x),m.y-(u.y-p.y));this.center=this.coordinateLocation(k),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(e,a){return a?this.coordinatePoint(this.locationCoordinate(e),a.getElevationForLngLatZoom(e,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(e))}pointLocation(e,a){return this.coordinateLocation(this.pointCoordinate(e,a))}locationCoordinate(e){return h.Z.fromLngLat(e)}coordinateLocation(e){return e&&e.toLngLat()}pointCoordinate(e,a){if(a){const U=a.pointCoordinate(e);if(U!=null)return U}const u=[e.x,e.y,0,1],p=[e.x,e.y,1,1];h.af(u,u,this.pixelMatrixInverse),h.af(p,p,this.pixelMatrixInverse);const m=u[3],k=p[3],E=u[1]/m,T=p[1]/k,I=u[2]/m,O=p[2]/k,B=I===O?0:(0-I)/(O-I);return new h.Z(h.y.number(u[0]/m,p[0]/k,B)/this.worldSize,h.y.number(E,T,B)/this.worldSize)}coordinatePoint(e,a=0,u=this.pixelMatrix){const p=[e.x*this.worldSize,e.y*this.worldSize,a,1];return h.af(p,p,u),new h.P(p[0]/p[3],p[1]/p[3])}getBounds(){const e=Math.max(0,this.height/2-this.getHorizon());return new be().extend(this.pointLocation(new h.P(0,e))).extend(this.pointLocation(new h.P(this.width,e))).extend(this.pointLocation(new h.P(this.width,this.height))).extend(this.pointLocation(new h.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new be([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(e){e?(this.lngRange=[e.getWest(),e.getEast()],this.latRange=[e.getSouth(),e.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-85.051129,Ac])}calculateTileMatrix(e){const a=e.canonical,u=this.worldSize/this.zoomScale(a.z),p=a.x+Math.pow(2,a.z)*e.wrap,m=h.an(new Float64Array(16));return h.J(m,m,[p*u,a.y*u,0]),h.K(m,m,[u/h.X,u/h.X,1]),m}calculatePosMatrix(e,a=!1){const u=e.key,p=a?this._alignedPosMatrixCache:this._posMatrixCache;if(p[u])return p[u];const m=this.calculateTileMatrix(e);return h.L(m,a?this.alignedModelViewProjectionMatrix:this.modelViewProjectionMatrix,m),p[u]=new Float32Array(m),p[u]}calculateFogMatrix(e){const a=e.key,u=this._fogMatrixCache;if(u[a])return u[a];const p=this.calculateTileMatrix(e);return h.L(p,this.fogMatrix,p),u[a]=new Float32Array(p),u[a]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(e,a){a=h.ac(+a,this.minZoom,this.maxZoom);const u={center:new h.N(e.lng,e.lat),zoom:a};let p=this.lngRange;if(!this._renderWorldCopies&&p===null){const X=179.9999999999;p=[-X,X]}const m=this.tileSize*this.zoomScale(u.zoom);let k=0,E=m,T=0,I=m,O=0,B=0;const{x:U,y:Z}=this.size;if(this.latRange){const X=this.latRange;k=h.Q(X[1])*m,E=h.Q(X[0])*m,E-k<Z&&(O=Z/(E-k))}p&&(T=h.b3(h.O(p[0])*m,0,m),I=h.b3(h.O(p[1])*m,0,m),I<T&&(I+=m),I-T<U&&(B=U/(I-T)));const{x:G,y:Q}=this.project.call({worldSize:m},e);let ne,re;const ae=Math.max(B||0,O||0);if(ae){const X=new h.P(B?(I+T)/2:G,O?(E+k)/2:Q);return u.center=this.unproject.call({worldSize:m},X).wrap(),u.zoom+=this.scaleZoom(ae),u}if(this.latRange){const X=Z/2;Q-X<k&&(re=k+X),Q+X>E&&(re=E-X)}if(p){const X=(T+I)/2;let ue=G;this._renderWorldCopies&&(ue=h.b3(G,X-m/2,X+m/2));const pe=U/2;ue-pe<T&&(ne=T+pe),ue+pe>I&&(ne=I-pe)}if(ne!==void 0||re!==void 0){const X=new h.P(ne??G,re??Q);u.center=this.unproject.call({worldSize:m},X).wrap()}return u}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const e=this._unmodified,{center:a,zoom:u}=this.getConstrained(this.center,this.zoom);this.center=a,this.zoom=u,this._unmodified=e,this._constraining=!1}_calcMatrices(){if(!this.height)return;const e=this.centerOffset,a=this.point.x,u=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=h.b5(1,this.center.lat)*this.worldSize;let p=h.an(new Float64Array(16));h.K(p,p,[this.width/2,-this.height/2,1]),h.J(p,p,[1,-1,0]),this.labelPlaneMatrix=p,p=h.an(new Float64Array(16)),h.K(p,p,[1,-1,1]),h.J(p,p,[-1,-1,0]),h.K(p,p,[2/this.width,2/this.height,1]),this.glCoordMatrix=p;const m=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),k=Math.min(this.elevation,this.minElevationForCurrentTile),E=m-k*this._pixelPerMeter/Math.cos(this._pitch),T=k<0?E:m,I=Math.PI/2+this._pitch,O=this._fov*(.5+e.y/this.height),B=Math.sin(O)*T/Math.sin(h.ac(Math.PI-I-O,.01,Math.PI-.01)),U=this.getHorizon(),Z=2*Math.atan(U/this.cameraToCenterDistance)*(.5+e.y/(2*U)),G=Math.sin(Z)*T/Math.sin(h.ac(Math.PI-I-Z,.01,Math.PI-.01)),Q=Math.min(B,G);this.farZ=1.01*(Math.cos(Math.PI/2-this._pitch)*Q+T),this.nearZ=this.height/50,p=new Float64Array(16),h.b6(p,this._fov,this.width/this.height,this.nearZ,this.farZ),p[8]=2*-e.x/this.width,p[9]=2*e.y/this.height,this.projectionMatrix=h.ae(p),h.K(p,p,[1,-1,1]),h.J(p,p,[0,0,-this.cameraToCenterDistance]),h.b7(p,p,this._pitch),h.ad(p,p,this.angle),h.J(p,p,[-a,-u,0]),this.mercatorMatrix=h.K([],p,[this.worldSize,this.worldSize,this.worldSize]),h.K(p,p,[1,1,this._pixelPerMeter]),this.pixelMatrix=h.L(new Float64Array(16),this.labelPlaneMatrix,p),h.J(p,p,[0,0,-this.elevation]),this.modelViewProjectionMatrix=p,this.invModelViewProjectionMatrix=h.as([],p),this.fogMatrix=new Float64Array(16),h.b6(this.fogMatrix,this._fov,this.width/this.height,m,this.farZ),this.fogMatrix[8]=2*-e.x/this.width,this.fogMatrix[9]=2*e.y/this.height,h.K(this.fogMatrix,this.fogMatrix,[1,-1,1]),h.J(this.fogMatrix,this.fogMatrix,[0,0,-this.cameraToCenterDistance]),h.b7(this.fogMatrix,this.fogMatrix,this._pitch),h.ad(this.fogMatrix,this.fogMatrix,this.angle),h.J(this.fogMatrix,this.fogMatrix,[-a,-u,0]),h.K(this.fogMatrix,this.fogMatrix,[1,1,this._pixelPerMeter]),h.J(this.fogMatrix,this.fogMatrix,[0,0,-this.elevation]),this.pixelMatrix3D=h.L(new Float64Array(16),this.labelPlaneMatrix,p);const ne=this.width%2/2,re=this.height%2/2,ae=Math.cos(this.angle),X=Math.sin(this.angle),ue=a-Math.round(a)+ae*ne+X*re,pe=u-Math.round(u)+ae*re+X*ne,xe=new Float64Array(p);if(h.J(xe,xe,[ue>.5?ue-1:ue,pe>.5?pe-1:pe,0]),this.alignedModelViewProjectionMatrix=xe,p=h.as(new Float64Array(16),this.pixelMatrix),!p)throw new Error("failed to invert matrix");this.pixelMatrixInverse=p,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const e=this.pointCoordinate(new h.P(0,0)),a=[e.x*this.worldSize,e.y*this.worldSize,0,1];return h.af(a,a,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const e=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new h.P(0,e))}getCameraQueryGeometry(e){const a=this.getCameraPoint();if(e.length===1)return[e[0],a];{let u=a.x,p=a.y,m=a.x,k=a.y;for(const E of e)u=Math.min(u,E.x),p=Math.min(p,E.y),m=Math.max(m,E.x),k=Math.max(k,E.y);return[new h.P(u,p),new h.P(m,p),new h.P(m,k),new h.P(u,k),new h.P(u,p)]}}lngLatToCameraDepth(e,a){const u=this.locationCoordinate(e),p=[u.x*this.worldSize,u.y*this.worldSize,a,1];return h.af(p,p,this.modelViewProjectionMatrix),p[2]/p[3]}}function la(g,e){let a,u=!1,p=null,m=null;const k=()=>{p=null,u&&(g.apply(m,a),p=setTimeout(k,e),u=!1)};return(...E)=>(u=!0,m=this,a=E,p||k(),p)}class cl{constructor(e){this._getCurrentHash=()=>{const a=window.location.hash.replace("#","");if(this._hashName){let u;return a.split("&").map(p=>p.split("=")).forEach(p=>{p[0]===this._hashName&&(u=p)}),(u&&u[1]||"").split("/")}return a.split("/")},this._onHashChange=()=>{const a=this._getCurrentHash();if(a.length>=3&&!a.some(u=>isNaN(u))){const u=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(a[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+a[2],+a[1]],zoom:+a[0],bearing:u,pitch:+(a[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const a=window.location.href.replace(/(#.+)?$/,this.getHashString());window.history.replaceState(window.history.state,null,a)},this._removeHash=()=>{const a=this._getCurrentHash();if(a.length===0)return;const u=a.join("/");let p=u;p.split("&").length>0&&(p=p.split("&")[0]),this._hashName&&(p=`${this._hashName}=${u}`);let m=window.location.hash.replace(p,"");m.startsWith("#&")?m=m.slice(0,1)+m.slice(2):m==="#"&&(m="");let k=window.location.href.replace(/(#.+)?$/,m);k=k.replace("&&","&"),window.history.replaceState(window.history.state,null,k)},this._updateHash=la(this._updateHashUnthrottled,300),this._hashName=e&&encodeURIComponent(e)}addTo(e){return this._map=e,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(e){const a=this._map.getCenter(),u=Math.round(100*this._map.getZoom())/100,p=Math.ceil((u*Math.LN2+Math.log(512/360/.5))/Math.LN10),m=Math.pow(10,p),k=Math.round(a.lng*m)/m,E=Math.round(a.lat*m)/m,T=this._map.getBearing(),I=this._map.getPitch();let O="";if(O+=e?`/${k}/${E}/${u}`:`${u}/${E}/${k}`,(T||I)&&(O+="/"+Math.round(10*T)/10),I&&(O+=`/${Math.round(I)}`),this._hashName){const B=this._hashName;let U=!1;const Z=window.location.hash.slice(1).split("&").map(G=>{const Q=G.split("=")[0];return Q===B?(U=!0,`${Q}=${O}`):G}).filter(G=>G);return U||Z.push(`${B}=${O}`),`#${Z.join("&")}`}return`#${O}`}}const hl={linearity:.3,easing:h.b8(0,0,.3,1)},Dc=h.e({deceleration:2500,maxSpeed:1400},hl),cf=h.e({deceleration:20,maxSpeed:1400},hl),Ou=h.e({deceleration:1e3,maxSpeed:360},hl),ul=h.e({deceleration:1e3,maxSpeed:90},hl);class zc{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:z.now(),settings:e})}_drainInertiaBuffer(){const e=this._inertiaBuffer,a=z.now();for(;e.length>0&&a-e[0].time>160;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const a={zoom:0,bearing:0,pitch:0,pan:new h.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:m}of this._inertiaBuffer)a.zoom+=m.zoomDelta||0,a.bearing+=m.bearingDelta||0,a.pitch+=m.pitchDelta||0,m.panDelta&&a.pan._add(m.panDelta),m.around&&(a.around=m.around),m.pinchAround&&(a.pinchAround=m.pinchAround);const u=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,p={};if(a.pan.mag()){const m=ha(a.pan.mag(),u,h.e({},Dc,e||{}));p.offset=a.pan.mult(m.amount/a.pan.mag()),p.center=this._map.transform.center,ca(p,m)}if(a.zoom){const m=ha(a.zoom,u,cf);p.zoom=this._map.transform.zoom+m.amount,ca(p,m)}if(a.bearing){const m=ha(a.bearing,u,Ou);p.bearing=this._map.transform.bearing+h.ac(m.amount,-179,179),ca(p,m)}if(a.pitch){const m=ha(a.pitch,u,ul);p.pitch=this._map.transform.pitch+m.amount,ca(p,m)}if(p.zoom||p.bearing){const m=a.pinchAround===void 0?a.around:a.pinchAround;p.around=m?this._map.unproject(m):this._map.getCenter()}return this.clear(),h.e(p,{noMoveStart:!0})}}function ca(g,e){(!g.duration||g.duration<e.duration)&&(g.duration=e.duration,g.easing=e.easing)}function ha(g,e,a){const{maxSpeed:u,linearity:p,deceleration:m}=a,k=h.ac(g*p/(e/1e3),-u,u),E=Math.abs(k)/(m*p);return{easing:a.easing,duration:1e3*E,amount:k*(E/2)}}class Ji extends h.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,a,u,p={}){const m=L.mousePos(a.getCanvas(),u),k=a.unproject(m);super(e,h.e({point:m,lngLat:k,originalEvent:u},p)),this._defaultPrevented=!1,this.target=a}}class Os extends h.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,a,u){const p=e==="touchend"?u.changedTouches:u.touches,m=L.touchPos(a.getCanvasContainer(),p),k=m.map(T=>a.unproject(T)),E=m.reduce((T,I,O,B)=>T.add(I.div(B.length)),new h.P(0,0));super(e,{points:m,point:E,lngLats:k,lngLat:a.unproject(E),originalEvent:u}),this._defaultPrevented=!1}}class Bu extends h.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,a,u){super(e,{originalEvent:u}),this._defaultPrevented=!1}}class Fu{constructor(e,a){this._map=e,this._clickTolerance=a.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new Bu(e.type,this._map,e))}mousedown(e,a){return this._mousedownPos=a,this._firePreventable(new Ji(e.type,this._map,e))}mouseup(e){this._map.fire(new Ji(e.type,this._map,e))}click(e,a){this._mousedownPos&&this._mousedownPos.dist(a)>=this._clickTolerance||this._map.fire(new Ji(e.type,this._map,e))}dblclick(e){return this._firePreventable(new Ji(e.type,this._map,e))}mouseover(e){this._map.fire(new Ji(e.type,this._map,e))}mouseout(e){this._map.fire(new Ji(e.type,this._map,e))}touchstart(e){return this._firePreventable(new Os(e.type,this._map,e))}touchmove(e){this._map.fire(new Os(e.type,this._map,e))}touchend(e){this._map.fire(new Os(e.type,this._map,e))}touchcancel(e){this._map.fire(new Os(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Pi{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new Ji(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Ji("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new Ji(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class lr{constructor(e){this._map=e}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(e){return this.transform.pointLocation(h.P.convert(e),this._map.terrain)}}class Ln{constructor(e,a){this._map=e,this._tr=new lr(e),this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=a.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,a){this.isEnabled()&&e.shiftKey&&e.button===0&&(L.disableDrag(),this._startPos=this._lastPos=a,this._active=!0)}mousemoveWindow(e,a){if(!this._active)return;const u=a;if(this._lastPos.equals(u)||!this._box&&u.dist(this._startPos)<this._clickTolerance)return;const p=this._startPos;this._lastPos=u,this._box||(this._box=L.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",e));const m=Math.min(p.x,u.x),k=Math.max(p.x,u.x),E=Math.min(p.y,u.y),T=Math.max(p.y,u.y);L.setTransform(this._box,`translate(${m}px,${E}px)`),this._box.style.width=k-m+"px",this._box.style.height=T-E+"px"}mouseupWindow(e,a){if(!this._active||e.button!==0)return;const u=this._startPos,p=a;if(this.reset(),L.suppressClick(),u.x!==p.x||u.y!==p.y)return this._map.fire(new h.k("boxzoomend",{originalEvent:e})),{cameraAnimation:m=>m.fitScreenCoordinates(u,p,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",e)}keydown(e){this._active&&e.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",e))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(L.remove(this._box),this._box=null),L.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,a){return this._map.fire(new h.k(e,{originalEvent:a}))}}function ua(g,e){if(g.length!==e.length)throw new Error(`The number of touches and points are not equal - touches ${g.length}, points ${e.length}`);const a={};for(let u=0;u<g.length;u++)a[g[u].identifier]=e[u];return a}class Lc{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(e,a,u){(this.centroid||u.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=e.timeStamp),u.length===this.numTouches&&(this.centroid=function(p){const m=new h.P(0,0);for(const k of p)m._add(k);return m.div(p.length)}(a),this.touches=ua(u,a)))}touchmove(e,a,u){if(this.aborted||!this.centroid)return;const p=ua(u,a);for(const m in this.touches){const k=p[m];(!k||k.dist(this.touches[m])>30)&&(this.aborted=!0)}}touchend(e,a,u){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),u.length===0){const p=!this.aborted&&this.centroid;if(this.reset(),p)return p}}}class dl{constructor(e){this.singleTap=new Lc(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,a,u){this.singleTap.touchstart(e,a,u)}touchmove(e,a,u){this.singleTap.touchmove(e,a,u)}touchend(e,a,u){const p=this.singleTap.touchend(e,a,u);if(p){const m=e.timeStamp-this.lastTime<500,k=!this.lastTap||this.lastTap.dist(p)<30;if(m&&k||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=p,this.count===this.numTaps)return this.reset(),p}}}class mo{constructor(e){this._tr=new lr(e),this._zoomIn=new dl({numTouches:1,numTaps:2}),this._zoomOut=new dl({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,a,u){this._zoomIn.touchstart(e,a,u),this._zoomOut.touchstart(e,a,u)}touchmove(e,a,u){this._zoomIn.touchmove(e,a,u),this._zoomOut.touchmove(e,a,u)}touchend(e,a,u){const p=this._zoomIn.touchend(e,a,u),m=this._zoomOut.touchend(e,a,u),k=this._tr;return p?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:E=>E.easeTo({duration:300,zoom:k.zoom+1,around:k.unproject(p)},{originalEvent:e})}):m?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:E=>E.easeTo({duration:300,zoom:k.zoom-1,around:k.unproject(m)},{originalEvent:e})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Hr{constructor(e){this._enabled=!!e.enable,this._moveStateManager=e.moveStateManager,this._clickTolerance=e.clickTolerance||1,this._moveFunction=e.move,this._activateOnStart=!!e.activateOnStart,e.assignEvents(this),this.reset()}reset(e){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(e)}_move(...e){const a=this._moveFunction(...e);if(a.bearingDelta||a.pitchDelta||a.around||a.panDelta)return this._active=!0,a}dragStart(e,a){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(e)&&(this._moveStateManager.startMove(e),this._lastPoint=a.length?a[0]:a,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(e,a){if(!this.isEnabled())return;const u=this._lastPoint;if(!u)return;if(e.preventDefault(),!this._moveStateManager.isValidMoveEvent(e))return void this.reset(e);const p=a.length?a[0]:a;return!this._moved&&p.dist(u)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=p,this._move(u,p))}dragEnd(e){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(e)&&(this._moved&&L.suppressClick(),this.reset(e))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}const Rc={0:1,2:2};class pl{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){const a=L.mouseButton(e);this._eventButton=a}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){return!function(a,u){const p=Rc[u];return a.buttons===void 0||(a.buttons&p)!==p}(e,this._eventButton)}isValidEndEvent(e){return L.mouseButton(e)===this._eventButton}}class Oc{constructor(){this._firstTouch=void 0}_isOneFingerTouch(e){return e.targetTouches.length===1}_isSameTouchEvent(e){return e.targetTouches[0].identifier===this._firstTouch}startMove(e){this._firstTouch=e.targetTouches[0].identifier}endMove(e){delete this._firstTouch}isValidStartEvent(e){return this._isOneFingerTouch(e)}isValidMoveEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}isValidEndEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}}const fl=g=>{g.mousedown=g.dragStart,g.mousemoveWindow=g.dragMove,g.mouseup=g.dragEnd,g.contextmenu=e=>{e.preventDefault()}},Bc=({enable:g,clickTolerance:e,bearingDegreesPerPixelMoved:a=.8})=>{const u=new pl({checkCorrectEvent:p=>L.mouseButton(p)===0&&p.ctrlKey||L.mouseButton(p)===2});return new Hr({clickTolerance:e,move:(p,m)=>({bearingDelta:(m.x-p.x)*a}),moveStateManager:u,enable:g,assignEvents:fl})},Fc=({enable:g,clickTolerance:e,pitchDegreesPerPixelMoved:a=-.5})=>{const u=new pl({checkCorrectEvent:p=>L.mouseButton(p)===0&&p.ctrlKey||L.mouseButton(p)===2});return new Hr({clickTolerance:e,move:(p,m)=>({pitchDelta:(m.y-p.y)*a}),moveStateManager:u,enable:g,assignEvents:fl})};class Bs{constructor(e,a){this._clickTolerance=e.clickTolerance||1,this._map=a,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new h.P(0,0)}_shouldBePrevented(e){return e<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(e,a,u){return this._calculateTransform(e,a,u)}touchmove(e,a,u){if(this._active){if(!this._shouldBePrevented(u.length))return e.preventDefault(),this._calculateTransform(e,a,u);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",e)}}touchend(e,a,u){this._calculateTransform(e,a,u),this._active&&this._shouldBePrevented(u.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,a,u){u.length>0&&(this._active=!0);const p=ua(u,a),m=new h.P(0,0),k=new h.P(0,0);let E=0;for(const I in p){const O=p[I],B=this._touches[I];B&&(m._add(O),k._add(O.sub(B)),E++,p[I]=O)}if(this._touches=p,this._shouldBePrevented(E)||!k.mag())return;const T=k.div(E);return this._sum._add(T),this._sum.mag()<this._clickTolerance?void 0:{around:m.div(E),panDelta:T}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class ml{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(e,a,u){this._firstTwoTouches||u.length<2||(this._firstTwoTouches=[u[0].identifier,u[1].identifier],this._start([a[0],a[1]]))}touchmove(e,a,u){if(!this._firstTwoTouches)return;e.preventDefault();const[p,m]=this._firstTwoTouches,k=da(u,a,p),E=da(u,a,m);if(!k||!E)return;const T=this._aroundCenter?null:k.add(E).div(2);return this._move([k,E],T,e)}touchend(e,a,u){if(!this._firstTwoTouches)return;const[p,m]=this._firstTwoTouches,k=da(u,a,p),E=da(u,a,m);k&&E||(this._active&&L.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(e){this._enabled=!0,this._aroundCenter=!!e&&e.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function da(g,e,a){for(let u=0;u<g.length;u++)if(g[u].identifier===a)return e[u]}function Nc(g,e){return Math.log(g/e)/Math.LN2}class Vc extends ml{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(e){this._startDistance=this._distance=e[0].dist(e[1])}_move(e,a){const u=this._distance;if(this._distance=e[0].dist(e[1]),this._active||!(Math.abs(Nc(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Nc(this._distance,u),pinchAround:a}}}function $c(g,e){return 180*g.angleWith(e)/Math.PI}class jc extends ml{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(e){this._startVector=this._vector=e[0].sub(e[1]),this._minDiameter=e[0].dist(e[1])}_move(e,a,u){const p=this._vector;if(this._vector=e[0].sub(e[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:$c(this._vector,p),pinchAround:a}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());const a=25/(Math.PI*this._minDiameter)*360,u=$c(e,this._startVector);return Math.abs(u)<a}}function gl(g){return Math.abs(g.y)>Math.abs(g.x)}class go extends ml{constructor(e){super(),this._currentTouchCount=0,this._map=e}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(e,a,u){super.touchstart(e,a,u),this._currentTouchCount=u.length}_start(e){this._lastPoints=e,gl(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,a,u){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const p=e[0].sub(this._lastPoints[0]),m=e[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(p,m,u.timeStamp),this._valid?(this._lastPoints=e,this._active=!0,{pitchDelta:(p.y+m.y)/2*-.5}):void 0}gestureBeginsVertically(e,a,u){if(this._valid!==void 0)return this._valid;const p=e.mag()>=2,m=a.mag()>=2;if(!p&&!m)return;if(!p||!m)return this._firstMove===void 0&&(this._firstMove=u),u-this._firstMove<100&&void 0;const k=e.y>0==a.y>0;return gl(e)&&gl(a)&&k}}const Nu={panStep:100,bearingStep:15,pitchStep:10};class Gn{constructor(e){this._tr=new lr(e);const a=Nu;this._panStep=a.panStep,this._bearingStep=a.bearingStep,this._pitchStep=a.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let a=0,u=0,p=0,m=0,k=0;switch(e.keyCode){case 61:case 107:case 171:case 187:a=1;break;case 189:case 109:case 173:a=-1;break;case 37:e.shiftKey?u=-1:(e.preventDefault(),m=-1);break;case 39:e.shiftKey?u=1:(e.preventDefault(),m=1);break;case 38:e.shiftKey?p=1:(e.preventDefault(),k=-1);break;case 40:e.shiftKey?p=-1:(e.preventDefault(),k=1);break;default:return}return this._rotationDisabled&&(u=0,p=0),{cameraAnimation:E=>{const T=this._tr;E.easeTo({duration:300,easeId:"keyboardHandler",easing:Ir,zoom:a?Math.round(T.zoom)+a*(e.shiftKey?2:1):T.zoom,bearing:T.bearing+u*this._bearingStep,pitch:T.pitch+p*this._pitchStep,offset:[-m*this._panStep,-k*this._panStep],center:T.center},{originalEvent:e})}}}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 Ir(g){return g*(2-g)}const Uc=4.000244140625;class cr{constructor(e,a){this._onTimeout=u=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(u)},this._map=e,this._tr=new lr(e),this._triggerRenderFrame=a,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&e.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(e){return!!this._map.cooperativeGestures.isEnabled()&&!(e.ctrlKey||this._map.cooperativeGestures.isBypassed(e))}wheel(e){if(!this.isEnabled())return;if(this._shouldBePrevented(e))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",e);let a=e.deltaMode===WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY;const u=z.now(),p=u-(this._lastWheelEventTime||0);this._lastWheelEventTime=u,a!==0&&a%Uc==0?this._type="wheel":a!==0&&Math.abs(a)<4?this._type="trackpad":p>400?(this._type=null,this._lastValue=a,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(p*a)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,a+=this._lastValue)),e.shiftKey&&a&&(a/=4),this._type&&(this._lastWheelEvent=e,this._delta-=a,this._active||this._start(e)),e.preventDefault()}_start(e){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 a=L.mousePos(this._map.getCanvas(),e),u=this._tr;this._around=a.y>u.transform.height/2-u.transform.getHorizon()?h.N.convert(this._aroundCenter?u.center:u.unproject(a)):h.N.convert(u.center),this._aroundPoint=u.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const e=this._tr.transform;if(this._delta!==0){const T=this._type==="wheel"&&Math.abs(this._delta)>Uc?this._wheelZoomRate:this._defaultZoomRate;let I=2/(1+Math.exp(-Math.abs(this._delta*T)));this._delta<0&&I!==0&&(I=1/I);const O=typeof this._targetZoom=="number"?e.zoomScale(this._targetZoom):e.scale;this._targetZoom=Math.min(e.maxZoom,Math.max(e.minZoom,e.scaleZoom(O*I))),this._type==="wheel"&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const a=typeof this._targetZoom=="number"?this._targetZoom:e.zoom,u=this._startZoom,p=this._easing;let m,k=!1;const E=z.now()-this._lastWheelEventTime;if(this._type==="wheel"&&u&&p&&E){const T=Math.min(E/200,1),I=p(T);m=h.y.number(u,a,I),T<1?this._frameId||(this._frameId=!0):k=!0}else m=a,k=!0;return this._active=!0,k&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!k,zoomDelta:m-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let a=h.b9;if(this._prevEase){const u=this._prevEase,p=(z.now()-u.start)/u.duration,m=u.easing(p+.01)-u.easing(p),k=.27/Math.sqrt(m*m+1e-4)*.01,E=Math.sqrt(.0729-k*k);a=h.b8(k,E,.25,1)}return this._prevEase={start:z.now(),duration:e,easing:a},a}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class Fs{constructor(e,a){this._clickZoom=e,this._tapZoom=a}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 hf{constructor(e){this._tr=new lr(e),this.reset()}reset(){this._active=!1}dblclick(e,a){return e.preventDefault(),{cameraAnimation:u=>{u.easeTo({duration:300,zoom:this._tr.zoom+(e.shiftKey?-1:1),around:this._tr.unproject(a)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class uf{constructor(){this._tap=new dl({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(e,a,u){if(!this._swipePoint)if(this._tapTime){const p=a[0],m=e.timeStamp-this._tapTime<500,k=this._tapPoint.dist(p)<30;m&&k?u.length>0&&(this._swipePoint=p,this._swipeTouch=u[0].identifier):this.reset()}else this._tap.touchstart(e,a,u)}touchmove(e,a,u){if(this._tapTime){if(this._swipePoint){if(u[0].identifier!==this._swipeTouch)return;const p=a[0],m=p.y-this._swipePoint.y;return this._swipePoint=p,e.preventDefault(),this._active=!0,{zoomDelta:m/128}}}else this._tap.touchmove(e,a,u)}touchend(e,a,u){if(this._tapTime)this._swipePoint&&u.length===0&&this.reset();else{const p=this._tap.touchend(e,a,u);p&&(this._tapTime=e.timeStamp,this._tapPoint=p)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Vu{constructor(e,a,u){this._el=e,this._mousePan=a,this._touchPan=u}enable(e){this._inertiaOptions=e||{},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 $u{constructor(e,a,u){this._pitchWithRotate=e.pitchWithRotate,this._mouseRotate=a,this._mousePitch=u}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 Hc{constructor(e,a,u,p){this._el=e,this._touchZoom=a,this._touchRotate=u,this._tapDragZoom=p,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),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 yo{constructor(e,a){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=e,this._options=a,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const e=this._map.getCanvasContainer();e.classList.add("maplibregl-cooperative-gestures"),this._container=L.create("div","maplibregl-cooperative-gesture-screen",e);let a=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(a=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const u=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),p=document.createElement("div");p.className="maplibregl-desktop-message",p.textContent=a,this._container.appendChild(p);const m=document.createElement("div");m.className="maplibregl-mobile-message",m.textContent=u,this._container.appendChild(m),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(L.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(e){return e[this._bypassKey]}notifyGestureBlocked(e,a){this._enabled&&(this._map.fire(new h.k("cooperativegestureprevented",{gestureType:e,originalEvent:a})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const Yn=g=>g.zoom||g.drag||g.pitch||g.rotate;class Xe extends h.k{}function yl(g){return g.panDelta&&g.panDelta.mag()||g.zoomDelta||g.bearingDelta||g.pitchDelta}class qc{constructor(e,a){this.handleWindowEvent=p=>{this.handleEvent(p,`${p.type}Window`)},this.handleEvent=(p,m)=>{if(p.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const k=p.type==="renderFrame"?void 0:p,E={needsRenderFrame:!1},T={},I={},O=p.touches,B=O?this._getMapTouches(O):void 0,U=B?L.touchPos(this._map.getCanvas(),B):L.mousePos(this._map.getCanvas(),p);for(const{handlerName:Q,handler:ne,allowed:re}of this._handlers){if(!ne.isEnabled())continue;let ae;this._blockedByActive(I,re,Q)?ne.reset():ne[m||p.type]&&(ae=ne[m||p.type](p,U,B),this.mergeHandlerResult(E,T,ae,Q,k),ae&&ae.needsRenderFrame&&this._triggerRenderFrame()),(ae||ne.isActive())&&(I[Q]=ne)}const Z={};for(const Q in this._previousActiveHandlers)I[Q]||(Z[Q]=k);this._previousActiveHandlers=I,(Object.keys(Z).length||yl(E))&&(this._changes.push([E,T,Z]),this._triggerRenderFrame()),(Object.keys(I).length||yl(E))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:G}=E;G&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],G(this._map))},this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new zc(e),this._bearingSnap=a.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(a);const u=this._el;this._listeners=[[u,"touchstart",{passive:!0}],[u,"touchmove",{passive:!1}],[u,"touchend",void 0],[u,"touchcancel",void 0],[u,"mousedown",void 0],[u,"mousemove",void 0],[u,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[u,"mouseover",void 0],[u,"mouseout",void 0],[u,"dblclick",void 0],[u,"click",void 0],[u,"keydown",{capture:!1}],[u,"keyup",void 0],[u,"wheel",{passive:!1}],[u,"contextmenu",void 0],[window,"blur",void 0]];for(const[p,m,k]of this._listeners)L.addEventListener(p,m,p===document?this.handleWindowEvent:this.handleEvent,k)}destroy(){for(const[e,a,u]of this._listeners)L.removeEventListener(e,a,e===document?this.handleWindowEvent:this.handleEvent,u)}_addDefaultHandlers(e){const a=this._map,u=a.getCanvasContainer();this._add("mapEvent",new Fu(a,e));const p=a.boxZoom=new Ln(a,e);this._add("boxZoom",p),e.interactive&&e.boxZoom&&p.enable();const m=a.cooperativeGestures=new yo(a,e.cooperativeGestures);this._add("cooperativeGestures",m),e.cooperativeGestures&&m.enable();const k=new mo(a),E=new hf(a);a.doubleClickZoom=new Fs(E,k),this._add("tapZoom",k),this._add("clickZoom",E),e.interactive&&e.doubleClickZoom&&a.doubleClickZoom.enable();const T=new uf;this._add("tapDragZoom",T);const I=a.touchPitch=new go(a);this._add("touchPitch",I),e.interactive&&e.touchPitch&&a.touchPitch.enable(e.touchPitch);const O=Bc(e),B=Fc(e);a.dragRotate=new $u(e,O,B),this._add("mouseRotate",O,["mousePitch"]),this._add("mousePitch",B,["mouseRotate"]),e.interactive&&e.dragRotate&&a.dragRotate.enable();const U=(({enable:ae,clickTolerance:X})=>{const ue=new pl({checkCorrectEvent:pe=>L.mouseButton(pe)===0&&!pe.ctrlKey});return new Hr({clickTolerance:X,move:(pe,xe)=>({around:xe,panDelta:xe.sub(pe)}),activateOnStart:!0,moveStateManager:ue,enable:ae,assignEvents:fl})})(e),Z=new Bs(e,a);a.dragPan=new Vu(u,U,Z),this._add("mousePan",U),this._add("touchPan",Z,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&a.dragPan.enable(e.dragPan);const G=new jc,Q=new Vc;a.touchZoomRotate=new Hc(u,Q,G,T),this._add("touchRotate",G,["touchPan","touchZoom"]),this._add("touchZoom",Q,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&a.touchZoomRotate.enable(e.touchZoomRotate);const ne=a.scrollZoom=new cr(a,()=>this._triggerRenderFrame());this._add("scrollZoom",ne,["mousePan"]),e.interactive&&e.scrollZoom&&a.scrollZoom.enable(e.scrollZoom);const re=a.keyboard=new Gn(a);this._add("keyboard",re),e.interactive&&e.keyboard&&a.keyboard.enable(),this._add("blockableMapEvent",new Pi(a))}_add(e,a,u){this._handlers.push({handlerName:e,handler:a,allowed:u}),this._handlersById[e]=a}stop(e){if(!this._updatingCamera){for(const{handler:a}of this._handlers)a.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[]}}isActive(){for(const{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Yn(this._eventsInProgress)||this.isZooming()}_blockedByActive(e,a,u){for(const p in e)if(p!==u&&(!a||a.indexOf(p)<0))return!0;return!1}_getMapTouches(e){const a=[];for(const u of e)this._el.contains(u.target)&&a.push(u);return a}mergeHandlerResult(e,a,u,p,m){if(!u)return;h.e(e,u);const k={handlerName:p,originalEvent:u.originalEvent||m};u.zoomDelta!==void 0&&(a.zoom=k),u.panDelta!==void 0&&(a.drag=k),u.pitchDelta!==void 0&&(a.pitch=k),u.bearingDelta!==void 0&&(a.rotate=k)}_applyChanges(){const e={},a={},u={};for(const[p,m,k]of this._changes)p.panDelta&&(e.panDelta=(e.panDelta||new h.P(0,0))._add(p.panDelta)),p.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+p.zoomDelta),p.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+p.bearingDelta),p.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+p.pitchDelta),p.around!==void 0&&(e.around=p.around),p.pinchAround!==void 0&&(e.pinchAround=p.pinchAround),p.noInertia&&(e.noInertia=p.noInertia),h.e(a,m),h.e(u,k);this._updateMapTransform(e,a,u),this._changes=[]}_updateMapTransform(e,a,u){const p=this._map,m=p._getTransformForUpdate(),k=p.terrain;if(!(yl(e)||k&&this._terrainMovement))return this._fireEvents(a,u,!0);let{panDelta:E,zoomDelta:T,bearingDelta:I,pitchDelta:O,around:B,pinchAround:U}=e;U!==void 0&&(B=U),p._stop(!0),B=B||p.transform.centerPoint;const Z=m.pointLocation(E?B.sub(E):B);I&&(m.bearing+=I),O&&(m.pitch+=O),T&&(m.zoom+=T),k?this._terrainMovement||!a.drag&&!a.zoom?a.drag&&this._terrainMovement?m.center=m.pointLocation(m.centerPoint.sub(E)):m.setLocationAtPoint(Z,B):(this._terrainMovement=!0,this._map._elevationFreeze=!0,m.setLocationAtPoint(Z,B)):m.setLocationAtPoint(Z,B),p._applyUpdatedTransform(m),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(a,u,!0)}_fireEvents(e,a,u){const p=Yn(this._eventsInProgress),m=Yn(e),k={};for(const B in e){const{originalEvent:U}=e[B];this._eventsInProgress[B]||(k[`${B}start`]=U),this._eventsInProgress[B]=e[B]}!p&&m&&this._fireEvent("movestart",m.originalEvent);for(const B in k)this._fireEvent(B,k[B]);m&&this._fireEvent("move",m.originalEvent);for(const B in e){const{originalEvent:U}=e[B];this._fireEvent(B,U)}const E={};let T;for(const B in this._eventsInProgress){const{handlerName:U,originalEvent:Z}=this._eventsInProgress[B];this._handlersById[U].isActive()||(delete this._eventsInProgress[B],T=a[U]||Z,E[`${B}end`]=T)}for(const B in E)this._fireEvent(B,E[B]);const I=Yn(this._eventsInProgress),O=(p||m)&&!I;if(O&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const B=this._map._getTransformForUpdate();B.recalculateZoom(this._map.terrain),this._map._applyUpdatedTransform(B)}if(u&&O){this._updatingCamera=!0;const B=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),U=Z=>Z!==0&&-this._bearingSnap<Z&&Z<this._bearingSnap;!B||!B.essential&&z.prefersReducedMotion?(this._map.fire(new h.k("moveend",{originalEvent:T})),U(this._map.getBearing())&&this._map.resetNorth()):(U(B.bearing||this._map.getBearing())&&(B.bearing=0),B.freezeElevation=!0,this._map.easeTo(B,{originalEvent:T})),this._updatingCamera=!1}}_fireEvent(e,a){this._map.fire(new h.k(e,a?{originalEvent:a}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(e=>{delete this._frameId,this.handleEvent(new Xe("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class ju extends h.E{constructor(e,a){super(),this._renderFrameCallback=()=>{const u=Math.min((z.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(u)),u<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=a.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new h.N(this.transform.center.lng,this.transform.center.lat)}setCenter(e,a){return this.jumpTo({center:e},a)}panBy(e,a,u){return e=h.P.convert(e).mult(-1),this.panTo(this.transform.center,h.e({offset:e},a),u)}panTo(e,a,u){return this.easeTo(h.e({center:e},a),u)}getZoom(){return this.transform.zoom}setZoom(e,a){return this.jumpTo({zoom:e},a),this}zoomTo(e,a,u){return this.easeTo(h.e({zoom:e},a),u)}zoomIn(e,a){return this.zoomTo(this.getZoom()+1,e,a),this}zoomOut(e,a){return this.zoomTo(this.getZoom()-1,e,a),this}getBearing(){return this.transform.bearing}setBearing(e,a){return this.jumpTo({bearing:e},a),this}getPadding(){return this.transform.padding}setPadding(e,a){return this.jumpTo({padding:e},a),this}rotateTo(e,a,u){return this.easeTo(h.e({bearing:e},a),u)}resetNorth(e,a){return this.rotateTo(0,h.e({duration:1e3},e),a),this}resetNorthPitch(e,a){return this.easeTo(h.e({bearing:0,pitch:0,duration:1e3},e),a),this}snapToNorth(e,a){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,a):this}getPitch(){return this.transform.pitch}setPitch(e,a){return this.jumpTo({pitch:e},a),this}cameraForBounds(e,a){e=be.convert(e).adjustAntiMeridian();const u=a&&a.bearing||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),u,a)}_cameraForBoxAndBearing(e,a,u,p){const m={top:0,bottom:0,right:0,left:0};if(typeof(p=h.e({padding:m,offset:[0,0],maxZoom:this.transform.maxZoom},p)).padding=="number"){const Oe=p.padding;p.padding={top:Oe,bottom:Oe,right:Oe,left:Oe}}p.padding=h.e(m,p.padding);const k=this.transform,E=k.padding,T=new be(e,a),I=k.project(T.getNorthWest()),O=k.project(T.getNorthEast()),B=k.project(T.getSouthEast()),U=k.project(T.getSouthWest()),Z=h.ba(-u),G=I.rotate(Z),Q=O.rotate(Z),ne=B.rotate(Z),re=U.rotate(Z),ae=new h.P(Math.max(G.x,Q.x,re.x,ne.x),Math.max(G.y,Q.y,re.y,ne.y)),X=new h.P(Math.min(G.x,Q.x,re.x,ne.x),Math.min(G.y,Q.y,re.y,ne.y)),ue=ae.sub(X),pe=(k.width-(E.left+E.right+p.padding.left+p.padding.right))/ue.x,xe=(k.height-(E.top+E.bottom+p.padding.top+p.padding.bottom))/ue.y;if(xe<0||pe<0)return void h.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");const Ce=Math.min(k.scaleZoom(k.scale*Math.min(pe,xe)),p.maxZoom),Ae=h.P.convert(p.offset),$e=new h.P((p.padding.left-p.padding.right)/2,(p.padding.top-p.padding.bottom)/2).rotate(h.ba(u)),We=Ae.add($e).mult(k.scale/k.zoomScale(Ce));return{center:k.unproject(I.add(B).div(2).sub(We)),zoom:Ce,bearing:u}}fitBounds(e,a,u){return this._fitInternal(this.cameraForBounds(e,a),a,u)}fitScreenCoordinates(e,a,u,p,m){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(h.P.convert(e)),this.transform.pointLocation(h.P.convert(a)),u,p),p,m)}_fitInternal(e,a,u){return e?(delete(a=h.e(e,a)).padding,a.linear?this.easeTo(a,u):this.flyTo(a,u)):this}jumpTo(e,a){this.stop();const u=this._getTransformForUpdate();let p=!1,m=!1,k=!1;return"zoom"in e&&u.zoom!==+e.zoom&&(p=!0,u.zoom=+e.zoom),e.center!==void 0&&(u.center=h.N.convert(e.center)),"bearing"in e&&u.bearing!==+e.bearing&&(m=!0,u.bearing=+e.bearing),"pitch"in e&&u.pitch!==+e.pitch&&(k=!0,u.pitch=+e.pitch),e.padding==null||u.isPaddingEqual(e.padding)||(u.padding=e.padding),this._applyUpdatedTransform(u),this.fire(new h.k("movestart",a)).fire(new h.k("move",a)),p&&this.fire(new h.k("zoomstart",a)).fire(new h.k("zoom",a)).fire(new h.k("zoomend",a)),m&&this.fire(new h.k("rotatestart",a)).fire(new h.k("rotate",a)).fire(new h.k("rotateend",a)),k&&this.fire(new h.k("pitchstart",a)).fire(new h.k("pitch",a)).fire(new h.k("pitchend",a)),this.fire(new h.k("moveend",a))}calculateCameraOptionsFromTo(e,a,u,p=0){const m=h.Z.fromLngLat(e,a),k=h.Z.fromLngLat(u,p),E=k.x-m.x,T=k.y-m.y,I=k.z-m.z,O=Math.hypot(E,T,I);if(O===0)throw new Error("Can't calculate camera options with same From and To");const B=Math.hypot(E,T),U=this.transform.scaleZoom(this.transform.cameraToCenterDistance/O/this.transform.tileSize),Z=180*Math.atan2(E,-T)/Math.PI;let G=180*Math.acos(B/O)/Math.PI;return G=I<0?90-G:90+G,{center:k.toLngLat(),zoom:U,pitch:G,bearing:Z}}easeTo(e,a){var u;this._stop(!1,e.easeId),((e=h.e({offset:[0,0],duration:500,easing:h.b9},e)).animate===!1||!e.essential&&z.prefersReducedMotion)&&(e.duration=0);const p=this._getTransformForUpdate(),m=p.zoom,k=p.bearing,E=p.pitch,T=p.padding,I="bearing"in e?this._normalizeBearing(e.bearing,k):k,O="pitch"in e?+e.pitch:E,B="padding"in e?e.padding:p.padding,U=h.P.convert(e.offset);let Z=p.centerPoint.add(U);const G=p.pointLocation(Z),{center:Q,zoom:ne}=p.getConstrained(h.N.convert(e.center||G),(u=e.zoom)!==null&&u!==void 0?u:m);this._normalizeCenter(Q,p);const re=p.project(G),ae=p.project(Q).sub(re),X=p.zoomScale(ne-m);let ue,pe;e.around&&(ue=h.N.convert(e.around),pe=p.locationPoint(ue));const xe={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||ne!==m,this._rotating=this._rotating||k!==I,this._pitching=this._pitching||O!==E,this._padding=!p.isPaddingEqual(B),this._easeId=e.easeId,this._prepareEase(a,e.noMoveStart,xe),this.terrain&&this._prepareElevation(Q),this._ease(Ce=>{if(this._zooming&&(p.zoom=h.y.number(m,ne,Ce)),this._rotating&&(p.bearing=h.y.number(k,I,Ce)),this._pitching&&(p.pitch=h.y.number(E,O,Ce)),this._padding&&(p.interpolatePadding(T,B,Ce),Z=p.centerPoint.add(U)),this.terrain&&!e.freezeElevation&&this._updateElevation(Ce),ue)p.setLocationAtPoint(ue,pe);else{const Ae=p.zoomScale(p.zoom-m),$e=ne>m?Math.min(2,X):Math.max(.5,X),We=Math.pow($e,1-Ce),Oe=p.unproject(re.add(ae.mult(Ce*We)).mult(Ae));p.setLocationAtPoint(p.renderWorldCopies?Oe.wrap():Oe,Z)}this._applyUpdatedTransform(p),this._fireMoveEvents(a)},Ce=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(a,Ce)},e),this}_prepareEase(e,a,u={}){this._moving=!0,a||u.moving||this.fire(new h.k("movestart",e)),this._zooming&&!u.zooming&&this.fire(new h.k("zoomstart",e)),this._rotating&&!u.rotating&&this.fire(new h.k("rotatestart",e)),this._pitching&&!u.pitching&&this.fire(new h.k("pitchstart",e))}_prepareElevation(e){this._elevationCenter=e,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(e,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(e){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const a=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(e<1&&a!==this._elevationTarget){const u=this._elevationTarget-this._elevationStart;this._elevationStart+=e*(u-(a-(u*e+this._elevationStart))/(1-e)),this._elevationTarget=a}this.transform.elevation=h.y.number(this._elevationStart,this._elevationTarget,e)}_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(e){const a=e.getCameraPosition(),u=this.terrain.getElevationForLngLatZoom(a.lngLat,e.zoom);if(a.altitude<u){const p=this.calculateCameraOptionsFromTo(a.lngLat,u,e.center,e.elevation);return{pitch:p.pitch,zoom:p.zoom}}return{}}_applyUpdatedTransform(e){const a=[];if(this.terrain&&a.push(p=>this._elevateCameraIfInsideTerrain(p)),this.transformCameraUpdate&&a.push(p=>this.transformCameraUpdate(p)),!a.length)return;const u=e.clone();for(const p of a){const m=u.clone(),{center:k,zoom:E,pitch:T,bearing:I,elevation:O}=p(m);k&&(m.center=k),E!==void 0&&(m.zoom=E),T!==void 0&&(m.pitch=T),I!==void 0&&(m.bearing=I),O!==void 0&&(m.elevation=O),u.apply(m)}this.transform.apply(u)}_fireMoveEvents(e){this.fire(new h.k("move",e)),this._zooming&&this.fire(new h.k("zoom",e)),this._rotating&&this.fire(new h.k("rotate",e)),this._pitching&&this.fire(new h.k("pitch",e))}_afterEase(e,a){if(this._easeId&&a&&this._easeId===a)return;delete this._easeId;const u=this._zooming,p=this._rotating,m=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,u&&this.fire(new h.k("zoomend",e)),p&&this.fire(new h.k("rotateend",e)),m&&this.fire(new h.k("pitchend",e)),this.fire(new h.k("moveend",e))}flyTo(e,a){var u;if(!e.essential&&z.prefersReducedMotion){const Ue=h.M(e,["center","zoom","bearing","pitch","around"]);return this.jumpTo(Ue,a)}this.stop(),e=h.e({offset:[0,0],speed:1.2,curve:1.42,easing:h.b9},e);const p=this._getTransformForUpdate(),m=p.zoom,k=p.bearing,E=p.pitch,T=p.padding,I="bearing"in e?this._normalizeBearing(e.bearing,k):k,O="pitch"in e?+e.pitch:E,B="padding"in e?e.padding:p.padding,U=h.P.convert(e.offset);let Z=p.centerPoint.add(U);const G=p.pointLocation(Z),{center:Q,zoom:ne}=p.getConstrained(h.N.convert(e.center||G),(u=e.zoom)!==null&&u!==void 0?u:m);this._normalizeCenter(Q,p);const re=p.zoomScale(ne-m),ae=p.project(G),X=p.project(Q).sub(ae);let ue=e.curve;const pe=Math.max(p.width,p.height),xe=pe/re,Ce=X.mag();if("minZoom"in e){const Ue=h.ac(Math.min(e.minZoom,m,ne),p.minZoom,p.maxZoom),yt=pe/p.zoomScale(Ue-m);ue=Math.sqrt(yt/Ce*2)}const Ae=ue*ue;function $e(Ue){const yt=(xe*xe-pe*pe+(Ue?-1:1)*Ae*Ae*Ce*Ce)/(2*(Ue?xe:pe)*Ae*Ce);return Math.log(Math.sqrt(yt*yt+1)-yt)}function We(Ue){return(Math.exp(Ue)-Math.exp(-Ue))/2}function Oe(Ue){return(Math.exp(Ue)+Math.exp(-Ue))/2}const Re=$e(!1);let et=function(Ue){return Oe(Re)/Oe(Re+ue*Ue)},bt=function(Ue){return pe*((Oe(Re)*(We(yt=Re+ue*Ue)/Oe(yt))-We(Re))/Ae)/Ce;var yt},Fe=($e(!0)-Re)/ue;if(Math.abs(Ce)<1e-6||!isFinite(Fe)){if(Math.abs(pe-xe)<1e-6)return this.easeTo(e,a);const Ue=xe<pe?-1:1;Fe=Math.abs(Math.log(xe/pe))/ue,bt=()=>0,et=yt=>Math.exp(Ue*ue*yt)}return e.duration="duration"in e?+e.duration:1e3*Fe/("screenSpeed"in e?+e.screenSpeed/ue:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=k!==I,this._pitching=O!==E,this._padding=!p.isPaddingEqual(B),this._prepareEase(a,!1),this.terrain&&this._prepareElevation(Q),this._ease(Ue=>{const yt=Ue*Fe,gi=1/et(yt);p.zoom=Ue===1?ne:m+p.scaleZoom(gi),this._rotating&&(p.bearing=h.y.number(k,I,Ue)),this._pitching&&(p.pitch=h.y.number(E,O,Ue)),this._padding&&(p.interpolatePadding(T,B,Ue),Z=p.centerPoint.add(U)),this.terrain&&!e.freezeElevation&&this._updateElevation(Ue);const Ct=Ue===1?Q:p.unproject(ae.add(X.mult(bt(yt))).mult(gi));p.setLocationAtPoint(p.renderWorldCopies?Ct.wrap():Ct,Z),this._applyUpdatedTransform(p),this._fireMoveEvents(a)},()=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(a)},e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(e,a){var u;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const p=this._onEaseEnd;delete this._onEaseEnd,p.call(this,a)}return e||(u=this.handlers)===null||u===void 0||u.stop(!1),this}_ease(e,a,u){u.animate===!1||u.duration===0?(e(1),a()):(this._easeStart=z.now(),this._easeOptions=u,this._onEaseFrame=e,this._onEaseEnd=a,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,a){e=h.b3(e,-180,180);const u=Math.abs(e-a);return Math.abs(e-360-a)<u&&(e-=360),Math.abs(e+360-a)<u&&(e+=360),e}_normalizeCenter(e,a){if(!a.renderWorldCopies||a.lngRange)return;const u=e.lng-a.center.lng;e.lng+=u>180?-360:u<-180?360:0}queryTerrainElevation(e){return this.terrain?this.terrain.getElevationForLngLatZoom(h.N.convert(e),this.transform.tileZoom)-this.transform.elevation:null}}const _o={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class xo{constructor(e=_o){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=a=>{!a||a.sourceDataType!=="metadata"&&a.sourceDataType!=="visibility"&&a.dataType!=="style"&&a.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=e}getDefaultPosition(){return"bottom-right"}onAdd(e){return this._map=e,this._compact=this.options.compact,this._container=L.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=L.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=L.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(){L.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(e,a){const u=this._map._getUIString(`AttributionControl.${a}`);e.title=u,e.setAttribute("aria-label",u)}_updateAttributions(){if(!this._map.style)return;let e=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map(p=>typeof p!="string"?"":p)):typeof this.options.customAttribution=="string"&&e.push(this.options.customAttribution)),this._map.style.stylesheet){const p=this._map.style.stylesheet;this.styleOwner=p.owner,this.styleId=p.id}const a=this._map.style.sourceCaches;for(const p in a){const m=a[p];if(m.used||m.usedForTerrain){const k=m.getSource();k.attribution&&e.indexOf(k.attribution)<0&&e.push(k.attribution)}}e=e.filter(p=>String(p).trim()),e.sort((p,m)=>p.length-m.length),e=e.filter((p,m)=>{for(let k=m+1;k<e.length;k++)if(e[k].indexOf(p)>=0)return!1;return!0});const u=e.join(" | ");u!==this._attribHTML&&(this._attribHTML=u,e.length?(this._innerContainer.innerHTML=u,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class Zc{constructor(e={}){this._updateCompact=()=>{const a=this._container.children;if(a.length){const u=a[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&u.classList.add("maplibregl-compact"):u.classList.remove("maplibregl-compact")}},this.options=e}getDefaultPosition(){return"bottom-left"}onAdd(e){this._map=e,this._compact=this.options&&this.options.compact,this._container=L.create("div","maplibregl-ctrl");const a=L.create("a","maplibregl-ctrl-logo");return a.target="_blank",a.rel="noopener nofollow",a.href="https://maplibre.org/",a.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),a.setAttribute("rel","noopener nofollow"),this._container.appendChild(a),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){L.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class Bt{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){const a=++this._id;return this._queue.push({callback:e,id:a,cancelled:!1}),a}remove(e){const a=this._currentlyRunning,u=a?this._queue.concat(a):this._queue;for(const p of u)if(p.id===e)return void(p.cancelled=!0)}run(e=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const a=this._currentlyRunning=this._queue;this._queue=[];for(const u of a)if(!u.cancelled&&(u.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var Wc=h.Y([{name:"a_pos3d",type:"Int16",components:3}]);class df extends h.E{constructor(e){super(),this.sourceCache=e,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,e.usedForTerrain=!0,e.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(e,a){this.sourceCache.update(e,a),this._renderableTilesKeys=[];const u={};for(const p of e.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:a}))u[p.key]=!0,this._renderableTilesKeys.push(p.key),this._tiles[p.key]||(p.posMatrix=new Float64Array(16),h.aP(p.posMatrix,0,h.X,0,h.X,0,1),this._tiles[p.key]=new ns(p,this.tileSize));for(const p in this._tiles)u[p]||delete this._tiles[p]}freeRtt(e){for(const a in this._tiles){const u=this._tiles[a];(!e||u.tileID.equals(e)||u.tileID.isChildOf(e)||e.isChildOf(u.tileID))&&(u.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(e=>this.getTileByID(e))}getTileByID(e){return this._tiles[e]}getTerrainCoords(e){const a={};for(const u of this._renderableTilesKeys){const p=this._tiles[u].tileID;if(p.canonical.equals(e.canonical)){const m=e.clone();m.posMatrix=new Float64Array(16),h.aP(m.posMatrix,0,h.X,0,h.X,0,1),a[u]=m}else if(p.canonical.isChildOf(e.canonical)){const m=e.clone();m.posMatrix=new Float64Array(16);const k=p.canonical.z-e.canonical.z,E=p.canonical.x-(p.canonical.x>>k<<k),T=p.canonical.y-(p.canonical.y>>k<<k),I=h.X>>k;h.aP(m.posMatrix,0,I,0,I,0,1),h.J(m.posMatrix,m.posMatrix,[-E*I,-T*I,0]),a[u]=m}else if(e.canonical.isChildOf(p.canonical)){const m=e.clone();m.posMatrix=new Float64Array(16);const k=e.canonical.z-p.canonical.z,E=e.canonical.x-(e.canonical.x>>k<<k),T=e.canonical.y-(e.canonical.y>>k<<k),I=h.X>>k;h.aP(m.posMatrix,0,h.X,0,h.X,0,1),h.J(m.posMatrix,m.posMatrix,[E*I,T*I,0]),h.K(m.posMatrix,m.posMatrix,[1/2**k,1/2**k,0]),a[u]=m}}return a}getSourceTile(e,a){const u=this.sourceCache._source;let p=e.overscaledZ-this.deltaZoom;if(p>u.maxzoom&&(p=u.maxzoom),p<u.minzoom)return null;this._sourceTileCache[e.key]||(this._sourceTileCache[e.key]=e.scaledTo(p).key);let m=this.sourceCache.getTileByID(this._sourceTileCache[e.key]);if((!m||!m.dem)&&a)for(;p>=u.minzoom&&(!m||!m.dem);)m=this.sourceCache.getTileByID(e.scaledTo(p--).key);return m}tilesAfterTime(e=Date.now()){return Object.values(this._tiles).filter(a=>a.timeAdded>=e)}}class Gc{constructor(e,a,u){this.painter=e,this.sourceCache=new df(a),this.options=u,this.exaggeration=typeof u.exaggeration=="number"?u.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(e,a,u,p=h.X){var m;if(!(a>=0&&a<p&&u>=0&&u<p))return 0;const k=this.getTerrainData(e),E=(m=k.tile)===null||m===void 0?void 0:m.dem;if(!E)return 0;const T=function(G,Q,ne){var re=Q[0],ae=Q[1];return G[0]=ne[0]*re+ne[4]*ae+ne[12],G[1]=ne[1]*re+ne[5]*ae+ne[13],G}([],[a/p*h.X,u/p*h.X],k.u_terrain_matrix),I=[T[0]*E.dim,T[1]*E.dim],O=Math.floor(I[0]),B=Math.floor(I[1]),U=I[0]-O,Z=I[1]-B;return E.get(O,B)*(1-U)*(1-Z)+E.get(O+1,B)*U*(1-Z)+E.get(O,B+1)*(1-U)*Z+E.get(O+1,B+1)*U*Z}getElevationForLngLatZoom(e,a){if(!h.bb(a,e.wrap()))return 0;const{tileID:u,mercatorX:p,mercatorY:m}=this._getOverscaledTileIDFromLngLatZoom(e,a);return this.getElevation(u,p%h.X,m%h.X,h.X)}getElevation(e,a,u,p=h.X){return this.getDEMElevation(e,a,u,p)*this.exaggeration}getTerrainData(e){if(!this._emptyDemTexture){const p=this.painter.context,m=new h.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new Et(p,m,p.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new Et(p,new h.R({width:1,height:1}),p.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(p.gl.NEAREST,p.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=h.an([])}const a=this.sourceCache.getSourceTile(e,!0);if(a&&a.dem&&(!a.demTexture||a.needsTerrainPrepare)){const p=this.painter.context;a.demTexture=this.painter.getTileTexture(a.dem.stride),a.demTexture?a.demTexture.update(a.dem.getPixels(),{premultiply:!1}):a.demTexture=new Et(p,a.dem.getPixels(),p.gl.RGBA,{premultiply:!1}),a.demTexture.bind(p.gl.NEAREST,p.gl.CLAMP_TO_EDGE),a.needsTerrainPrepare=!1}const u=a&&a+a.tileID.key+e.key;if(u&&!this._demMatrixCache[u]){const p=this.sourceCache.sourceCache._source.maxzoom;let m=e.canonical.z-a.tileID.canonical.z;e.overscaledZ>e.canonical.z&&(e.canonical.z>=p?m=e.canonical.z-p:h.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const k=e.canonical.x-(e.canonical.x>>m<<m),E=e.canonical.y-(e.canonical.y>>m<<m),T=h.bc(new Float64Array(16),[1/(h.X<<m),1/(h.X<<m),0]);h.J(T,T,[k*h.X,E*h.X,0]),this._demMatrixCache[e.key]={matrix:T,coord:e}}return{u_depth:2,u_terrain:3,u_terrain_dim:a&&a.dem&&a.dem.dim||1,u_terrain_matrix:u?this._demMatrixCache[e.key].matrix:this._emptyDemMatrix,u_terrain_unpack:a&&a.dem&&a.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(a&&a.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:a}}getFramebuffer(e){const a=this.painter,u=a.width/devicePixelRatio,p=a.height/devicePixelRatio;return!this._fbo||this._fbo.width===u&&this._fbo.height===p||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new Et(a.context,{width:u,height:p,data:null},a.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(a.context.gl.NEAREST,a.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new Et(a.context,{width:u,height:p,data:null},a.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(a.context.gl.NEAREST,a.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=a.context.createFramebuffer(u,p,!0,!1),this._fbo.depthAttachment.set(a.context.createRenderbuffer(a.context.gl.DEPTH_COMPONENT16,u,p))),this._fbo.colorAttachment.set(e==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const e=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const a=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let m=0,k=0;m<this._coordsTextureSize;m++)for(let E=0;E<this._coordsTextureSize;E++,k+=4)a[k+0]=255&E,a[k+1]=255&m,a[k+2]=E>>8<<4|m>>8,a[k+3]=0;const u=new h.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(a.buffer)),p=new Et(e,u,e.gl.RGBA,{premultiply:!1});return p.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._coordsTexture=p,p}pointCoordinate(e){this.painter.maybeDrawDepthAndCoords(!0);const a=new Uint8Array(4),u=this.painter.context,p=u.gl,m=Math.round(e.x*this.painter.pixelRatio/devicePixelRatio),k=Math.round(e.y*this.painter.pixelRatio/devicePixelRatio),E=Math.round(this.painter.height/devicePixelRatio);u.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),p.readPixels(m,E-k-1,1,1,p.RGBA,p.UNSIGNED_BYTE,a),u.bindFramebuffer.set(null);const T=a[0]+(a[2]>>4<<8),I=a[1]+((15&a[2])<<8),O=this.coordsIndex[255-a[3]],B=O&&this.sourceCache.getTileByID(O);if(!B)return null;const U=this._coordsTextureSize,Z=(1<<B.tileID.canonical.z)*U;return new h.Z((B.tileID.canonical.x*U+T)/Z+B.tileID.wrap,(B.tileID.canonical.y*U+I)/Z,this.getElevation(B.tileID,T,I,U))}depthAtPoint(e){const a=new Uint8Array(4),u=this.painter.context,p=u.gl;return u.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),p.readPixels(e.x,this.painter.height/devicePixelRatio-e.y-1,1,1,p.RGBA,p.UNSIGNED_BYTE,a),u.bindFramebuffer.set(null),(a[0]/16777216+a[1]/65536+a[2]/256+a[3])/256}getTerrainMesh(){if(this._mesh)return this._mesh;const e=this.painter.context,a=new h.bd,u=new h.aY,p=this.meshSize,m=h.X/p,k=p*p;for(let B=0;B<=p;B++)for(let U=0;U<=p;U++)a.emplaceBack(U*m,B*m,0);for(let B=0;B<k;B+=p+1)for(let U=0;U<p;U++)u.emplaceBack(U+B,p+U+B+1,p+U+B+2),u.emplaceBack(U+B,p+U+B+2,U+B+1);const E=a.length,T=E+2*(p+1);for(const B of[0,1])for(let U=0;U<=p;U++)for(const Z of[0,1])a.emplaceBack(U*m,B*h.X,Z);for(let B=0;B<2*p;B+=2)u.emplaceBack(T+B,T+B+1,T+B+3),u.emplaceBack(T+B,T+B+3,T+B+2),u.emplaceBack(E+B,E+B+3,E+B+1),u.emplaceBack(E+B,E+B+2,E+B+3);const I=a.length,O=I+2*(p+1);for(const B of[0,1])for(let U=0;U<=p;U++)for(const Z of[0,1])a.emplaceBack(B*h.X,U*m,Z);for(let B=0;B<2*p;B+=2)u.emplaceBack(I+B,I+B+1,I+B+3),u.emplaceBack(I+B,I+B+3,I+B+2),u.emplaceBack(O+B,O+B+3,O+B+1),u.emplaceBack(O+B,O+B+2,O+B+3);return this._mesh=new al(e.createVertexBuffer(a,Wc.members),e.createIndexBuffer(u),h.a0.simpleSegment(0,0,a.length,u.length)),this._mesh}getMeshFrameDelta(e){return 2*Math.PI*h.be/Math.pow(2,e)/5}getMinTileElevationForLngLatZoom(e,a){var u;const{tileID:p}=this._getOverscaledTileIDFromLngLatZoom(e,a);return(u=this.getMinMaxElevation(p).minElevation)!==null&&u!==void 0?u:0}getMinMaxElevation(e){const a=this.getTerrainData(e).tile,u={minElevation:null,maxElevation:null};return a&&a.dem&&(u.minElevation=a.dem.min*this.exaggeration,u.maxElevation=a.dem.max*this.exaggeration),u}_getOverscaledTileIDFromLngLatZoom(e,a){const u=h.Z.fromLngLat(e.wrap()),p=(1<<a)*h.X,m=u.x*p,k=u.y*p,E=Math.floor(m/h.X),T=Math.floor(k/h.X);return{tileID:new h.S(a,0,a,E,T),mercatorX:m,mercatorY:k}}}class pf{constructor(e,a,u){this._context=e,this._size=a,this._tileSize=u,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const e of this._objects)e.texture.destroy(),e.fbo.destroy()}_createObject(e){const a=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),u=new Et(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return u.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),a.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),a.colorAttachment.set(u.texture),{id:e,fbo:a,texture:u,stamp:-1,inUse:!1}}getObjectForId(e){return this._objects[e]}useObject(e){e.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(a=>e.id!==a),this._recentlyUsed.push(e.id)}stampObject(e){e.stamp=++this._stamp}getOrCreateFreeObject(){for(const a of this._recentlyUsed)if(!this._objects[a].inUse)return this._objects[a];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const e=this._createObject(this._objects.length);return this._objects.push(e),e}freeObject(e){e.inUse=!1}freeAllObjects(){for(const e of this._objects)this.freeObject(e)}isFull(){return!(this._objects.length<this._size)&&this._objects.some(e=>!e.inUse)===!1}}const bo={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class Uu{constructor(e,a){this.painter=e,this.terrain=a,this.pool=new pf(e.context,30,a.sourceCache.tileSize*a.qualityFactor)}destruct(){this.pool.destruct()}getTexture(e){return this.pool.getObjectForId(e.rtt[this._stacks.length-1].id).texture}prepareForRender(e,a){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=e._order.filter(u=>!e._layers[u].isHidden(a)),this._coordsDescendingInv={};for(const u in e.sourceCaches){this._coordsDescendingInv[u]={};const p=e.sourceCaches[u].getVisibleCoordinates();for(const m of p){const k=this.terrain.sourceCache.getTerrainCoords(m);for(const E in k)this._coordsDescendingInv[u][E]||(this._coordsDescendingInv[u][E]=[]),this._coordsDescendingInv[u][E].push(k[E])}}this._coordsDescendingInvStr={};for(const u of e._order){const p=e._layers[u],m=p.source;if(bo[p.type]&&!this._coordsDescendingInvStr[m]){this._coordsDescendingInvStr[m]={};for(const k in this._coordsDescendingInv[m])this._coordsDescendingInvStr[m][k]=this._coordsDescendingInv[m][k].map(E=>E.key).sort().join()}}for(const u of this._renderableTiles)for(const p in this._coordsDescendingInvStr){const m=this._coordsDescendingInvStr[p][u.tileID.key];m&&m!==u.rttCoords[p]&&(u.rtt=[])}}renderLayer(e){if(e.isHidden(this.painter.transform.zoom))return!1;const a=e.type,u=this.painter,p=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(bo[a]&&(this._prevType&&bo[this._prevType]||this._stacks.push([]),this._prevType=a,this._stacks[this._stacks.length-1].push(e.id),!p))return!0;if(bo[this._prevType]||bo[a]&&p){this._prevType=a;const m=this._stacks.length-1,k=this._stacks[m]||[];for(const E of this._renderableTiles){if(this.pool.isFull()&&(Ru(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(E),E.rtt[m]){const I=this.pool.getObjectForId(E.rtt[m].id);if(I.stamp===E.rtt[m].stamp){this.pool.useObject(I);continue}}const T=this.pool.getOrCreateFreeObject();this.pool.useObject(T),this.pool.stampObject(T),E.rtt[m]={id:T.id,stamp:T.stamp},u.context.bindFramebuffer.set(T.fbo.framebuffer),u.context.clear({color:h.aM.transparent,stencil:0}),u.currentStencilSource=void 0;for(let I=0;I<k.length;I++){const O=u.style._layers[k[I]],B=O.source?this._coordsDescendingInv[O.source][E.tileID.key]:[E.tileID];u.context.viewport.set([0,0,T.fbo.width,T.fbo.height]),u._renderTileClippingMasks(O,B),u.renderLayer(u,u.style.sourceCaches[O.source],O,B),O.source&&(E.rttCoords[O.source]=this._coordsDescendingInvStr[O.source][E.tileID.key])}}return Ru(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects(),bo[a]}return!1}}const Yc={"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"},Hu=M,ff={hash:!1,interactive:!0,bearingSnap:7,attributionControl:_o,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:h.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},Xc=g=>{g.touchstart=g.dragStart,g.touchmoveWindow=g.dragMove,g.touchend=g.dragEnd},mf={showCompass:!0,showZoom:!0,visualizePitch:!1};class gf{constructor(e,a,u=!1){this.mousedown=k=>{this.startMouse(h.e({},k,{ctrlKey:!0,preventDefault:()=>k.preventDefault()}),L.mousePos(this.element,k)),L.addEventListener(window,"mousemove",this.mousemove),L.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=k=>{this.moveMouse(k,L.mousePos(this.element,k))},this.mouseup=k=>{this.mouseRotate.dragEnd(k),this.mousePitch&&this.mousePitch.dragEnd(k),this.offTemp()},this.touchstart=k=>{k.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=L.touchPos(this.element,k.targetTouches)[0],this.startTouch(k,this._startPos),L.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),L.addEventListener(window,"touchend",this.touchend))},this.touchmove=k=>{k.targetTouches.length!==1?this.reset():(this._lastPos=L.touchPos(this.element,k.targetTouches)[0],this.moveTouch(k,this._lastPos))},this.touchend=k=>{k.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 p=e.dragRotate._mouseRotate.getClickTolerance(),m=e.dragRotate._mousePitch.getClickTolerance();this.element=a,this.mouseRotate=Bc({clickTolerance:p,enable:!0}),this.touchRotate=(({enable:k,clickTolerance:E,bearingDegreesPerPixelMoved:T=.8})=>{const I=new Oc;return new Hr({clickTolerance:E,move:(O,B)=>({bearingDelta:(B.x-O.x)*T}),moveStateManager:I,enable:k,assignEvents:Xc})})({clickTolerance:p,enable:!0}),this.map=e,u&&(this.mousePitch=Fc({clickTolerance:m,enable:!0}),this.touchPitch=(({enable:k,clickTolerance:E,pitchDegreesPerPixelMoved:T=-.5})=>{const I=new Oc;return new Hr({clickTolerance:E,move:(O,B)=>({pitchDelta:(B.y-O.y)*T}),moveStateManager:I,enable:k,assignEvents:Xc})})({clickTolerance:m,enable:!0})),L.addEventListener(a,"mousedown",this.mousedown),L.addEventListener(a,"touchstart",this.touchstart,{passive:!1}),L.addEventListener(a,"touchcancel",this.reset)}startMouse(e,a){this.mouseRotate.dragStart(e,a),this.mousePitch&&this.mousePitch.dragStart(e,a),L.disableDrag()}startTouch(e,a){this.touchRotate.dragStart(e,a),this.touchPitch&&this.touchPitch.dragStart(e,a),L.disableDrag()}moveMouse(e,a){const u=this.map,{bearingDelta:p}=this.mouseRotate.dragMove(e,a)||{};if(p&&u.setBearing(u.getBearing()+p),this.mousePitch){const{pitchDelta:m}=this.mousePitch.dragMove(e,a)||{};m&&u.setPitch(u.getPitch()+m)}}moveTouch(e,a){const u=this.map,{bearingDelta:p}=this.touchRotate.dragMove(e,a)||{};if(p&&u.setBearing(u.getBearing()+p),this.touchPitch){const{pitchDelta:m}=this.touchPitch.dragMove(e,a)||{};m&&u.setPitch(u.getPitch()+m)}}off(){const e=this.element;L.removeEventListener(e,"mousedown",this.mousedown),L.removeEventListener(e,"touchstart",this.touchstart,{passive:!1}),L.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),L.removeEventListener(window,"touchend",this.touchend),L.removeEventListener(e,"touchcancel",this.reset),this.offTemp()}offTemp(){L.enableDrag(),L.removeEventListener(window,"mousemove",this.mousemove),L.removeEventListener(window,"mouseup",this.mouseup),L.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),L.removeEventListener(window,"touchend",this.touchend)}}let Rn;function mi(g,e,a){const u=new h.N(g.lng,g.lat);if(g=new h.N(g.lng,g.lat),e){const p=new h.N(g.lng-360,g.lat),m=new h.N(g.lng+360,g.lat),k=a.locationPoint(g).distSqr(e);a.locationPoint(p).distSqr(e)<k?g=p:a.locationPoint(m).distSqr(e)<k&&(g=m)}for(;Math.abs(g.lng-a.center.lng)>180;){const p=a.locationPoint(g);if(p.x>=0&&p.y>=0&&p.x<=a.width&&p.y<=a.height)break;g.lng>a.center.lng?g.lng-=360:g.lng+=360}return g.lng!==u.lng&&a.locationPoint(g).y>a.height/2-a.getHorizon()?g:u}const vo={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 _l(g,e,a){const u=g.classList;for(const p in vo)u.remove(`maplibregl-${a}-anchor-${p}`);u.add(`maplibregl-${a}-anchor-${e}`)}class xl extends h.E{constructor(e){if(super(),this._onKeyPress=a=>{const u=a.code,p=a.charCode||a.keyCode;u!=="Space"&&u!=="Enter"&&p!==32&&p!==13||this.togglePopup()},this._onMapClick=a=>{const u=a.originalEvent.target,p=this._element;this._popup&&(u===p||p.contains(u))&&this.togglePopup()},this._update=a=>{var u;if(!this._map)return;const p=this._map.loaded()&&!this._map.isMoving();((a==null?void 0:a.type)==="terrain"||(a==null?void 0:a.type)==="render"&&!p)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?mi(this._lngLat,this._flatPos,this._map.transform):(u=this._lngLat)===null||u===void 0?void 0:u.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 m="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?m=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(m=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let k="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?k="rotateX(0deg)":this._pitchAlignment==="map"&&(k=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||a&&a.type!=="moveend"||(this._pos=this._pos.round()),L.setTransform(this._element,`${vo[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${k} ${m}`),z.frameAsync(new AbortController).then(()=>{this._updateOpacity(a&&a.type==="moveend")}).catch(()=>{})},this._onMove=a=>{if(!this._isDragging){const u=this._clickTolerance||this._map._clickTolerance;this._isDragging=a.point.dist(this._pointerdownPos)>=u}this._isDragging&&(this._pos=a.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 h.k("dragstart"))),this.fire(new h.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 h.k("dragend")),this._state="inactive"},this._addDragHandler=a=>{this._element.contains(a.originalEvent.target)&&(a.preventDefault(),this._positionDelta=a.point.sub(this._pos).add(this._offset),this._pointerdownPos=a.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=e&&e.anchor||"center",this._color=e&&e.color||"#3FB1CE",this._scale=e&&e.scale||1,this._draggable=e&&e.draggable||!1,this._clickTolerance=e&&e.clickTolerance||0,this._subpixelPositioning=e&&e.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=e&&e.rotation||0,this._rotationAlignment=e&&e.rotationAlignment||"auto",this._pitchAlignment=e&&e.pitchAlignment&&e.pitchAlignment!=="auto"?e.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(e==null?void 0:e.opacity,e==null?void 0:e.opacityWhenCovered),e&&e.element)this._element=e.element,this._offset=h.P.convert(e&&e.offset||[0,0]);else{this._defaultMarker=!0,this._element=L.create("div");const a=L.createNS("http://www.w3.org/2000/svg","svg"),u=41,p=27;a.setAttributeNS(null,"display","block"),a.setAttributeNS(null,"height",`${u}px`),a.setAttributeNS(null,"width",`${p}px`),a.setAttributeNS(null,"viewBox",`0 0 ${p} ${u}`);const m=L.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"stroke","none"),m.setAttributeNS(null,"stroke-width","1"),m.setAttributeNS(null,"fill","none"),m.setAttributeNS(null,"fill-rule","evenodd");const k=L.createNS("http://www.w3.org/2000/svg","g");k.setAttributeNS(null,"fill-rule","nonzero");const E=L.createNS("http://www.w3.org/2000/svg","g");E.setAttributeNS(null,"transform","translate(3.0, 29.0)"),E.setAttributeNS(null,"fill","#000000");const T=[{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 re of T){const ae=L.createNS("http://www.w3.org/2000/svg","ellipse");ae.setAttributeNS(null,"opacity","0.04"),ae.setAttributeNS(null,"cx","10.5"),ae.setAttributeNS(null,"cy","5.80029008"),ae.setAttributeNS(null,"rx",re.rx),ae.setAttributeNS(null,"ry",re.ry),E.appendChild(ae)}const I=L.createNS("http://www.w3.org/2000/svg","g");I.setAttributeNS(null,"fill",this._color);const O=L.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"),I.appendChild(O);const B=L.createNS("http://www.w3.org/2000/svg","g");B.setAttributeNS(null,"opacity","0.25"),B.setAttributeNS(null,"fill","#000000");const U=L.createNS("http://www.w3.org/2000/svg","path");U.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"),B.appendChild(U);const Z=L.createNS("http://www.w3.org/2000/svg","g");Z.setAttributeNS(null,"transform","translate(6.0, 7.0)"),Z.setAttributeNS(null,"fill","#FFFFFF");const G=L.createNS("http://www.w3.org/2000/svg","g");G.setAttributeNS(null,"transform","translate(8.0, 8.0)");const Q=L.createNS("http://www.w3.org/2000/svg","circle");Q.setAttributeNS(null,"fill","#000000"),Q.setAttributeNS(null,"opacity","0.25"),Q.setAttributeNS(null,"cx","5.5"),Q.setAttributeNS(null,"cy","5.5"),Q.setAttributeNS(null,"r","5.4999962");const ne=L.createNS("http://www.w3.org/2000/svg","circle");ne.setAttributeNS(null,"fill","#FFFFFF"),ne.setAttributeNS(null,"cx","5.5"),ne.setAttributeNS(null,"cy","5.5"),ne.setAttributeNS(null,"r","5.4999962"),G.appendChild(Q),G.appendChild(ne),k.appendChild(E),k.appendChild(I),k.appendChild(B),k.appendChild(Z),k.appendChild(G),a.appendChild(k),a.setAttributeNS(null,"height",u*this._scale+"px"),a.setAttributeNS(null,"width",p*this._scale+"px"),this._element.appendChild(a),this._offset=h.P.convert(e&&e.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",a=>{a.preventDefault()}),this._element.addEventListener("mousedown",a=>{a.preventDefault()}),_l(this._element,this._anchor,"marker"),e&&e.className)for(const a of e.className.split(" "))this._element.classList.add(a);this._popup=null}addTo(e){return this.remove(),this._map=e,this._element.setAttribute("aria-label",e._getUIString("Marker.Title")),e.getCanvasContainer().appendChild(this._element),e.on("move",this._update),e.on("moveend",this._update),e.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),L.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=h.N.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),e){if(!("offset"in e.options)){const p=Math.abs(13.5)/Math.SQRT2;e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[p,-1*(38.1-13.5+p)],"bottom-right":[-p,-1*(38.1-13.5+p)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=e,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(e){return this._subpixelPositioning=e,this}getPopup(){return this._popup}togglePopup(){const e=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:e?(e.isOpen()?e.remove():(e.setLngLat(this._lngLat),e.addTo(this._map)),this):this}_updateOpacity(e=!1){var a,u;if(!(!((a=this._map)===null||a===void 0)&&a.terrain))return void(this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity));if(e)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const p=this._map,m=p.terrain.depthAtPoint(this._pos),k=p.terrain.getElevationForLngLatZoom(this._lngLat,p.transform.tileZoom);if(p.transform.lngLatToCameraDepth(this._lngLat,k)-m<.006)return void(this._element.style.opacity=this._opacity);const E=-this._offset.y/p.transform._pixelPerMeter,T=Math.sin(p.getPitch()*Math.PI/180)*E,I=p.terrain.depthAtPoint(new h.P(this._pos.x,this._pos.y-this._offset.y)),O=p.transform.lngLatToCameraDepth(this._lngLat,k+T)-I>.006;!((u=this._popup)===null||u===void 0)&&u.isOpen()&&O&&this._popup.remove(),this._element.style.opacity=O?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(e){return this._offset=h.P.convert(e),this._update(),this}addClassName(e){this._element.classList.add(e)}removeClassName(e){this._element.classList.remove(e)}toggleClassName(e){return this._element.classList.toggle(e)}setDraggable(e){return this._draggable=!!e,this._map&&(e?(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(e){return this._rotation=e||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(e){return this._rotationAlignment=e||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(e){return this._pitchAlignment=e&&e!=="auto"?e:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(e,a){return e===void 0&&a===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),e!==void 0&&(this._opacity=e),a!==void 0&&(this._opacityWhenCovered=a),this._map&&this._updateOpacity(!0),this}}const qu={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let pa=0,fa=!1;const Ar={maxWidth:100,unit:"metric"};function ma(g,e,a){const u=a&&a.maxWidth||100,p=g._container.clientHeight/2,m=g.unproject([0,p]),k=g.unproject([u,p]),E=m.distanceTo(k);if(a&&a.unit==="imperial"){const T=3.2808*E;T>5280?Qe(e,u,T/5280,g._getUIString("ScaleControl.Miles")):Qe(e,u,T,g._getUIString("ScaleControl.Feet"))}else a&&a.unit==="nautical"?Qe(e,u,E/1852,g._getUIString("ScaleControl.NauticalMiles")):E>=1e3?Qe(e,u,E/1e3,g._getUIString("ScaleControl.Kilometers")):Qe(e,u,E,g._getUIString("ScaleControl.Meters"))}function Qe(g,e,a,u){const p=function(m){const k=Math.pow(10,`${Math.floor(m)}`.length-1);let E=m/k;return E=E>=10?10:E>=5?5:E>=3?3:E>=2?2:E>=1?1:function(T){const I=Math.pow(10,Math.ceil(-Math.log(T)/Math.LN10));return Math.round(T*I)/I}(E),k*E}(a);g.style.width=e*(p/a)+"px",g.innerHTML=`${p} ${u}`}const ut={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},bl=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function vl(g){if(g){if(typeof g=="number"){const e=Math.round(Math.abs(g)/Math.SQRT2);return{center:new h.P(0,0),top:new h.P(0,g),"top-left":new h.P(e,e),"top-right":new h.P(-e,e),bottom:new h.P(0,-g),"bottom-left":new h.P(e,-e),"bottom-right":new h.P(-e,-e),left:new h.P(g,0),right:new h.P(-g,0)}}if(g instanceof h.P||Array.isArray(g)){const e=h.P.convert(g);return{center:e,top:e,"top-left":e,"top-right":e,bottom:e,"bottom-left":e,"bottom-right":e,left:e,right:e}}return{center:h.P.convert(g.center||[0,0]),top:h.P.convert(g.top||[0,0]),"top-left":h.P.convert(g["top-left"]||[0,0]),"top-right":h.P.convert(g["top-right"]||[0,0]),bottom:h.P.convert(g.bottom||[0,0]),"bottom-left":h.P.convert(g["bottom-left"]||[0,0]),"bottom-right":h.P.convert(g["bottom-right"]||[0,0]),left:h.P.convert(g.left||[0,0]),right:h.P.convert(g.right||[0,0])}}return vl(new h.P(0,0))}const Kc=M;y.AJAXError=h.bh,y.Evented=h.E,y.LngLat=h.N,y.MercatorCoordinate=h.Z,y.Point=h.P,y.addProtocol=h.bi,y.config=h.a,y.removeProtocol=h.bj,y.AttributionControl=xo,y.BoxZoomHandler=Ln,y.CanvasSource=qn,y.CooperativeGesturesHandler=yo,y.DoubleClickZoomHandler=Fs,y.DragPanHandler=Vu,y.DragRotateHandler=$u,y.EdgeInsets=po,y.FullscreenControl=class extends h.E{constructor(g={}){super(),this._onFullscreenChange=()=>{var e;let a=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((e=a==null?void 0:a.shadowRoot)===null||e===void 0)&&e.fullscreenElement;)a=a.shadowRoot.fullscreenElement;a===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,g&&g.container&&(g.container instanceof HTMLElement?this._container=g.container:h.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(g){return this._map=g,this._container||(this._container=this._map.getContainer()),this._controlContainer=L.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){L.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const g=this._fullscreenButton=L.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);L.create("span","maplibregl-ctrl-icon",g).setAttribute("aria-hidden","true"),g.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const g=this._getTitle();this._fullscreenButton.setAttribute("aria-label",g),this._fullscreenButton.title=g}_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 h.k("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new h.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()}},y.GeoJSONSource=Yo,y.GeolocateControl=class extends h.E{constructor(g){super(),this._onSuccess=e=>{if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new h.k("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,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(e),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new h.k("geolocate",e)),this._finish()}},this._updateCamera=e=>{const a=new h.N(e.coords.longitude,e.coords.latitude),u=e.coords.accuracy,p=this._map.getBearing(),m=h.e({bearing:p},this.options.fitBoundsOptions),k=be.fromLngLat(a,u);this._map.fitBounds(k,m,{geolocateSource:!0})},this._updateMarker=e=>{if(e){const a=new h.N(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(a).addTo(this._map),this._userLocationDotMarker.setLngLat(a).addTo(this._map),this._accuracy=e.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=e=>{if(this._map){if(this.options.trackUserLocation)if(e.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 a=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=a,this._geolocateButton.setAttribute("aria-label",a),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(e.code===3&&fa)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new h.k("error",e)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",e=>e.preventDefault()),this._geolocateButton=L.create("button","maplibregl-ctrl-geolocate",this._container),L.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=e=>{if(this._map){if(e===!1){h.w("Geolocation support is not available so the GeolocateControl will be disabled.");const a=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=a,this._geolocateButton.setAttribute("aria-label",a)}else{const a=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=a,this._geolocateButton.setAttribute("aria-label",a)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=L.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new xl({element:this._dotElement}),this._circleElement=L.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new xl({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",a=>{a.geolocateSource||this._watchState!=="ACTIVE_LOCK"||a.originalEvent&&a.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 h.k("trackuserlocationend")),this.fire(new h.k("userlocationlostfocus")))})}},this.options=h.e({},qu,g)}onAdd(g){return this._map=g,this._container=L.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return h._(this,arguments,void 0,function*(e=!1){if(Rn!==void 0&&!e)return Rn;if(window.navigator.permissions===void 0)return Rn=!!window.navigator.geolocation,Rn;try{Rn=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{Rn=!!window.navigator.geolocation}return Rn})}().then(e=>this._finishSetupUI(e)),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(),L.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,pa=0,fa=!1}_isOutOfMapMaxBounds(g){const e=this._map.getMaxBounds(),a=g.coords;return e&&(a.longitude<e.getWest()||a.longitude>e.getEast()||a.latitude<e.getSouth()||a.latitude>e.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 g=this._map.getBounds(),e=g.getSouthEast(),a=g.getNorthEast(),u=e.distanceTo(a),p=Math.ceil(this._accuracy/(u/this._map._container.clientHeight)*2);this._circleElement.style.width=`${p}px`,this._circleElement.style.height=`${p}px`}trigger(){if(!this._setup)return h.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 h.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":pa--,fa=!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 h.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 h.k("trackuserlocationstart")),this.fire(new h.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 g;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),pa++,pa>1?(g={maximumAge:6e5,timeout:0},fa=!0):(g=this.options.positionOptions,fa=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,g)}}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)}},y.Hash=cl,y.ImageSource=$r,y.KeyboardHandler=Gn,y.LngLatBounds=be,y.LogoControl=Zc,y.Map=class extends ju{constructor(g){h.bf.mark(h.bg.create);const e=Object.assign(Object.assign({},ff),g);if(e.minZoom!=null&&e.maxZoom!=null&&e.minZoom>e.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(e.minPitch!=null&&e.maxPitch!=null&&e.minPitch>e.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(e.minPitch!=null&&e.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(e.maxPitch!=null&&e.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new fo(e.minZoom,e.maxZoom,e.minPitch,e.maxPitch,e.renderWorldCopies),{bearingSnap:e.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new Bt,this._controls=[],this._mapId=h.a4(),this._contextLost=a=>{a.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new h.k("webglcontextlost",{originalEvent:a}))},this._contextRestored=a=>{this._setupPainter(),this.resize(),this._update(),this.fire(new h.k("webglcontextrestored",{originalEvent:a}))},this._onMapScroll=a=>{if(a.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=e.interactive,this._maxTileCacheSize=e.maxTileCacheSize,this._maxTileCacheZoomLevels=e.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=e.failIfMajorPerformanceCaveat===!0,this._preserveDrawingBuffer=e.preserveDrawingBuffer===!0,this._antialias=e.antialias===!0,this._trackResize=e.trackResize===!0,this._bearingSnap=e.bearingSnap,this._refreshExpiredTiles=e.refreshExpiredTiles===!0,this._fadeDuration=e.fadeDuration,this._crossSourceCollisions=e.crossSourceCollisions===!0,this._collectResourceTiming=e.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},Yc),e.locale),this._clickTolerance=e.clickTolerance,this._overridePixelRatio=e.pixelRatio,this._maxCanvasSize=e.maxCanvasSize,this.transformCameraUpdate=e.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=e.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=me.addThrottleControl(()=>this.isMoving()),this._requestManager=new Ie(e.transformRequest),typeof e.container=="string"){if(this._container=document.getElementById(e.container),!this._container)throw new Error(`Container '${e.container}' not found.`)}else{if(!(e.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=e.container}if(e.maxBounds&&this.setMaxBounds(e.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 a=!1;const u=la(p=>{this._trackResize&&!this._removed&&(this.resize(p),this.redraw())},50);this._resizeObserver=new ResizeObserver(p=>{a?u(p):a=!0}),this._resizeObserver.observe(this._container)}this.handlers=new qc(this,e),this._hash=e.hash&&new cl(typeof e.hash=="string"&&e.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:e.center,zoom:e.zoom,bearing:e.bearing,pitch:e.pitch}),e.bounds&&(this.resize(),this.fitBounds(e.bounds,h.e({},e.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=e.localIdeographFontFamily,this._validateStyle=e.validateStyle,e.style&&this.setStyle(e.style,{localIdeographFontFamily:e.localIdeographFontFamily}),e.attributionControl&&this.addControl(new xo(typeof e.attributionControl=="boolean"?void 0:e.attributionControl)),e.maplibreLogo&&this.addControl(new Zc,e.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",a=>{this._update(a.dataType==="style"),this.fire(new h.k(`${a.dataType}data`,a))}),this.on("dataloading",a=>{this.fire(new h.k(`${a.dataType}dataloading`,a))}),this.on("dataabort",a=>{this.fire(new h.k("sourcedataabort",a))})}_getMapId(){return this._mapId}addControl(g,e){if(e===void 0&&(e=g.getDefaultPosition?g.getDefaultPosition():"top-right"),!g||!g.onAdd)return this.fire(new h.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const a=g.onAdd(this);this._controls.push(g);const u=this._controlPositions[e];return e.indexOf("bottom")!==-1?u.insertBefore(a,u.firstChild):u.appendChild(a),this}removeControl(g){if(!g||!g.onRemove)return this.fire(new h.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const e=this._controls.indexOf(g);return e>-1&&this._controls.splice(e,1),g.onRemove(this),this}hasControl(g){return this._controls.indexOf(g)>-1}calculateCameraOptionsFromTo(g,e,a,u){return u==null&&this.terrain&&(u=this.terrain.getElevationForLngLatZoom(a,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(g,e,a,u)}resize(g){var e;const a=this._containerDimensions(),u=a[0],p=a[1],m=this._getClampedPixelRatio(u,p);if(this._resizeCanvas(u,p,m),this.painter.resize(u,p,m),this.painter.overLimit()){const E=this.painter.context.gl;this._maxCanvasSize=[E.drawingBufferWidth,E.drawingBufferHeight];const T=this._getClampedPixelRatio(u,p);this._resizeCanvas(u,p,T),this.painter.resize(u,p,T)}this.transform.resize(u,p),(e=this._requestedCameraState)===null||e===void 0||e.resize(u,p);const k=!this._moving;return k&&(this.stop(),this.fire(new h.k("movestart",g)).fire(new h.k("move",g))),this.fire(new h.k("resize",g)),k&&this.fire(new h.k("moveend",g)),this}_getClampedPixelRatio(g,e){const{0:a,1:u}=this._maxCanvasSize,p=this.getPixelRatio(),m=g*p,k=e*p;return Math.min(m>a?a/m:1,k>u?u/k:1)*p}getPixelRatio(){var g;return(g=this._overridePixelRatio)!==null&&g!==void 0?g:devicePixelRatio}setPixelRatio(g){this._overridePixelRatio=g,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(g){return this.transform.setMaxBounds(be.convert(g)),this._update()}setMinZoom(g){if((g=g??-2)>=-2&&g<=this.transform.maxZoom)return this.transform.minZoom=g,this._update(),this.getZoom()<g&&this.setZoom(g),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(g){if((g=g??22)>=this.transform.minZoom)return this.transform.maxZoom=g,this._update(),this.getZoom()>g&&this.setZoom(g),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(g){if((g=g??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(g>=0&&g<=this.transform.maxPitch)return this.transform.minPitch=g,this._update(),this.getPitch()<g&&this.setPitch(g),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(g){if((g=g??60)>85)throw new Error("maxPitch must be less than or equal to 85");if(g>=this.transform.minPitch)return this.transform.maxPitch=g,this._update(),this.getPitch()>g&&this.setPitch(g),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(g){return this.transform.renderWorldCopies=g,this._update()}project(g){return this.transform.locationPoint(h.N.convert(g),this.style&&this.terrain)}unproject(g){return this.transform.pointLocation(h.P.convert(g),this.terrain)}isMoving(){var g;return this._moving||((g=this.handlers)===null||g===void 0?void 0:g.isMoving())}isZooming(){var g;return this._zooming||((g=this.handlers)===null||g===void 0?void 0:g.isZooming())}isRotating(){var g;return this._rotating||((g=this.handlers)===null||g===void 0?void 0:g.isRotating())}_createDelegatedListener(g,e,a){if(g==="mouseenter"||g==="mouseover"){let u=!1;return{layers:e,listener:a,delegates:{mousemove:m=>{const k=e.filter(T=>this.getLayer(T)),E=k.length!==0?this.queryRenderedFeatures(m.point,{layers:k}):[];E.length?u||(u=!0,a.call(this,new Ji(g,this,m.originalEvent,{features:E}))):u=!1},mouseout:()=>{u=!1}}}}if(g==="mouseleave"||g==="mouseout"){let u=!1;return{layers:e,listener:a,delegates:{mousemove:k=>{const E=e.filter(T=>this.getLayer(T));(E.length!==0?this.queryRenderedFeatures(k.point,{layers:E}):[]).length?u=!0:u&&(u=!1,a.call(this,new Ji(g,this,k.originalEvent)))},mouseout:k=>{u&&(u=!1,a.call(this,new Ji(g,this,k.originalEvent)))}}}}{const u=p=>{const m=e.filter(E=>this.getLayer(E)),k=m.length!==0?this.queryRenderedFeatures(p.point,{layers:m}):[];k.length&&(p.features=k,a.call(this,p),delete p.features)};return{layers:e,listener:a,delegates:{[g]:u}}}}_saveDelegatedListener(g,e){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[g]=this._delegatedListeners[g]||[],this._delegatedListeners[g].push(e)}_removeDelegatedListener(g,e,a){if(!this._delegatedListeners||!this._delegatedListeners[g])return;const u=this._delegatedListeners[g];for(let p=0;p<u.length;p++){const m=u[p];if(m.listener===a&&m.layers.length===e.length&&m.layers.every(k=>e.includes(k))){for(const k in m.delegates)this.off(k,m.delegates[k]);return void u.splice(p,1)}}}on(g,e,a){if(a===void 0)return super.on(g,e);const u=this._createDelegatedListener(g,typeof e=="string"?[e]:e,a);this._saveDelegatedListener(g,u);for(const p in u.delegates)this.on(p,u.delegates[p]);return this}once(g,e,a){if(a===void 0)return super.once(g,e);const u=typeof e=="string"?[e]:e,p=this._createDelegatedListener(g,u,a);for(const m in p.delegates){const k=p.delegates[m];p.delegates[m]=(...E)=>{this._removeDelegatedListener(g,u,a),k(...E)}}this._saveDelegatedListener(g,p);for(const m in p.delegates)this.once(m,p.delegates[m]);return this}off(g,e,a){return a===void 0?super.off(g,e):(this._removeDelegatedListener(g,typeof e=="string"?[e]:e,a),this)}queryRenderedFeatures(g,e){if(!this.style)return[];let a;const u=g instanceof h.P||Array.isArray(g),p=u?g:[[0,0],[this.transform.width,this.transform.height]];if(e=e||(u?{}:g)||{},p instanceof h.P||typeof p[0]=="number")a=[h.P.convert(p)];else{const m=h.P.convert(p[0]),k=h.P.convert(p[1]);a=[m,new h.P(k.x,m.y),k,new h.P(m.x,k.y),m]}return this.style.queryRenderedFeatures(a,e,this.transform)}querySourceFeatures(g,e){return this.style.querySourceFeatures(g,e)}setStyle(g,e){return(e=h.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},e)).diff!==!1&&e.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&g?(this._diffStyle(g,e),this):(this._localIdeographFontFamily=e.localIdeographFontFamily,this._updateStyle(g,e))}setTransformRequest(g){return this._requestManager.setTransformRequest(g),this}_getUIString(g){const e=this._locale[g];if(e==null)throw new Error(`Missing UI string '${g}'`);return e}_updateStyle(g,e){if(e.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(g,e));const a=this.style&&e.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!g)),g?(this.style=new Za(this,e||{}),this.style.setEventedParent(this,{style:this.style}),typeof g=="string"?this.style.loadURL(g,e,a):this.style.loadJSON(g,e,a),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Za(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(g,e){if(typeof g=="string"){const a=this._requestManager.transformRequest(g,"Style");h.h(a,new AbortController).then(u=>{this._updateDiff(u.data,e)}).catch(u=>{u&&this.fire(new h.j(u))})}else typeof g=="object"&&this._updateDiff(g,e)}_updateDiff(g,e){try{this.style.setState(g,e)&&this._update(!0)}catch(a){h.w(`Unable to perform style diff: ${a.message||a.error||a}. Rebuilding the style from scratch.`),this._updateStyle(g,e)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():h.w("There is no style added to the map.")}addSource(g,e){return this._lazyInitEmptyStyle(),this.style.addSource(g,e),this._update(!0)}isSourceLoaded(g){const e=this.style&&this.style.sourceCaches[g];if(e!==void 0)return e.loaded();this.fire(new h.j(new Error(`There is no source with ID '${g}'`)))}setTerrain(g){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),g){const e=this.style.sourceCaches[g.source];if(!e)throw new Error(`cannot load terrain, because there exists no source with ID: ${g.source}`);this.terrain===null&&e.reload();for(const a in this.style._layers){const u=this.style._layers[a];u.type==="hillshade"&&u.source===g.source&&h.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 Gc(this.painter,e,g),this.painter.renderToTexture=new Uu(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=a=>{a.dataType==="style"?this.terrain.sourceCache.freeRtt():a.dataType==="source"&&a.tile&&(a.sourceId!==g.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(a.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 h.k("terrain",{terrain:g})),this}getTerrain(){var g,e;return(e=(g=this.terrain)===null||g===void 0?void 0:g.options)!==null&&e!==void 0?e:null}areTilesLoaded(){const g=this.style&&this.style.sourceCaches;for(const e in g){const a=g[e]._tiles;for(const u in a){const p=a[u];if(p.state!=="loaded"&&p.state!=="errored")return!1}}return!0}removeSource(g){return this.style.removeSource(g),this._update(!0)}getSource(g){return this.style.getSource(g)}addImage(g,e,a={}){const{pixelRatio:u=1,sdf:p=!1,stretchX:m,stretchY:k,content:E,textFitWidth:T,textFitHeight:I}=a;if(this._lazyInitEmptyStyle(),!(e instanceof HTMLImageElement||h.b(e))){if(e.width===void 0||e.height===void 0)return this.fire(new h.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:B,data:U}=e,Z=e;return this.style.addImage(g,{data:new h.R({width:O,height:B},new Uint8Array(U)),pixelRatio:u,stretchX:m,stretchY:k,content:E,textFitWidth:T,textFitHeight:I,sdf:p,version:0,userImage:Z}),Z.onAdd&&Z.onAdd(this,g),this}}{const{width:O,height:B,data:U}=z.getImageData(e);this.style.addImage(g,{data:new h.R({width:O,height:B},U),pixelRatio:u,stretchX:m,stretchY:k,content:E,textFitWidth:T,textFitHeight:I,sdf:p,version:0})}}updateImage(g,e){const a=this.style.getImage(g);if(!a)return this.fire(new h.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const u=e instanceof HTMLImageElement||h.b(e)?z.getImageData(e):e,{width:p,height:m,data:k}=u;if(p===void 0||m===void 0)return this.fire(new h.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(p!==a.data.width||m!==a.data.height)return this.fire(new h.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));const E=!(e instanceof HTMLImageElement||h.b(e));return a.data.replace(k,E),this.style.updateImage(g,a),this}getImage(g){return this.style.getImage(g)}hasImage(g){return g?!!this.style.getImage(g):(this.fire(new h.j(new Error("Missing required image id"))),!1)}removeImage(g){this.style.removeImage(g)}loadImage(g){return me.getImage(this._requestManager.transformRequest(g,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(g,e){return this._lazyInitEmptyStyle(),this.style.addLayer(g,e),this._update(!0)}moveLayer(g,e){return this.style.moveLayer(g,e),this._update(!0)}removeLayer(g){return this.style.removeLayer(g),this._update(!0)}getLayer(g){return this.style.getLayer(g)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(g,e,a){return this.style.setLayerZoomRange(g,e,a),this._update(!0)}setFilter(g,e,a={}){return this.style.setFilter(g,e,a),this._update(!0)}getFilter(g){return this.style.getFilter(g)}setPaintProperty(g,e,a,u={}){return this.style.setPaintProperty(g,e,a,u),this._update(!0)}getPaintProperty(g,e){return this.style.getPaintProperty(g,e)}setLayoutProperty(g,e,a,u={}){return this.style.setLayoutProperty(g,e,a,u),this._update(!0)}getLayoutProperty(g,e){return this.style.getLayoutProperty(g,e)}setGlyphs(g,e={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(g,e),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(g,e,a={}){return this._lazyInitEmptyStyle(),this.style.addSprite(g,e,a,u=>{u||this._update(!0)}),this}removeSprite(g){return this._lazyInitEmptyStyle(),this.style.removeSprite(g),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(g,e={}){return this._lazyInitEmptyStyle(),this.style.setSprite(g,e,a=>{a||this._update(!0)}),this}setLight(g,e={}){return this._lazyInitEmptyStyle(),this.style.setLight(g,e),this._update(!0)}getLight(){return this.style.getLight()}setSky(g){return this._lazyInitEmptyStyle(),this.style.setSky(g),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(g,e){return this.style.setFeatureState(g,e),this._update()}removeFeatureState(g,e){return this.style.removeFeatureState(g,e),this._update()}getFeatureState(g){return this.style.getFeatureState(g)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let g=0,e=0;return this._container&&(g=this._container.clientWidth||400,e=this._container.clientHeight||300),[g,e]}_setupContainer(){const g=this._container;g.classList.add("maplibregl-map");const e=this._canvasContainer=L.create("div","maplibregl-canvas-container",g);this._interactive&&e.classList.add("maplibregl-interactive"),this._canvas=L.create("canvas","maplibregl-canvas",e),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 a=this._containerDimensions(),u=this._getClampedPixelRatio(a[0],a[1]);this._resizeCanvas(a[0],a[1],u);const p=this._controlContainer=L.create("div","maplibregl-control-container",g),m=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(k=>{m[k]=L.create("div",`maplibregl-ctrl-${k} `,p)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(g,e,a){this._canvas.width=Math.floor(a*g),this._canvas.height=Math.floor(a*e),this._canvas.style.width=`${g}px`,this._canvas.style.height=`${e}px`}_setupPainter(){const g={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let e=null;this._canvas.addEventListener("webglcontextcreationerror",u=>{e={requestedAttributes:g},u&&(e.statusMessage=u.statusMessage,e.type=u.type)},{once:!0});const a=this._canvas.getContext("webgl2",g)||this._canvas.getContext("webgl",g);if(!a){const u="Failed to initialize WebGL";throw e?(e.message=u,new Error(JSON.stringify(e))):new Error(u)}this.painter=new ll(a,this.transform),N.testSupport(a)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(g){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||g,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(g){return this._update(),this._renderTaskQueue.add(g)}_cancelRenderFrame(g){this._renderTaskQueue.remove(g)}_render(g){const e=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(g),this._removed)return;let a=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const p=this.transform.zoom,m=z.now();this.style.zoomHistory.update(p,m);const k=new h.z(p,{now:m,fadeDuration:e,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),E=k.crossFadingFactor();E===1&&E===this._crossFadingFactor||(a=!0,this._crossFadingFactor=E),this.style.update(k)}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,e,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:e,showPadding:this.showPadding}),this.fire(new h.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,h.bf.mark(h.bg.load),this.fire(new h.k("load"))),this.style&&(this.style.hasTransitions()||a)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const u=this._sourcesDirty||this._styleDirty||this._placementDirty;return u||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new h.k("idle")),!this._loaded||this._fullyLoaded||u||(this._fullyLoaded=!0,h.bf.mark(h.bg.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var g;this._hash&&this._hash.remove();for(const a of this._controls)a.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),me.removeThrottleControl(this._imageQueueHandle),(g=this._resizeObserver)===null||g===void 0||g.disconnect();const e=this.painter.context.gl.getExtension("WEBGL_lose_context");e!=null&&e.loseContext&&e.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),L.remove(this._canvasContainer),L.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),h.bf.clearMetrics(),this._removed=!0,this.fire(new h.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,z.frameAsync(this._frameRequest).then(g=>{h.bf.frame(g),this._frameRequest=null,this._render(g)}).catch(()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(g){this._showTileBoundaries!==g&&(this._showTileBoundaries=g,this._update())}get showPadding(){return!!this._showPadding}set showPadding(g){this._showPadding!==g&&(this._showPadding=g,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(g){this._showCollisionBoxes!==g&&(this._showCollisionBoxes=g,g?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(g){this._showOverdrawInspector!==g&&(this._showOverdrawInspector=g,this._update())}get repaint(){return!!this._repaint}set repaint(g){this._repaint!==g&&(this._repaint=g,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(g){this._vertices=g,this._update()}get version(){return Hu}getCameraTargetElevation(){return this.transform.elevation}},y.MapMouseEvent=Ji,y.MapTouchEvent=Os,y.MapWheelEvent=Bu,y.Marker=xl,y.NavigationControl=class{constructor(g){this._updateZoomButtons=()=>{const e=this._map.getZoom(),a=e===this._map.getMaxZoom(),u=e===this._map.getMinZoom();this._zoomInButton.disabled=a,this._zoomOutButton.disabled=u,this._zoomInButton.setAttribute("aria-disabled",a.toString()),this._zoomOutButton.setAttribute("aria-disabled",u.toString())},this._rotateCompassArrow=()=>{const e=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=e},this._setButtonTitle=(e,a)=>{const u=this._map._getUIString(`NavigationControl.${a}`);e.title=u,e.setAttribute("aria-label",u)},this.options=h.e({},mf,g),this._container=L.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",e=>e.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",e=>this._map.zoomIn({},{originalEvent:e})),L.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",e=>this._map.zoomOut({},{originalEvent:e})),L.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",e=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:e}):this._map.resetNorth({},{originalEvent:e})}),this._compassIcon=L.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(g){return this._map=g,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 gf(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){L.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(g,e){const a=L.create("button",g,this._container);return a.type="button",a.addEventListener("click",e),a}},y.Popup=class extends h.E{constructor(g){super(),this.remove=()=>(this._content&&L.remove(this._content),this._container&&(L.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 h.k("close"))),this),this._onMouseUp=e=>{this._update(e.point)},this._onMouseMove=e=>{this._update(e.point)},this._onDrag=e=>{this._update(e.point)},this._update=e=>{var a;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=L.create("div","maplibregl-popup",this._map.getContainer()),this._tip=L.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const E of this.options.className.split(" "))this._container.classList.add(E);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?mi(this._lngLat,this._flatPos,this._map.transform):(a=this._lngLat)===null||a===void 0?void 0:a.wrap(),this._trackPointer&&!e)return;const u=this._flatPos=this._pos=this._trackPointer&&e?e:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&e?e:this._map.transform.locationPoint(this._lngLat));let p=this.options.anchor;const m=vl(this.options.offset);if(!p){const E=this._container.offsetWidth,T=this._container.offsetHeight;let I;I=u.y+m.bottom.y<T?["top"]:u.y>this._map.transform.height-T?["bottom"]:[],u.x<E/2?I.push("left"):u.x>this._map.transform.width-E/2&&I.push("right"),p=I.length===0?"bottom":I.join("-")}let k=u.add(m[p]);this.options.subpixelPositioning||(k=k.round()),L.setTransform(this._container,`${vo[p]} translate(${k.x}px,${k.y}px)`),_l(this._container,p,"popup")},this._onClose=()=>{this.remove()},this.options=h.e(Object.create(ut),g)}addTo(g){return this._map&&this.remove(),this._map=g,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 h.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(g){return this._lngLat=h.N.convert(g),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(g){return this.setDOMContent(document.createTextNode(g))}setHTML(g){const e=document.createDocumentFragment(),a=document.createElement("body");let u;for(a.innerHTML=g;u=a.firstChild,u;)e.appendChild(u);return this.setDOMContent(e)}getMaxWidth(){var g;return(g=this._container)===null||g===void 0?void 0:g.style.maxWidth}setMaxWidth(g){return this.options.maxWidth=g,this._update(),this}setDOMContent(g){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=L.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(g),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(g){return this._container&&this._container.classList.add(g),this}removeClassName(g){return this._container&&this._container.classList.remove(g),this}setOffset(g){return this.options.offset=g,this._update(),this}toggleClassName(g){if(this._container)return this._container.classList.toggle(g)}setSubpixelPositioning(g){this.options.subpixelPositioning=g}_createCloseButton(){this.options.closeButton&&(this._closeButton=L.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 g=this._container.querySelector(bl);g&&g.focus()}},y.RasterDEMTileSource=Si,y.RasterTileSource=Zt,y.ScaleControl=class{constructor(g){this._onMove=()=>{ma(this._map,this._container,this.options)},this.setUnit=e=>{this.options.unit=e,ma(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Ar),g)}getDefaultPosition(){return"bottom-left"}onAdd(g){return this._map=g,this._container=L.create("div","maplibregl-ctrl maplibregl-ctrl-scale",g.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){L.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},y.ScrollZoomHandler=cr,y.Style=Za,y.TerrainControl=class{constructor(g){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=g}onAdd(g){return this._map=g,this._container=L.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=L.create("button","maplibregl-ctrl-terrain",this._container),L.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(){L.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},y.TwoFingersTouchPitchHandler=go,y.TwoFingersTouchRotateHandler=jc,y.TwoFingersTouchZoomHandler=Vc,y.TwoFingersTouchZoomRotateHandler=Hc,y.VectorTileSource=Go,y.VideoSource=Js,y.addSourceType=(g,e)=>h._(void 0,void 0,void 0,function*(){if(Ko(g))throw new Error(`A source type called "${g}" already exists.`);((a,u)=>{Xo[a]=u})(g,e)}),y.clearPrewarmedResources=function(){const g=Se;g&&(g.isPreloaded()&&g.numActive()===1?(g.release(Mn),Se=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()"))},y.getMaxParallelImageRequests=function(){return h.a.MAX_PARALLEL_IMAGE_REQUESTS},y.getRTLTextPluginStatus=function(){return Tr().getRTLTextPluginStatus()},y.getVersion=function(){return Kc},y.getWorkerCount=function(){return Pn.workerCount},y.getWorkerUrl=function(){return h.a.WORKER_URL},y.importScriptInWorkers=function(g){return Vt().broadcast("IS",g)},y.prewarm=function(){Ze().acquire(Mn)},y.setMaxParallelImageRequests=function(g){h.a.MAX_PARALLEL_IMAGE_REQUESTS=g},y.setRTLTextPlugin=function(g,e){return Tr().setRTLTextPlugin(g,e)},y.setWorkerCount=function(g){Pn.workerCount=g},y.setWorkerUrl=function(g){h.a.WORKER_URL=g}});var x=o;return x})})(Py);var eE=Py.exports;const tE=JS(eE),Xh=["#FF6633","#FFB399","#FF33FF","#00B3E6","#E6B333","#3366E6","#999966","#99FF99","#B34D4D","#80B300","#809900","#E6B3B3","#6680B3","#66991A","#FF99E6","#CCFF1A","#FF1A66","#E6331A","#33FFCC","#66994D","#B366CC","#4D8000","#B33300","#CC80CC","#66664D","#991AFF","#E666FF","#4DB3FF","#1AB399","#E666B3","#33991A","#CC9999","#B3B31A","#00E680","#4D8066","#809980","#E6FF80","#1AFF33","#999933","#FF3380","#CCCC00","#66E64D","#4D80CC","#9900B3","#E64D66","#4DB380","#FF4D4D","#99E6E6","#6666FF","#FFFF99"],jn={};async function Kh(n="pin4-sm-mi-plumber+f45942.png",t=null){try{const c=n!=null&&n.includes("/")?n:`/api-user/marker_icon/${n}`,d=await t.loadImage(c);if(t.hasImage(n))return;t==null||t.addImage(n,d.data,{sdf:n==null?void 0:n.includes("+sdf")})}catch(o){console.error(o)}}function iE(n){if(!(n!=null&&n.startsWith("rgba")))return n;const t=n.replace(/^rgba?\(|\s+|\)$/g,"").split(",");return`${((1<<24)+(parseInt(t[0],10)<<16)+(parseInt(t[1],10)<<8)+parseInt(t[2],10)).toString(16).slice(1)}`}jn.point=async(n={},t={},o=null)=>{var z,L,N,Y,ee,oe,he,_e,me,Ie,tt,gt;t||(t={}),((z=t==null?void 0:t.width)==null?void 0:z[0])==="["&&(t.width={stops:JSON.parse(t.width)}),typeof(t==null?void 0:t.width)=="string"&&(t.width-=0),typeof(t==null?void 0:t.opacity)=="string"&&(t.opacity=(t.opacity-0)*100);const c=((L=n.style)==null?void 0:L.colorAttr)||((N=n.style)==null?void 0:N.iconCls);let d={circle:"none-xl-{{marker}}+222.png",circle2:"circle-xl-{{marker}}+222.png",pin2:"pin2-xl-{{marker}}+sdf.png",pin:"pin-xl-{{marker}}+sdf.png"}[t.iconType]||(t==null?void 0:t.icon);const[x,y]=(d==null?void 0:d.split("-"))||[],h=((Y=n.style)==null?void 0:Y.color)||"blue";!((ee=n.style)!=null&&ee.iconAttr)&&(d!=null&&d.includes("{{marker}}"))&&(d=d.replace("{{marker}}","fa-star"));const M="gray",D=(Ve,rt)=>`${Ve==null?void 0:Ve.split("+")[0]}+${rt.replace("#","")}.png`;if(n.legendAuto={icon:[],color:[]},(oe=n.style)!=null&&oe.iconAttr&&d){const Ve=(_e=(he=n.meta)==null?void 0:he.columns)==null?void 0:_e.find(xt=>{var zt;return xt.name===((zt=n==null?void 0:n.style)==null?void 0:zt.iconAttr)}),rt=(Ve==null?void 0:Ve.values)||await mt.get(`/api-user/gis-ir/${n.id}/${(me=n.style)==null?void 0:me.iconAttr}`).then(xt=>xt.data.rows);if(rt!=null&&rt.length){const xt=d.replace("{{color}}",h.length?h:iE(h)||[0]).split("+")[1].split(/[.-]/)[0];rt.forEach((zt,Et)=>{var Ki;return zt.icon=(Ki=zt.icon)!=null&&Ki.includes("png")?zt.icon:`${x}-${y}-${zt.data||zt.icon||`ub-${Et}`}+${d!=null&&d.includes("circle")?"ddd-222":xt}.png`}),d=d!=null&&d.includes("{{")?`${x}-${y}-fa-question+0c53ad.png`:d,n.legendAuto.iconText=(Ve==null?void 0:Ve.title)||n.style.iconAttr,rt.forEach(zt=>n.legendAuto.icon.push(zt)),n.legendAuto.icon.push({icon:d,text:"Не визначено"}),n.style.iconArr=["match",["get",n.style.iconAttr]].concat(rt.filter(zt=>zt.id).reduce((zt,Et)=>zt.concat([Et.id,Et.icon]),[])).concat([d]),await Promise.all(rt.map(zt=>zt.icon).map(zt=>Kh(zt,o))),await Kh(d,o)}else d=c?"pin6-m-fa-star+{{color}}.png":`pin6-m-fa-star+${h==null?void 0:h.replace("#","")}.png`}if(d!=null&&d.includes("{{color}}")?d=d.replace("{{color}}","222"):t!=null&&t.icon&&t.iconAttr,c){const Ve=(tt=(Ie=n.meta)==null?void 0:Ie.columns)==null?void 0:tt.find(xt=>xt.name===c),rt=(Ve==null?void 0:Ve.values)||await mt.get(`/api-user/gis-ir/${n.id}/${c}`).then(xt=>xt.data.rows);n.style.color=rt!=null&&rt.length?["match",["get",c]].concat(rt.filter(xt=>xt.id).reduce((xt,zt,Et)=>xt.concat([zt.id,zt.color||Xh[Et]]),[])).concat(["#aaa"]):h,n.style.colorArr=n.style.color,n.legendAuto.colorText=(Ve==null?void 0:Ve.title)||c,rt.forEach(xt=>n.legendAuto.color.push(xt)),n.legendAuto.color.push({color:"#aaa",text:"Не визначено"}),!((gt=n.style)!=null&>.iconAttr)&&!(d!=null&&d.includes("+sdf"))&&d&&(rt.forEach((xt,zt)=>xt.icon=D(d,xt.color||Xh[zt])),n.style.iconArr=["match",["get",c]].concat(rt.filter(xt=>xt.id).reduce((xt,zt)=>xt.concat([zt.id,zt.icon]),[])).concat([D(d,M)]),await Promise.all(rt.map(xt=>xt.icon).map(xt=>Kh(xt,o))))}if(d&&!(d!=null&&d.includes("{"))){const Ve=t!=null&&t.colorAttr?D(d,M):d;await Kh(Ve,o)}const A=d!=null&&d.includes("sdf")?["interpolate",["linear"],["zoom"],14,.1,18,.2]:["interpolate",["linear"],["zoom"],14,.7,16,1];return t.iconOffset=d!=null&&d.includes("pin")?[0,d!=null&&d.includes("+sdf")?-96:-20]:null,[{id:`${n.id}`,source:n.id,type:"circle",cluster:!0,lsource:t==null?void 0:t.lsource,minzoom:(t==null?void 0:t.minzoom)!==void 0?+(t==null?void 0:t.minzoom):4,maxzoom:(d!=null&&d.includes("+sdf")||!(d!=null&&d.includes("circle"))&&!(d!=null&&d.includes("none"))?+t.iconZoom:null)||+(t==null?void 0:t.maxzoom)||24,filter:["all",["==",["geometry-type"],"Point"],["!",["has","point_count"]]],paint:{"circle-stroke-width":["case",["boolean",["feature-state","select"],!1],(t==null?void 0:t.strokeWidth)||1,["boolean",["feature-state","hover"],!1],2,(t==null?void 0:t.strokeWidth)||1],"circle-stroke-color":["case",["boolean",["feature-state","select"],!1],(t==null?void 0:t.stroke)||(t==null?void 0:t.color)||"#fff",["boolean",["feature-state","hover"],!1],"maroon",(t==null?void 0:t.stroke)||(t==null?void 0:t.color)||"#fff"],"circle-opacity":(t.iconZoom?["interpolate",["exponential",.5],["zoom"],+t.iconZoom-1,1,+t.iconZoom,d!=null&&d.includes("none")?.3:0]:null)||t.opacity||1,"circle-color":t.color||["case",["boolean",["feature-state","hover"],!1],"red","blue"],"circle-radius":(Array.isArray(t.width)?{stops:t.width}:null)||t.width||{stops:t.iconZoom?[[+t.iconZoom,4],[+t.iconZoom,8],[18,16]]:[[13,4],[15,8],[18,12]]}}}].concat(t.iconArr||t.icon?[{id:`${n.id}-5`,source:n.id,lsource:t==null?void 0:t.lsource,type:"symbol",minzoom:+t.iconZoom||16,filter:["all",["!",["has","point_count"]]],layout:{"icon-image":t!=null&&t.colorAttr&&t.iconArr||d,"icon-allow-overlap":!0,...t.iconOffset?{"icon-offset":t.iconOffset||!1}:{},...A?{"icon-size":A||!1}:{}},paint:{"icon-opacity":["case",["boolean",["feature-state","hover"],!1],.5,["boolean",["feature-state","select"],!1],.5,(d!=null&&d.includes("+sdf")?1:null)||(d!=null&&d.includes("circle")?.6:1)],...d!=null&&d.includes("+sdf")?{"icon-color":["case",["boolean",["feature-state","hover"],!1],"#cd0bbf",["boolean",["feature-state","select"],!1],"#8517cf",t.color||"#aa0000"]}:{}}}]:[]).concat(t.label?[{id:`${n.id}-4`,source:n.id,lsource:t==null?void 0:t.lsource,type:"symbol",minzoom:14,filter:["!",["has","point_count"]],layout:{"text-field":t.label,"text-font":["Open Sans Regular"],"text-size":t["text-size"]||8},paint:{"text-color":t["text-color"]||"#ffffff","text-halo-color":t["text-halo-color"]||"black"}}]:[]).concat(n.cluster||t.clusterMaxZoom?[{id:`${n.id}-1`,source:n.id,lsource:t==null?void 0:t.lsource,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]}},{id:`${n.id}-2`,source:n.id,lsource:t==null?void 0:t.lsource,type:"symbol",filter:["has","point_count"],layout:{"text-field":"{point_count_abbreviated}","text-font":["Open Sans Regular"],"text-size":12}}]:[])},jn.label=(n={})=>[{id:n.id,source:n.id,type:"line",layout:{"text-field":"{str_name}","text-font":["DIN Offc Pro Italic","Arial Unicode MS Regular"],"symbol-placement":"line","text-pitch-alignment":"viewport","text-max-angle":30,"text-size":{base:1,stops:[[13,12],[18,16]]}},paint:{"text-halo-width":0,"text-halo-blur":0,"text-color":"#78888a"}}],jn.polygon=async(n={},t={},o=null)=>{var x,y,h,M;const{colorAttr:c}=t,d=((x=n.style)==null?void 0:x.color)||"blue";if(t.colorAttr){o.getSource(n.id)&&o.getSource(o.getSource(n.id).setData(`${o.getSource(n.id)._data.split("&props")[0]}&props=${c}`));const D=((h=(y=n.meta)==null?void 0:y.columns.find(A=>A.name===c))==null?void 0:h.values)||await mt.get(`/api-user/gis-ir/${n.id}/${c}`).then(A=>A.data.rows);n.legendAuto={color:[]},D.forEach(A=>n.legendAuto.color.push(A)),n.legendAuto.color.push({color:"#aaa",text:"Не визначено"}),n.style.color=D?["match",["get",c]].concat(D.filter(A=>A.id).reduce((A,z,L)=>A.concat([z.id,z.color||Xh[L]]),[])).concat(["#aaa"]):d}return[{id:`${n.id}`,source:`${n.id}`,lsource:t==null?void 0:t.lsource,minzoom:(+(t==null?void 0:t.minzoom)||+(t==null?void 0:t.pointZoom)||0)-0,maxzoom:+(t==null?void 0:t.maxzoom)||24,type:"fill",filter:["all",["match",["geometry-type"],["Polygon","MultiPolygon"],!0,!1]],paint:{"fill-color":["case",["boolean",["feature-state","hover"],!1],"red",["boolean",["feature-state","select"],!1],"#c356c1",(t==null?void 0:t.color)||"#0080ff"],"fill-opacity":.5}}].concat(t!=null&&t.pointZoom?[{id:`${n.id}-5`,source:(M=n.url)!=null&&M.includes(".vmt")?`${n.id}`:`${n.id}-point`,type:"circle",minzoom:0,maxzoom:((t==null?void 0:t.pointZoom)||1)-0,paint:{"circle-color":["case",["boolean",["feature-state","hover"],!1],"red",(t==null?void 0:t.color)||"blue"],"circle-stroke-width":1,"circle-stroke-color":"#fff"}}]:[]).concat(t!=null&&t.label?[{id:`${n.id}-1`,source:n.id,type:"symbol",lsource:t==null?void 0:t.lsource,minzoom:15,layout:{"text-field":t==null?void 0:t.label,"text-font":["Open Sans Regular"],"text-size":t["text-size"]||{stops:[[14,4],[18,16]]}},paint:{"text-color":t["text-color"]||"#ffffff","text-halo-color":t["text-halo-color"]||"#fff","text-halo-width":t["text-halo-width"]||0}}]:[]).concat(t!=null&&t.stroke?[{id:`${n.id}-2`,source:n.id,lsource:t==null?void 0:t.lsource,minzoom:(+(t==null?void 0:t.minzoom)||+(t==null?void 0:t.pointZoom)||0)-0,maxzoom:+(t==null?void 0:t.maxzoom)||24,type:"line",paint:{"line-color":["case",["boolean",["feature-state","select"],!1],"#c356c1",t.stroke],"line-width":["case",["boolean",["feature-state","select"],!1],3,(t.width||t["line-width"]||1)-0]}}]:[])},jn.line=(n={},t={})=>[{id:n.id,source:n.id,lsource:t.lsource,type:"line",filter1:["all",["match",["geometry-type"],["LineString","MultiLineString","MultiPolygon","Polygon"],!0,!1]],minzoom:(t==null?void 0:t.minzoom)||n.minzoom||5,layout:{"line-join":"round","line-cap":"round"},paint:{"line-width":["case",["boolean",["feature-state","select"],!1],4,t.width||t["line-width"]||1],"line-color":["case",["boolean",["feature-state","select"],!1],"#c356c1",t.color||t["line-color"]||"#c71ccb"],"line-gap-width":t["line-gap-width"]||0}}].concat(t.label?[{id:`${n.id}-4`,source:n.id,lsource:t.lsource,type:"symbol",minzoom:14,paint:{"text-color":"#111","text-halo-color":"#fff","text-halo-width":2},layout:{"symbol-placement":"line","text-letter-spacing":.2,"text-field":t.label,"text-font":["Open Sans Regular"],"text-size":t["text-size"]||15}}]:[]),jn.linestring=jn.line,jn.circle=jn.point;async function nE(n,t,o){var h,M,D,A,z,L,N,Y,ee,oe,he,_e;typeof t.style=="string"&&(t.style=t.style[0]==="{"?JSON.parse(t.style):(h=window.YAML.parse(t.style))==null?void 0:h.style),(D=(M=t.style)==null?void 0:M.filter)==null||D.call(M,me=>me.source).forEach(me=>{me.lsource=`${t.id}-${me.source}`});const c=((A=t==null?void 0:t.style)==null?void 0:A.type)||((he=((N=(L=(z=t==null?void 0:t.meta)==null?void 0:z.geom)==null?void 0:L.geometry)==null?void 0:N.length)>2?["point"]:[((oe=(ee=(Y=t==null?void 0:t.meta)==null?void 0:Y.geom)==null?void 0:ee.geometry)==null?void 0:oe[0].toLowerCase())||"point"])==null?void 0:he.map(me=>{var Ie;return(Ie=me==null?void 0:me.replace)==null?void 0:Ie.call(me,"multi","")})),d=Array.isArray(c)?c:[c],x=(await Promise.all(Array.isArray(t==null?void 0:t.style)?t.style.map(async me=>{var Ie;return(Ie=jn[me.type])==null?void 0:Ie.call(jn,t,me,o)}):d.map(async me=>{var Ie;return(Ie=jn[me])==null?void 0:Ie.call(jn,t,t.style,o)}))).reduce((me,Ie)=>Ie?me.concat(Ie):me,[]);x.forEach((me,Ie)=>{me.id=`${me.id}-${Ie}`});const y=x;return(t.service==="vtile"||(_e=t.url)!=null&&_e.includes(".vmt"))&&y.forEach(me=>{me.layout||(me.layout={}),me.layout.visibility="visible",me["source-layer"]=me.lsource||t.data||n}),y}const rE={data(){return{layerList:[],layerObj:{},colors:Xh,activeLayer:"",addedLayersSettings:[],hoveredFeatureId:null}},computed:{interactiveSources(){return this.layerList.filter(n=>n==null?void 0:n.interactive).map(n=>n.id)}},methods:{moveLayers(n,t=this.map){t.getStyle().layers.forEach(o=>{o.id.match(n)&&t.moveLayer(o.id)})},getLayersBySourceId(n,t){return t.getStyle().layers.filter(c=>c.id.match(n))},async setVisible(n,t=!0,o={}){const c=typeof n=="object";try{const{style:d,map:x=this.map}=o,y=(n==null?void 0:n.id)||n,h=c?n:await this.getLayerById(y);if(!(h!=null&&h.id))throw new Error("MixinError: Layer has no id");const M=x.getStyle().layers.filter(D=>D.id.match(y));!M.length||d?await this.addToLayers({...h,...(o==null?void 0:o.data)||{},interactive:(h==null?void 0:h.interactive)!==void 0?h==null?void 0:h.interactive:!0,visible:t},{map:x,cb:o==null?void 0:o.onAddLayer}):(this.layerList=this.layerList.map(D=>D.id===h.id?{...D,visible:t}:D),M.forEach(D=>{x.setLayoutProperty(D.id,"visibility",t?"visible":"none")})),o!=null&&o.cb&&await(o==null?void 0:o.cb(h))}catch(d){console.error(d),!o.onAddLayer||o.onAddLayer({data:c?n:{id:n},message:d.message,type:"error"})}},async addToLayers(n,t={}){try{const{map:o=this==null?void 0:this.map}=t;this.layerList.find(d=>d.id===n.id)||(this.layerList=this.layerList.concat(n)),this.layerObj={...this.layerObj,[n.id]:n},n.visible?n!=null&&n.layer?await this.addVectorLayer(n,o):n.service==="vtile"?await this.addVtileLayer(n,o):n.service==="geojson"?await this.addGeojsonLayers(n,o):this.addRasterLayer(n,o):o.getStyle().layers.forEach(async d=>{d.source===n.id&&await o.setLayoutProperty(d.id,"visibility","none")}),!(t!=null&&t.cb&&(n!=null&&n.visible))||await t.cb({data:n,type:"success"}),this.moveLayers("gl-draw")}catch(o){!t.cb||t.cb({data:n,message:o.message,type:"error"}),console.error(o)}},addRasterLayer(n,t){t.addSource(n.id,{type:"raster",tiles:[(n==null?void 0:n.url)||(n==null?void 0:n.url1)],tileSize:256,...n!=null&&n.scheme?{scheme:n==null?void 0:n.scheme}:{}}),t.addLayer({id:n.id,type:"raster",source:n.id,minzoom:0,maxzoom:(n==null?void 0:n.maxzoom)||22})},async addVtileLayer(n){await this.createGeometryLayer({data:n},"vector")},async addVectorLayer(n,t){const{data:o}=await mt.get(n.layer),c={...n,source:n.id,layers:[]};Object.keys(o.sources).forEach(async d=>{await t.addSource(n.id,{type:o.sources[d].type,maxzoom:o.sources[d].maxzoom,url:o.sources[d].url})}),await o.layers.forEach(async d=>{await t.addLayer({...d,source:n.id,id:`${d.id}-${n.id}`}),c.layers=await c.layers.concat(`${d.id}-${n.id}`)})},async addGeojsonLayers(n){const t=o=>{throw this.$notify({type:"error",title:"Відсутня геометрія у обраному шарі",message:o,position:"bottom-right"}),this.layerList=this.layerList.filter(c=>c.id!==n.id),new Error(o)};if(typeof(n==null?void 0:n.geojson)=="object"){this.createGeometryLayer({data:n,geojson:n.geojson},"geojson");return}try{const o=await mt.get((n==null?void 0:n.geojson)||(n==null?void 0:n.url)),c=await o.data;if(o.statusText==="OK")this.createGeometryLayer({data:n,geojson:c},"geojson");else throw new Error((c==null?void 0:c.message)||(o==null?void 0:o.statusText)||"Error addGeojson layer")}catch(o){t(o.message),console.error(o)}},async createGeometryLayer({data:n,geojson:t},o){var h,M,D,A,z;const{map:c}=this,d=await nE(n.id,this.layerList.find(L=>L.id==n.id),c),x={type:o,cluster:((h=n==null?void 0:n.style)==null?void 0:h.cluster)||!1,clusterMaxZoom:((M=n==null?void 0:n.style)==null?void 0:M.clusterMaxZoom)||14};o==="vector"&&(x.tiles=[`${window.location.origin}${(n==null?void 0:n.geojson)||(n==null?void 0:n.url)}${n!=null&&n.version?`?ver=${n.version}`:""}${n.props?`&props=${n.props}`:""}${(D=n==null?void 0:n.style)!=null&&D.pointZoom?`&pointZoom=${n.style.pointZoom}`:""}`]),o==="geojson"&&(x.data=t||`${window.location.origin}${(n==null?void 0:n.geojson)||(n==null?void 0:n.url)}`),c.addSource(n.id,x),d.forEach(L=>{var Y;const N={...L,source:n.id,maxzoom:+(L==null?void 0:L.maxzoom)||24,minzoom:+(L==null?void 0:L.minzoom)||0,cluster:!1,clusterMaxZoom:2};c.addLayer(N),c.moveLayer(L.id),(Y=L==null?void 0:L.layout)!=null&&Y["text-field"]||this.apiLayersHover(L.id,n.id,c),this.addedLayersSettings=this.addedLayersSettings.concat(N)});const y=d.map(L=>L.type).filter(L=>L&&L!=="symbol");(z=(A=n==null?void 0:n.meta)==null?void 0:A.geom)!=null&&z.geometry&&n.meta.geom.geometry.filter(N=>!y.includes(this.geometryByType(N,!0))).forEach(N=>{this.createStyleObj({type:N,style:n.style},n.id)})},async setStyle(n,t,o=this.map){const c=(n==null?void 0:n.id)||n;o.getStyle().layers.forEach(x=>{x.source===c&&o.removeLayer(x.id)}),o.getSource(c)&&(o==null||o.removeSource(c)),this.layerList=this.layerList.map(x=>(x.id===c&&(x.style=t),x));const d=this.layerList.find(x=>x.id===c);this.addToLayers(d)},setLayerData({source:n,data:t}){const o=(n==null?void 0:n.id)||n;this.layerList=this.layerList.map(c=>c.id===o?{...c,...t}:c),this.layerObj={...this.layerObj,[n]:{...this.layerObj[n],...t}}},geometryByType(n,t=!1){if(n==="fill"||n==="Polygon"||n==="MultiPolygon")return t?"fill":"Polygon";if(n==="circle"||n==="Point"||n==="MultiPoint")return t?"circle":"Point";if(n==="line"||n==="LineString"||n==="MultiLineString")return t?"line":"LineString"},async removeLayer(n,t=this.map){const o=(n==null?void 0:n.id)||n;this.layerList=this.layerList.filter(c=>c.id!==o),await t.getStyle().layers.forEach(async c=>{c.source===o&&await t.removeLayer(c.id)}),await t.removeSource(o)},async reloadUrl(n,t=this.map){const o=(n==null?void 0:n.id)||n;await t.getStyle().layers.forEach(c=>{c.id===o&&t.removeLayer(c.id)}),await t.removeSource(o),await this.setVisible(n,!0)},async setFilter(n,t){const o=this.layerObj[n],c=await this.map.getSource(n);if(o.service==="vtile")await c.setTiles([`${window.location.origin}${o.geojson||o.url}${o.url.includes("?")?"&":"?"}filter=${t}${o.props?`&props=${o.props}`:""}`]);else if(o.service==="geojson"){const{data:d}=await mt.get((o==null?void 0:o.geojson)||`${o==null?void 0:o.url}?filter=${t}`);await this.map.getSource(n).setData(d)}},async getLayerById(n,t=null){var c;const o=(n==null?void 0:n.id)||n;try{const d=(c=this.layerList)==null?void 0:c.find(y=>y.id===o);if(d)return d;const x=await mt.get(`/api-user/gis-ir/${o}${n!=null&&n.service?`?service=${n==null?void 0:n.service}`:""}`);if(x.statusText==="OK"){const y=await x.data;return!t||await t(y),y}return this.$notify({type:"warning",message:`Шар ${o} не було знайдено!`}),null}catch(d){this.$notify({type:"warning",message:`Шар ${o} не було знайдено!`}),console.error(d)}},createStyleObj({type:n,style:t},o){const c=this.geometryByType(n,!0);if(!c)throw Error("Geomery type ERROR: Error adding missing layers");const d=`${o}-${c}`;if(this.map.getStyle().layers.find(y=>y.id===d))return;const x={id:d,type:c,source:o,"source-layer":o,layout:{},paint:{[`${c}-color`]:["case",["boolean",["feature-state","hover"],!1],"red",(t==null?void 0:t.color)||"#444e3d"],[`${c}-opacity`]:t!=null&&t.opacity||c==="fill"?.5:1},filter:["all",["==",["geometry-type"],this.geometryByType(n)]]};this.map.addLayer(x),this.addedLayersSettings=this.addedLayersSettings.concat(x),this.apiLayersHover(d,o,this.map)},apiLayersHover(n,t,o){const c=o.getSource(t),d=()=>{const x={source:t,id:this.hoveredFeatureId};return c.type==="vector"&&(x.sourceLayer=t),x};o.on("mousemove",n,x=>{x.features.length>0&&(this.hoveredFeatureId!==null&&o.setFeatureState(d(),{hover:!1}),this.hoveredFeatureId=x.features[0].id,o.setFeatureState(d(),{hover:!0}))}),o.on("mouseleave",n,()=>{this.hoveredFeatureId!==null&&o.setFeatureState(d(),{hover:!1}),this.hoveredFeatureId=null})},async changeBaseLayer(n,t=!0,o=!0){await this.setVisible(n,t);const c=(n==null?void 0:n.id)||n;c!==this.activeLayer&&(o&&this.activeLayer&&await this.setVisible(this.activeLayer,!1),this.map.getStyle().layers.forEach(d=>{d.source!==c&&d.type!=="background"&&this.map.moveLayer(d.id)}),this.activeLayer=c)},async refreshLayer(n,t=this.map){const o=(n==null?void 0:n.id)||n;await t.getStyle().layers.forEach(c=>{c.source===o&&t.removeLayer(c.id)}),await t.removeSource(o),this.layers=await this.layers.filter(c=>c.id!==o),await this.setVisible(typeof n=="object"?n:o)}}},sE={props:{objectData:{type:Array,default:()=>[]},object:{type:Object,default:()=>null},mapRef:{type:Object,default:()=>null}},computed:{currentLayer(){var o;const n=(o=this.object)==null?void 0:o.source;return this.mapRef.layerObj[n]},popupPosition(){var t,o,c;return((c=(o=(t=this.currentLayer)==null?void 0:t.setting)==null?void 0:o.popup)==null?void 0:c.position)||"horizontal"},popupWidth(){var t,o,c;return`${((c=(o=(t=this.currentLayer)==null?void 0:t.setting)==null?void 0:o.popup)==null?void 0:c.width)||240}px`},popupRows(){return this.objectData.filter(n=>n.column!=="image")},positionIsVertical(){return this.popupPosition==="vertical"}},methods:{rowValue(n){return n.value},rowTitle(n){return n.title}}},oE={key:0,class:"vsTailwind map-popup__vertical"},aE={class:"mb-1"},lE={class:"text-sm"},cE={key:1,class:"map__popup-body"},hE=["innerHTML"],uE={key:1};function dE(n,t,o,c,d,x){return v.openBlock(),v.createElementBlock("div",{class:"map-popup",style:v.normalizeStyle({"max-width":x.popupWidth,width:x.popupWidth})},[x.positionIsVertical?(v.openBlock(),v.createElementBlock("div",oE,[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList(x.popupRows,y=>(v.openBlock(),v.createElementBlock("div",{class:"border-b py-1 last:border-none last:pt-1 last:pb-0",key:x.rowTitle(y)},[v.createElementVNode("strong",aE,v.toDisplayString(x.rowTitle(y)),1),v.createElementVNode("div",lE,v.toDisplayString(x.rowValue(y)),1)]))),128))])):(v.openBlock(),v.createElementBlock("table",cE,[v.createElementVNode("tbody",null,[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList(x.popupRows,y=>v.withDirectives((v.openBlock(),v.createElementBlock("tr",{key:x.rowTitle(y),class:"map__popup-body-item"},[v.createElementVNode("td",null,v.toDisplayString(x.rowTitle(y)),1),x.rowValue(y)?(v.openBlock(),v.createElementBlock("td",{key:0,innerHTML:x.rowValue(y)},null,8,hE)):(v.openBlock(),v.createElementBlock("td",uE,t[0]||(t[0]=[v.createElementVNode("div",{class:"text-red-500"}," Не визначено ",-1)])))])),[[v.vShow,!x.rowValue(y).includes("id")]])),128))])]))],4)}const pE=vt(sE,[["render",dE],["__scopeId","data-v-3f5a9aff"]]),Iy={width:200,show:!0,position:"horizontal"},fE={components:{VsPopupBody:pE},props:{aviableFields:{type:Array,default:()=>[]},mapRef:{type:[Object,Array],default:()=>{}},object:{type:[Object,Array],default:()=>{}}},data(){return{objectData:[],popupSettings:Iy}},computed:{getImage(){return this.objectData.find(n=>n.column==="image")||null},currentLayer(){var n;return(n=this.$parent.layerList)==null?void 0:n.find(t=>{var o;return(t==null?void 0:t.id)===((o=this.object)==null?void 0:o.source)})}},watch:{async object(n,t){n!==null&&(n==null?void 0:n.id)!==(t==null?void 0:t.id)||!(n!=null&&n.id)?await this.getFormatObject(n):n===null&&(this.objectData=[])}},methods:{async getFormatObject(n){var M,D,A,z,L,N;if(!n)return;const t=Object.keys(n.properties).filter(Y=>!Y.match("__text")&&!["id"].includes(Y)),{currentLayer:o}=this;if((M=o==null?void 0:o.setting)!=null&&M.popup&&(this.popupSettings=(o==null?void 0:o.setting.popup)||Iy),!(o!=null&&o.meta)){const Y=t.map(ee=>({title:ee,value:n.properties[ee]}));this.objectData=[...Y,{value:((D=n.properties)==null?void 0:D.image)||"",title:"Фото",column:"image"}];return}const c=o.meta.columns,d=t.map(Y=>{var me,Ie,tt,gt;const ee={},he=Object.assign({values:[]},c.find(Ve=>Ve.name===Y));typeof he.values!="object"&&console.warn(`Warning: Layer ${n.source} has key "values" which is not an object in meta!`);const _e=he!=null&&he.values&&((me=he==null?void 0:he.values)==null?void 0:me.find(Ve=>(Ve==null?void 0:Ve.id)==n.properties[Y]))||null;return ee.value=(he==null?void 0:he.format)==="select"?this.formatBadge({text:(_e==null?void 0:_e.text)||((Ie=n.properties)==null?void 0:Ie[`${Y}__text`])||((tt=n.properties)==null?void 0:tt[Y])||"-",color:(_e==null?void 0:_e.color)||"#1989FA"}):(_e==null?void 0:_e.text)||((gt=n.properties)==null?void 0:gt[`${Y}__text`])||n.properties[Y],ee.column=Y,ee.title=(he==null?void 0:he[window==null?void 0:window.lang])||(he==null?void 0:he.ua)||(he==null?void 0:he.title)||Y,ee});this.objectData=[...d,{value:((A=n.properties)==null?void 0:A.image)||"",title:"Фото",column:"image"}];const x=(L=(z=o==null?void 0:o.setting)==null?void 0:z.popup)==null?void 0:L.popup,y=typeof x=="string"?x==null?void 0:x.split(","):x,h=[...this.aviableFields,...((N=o==null?void 0:o.popup)==null?void 0:N.split(","))||[],...y||[]];this.objectData=h.length?this.objectData.filter(Y=>h.includes(Y.column)||h.includes(Y.title)):[]},noInfoObject(){var c,d,x,y,h;if(!this.object)return"Інформація відсутня";const{currentLayer:n}=this,t=((d=(c=n==null?void 0:n.meta)==null?void 0:c.columns)==null?void 0:d.find(M=>(M==null?void 0:M.meta)==="title"))||((x=n==null?void 0:n.meta)==null?void 0:x.columns[0])||null;return{title:(n==null?void 0:n.name)||(n==null?void 0:n.id)||((y=this.object)==null?void 0:y.sourceLayer)||((h=this.object)==null?void 0:h.source)||"Дані по шару не знайдено",column:t}},formatBadge(n){const t=(n==null?void 0:n.text)||"-";return n!=null&&n.color?`<span >${t}</span>`:t}}},mE={key:0},gE={key:0},yE=["src","alt"],_E={key:1},xE={class:"text-left text-sm m-b-sm"},bE={key:1,class:"text-center"};function vE(n,t,o,c,d,x){var h,M,D,A,z,L,N,Y,ee,oe,he;const y=v.resolveComponent("VsPopupBody");return v.openBlock(),v.createElementBlock("div",{class:v.normalizeClass((((h=d.popupSettings)==null?void 0:h.position)||"horizontal")+"-position")},[d.objectData.filter(_e=>_e.column!=="image").length?(v.openBlock(),v.createElementBlock("div",mE,[x.getImage&&((M=x.getImage)!=null&&M.value)?(v.openBlock(),v.createElementBlock("div",gE,[v.createElementVNode("img",{class:"popup-image",src:"files/"+x.getImage.value,alt:x.getImage.column},null,8,yE)])):v.createCommentVNode("",!0),v.createVNode(y,{"object-data":d.objectData,object:o.object,mapRef:o.mapRef},null,8,["object-data","object","mapRef"])])):(v.openBlock(),v.createElementBlock("div",_E,[(D=x.noInfoObject())!=null&&D.column?(v.openBlock(),v.createElementBlock(v.Fragment,{key:0},[v.createElementVNode("b",xE,v.toDisplayString(x.noInfoObject().title),1),v.createElementVNode("div",null,[v.createElementVNode("b",null,v.toDisplayString(((z=(A=x.noInfoObject())==null?void 0:A.column)==null?void 0:z.ua)||((N=(L=x.noInfoObject())==null?void 0:L.column)==null?void 0:N.title))+":",1),v.createTextVNode(" "+v.toDisplayString(((he=(Y=o.object)==null?void 0:Y.properties)==null?void 0:he[(oe=(ee=x.noInfoObject())==null?void 0:ee.column)==null?void 0:oe.name])||"-"),1)])],64)):(v.openBlock(),v.createElementBlock("div",bE,v.toDisplayString(x.noInfoObject().title),1))]))],2)}const wE=vt(fE,[["render",vE],["__scopeId","data-v-deb51e0a"]]),{Map:kE,NavigationControl:SE,Popup:EE}=tE,TE={mixins:[rE],components:{VsMapPopup:wE},props:{popupVisible:{type:Boolean,default:()=>!0},map:{type:Object,default:()=>null},height:{type:String,default:()=>"400px"}},data(){var n,t,o,c;return{mapId:`gis-map-${Math.floor(Math.random()*1e3)}`,features:[],katottg:((t=(n=window==null?void 0:window.setting)==null?void 0:n.map)==null?void 0:t.katottg)||((c=(o=window==null?void 0:window.setting)==null?void 0:o.map)==null?void 0:c.city_katottg),popup:{geometry:null,map:null},cityBbox:null}},async mounted(){this.initMap()},computed:{mapRef(){return this}},methods:{initMap(){const n={version:8,glyphs:"https://fonts.openmaptiles.org/{fontstack}/{range}.pbf",sources:{},layers:[]},t=new kE({container:this.mapId,style:n,center:[0,0],zoom:1,interactive:!0});t.addControl(new SE({visualizePitch:!0})),window==null||window.addEventListener("resize",()=>{t.resize()}),t.on("load",this.onMapLoad)},async onMapLoad(n){const t=n.target;t.resize();const o={id:"graymap",name:"Сіра карта",url:"https://basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png",service:"TMS",category:"Базові карти",attribution:"© <a href='http://www.openstreetmap.org/copyright'>OpenStreetMap</a>, © <a href='https://carto.com/attributions'>CARTO</a>",bounds1:"ua",image:"https://basemaps.cartocdn.com/light_all/10/601/348.png",position:0,owner:"OSM",basemap:!0};await this.$emit("update:map",t),await this.setVisible(o,!0),this.$emit("load",t),this.createPopup(),this.createBoundsLayers(),this.createAtuLayer()},createPopup(){var o,c,d,x,y,h;const{map:n}=this,t=["measure","katottg","geometry","mapbox-gl-draw-hot","mapbox-gl-draw-cold"];this.popup.map=new EE({closeOnClick:!1}).setDOMContent((c=(o=this==null?void 0:this.$refs)==null?void 0:o.popup)==null?void 0:c.$el),n&&(n.on("mousemove",M=>{var A,z;const D=n.queryRenderedFeatures(M.point).filter(L=>{var ee,oe,he;const N=this.layerList.find(_e=>_e.id===L.source),Y=((oe=(ee=N==null?void 0:N.setting)==null?void 0:ee.popup)==null?void 0:oe.show)===void 0?!0:N.setting.popup.show;if((this.interactiveSources.includes(L.source)&&!((he=L.properties)!=null&&he.cluster)&&Y||!N&&Object.keys(L.properties).length)&&!t.includes(L.source))return L}).filter(L=>{var N,Y;return!((Y=(N=L.layer)==null?void 0:N.layout)!=null&&Y["text-field"])});D.length&&this.popupVisible?(this.features=(D==null?void 0:D[0])||null,(A=this.popup.map)==null||A.setLngLat(Object.values(M.lngLat)).addTo(n),n.getCanvas().style.cursor=D.length?"pointer":"grab"):(this.features=null,(z=this.popup.map)==null||z.remove()),this.$emit("mouseMove",{event:M,features:D})}),n.on("touchend",this.handleMapClick),n.on("click",this.handleMapClick),n.on("dblclick",M=>{const D=n.queryRenderedFeatures(M.point);this.$emit("dbclick",{features:D,event:M})}),(h=(y=(x=(d=this==null?void 0:this.$refs)==null?void 0:d.popup)==null?void 0:x.$el)==null?void 0:y.parentElement)==null||h.addEventListener("mouseenter",()=>{var M;(M=this.popup.map)==null||M.remove()}))},createBoundsLayers(){const{map:n}=this;n&&(n.addSource("bounds-dataset",{type:"geojson",data:{type:"FeatureCollection",features:[]}}),n.addLayer({id:"bounds-dataset-line",type:"line",source:"bounds-dataset",layout:{},paint:{"line-color":"#a91a9e","line-width":2}}))},handleMapClick(n){if(!this.map)return;const t=this.map.queryRenderedFeatures(n.point);if(!t.length)return;const o=t.filter(c=>this.interactiveSources.includes(c==null?void 0:c.source));this.$emit("mapClick",o)},homeZoom(){const{map:n}=this,t=this.cityBbox?this.cityBbox:[22.1352,44.3909,40.2276,52.3791];n==null||n.fitBounds(t,{duration:0,padding:10})},async createAtuLayer(){try{const n=this.katottg,{map:t}=this;if(!t){console.warn("Map error: Map hasn't loaded");return}const{data:o}=await mt.get(`https://data.gki.com.ua/api-user/atu/${n}`),c=Cy(o);this.cityBbox=c,t.addSource("atu",{type:"geojson",data:o}),t.addLayer({id:"atu",type:"line",source:"atu",paint:{"line-color":"#3b82f6","line-width":2}})}catch(n){console.error(n)}}}},CE={class:"relative"},ME=["id"];function PE(n,t,o,c,d,x){const y=v.resolveComponent("VsMapPopup");return v.openBlock(),v.createElementBlock("div",CE,[v.createElementVNode("div",{id:d.mapId,style:v.normalizeStyle({height:o.height})},null,12,ME),v.createVNode(y,{ref:"popup",object:d.features,"map-ref":x.mapRef},null,8,["object","map-ref"])])}const IE=vt(TE,[["render",PE]]),Jr="widget-map-source",AE={components:{VsMap:IE},props:{geometry:{type:Object,default:()=>null},zoom:{type:String,default:()=>"50"}},data(){return{map:null}},mounted(){this.geometry&&this.initGeometryLayer()},watch:{geometry(){console.log(this.zoom),this.initGeometryLayer()}},methods:{initMap(){this.geometry&&this.map&&this.initGeometryLayer()},handleMapLoad(){this.initMap()},initGeometryLayer(){const{map:n}=this;if(!n)return;const t=this.formatGeojson(this.geometry),o=n.getSource(Jr);if(this.zoomToGeometry(t),o){o.setData(t);return}n.addSource(Jr,{type:"geojson",data:t}),n.addLayer({id:`${Jr}-point`,type:"circle",source:Jr,paint:{"circle-radius":10,"circle-color":"#F84C4C"},filter:["==","$type","Point"]}),n.addLayer({id:`${Jr}-polygon`,type:"fill",source:Jr,layout:{},paint:{"fill-color":"#0080ff","fill-opacity":.5},filter:["==","$type","Polygon"]}),n.addLayer({id:`${Jr}-polygon-line`,type:"line",source:Jr,layout:{},paint:{"line-color":"#0080ff","line-width":2},filter:["==","$type","Polygon"]}),n.addLayer({id:`${Jr}-line`,type:"line",source:Jr,layout:{},paint:{"line-color":"#0080ff","line-width":3},filter:["==","$type","LineString"]})},formatGeojson(n){let t=n;const o=n==null?void 0:n.type;if(Array.isArray(n))return My(n);if(!o)throw new Error("Unknown geometry type!");return o==="FeatureCollection"?n:(o==="Feature"&&(t=[n]),!["FeatureCollection","Feature"].includes(o)&&(t=[QS(n)]),My(t))},zoomToGeometry(n){const{map:t}=this,o=Cy(n);t.fitBounds(o,{zoom:this.zoom,padding:30,duration:0})}}};function DE(n,t,o,c,d,x){const y=v.resolveComponent("VsMap");return v.openBlock(),v.createElementBlock("div",null,[v.createVNode(y,{map:d.map,"onUpdate:map":t[0]||(t[0]=h=>d.map=h),onLoad:x.handleMapLoad},null,8,["map","onLoad"])])}const zE=vt(AE,[["render",DE]]),Ye=(n,t=1e4)=>(n=parseFloat(n+"")||0,Math.round((n+Number.EPSILON)*t)/t),wp=function(n){if(!(n&&n instanceof Element&&n.offsetParent))return!1;const t=n.scrollHeight>n.clientHeight,o=window.getComputedStyle(n).overflowY,c=o.indexOf("hidden")!==-1,d=o.indexOf("visible")!==-1;return t&&!c&&!d},Jh=function(n,t=void 0){return!(!n||n===document.body||t&&n===t)&&(wp(n)?n:Jh(n.parentElement,t))},Qr=function(n){var t=new DOMParser().parseFromString(n,"text/html").body;if(t.childElementCount>1){for(var o=document.createElement("div");t.firstChild;)o.appendChild(t.firstChild);return o}return t.firstChild},kp=n=>`${n||""}`.split(" ").filter(t=>!!t),es=(n,t,o)=>{n&&kp(t).forEach(c=>{n.classList.toggle(c,o||!1)})};class Na{constructor(t){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=t,this.pageX=t.pageX,this.pageY=t.pageY,this.clientX=t.clientX,this.clientY=t.clientY,this.id=self.Touch&&t instanceof Touch?t.identifier:-1,this.time=Date.now()}}const Va={passive:!1};class LE{constructor(t,{start:o=()=>!0,move:c=()=>{},end:d=()=>{}}){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=t,this.startCallback=o,this.moveCallback=c,this.endCallback=d;for(const x of["onPointerStart","onTouchStart","onMove","onTouchEnd","onPointerEnd","onWindowBlur"])this[x]=this[x].bind(this);this.element.addEventListener("mousedown",this.onPointerStart,Va),this.element.addEventListener("touchstart",this.onTouchStart,Va),this.element.addEventListener("touchmove",this.onMove,Va),this.element.addEventListener("touchend",this.onTouchEnd),this.element.addEventListener("touchcancel",this.onTouchEnd)}onPointerStart(t){if(!t.buttons||t.button!==0)return;const o=new Na(t);this.currentPointers.some(c=>c.id===o.id)||this.triggerPointerStart(o,t)&&(window.addEventListener("mousemove",this.onMove),window.addEventListener("mouseup",this.onPointerEnd),window.addEventListener("blur",this.onWindowBlur))}onTouchStart(t){for(const o of Array.from(t.changedTouches||[]))this.triggerPointerStart(new Na(o),t);window.addEventListener("blur",this.onWindowBlur)}onMove(t){const o=this.currentPointers.slice(),c="changedTouches"in t?Array.from(t.changedTouches||[]).map(x=>new Na(x)):[new Na(t)],d=[];for(const x of c){const y=this.currentPointers.findIndex(h=>h.id===x.id);y<0||(d.push(x),this.currentPointers[y]=x)}d.length&&this.moveCallback(t,this.currentPointers.slice(),o)}onPointerEnd(t){t.buttons>0&&t.button!==0||(this.triggerPointerEnd(t,new Na(t)),window.removeEventListener("mousemove",this.onMove),window.removeEventListener("mouseup",this.onPointerEnd),window.removeEventListener("blur",this.onWindowBlur))}onTouchEnd(t){for(const o of Array.from(t.changedTouches||[]))this.triggerPointerEnd(t,new Na(o))}triggerPointerStart(t,o){return!!this.startCallback(o,t,this.currentPointers.slice())&&(this.currentPointers.push(t),this.startPointers.push(t),!0)}triggerPointerEnd(t,o){const c=this.currentPointers.findIndex(d=>d.id===o.id);c<0||(this.currentPointers.splice(c,1),this.startPointers.splice(c,1),this.endCallback(t,o,this.currentPointers.slice()))}onWindowBlur(){this.clear()}clear(){for(;this.currentPointers.length;){const t=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:t.clientX,clientY:t.clientY}),t,this.currentPointers.slice())}}stop(){this.element.removeEventListener("mousedown",this.onPointerStart,Va),this.element.removeEventListener("touchstart",this.onTouchStart,Va),this.element.removeEventListener("touchmove",this.onMove,Va),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 Ay(n,t){return t?Math.sqrt(Math.pow(t.clientX-n.clientX,2)+Math.pow(t.clientY-n.clientY,2)):0}function Dy(n,t){return t?{clientX:(n.clientX+t.clientX)/2,clientY:(n.clientY+t.clientY)/2}:n}const Sp=n=>typeof n=="object"&&n!==null&&n.constructor===Object&&Object.prototype.toString.call(n)==="[object Object]",Un=(n,...t)=>{const o=t.length;for(let c=0;c<o;c++){const d=t[c]||{};Object.entries(d).forEach(([x,y])=>{const h=Array.isArray(y)?[]:{};n[x]||Object.assign(n,{[x]:h}),Sp(y)?Object.assign(n[x],Un(h,y)):Array.isArray(y)?Object.assign(n,{[x]:[...y]}):Object.assign(n,{[x]:y})})}return n},Ep=function(n,t){return n.split(".").reduce((o,c)=>typeof o=="object"?o[c]:void 0,t)};class Qh{constructor(t={}){Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),this.setOptions(t);for(const o of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))o.startsWith("on")&&typeof this[o]=="function"&&(this[o]=this[o].bind(this))}setOptions(t){this.options=t?Un({},this.constructor.defaults,t):{};for(const[o,c]of Object.entries(this.option("on")||{}))this.on(o,c)}option(t,...o){let c=Ep(t,this.options);return c&&typeof c=="function"&&(c=c.call(this,this,...o)),c}optionFor(t,o,c,...d){let x=Ep(o,t);var y;typeof(y=x)!="string"||isNaN(y)||isNaN(parseFloat(y))||(x=parseFloat(x)),x==="true"&&(x=!0),x==="false"&&(x=!1),x&&typeof x=="function"&&(x=x.call(this,this,t,...d));let h=Ep(o,this.options);return h&&typeof h=="function"?x=h.call(this,this,t,...d,x):x===void 0&&(x=h),x===void 0?c:x}cn(t){const o=this.options.classes;return o&&o[t]||""}localize(t,o=[]){t=String(t).replace(/\{\{(\w+).?(\w+)?\}\}/g,(c,d,x)=>{let y="";return x?y=this.option(`${d[0]+d.toLowerCase().substring(1)}.l10n.${x}`):d&&(y=this.option(`l10n.${d}`)),y||(y=c),y});for(let c=0;c<o.length;c++)t=t.split(o[c][0]).join(o[c][1]);return t=t.replace(/\{\{(.*?)\}\}/g,(c,d)=>d)}on(t,o){let c=[];typeof t=="string"?c=t.split(" "):Array.isArray(t)&&(c=t),this.events||(this.events=new Map),c.forEach(d=>{let x=this.events.get(d);x||(this.events.set(d,[]),x=[]),x.includes(o)||x.push(o),this.events.set(d,x)})}off(t,o){let c=[];typeof t=="string"?c=t.split(" "):Array.isArray(t)&&(c=t),c.forEach(d=>{const x=this.events.get(d);if(Array.isArray(x)){const y=x.indexOf(o);y>-1&&x.splice(y,1)}})}emit(t,...o){[...this.events.get(t)||[]].forEach(c=>c(this,...o)),t!=="*"&&this.emit("*",t,...o)}}Object.defineProperty(Qh,"version",{enumerable:!0,configurable:!0,writable:!0,value:"5.0.36"}),Object.defineProperty(Qh,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{}});class Tp extends Qh{constructor(t={}){super(t),Object.defineProperty(this,"plugins",{enumerable:!0,configurable:!0,writable:!0,value:{}})}attachPlugins(t={}){const o=new Map;for(const[c,d]of Object.entries(t)){const x=this.option(c),y=this.plugins[c];y||x===!1?y&&x===!1&&(y.detach(),delete this.plugins[c]):o.set(c,new d(this,x||{}))}for(const[c,d]of o)this.plugins[c]=d,d.attach()}detachPlugins(t){t=t||Object.keys(this.plugins);for(const o of t){const c=this.plugins[o];c&&c.detach(),delete this.plugins[o]}return this.emit("detachPlugins"),this}}var ci;(function(n){n[n.Init=0]="Init",n[n.Error=1]="Error",n[n.Ready=2]="Ready",n[n.Panning=3]="Panning",n[n.Mousemove=4]="Mousemove",n[n.Destroy=5]="Destroy"})(ci||(ci={}));const Ss=["a","b","c","d","e","f"],zy={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"},RE={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:zy},Ly='<circle cx="25" cy="25" r="20"></circle>',Cp='<div class="f-spinner"><svg viewBox="0 0 50 50">'+Ly+Ly+"</svg></div>",Hn=n=>n&&n!==null&&n instanceof Element&&"nodeType"in n,ni=(n,t)=>{n&&kp(t).forEach(o=>{n.classList.remove(o)})},dt=(n,t)=>{n&&kp(t).forEach(o=>{n.classList.add(o)})},eu={a:1,b:0,c:0,d:1,e:0,f:0},OE=1e5,tu=1e4,br="mousemove",Ry="drag",Oy="content",vr="auto";let Mp=null,Pp=null;class $o extends Tp{get fits(){return this.contentRect.width-this.contentRect.fitWidth<1&&this.contentRect.height-this.contentRect.fitHeight<1}get isTouchDevice(){return Pp===null&&(Pp=window.matchMedia("(hover: none)").matches),Pp}get isMobile(){return Mp===null&&(Mp=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)),Mp}get panMode(){return this.options.panMode!==br||this.isTouchDevice?Ry:br}get panOnlyZoomed(){const t=this.options.panOnlyZoomed;return t===vr?this.isTouchDevice:t}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:t,b:o}=this.current;return Math.sqrt(t*t+o*o)||1}get targetScale(){const{a:t,b:o}=this.target;return Math.sqrt(t*t+o*o)||1}get minScale(){return this.option("minScale")||1}get fullScale(){const{contentRect:t}=this;return t.fullWidth/t.fitWidth||1}get maxScale(){return this.fullScale*(this.option("maxScale")||1)||1}get coverScale(){const{containerRect:t,contentRect:o}=this,c=Math.max(t.height/o.fitHeight,t.width/o.fitWidth)||1;return Math.min(this.fullScale,c)}get isScaling(){return Math.abs(this.targetScale-this.scale)>1e-5&&!this.isResting}get isContentLoading(){const t=this.content;return!!(t&&t instanceof HTMLImageElement)&&!t.complete}get isResting(){if(this.isBouncingX||this.isBouncingY)return!1;for(const t of Ss){const o=t=="e"||t==="f"?1e-4:1e-5;if(Math.abs(this.target[t]-this.current[t])>o)return!1}return!(!this.ignoreBounds&&!this.checkBounds().inBounds)}constructor(t,o={},c={}){var d;if(super(o),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:ci.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({},eu)}),Object.defineProperty(this,"target",{enumerable:!0,configurable:!0,writable:!0,value:Object.assign({},eu)}),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}),!t)throw new Error("Container Element Not Found");this.container=t,this.initContent(),this.attachPlugins(Object.assign(Object.assign({},$o.Plugins),c)),this.emit("attachPlugins"),this.emit("init");const x=this.content;if(x.addEventListener("load",this.onLoad),x.addEventListener("error",this.onError),this.isContentLoading){if(this.option("spinner")){t.classList.add(this.cn("isLoading"));const y=Qr(Cp);!t.contains(x)||x.parentElement instanceof HTMLPictureElement?this.spinner=t.appendChild(y):this.spinner=((d=x.parentElement)===null||d===void 0?void 0:d.insertBefore(y,x))||null}this.emit("beforeLoad")}else queueMicrotask(()=>{this.enable()})}initContent(){const{container:t}=this,o=this.cn(Oy);let c=this.option(Oy)||t.querySelector(`.${o}`);if(c||(c=t.querySelector("img,picture")||t.firstElementChild,c&&dt(c,o)),c instanceof HTMLPictureElement&&(c=c.querySelector("img")),!c)throw new Error("No content found");this.content=c}onLoad(){const{spinner:t,container:o,state:c}=this;t&&(t.remove(),this.spinner=null),this.option("spinner")&&o.classList.remove(this.cn("isLoading")),this.emit("afterLoad"),c===ci.Init?this.enable():this.updateMetrics()}onError(){this.state!==ci.Destroy&&(this.spinner&&(this.spinner.remove(),this.spinner=null),this.stop(),this.detachEvents(),this.state=ci.Error,this.emit("error"))}getNextScale(t){const{fullScale:o,targetScale:c,coverScale:d,maxScale:x,minScale:y}=this;let h=y;switch(t){case"toggleMax":h=c-y<.5*(x-y)?x:y;break;case"toggleCover":h=c-y<.5*(d-y)?d:y;break;case"toggleZoom":h=c-y<.5*(o-y)?o:y;break;case"iterateZoom":let M=[1,o,x].sort((A,z)=>A-z),D=M.findIndex(A=>A>c+1e-5);h=M[D]||1}return h}attachObserver(){var t;const o=()=>{const{container:c,containerRect:d}=this;return Math.abs(d.width-c.getBoundingClientRect().width)>.1||Math.abs(d.height-c.getBoundingClientRect().height)>.1};this.resizeObserver||window.ResizeObserver===void 0||(this.resizeObserver=new ResizeObserver(()=>{this.updateTimer||(o()?(this.onResize(),this.isMobile&&(this.updateTimer=setTimeout(()=>{o()&&this.onResize(),this.updateTimer=null},500))):this.updateTimer&&(clearTimeout(this.updateTimer),this.updateTimer=null))})),(t=this.resizeObserver)===null||t===void 0||t.observe(this.container)}detachObserver(){var t;(t=this.resizeObserver)===null||t===void 0||t.disconnect()}attachEvents(){const{container:t}=this;t.addEventListener("click",this.onClick,{passive:!1,capture:!1}),t.addEventListener("wheel",this.onWheel,{passive:!1}),this.pointerTracker=new LE(t,{start:this.onPointerDown,move:this.onPointerMove,end:this.onPointerUp}),document.addEventListener(br,this.onMouseMove)}detachEvents(){var t;const{container:o}=this;o.removeEventListener("click",this.onClick,{passive:!1,capture:!1}),o.removeEventListener("wheel",this.onWheel,{passive:!1}),(t=this.pointerTracker)===null||t===void 0||t.stop(),this.pointerTracker=null,document.removeEventListener(br,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 t=this.friction,o=this.option("maxVelocity");for(const c of Ss)t?(this.velocity[c]*=1-t,o&&!this.isScaling&&(this.velocity[c]=Math.max(Math.min(this.velocity[c],o),-1*o)),this.current[c]+=this.velocity[c]):this.current[c]=this.target[c];this.setTransform(),this.setEdgeForce(),!this.isResting||this.isDragging?this.rAF=requestAnimationFrame(()=>this.animate()):this.stop("current")}setTargetForce(){for(const t of Ss)t==="e"&&this.isBouncingX||t==="f"&&this.isBouncingY||(this.velocity[t]=(1/(1-this.friction)-1)*(this.target[t]-this.current[t]))}checkBounds(t=0,o=0){const{current:c}=this,d=c.e+t,x=c.f+o,y=this.getBounds(),{x:h,y:M}=y,D=h.min,A=h.max,z=M.min,L=M.max;let N=0,Y=0;return D!==1/0&&d<D?N=D-d:A!==1/0&&d>A&&(N=A-d),z!==1/0&&x<z?Y=z-x:L!==1/0&&x>L&&(Y=L-x),Math.abs(N)<1e-4&&(N=0),Math.abs(Y)<1e-4&&(Y=0),Object.assign(Object.assign({},y),{xDiff:N,yDiff:Y,inBounds:!N&&!Y})}clampTargetBounds(){const{target:t}=this,{x:o,y:c}=this.getBounds();o.min!==1/0&&(t.e=Math.max(t.e,o.min)),o.max!==1/0&&(t.e=Math.min(t.e,o.max)),c.min!==1/0&&(t.f=Math.max(t.f,c.min)),c.max!==1/0&&(t.f=Math.min(t.f,c.max))}calculateContentDim(t=this.current){const{content:o,contentRect:c}=this,{fitWidth:d,fitHeight:x,fullWidth:y,fullHeight:h}=c;let M=y,D=h;if(this.option("zoom")||this.angle!==0){const A=!(o instanceof HTMLImageElement)&&(window.getComputedStyle(o).maxWidth==="none"||window.getComputedStyle(o).maxHeight==="none"),z=A?y:d,L=A?h:x,N=this.getMatrix(t),Y=new DOMPoint(0,0).matrixTransform(N),ee=new DOMPoint(0+z,0).matrixTransform(N),oe=new DOMPoint(0+z,0+L).matrixTransform(N),he=new DOMPoint(0,0+L).matrixTransform(N),_e=Math.abs(oe.x-Y.x),me=Math.abs(oe.y-Y.y),Ie=Math.abs(he.x-ee.x),tt=Math.abs(he.y-ee.y);M=Math.max(_e,Ie),D=Math.max(me,tt)}return{contentWidth:M,contentHeight:D}}setEdgeForce(){if(this.ignoreBounds||this.isDragging||this.panMode===br||this.targetScale<this.scale)return this.isBouncingX=!1,void(this.isBouncingY=!1);const{target:t}=this,{x:o,y:c,xDiff:d,yDiff:x}=this.checkBounds(),y=this.option("maxVelocity");let h=this.velocity.e,M=this.velocity.f;d!==0?(this.isBouncingX=!0,d*h<=0?h+=.14*d:(h=.14*d,o.min!==1/0&&(this.target.e=Math.max(t.e,o.min)),o.max!==1/0&&(this.target.e=Math.min(t.e,o.max))),y&&(h=Math.max(Math.min(h,y),-1*y))):this.isBouncingX=!1,x!==0?(this.isBouncingY=!0,x*M<=0?M+=.14*x:(M=.14*x,c.min!==1/0&&(this.target.f=Math.max(t.f,c.min)),c.max!==1/0&&(this.target.f=Math.min(t.f,c.max))),y&&(M=Math.max(Math.min(M,y),-1*y))):this.isBouncingY=!1,this.isBouncingX&&(this.velocity.e=h),this.isBouncingY&&(this.velocity.f=M)}enable(){const{content:t}=this,o=new DOMMatrixReadOnly(window.getComputedStyle(t).transform);for(const c of Ss)this.current[c]=this.target[c]=o[c];this.updateMetrics(),this.attachObserver(),this.attachEvents(),this.state=ci.Ready,this.emit("ready")}onClick(t){var o;t.type==="click"&&t.detail===0&&(this.dragOffset.x=0,this.dragOffset.y=0),this.isDragging&&((o=this.pointerTracker)===null||o===void 0||o.clear(),this.trackingPoints=[],this.startDecelAnim());const c=t.target;if(!c||t.defaultPrevented)return;if(c.hasAttribute("disabled"))return t.preventDefault(),void t.stopPropagation();if((()=>{const N=window.getSelection();return N&&N.type==="Range"})()&&!c.closest("button"))return;const d=c.closest("[data-panzoom-action]"),x=c.closest("[data-panzoom-change]"),y=d||x,h=y&&Hn(y)?y.dataset:null;if(h){const N=h.panzoomChange,Y=h.panzoomAction;if((N||Y)&&t.preventDefault(),N){let ee={};try{ee=JSON.parse(N)}catch{console&&console.warn("The given data was not valid JSON")}return void this.applyChange(ee)}if(Y)return void(this[Y]&&this[Y]())}if(Math.abs(this.dragOffset.x)>3||Math.abs(this.dragOffset.y)>3)return t.preventDefault(),void t.stopPropagation();if(c.closest("[data-fancybox]"))return;const M=this.content.getBoundingClientRect(),D=this.dragStart;if(D.time&&!this.canZoomOut()&&(Math.abs(M.x-D.x)>2||Math.abs(M.y-D.y)>2))return;this.dragStart.time=0;const A=N=>{this.option("zoom",t)&&N&&typeof N=="string"&&/(iterateZoom)|(toggle(Zoom|Full|Cover|Max)|(zoomTo(Fit|Cover|Max)))/.test(N)&&typeof this[N]=="function"&&(t.preventDefault(),this[N]({event:t}))},z=this.option("click",t),L=this.option("dblClick",t);L?(this.clicks++,this.clicks==1&&(this.clickTimer=setTimeout(()=>{this.clicks===1?(this.emit("click",t),!t.defaultPrevented&&z&&A(z)):(this.emit("dblClick",t),t.defaultPrevented||A(L)),this.clicks=0,this.clickTimer=null},350))):(this.emit("click",t),!t.defaultPrevented&&z&&A(z))}addTrackingPoint(t){const o=this.trackingPoints.filter(c=>c.time>Date.now()-100);o.push(t),this.trackingPoints=o}onPointerDown(t,o,c){var d;if(this.option("touch",t)===!1)return!1;this.pwt=0,this.dragOffset={x:0,y:0,time:0},this.trackingPoints=[];const x=this.content.getBoundingClientRect();if(this.dragStart={x:x.x,y:x.y,top:x.top,left:x.left,time:Date.now()},this.clickTimer)return!1;if(this.panMode===br&&this.targetScale>1)return t.preventDefault(),t.stopPropagation(),!1;const y=t.composedPath()[0];if(!c.length){if(["TEXTAREA","OPTION","INPUT","SELECT","VIDEO","IFRAME"].includes(y.nodeName)||y.closest("[contenteditable],[data-selectable],[data-draggable],[data-clickable],[data-panzoom-change],[data-panzoom-action]"))return!1;(d=window.getSelection())===null||d===void 0||d.removeAllRanges()}if(t.type==="mousedown")["A","BUTTON"].includes(y.nodeName)||t.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(o),this.emit("touchStart",t)),!0}onPointerMove(t,o,c){if(this.option("touch",t)===!1||!this.isDragging||o.length<2&&this.panOnlyZoomed&&Ye(this.targetScale)<=Ye(this.minScale)||(this.emit("touchMove",t),t.defaultPrevented))return;this.addTrackingPoint(o[0]);const{content:d}=this,x=Dy(c[0],c[1]),y=Dy(o[0],o[1]);let h=0,M=0;if(o.length>1){const me=d.getBoundingClientRect();h=x.clientX-me.left-.5*me.width,M=x.clientY-me.top-.5*me.height}const D=Ay(c[0],c[1]),A=Ay(o[0],o[1]);let z=D?A/D:1,L=y.clientX-x.clientX,N=y.clientY-x.clientY;this.dragOffset.x+=L,this.dragOffset.y+=N,this.dragOffset.time=Date.now()-this.dragStart.time;let Y=Ye(this.targetScale)===Ye(this.minScale)&&this.option("lockAxis");if(Y&&!this.lockedAxis)if(Y==="xy"||Y==="y"||t.type==="touchmove"){if(Math.abs(this.dragOffset.x)<6&&Math.abs(this.dragOffset.y)<6)return void t.preventDefault();const me=Math.abs(180*Math.atan2(this.dragOffset.y,this.dragOffset.x)/Math.PI);this.lockedAxis=me>45&&me<135?"y":"x",this.dragOffset.x=0,this.dragOffset.y=0,L=0,N=0}else this.lockedAxis=Y;if(Jh(t.target,this.content)&&(Y="x",this.dragOffset.y=0),Y&&Y!=="xy"&&this.lockedAxis!==Y&&Ye(this.targetScale)===Ye(this.minScale))return;t.cancelable&&t.preventDefault(),this.container.classList.add(this.cn("isDragging"));const ee=this.checkBounds(L,N);this.option("rubberband")?(this.isInfinite!=="x"&&(ee.xDiff>0&&L<0||ee.xDiff<0&&L>0)&&(L*=Math.max(0,.5-Math.abs(.75/this.contentRect.fitWidth*ee.xDiff))),this.isInfinite!=="y"&&(ee.yDiff>0&&N<0||ee.yDiff<0&&N>0)&&(N*=Math.max(0,.5-Math.abs(.75/this.contentRect.fitHeight*ee.yDiff)))):(ee.xDiff&&(L=0),ee.yDiff&&(N=0));const oe=this.targetScale,he=this.minScale,_e=this.maxScale;oe<.5*he&&(z=Math.max(z,he)),oe>1.5*_e&&(z=Math.min(z,_e)),this.lockedAxis==="y"&&Ye(oe)===Ye(he)&&(L=0),this.lockedAxis==="x"&&Ye(oe)===Ye(he)&&(N=0),this.applyChange({originX:h,originY:M,panX:L,panY:N,scale:z,friction:this.option("dragFriction"),ignoreBounds:!0})}onPointerUp(t,o,c){if(c.length)return this.dragOffset.x=0,this.dragOffset.y=0,void(this.trackingPoints=[]);this.container.classList.remove(this.cn("isDragging")),this.isDragging&&(this.addTrackingPoint(o),this.panOnlyZoomed&&this.contentRect.width-this.contentRect.fitWidth<1&&this.contentRect.height-this.contentRect.fitHeight<1&&(this.trackingPoints=[]),Jh(t.target,this.content)&&this.lockedAxis==="y"&&(this.trackingPoints=[]),this.emit("touchEnd",t),this.isDragging=!1,this.lockedAxis=!1,this.state!==ci.Destroy&&(t.defaultPrevented||this.startDecelAnim()))}startDecelAnim(){var t;const o=this.isScaling;this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const me of Ss)this.velocity[me]=0;this.target.e=this.current.e,this.target.f=this.current.f,ni(this.container,"is-scaling"),ni(this.container,"is-animating"),this.isTicking=!1;const{trackingPoints:c}=this,d=c[0],x=c[c.length-1];let y=0,h=0,M=0;x&&d&&(y=x.clientX-d.clientX,h=x.clientY-d.clientY,M=x.time-d.time);const D=((t=window.visualViewport)===null||t===void 0?void 0:t.scale)||1;D!==1&&(y*=D,h*=D);let A=0,z=0,L=0,N=0,Y=this.option("decelFriction");const ee=this.targetScale;if(M>0){L=Math.abs(y)>3?y/(M/30):0,N=Math.abs(h)>3?h/(M/30):0;const me=this.option("maxVelocity");me&&(L=Math.max(Math.min(L,me),-1*me),N=Math.max(Math.min(N,me),-1*me))}L&&(A=L/(1/(1-Y)-1)),N&&(z=N/(1/(1-Y)-1)),(this.option("lockAxis")==="y"||this.option("lockAxis")==="xy"&&this.lockedAxis==="y"&&Ye(ee)===this.minScale)&&(A=L=0),(this.option("lockAxis")==="x"||this.option("lockAxis")==="xy"&&this.lockedAxis==="x"&&Ye(ee)===this.minScale)&&(z=N=0);const oe=this.dragOffset.x,he=this.dragOffset.y,_e=this.option("dragMinThreshold")||0;Math.abs(oe)<_e&&Math.abs(he)<_e&&(A=z=0,L=N=0),(this.option("zoom")&&(ee<this.minScale-1e-5||ee>this.maxScale+1e-5)||o&&!A&&!z)&&(Y=.35),this.applyChange({panX:A,panY:z,friction:Y}),this.emit("decel",L,N,oe,he)}onWheel(t){var o=[-t.deltaX||0,-t.deltaY||0,-t.detail||0].reduce(function(x,y){return Math.abs(y)>Math.abs(x)?y:x});const c=Math.max(-1,Math.min(1,o));if(this.emit("wheel",t,c),this.panMode===br||t.defaultPrevented)return;const d=this.option("wheel");d==="pan"?(t.preventDefault(),this.panOnlyZoomed&&!this.canZoomOut()||this.applyChange({panX:2*-t.deltaX,panY:2*-t.deltaY,bounce:!1})):d==="zoom"&&this.option("zoom")!==!1&&this.zoomWithWheel(t)}onMouseMove(t){this.panWithMouse(t)}onKeydown(t){t.key==="Escape"&&this.toggleFS()}onResize(){this.updateMetrics(),this.checkBounds().inBounds||this.requestTick()}setTransform(){this.emit("beforeTransform");const{current:t,target:o,content:c,contentRect:d}=this,x=Object.assign({},eu);for(const oe of Ss){const he=oe=="e"||oe==="f"?tu:OE;x[oe]=Ye(t[oe],he),Math.abs(o[oe]-t[oe])<(oe=="e"||oe==="f"?.51:.001)&&(t[oe]=o[oe])}let{a:y,b:h,c:M,d:D,e:A,f:z}=x,L=`matrix(${y}, ${h}, ${M}, ${D}, ${A}, ${z})`,N=c.parentElement instanceof HTMLPictureElement?c.parentElement:c;if(this.option("transformParent")&&(N=N.parentElement||N),N.style.transform===L)return;N.style.transform=L;const{contentWidth:Y,contentHeight:ee}=this.calculateContentDim();d.width=Y,d.height=ee,this.emit("afterTransform")}updateMetrics(t=!1){var o;if(!this||this.state===ci.Destroy||this.isContentLoading)return;const c=Math.max(1,((o=window.visualViewport)===null||o===void 0?void 0:o.scale)||1),{container:d,content:x}=this,y=x instanceof HTMLImageElement,h=d.getBoundingClientRect(),M=getComputedStyle(this.container);let D=h.width*c,A=h.height*c;const z=parseFloat(M.paddingTop)+parseFloat(M.paddingBottom),L=D-(parseFloat(M.paddingLeft)+parseFloat(M.paddingRight)),N=A-z;this.containerRect={width:D,height:A,innerWidth:L,innerHeight:N};const Y=parseFloat(x.dataset.width||"")||(Pt=>{let ri=0;return ri=Pt instanceof HTMLImageElement?Pt.naturalWidth:Pt instanceof SVGElement?Pt.width.baseVal.value:Math.max(Pt.offsetWidth,Pt.scrollWidth),ri||0})(x),ee=parseFloat(x.dataset.height||"")||(Pt=>{let ri=0;return ri=Pt instanceof HTMLImageElement?Pt.naturalHeight:Pt instanceof SVGElement?Pt.height.baseVal.value:Math.max(Pt.offsetHeight,Pt.scrollHeight),ri||0})(x);let oe=this.option("width",Y)||vr,he=this.option("height",ee)||vr;const _e=oe===vr,me=he===vr;typeof oe!="number"&&(oe=Y),typeof he!="number"&&(he=ee),_e&&(oe=Y*(he/ee)),me&&(he=ee/(Y/oe));let Ie=x.parentElement instanceof HTMLPictureElement?x.parentElement:x;this.option("transformParent")&&(Ie=Ie.parentElement||Ie);const tt=Ie.getAttribute("style")||"";Ie.style.setProperty("transform","none","important"),y&&(Ie.style.width="",Ie.style.height=""),Ie.offsetHeight;const gt=x.getBoundingClientRect();let Ve=gt.width*c,rt=gt.height*c,xt=Ve,zt=rt;Ve=Math.min(Ve,oe),rt=Math.min(rt,he),y?{width:Ve,height:rt}=((Pt,ri,Vi,yn)=>{const zi=Vi/Pt,ui=yn/ri,an=Math.min(zi,ui);return{width:Pt*=an,height:ri*=an}})(oe,he,Ve,rt):(Ve=Math.min(Ve,oe),rt=Math.min(rt,he));let Et=.5*(zt-rt),Ki=.5*(xt-Ve);this.contentRect=Object.assign(Object.assign({},this.contentRect),{top:gt.top-h.top+Et,bottom:h.bottom-gt.bottom+Et,left:gt.left-h.left+Ki,right:h.right-gt.right+Ki,fitWidth:Ve,fitHeight:rt,width:Ve,height:rt,fullWidth:oe,fullHeight:he}),Ie.style.cssText=tt,y&&(Ie.style.width=`${Ve}px`,Ie.style.height=`${rt}px`),this.setTransform(),t!==!0&&this.emit("refresh"),this.ignoreBounds||(Ye(this.targetScale)<Ye(this.minScale)?this.zoomTo(this.minScale,{friction:0}):this.targetScale>this.maxScale?this.zoomTo(this.maxScale,{friction:0}):this.state===ci.Init||this.checkBounds().inBounds||this.requestTick()),this.updateControls()}calculateBounds(){const{contentWidth:t,contentHeight:o}=this.calculateContentDim(this.target),{targetScale:c,lockedAxis:d}=this,{fitWidth:x,fitHeight:y}=this.contentRect;let h=0,M=0,D=0,A=0;const z=this.option("infinite");if(z===!0||d&&z===d)h=-1/0,D=1/0,M=-1/0,A=1/0;else{let{containerRect:L,contentRect:N}=this,Y=Ye(x*c,tu),ee=Ye(y*c,tu),{innerWidth:oe,innerHeight:he}=L;if(L.width===Y&&(oe=L.width),L.width===ee&&(he=L.height),t>oe){D=.5*(t-oe),h=-1*D;let _e=.5*(N.right-N.left);h+=_e,D+=_e}if(x>oe&&t<oe&&(h-=.5*(x-oe),D-=.5*(x-oe)),o>he){A=.5*(o-he),M=-1*A;let _e=.5*(N.bottom-N.top);M+=_e,A+=_e}y>he&&o<he&&(h-=.5*(y-he),D-=.5*(y-he))}return{x:{min:h,max:D},y:{min:M,max:A}}}getBounds(){const t=this.option("bounds");return t!==vr?t:this.calculateBounds()}updateControls(){const t=this,o=t.container,{panMode:c,contentRect:d,targetScale:x,minScale:y}=t;let h=y,M=t.option("click")||!1;M&&(h=t.getNextScale(M));let D=t.canZoomIn(),A=t.canZoomOut(),z=c===Ry&&!!this.option("touch"),L=A&&z;if(z&&(Ye(x)<Ye(y)&&!this.panOnlyZoomed&&(L=!0),(Ye(d.width,1)>Ye(d.fitWidth,1)||Ye(d.height,1)>Ye(d.fitHeight,1))&&(L=!0)),Ye(d.width*x,1)<Ye(d.fitWidth,1)&&(L=!1),c===br&&(L=!1),es(o,this.cn("isDraggable"),L),!this.option("zoom"))return;let N=D&&Ye(h)>Ye(x),Y=!N&&!L&&A&&Ye(h)<Ye(x);es(o,this.cn("canZoomIn"),N),es(o,this.cn("canZoomOut"),Y);for(const ee of o.querySelectorAll("[data-panzoom-action]")){let oe=!1,he=!1;switch(ee.dataset.panzoomAction){case"zoomIn":D?oe=!0:he=!0;break;case"zoomOut":A?oe=!0:he=!0;break;case"toggleZoom":case"iterateZoom":D||A?oe=!0:he=!0;const _e=ee.querySelector("g");_e&&(_e.style.display=D?"":"none")}oe?(ee.removeAttribute("disabled"),ee.removeAttribute("tabindex")):he&&(ee.setAttribute("disabled",""),ee.setAttribute("tabindex","-1"))}}panTo({x:t=this.target.e,y:o=this.target.f,scale:c=this.targetScale,friction:d=this.option("friction"),angle:x=0,originX:y=0,originY:h=0,flipX:M=!1,flipY:D=!1,ignoreBounds:A=!1}){this.state!==ci.Destroy&&this.applyChange({panX:t-this.target.e,panY:o-this.target.f,scale:c/this.targetScale,angle:x,originX:y,originY:h,friction:d,flipX:M,flipY:D,ignoreBounds:A})}applyChange({panX:t=0,panY:o=0,scale:c=1,angle:d=0,originX:x=-this.current.e,originY:y=-this.current.f,friction:h=this.option("friction"),flipX:M=!1,flipY:D=!1,ignoreBounds:A=!1,bounce:z=this.option("bounce")}){const L=this.state;if(L===ci.Destroy)return;this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.friction=h||0,this.ignoreBounds=A;const{current:N}=this,Y=N.e,ee=N.f,oe=this.getMatrix(this.target);let he=new DOMMatrix().translate(Y,ee).translate(x,y).translate(t,o);if(this.option("zoom")){if(!A){const _e=this.targetScale,me=this.minScale,Ie=this.maxScale;_e*c<me&&(c=me/_e),_e*c>Ie&&(c=Ie/_e)}he=he.scale(c)}he=he.translate(-x,-y).translate(-Y,-ee).multiply(oe),d&&(he=he.rotate(d)),M&&(he=he.scale(-1,1)),D&&(he=he.scale(1,-1));for(const _e of Ss)_e!=="e"&&_e!=="f"&&(he[_e]>this.minScale+1e-5||he[_e]<this.minScale-1e-5)?this.target[_e]=he[_e]:this.target[_e]=Ye(he[_e],tu);(this.targetScale<this.scale||Math.abs(c-1)>.1||this.panMode===br||z===!1)&&!A&&this.clampTargetBounds(),L===ci.Init?this.animate():this.isResting||(this.state=ci.Panning,this.requestTick())}stop(t=!1){if(this.state===ci.Init||this.state===ci.Destroy)return;const o=this.isTicking;this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const c of Ss)this.velocity[c]=0,t==="current"?this.current[c]=this.target[c]:t==="target"&&(this.target[c]=this.current[c]);this.setTransform(),ni(this.container,"is-scaling"),ni(this.container,"is-animating"),this.isTicking=!1,this.state=ci.Ready,o&&(this.emit("endAnimation"),this.updateControls())}requestTick(){this.isTicking||(this.emit("startAnimation"),this.updateControls(),dt(this.container,"is-animating"),this.isScaling&&dt(this.container,"is-scaling")),this.isTicking=!0,this.rAF||(this.rAF=requestAnimationFrame(()=>this.animate()))}panWithMouse(t,o=this.option("mouseMoveFriction")){if(this.pmme=t,this.panMode!==br||!t||Ye(this.targetScale)<=Ye(this.minScale))return;this.emit("mouseMove",t);const{container:c,containerRect:d,contentRect:x}=this,y=d.width,h=d.height,M=c.getBoundingClientRect(),D=(t.clientX||0)-M.left,A=(t.clientY||0)-M.top;let{contentWidth:z,contentHeight:L}=this.calculateContentDim(this.target);const N=this.option("mouseMoveFactor");N>1&&(z!==y&&(z*=N),L!==h&&(L*=N));let Y=.5*(z-y)-D/y*100/100*(z-y);Y+=.5*(x.right-x.left);let ee=.5*(L-h)-A/h*100/100*(L-h);ee+=.5*(x.bottom-x.top),this.applyChange({panX:Y-this.target.e,panY:ee-this.target.f,friction:o})}zoomWithWheel(t){if(this.state===ci.Destroy||this.state===ci.Init)return;const o=Date.now();if(o-this.pwt<45)return void t.preventDefault();this.pwt=o;var c=[-t.deltaX||0,-t.deltaY||0,-t.detail||0].reduce(function(D,A){return Math.abs(A)>Math.abs(D)?A:D});const d=Math.max(-1,Math.min(1,c)),{targetScale:x,maxScale:y,minScale:h}=this;let M=x*(100+45*d)/100;Ye(M)<Ye(h)&&Ye(x)<=Ye(h)?(this.cwd+=Math.abs(d),M=h):Ye(M)>Ye(y)&&Ye(x)>=Ye(y)?(this.cwd+=Math.abs(d),M=y):(this.cwd=0,M=Math.max(Math.min(M,y),h)),this.cwd>this.option("wheelLimit")||(t.preventDefault(),Ye(M)!==Ye(x)&&this.zoomTo(M,{event:t}))}canZoomIn(){return this.option("zoom")&&(Ye(this.contentRect.width,1)<Ye(this.contentRect.fitWidth,1)||Ye(this.targetScale)<Ye(this.maxScale))}canZoomOut(){return this.option("zoom")&&Ye(this.targetScale)>Ye(this.minScale)}zoomIn(t=1.25,o){this.zoomTo(this.targetScale*t,o)}zoomOut(t=.8,o){this.zoomTo(this.targetScale*t,o)}zoomToFit(t){this.zoomTo("fit",t)}zoomToCover(t){this.zoomTo("cover",t)}zoomToFull(t){this.zoomTo("full",t)}zoomToMax(t){this.zoomTo("max",t)}toggleZoom(t){this.zoomTo(this.getNextScale("toggleZoom"),t)}toggleMax(t){this.zoomTo(this.getNextScale("toggleMax"),t)}toggleCover(t){this.zoomTo(this.getNextScale("toggleCover"),t)}iterateZoom(t){this.zoomTo("next",t)}zoomTo(t=1,{friction:o=vr,originX:c=vr,originY:d=vr,event:x}={}){if(this.isContentLoading||this.state===ci.Destroy)return;const{targetScale:y,fullScale:h,maxScale:M,coverScale:D}=this;if(this.stop(),this.panMode===br&&(x=this.pmme||x),x||c===vr||d===vr){const z=this.content.getBoundingClientRect(),L=this.container.getBoundingClientRect(),N=x?x.clientX:L.left+.5*L.width,Y=x?x.clientY:L.top+.5*L.height;c=N-z.left-.5*z.width,d=Y-z.top-.5*z.height}let A=1;typeof t=="number"?A=t:t==="full"?A=h:t==="cover"?A=D:t==="max"?A=M:t==="fit"?A=1:t==="next"&&(A=this.getNextScale("iterateZoom")),A=A/y||1,o=o===vr?A>1?.15:.25:o,this.applyChange({scale:A,originX:c,originY:d,friction:o}),x&&this.panMode===br&&this.panWithMouse(x,o)}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:t,contentRect:o,target:c}=this;this.applyChange({panX:.5*t.width-(o.left+.5*o.fitWidth)-c.e,panY:.5*t.height-(o.top+.5*o.fitHeight)-c.f,scale:t.width/o.fitWidth/this.targetScale,originX:0,originY:0,ignoreBounds:!0})}fitY(){this.stop("target");const{containerRect:t,contentRect:o,target:c}=this;this.applyChange({panX:.5*t.width-(o.left+.5*o.fitWidth)-c.e,panY:.5*t.innerHeight-(o.top+.5*o.fitHeight)-c.f,scale:t.height/o.fitHeight/this.targetScale,originX:0,originY:0,ignoreBounds:!0})}toggleFS(){const{container:t}=this,o=this.cn("inFullscreen"),c=this.cn("htmlHasFullscreen");t.classList.toggle(o);const d=t.classList.contains(o);d?(document.documentElement.classList.add(c),document.addEventListener("keydown",this.onKeydown,!0)):(document.documentElement.classList.remove(c),document.removeEventListener("keydown",this.onKeydown,!0)),this.updateMetrics(),this.emit(d?"enterFS":"exitFS")}getMatrix(t=this.current){const{a:o,b:c,c:d,d:x,e:y,f:h}=t;return new DOMMatrix([o,c,d,x,y,h])}reset(t){if(this.state!==ci.Init&&this.state!==ci.Destroy){this.stop("current");for(const o of Ss)this.target[o]=eu[o];this.target.a=this.minScale,this.target.d=this.minScale,this.clampTargetBounds(),this.isResting||(this.friction=t===void 0?this.option("friction"):t,this.state=ci.Panning,this.requestTick())}}destroy(){this.stop(),this.state=ci.Destroy,this.detachEvents(),this.detachObserver();const{container:t,content:o}=this,c=this.option("classes")||{};for(const d of Object.values(c))t.classList.remove(d+"");o&&(o.removeEventListener("load",this.onLoad),o.removeEventListener("error",this.onError)),this.detachPlugins()}}Object.defineProperty($o,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:RE}),Object.defineProperty($o,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:{}});const By=function(n,t){let o=!0;return(...c)=>{o&&(o=!1,n(...c),setTimeout(()=>{o=!0},t))}},Fy=(n,t)=>{let o=[];return n.childNodes.forEach(c=>{c.nodeType!==Node.ELEMENT_NODE||t&&!c.matches(t)||o.push(c)}),o},BE={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 Ni;(function(n){n[n.Init=0]="Init",n[n.Ready=1]="Ready",n[n.Destroy=2]="Destroy"})(Ni||(Ni={}));const Ip=n=>{if(typeof n=="string"||n instanceof HTMLElement)n={html:n};else{const t=n.thumb;t!==void 0&&(typeof t=="string"&&(n.thumbSrc=t),t instanceof HTMLImageElement&&(n.thumbEl=t,n.thumbElSrc=t.src,n.thumbSrc=t.src),delete n.thumb)}return Object.assign({html:"",el:null,isDom:!1,class:"",customClass:"",index:-1,dim:0,gap:0,pos:0,transition:!1},n)},FE=(n={})=>Object.assign({index:-1,slides:[],dim:0,pos:-1},n);class Vr extends Qh{constructor(t,o){super(o),Object.defineProperty(this,"instance",{enumerable:!0,configurable:!0,writable:!0,value:t})}attach(){}detach(){}}const NE={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};class Ny extends Vr{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 t=this.list;if(!t){t=document.createElement("ul"),dt(t,this.cn("list")),t.setAttribute("role","tablist");const o=this.instance.container;o.appendChild(t),dt(o,this.cn("hasDots")),this.list=t}return t}refresh(){var t;const o=this.instance.pages.length,c=Math.min(2,this.option("minCount")),d=Math.max(2e3,this.option("maxCount")),x=this.option("dynamicFrom");if(o<c||o>d)return void this.cleanup();const y=typeof x=="number"&&o>5&&o>=x,h=!this.list||this.isDynamic!==y||this.list.children.length!==o;h&&this.cleanup();const M=this.build();if(es(M,this.cn("isDynamic"),!!y),h)for(let z=0;z<o;z++)M.append(this.createItem(z));let D,A=0;for(const z of[...M.children]){const L=A===this.instance.page;L&&(D=z),es(z,this.cn("isCurrent"),L),(t=z.children[0])===null||t===void 0||t.setAttribute("aria-selected",L?"true":"false");for(const N of["isBeforePrev","isPrev","isNext","isAfterNext"])ni(z,this.cn(N));A++}if(D=D||M.firstChild,y&&D){const z=D.previousElementSibling,L=z&&z.previousElementSibling;dt(z,this.cn("isPrev")),dt(L,this.cn("isBeforePrev"));const N=D.nextElementSibling,Y=N&&N.nextElementSibling;dt(N,this.cn("isNext")),dt(Y,this.cn("isAfterNext"))}this.isDynamic=y}createItem(t=0){var o;const c=document.createElement("li");c.setAttribute("role","presentation");const d=Qr(this.instance.localize(this.option("dotTpl"),[["%d",t+1]]).replace(/\%i/g,t+""));return c.appendChild(d),(o=c.children[0])===null||o===void 0||o.setAttribute("role","tab"),c}cleanup(){this.list&&(this.list.remove(),this.list=null),this.isDynamic=!1,ni(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(Ny,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:NE});const iu="disabled",nu="next",Vy="prev";class $y extends Vr{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 t=this.instance,o=t.pages.length,c=t.page;if(o<2)return void this.cleanup();this.build();let d=this.prev,x=this.next;d&&x&&(d.removeAttribute(iu),x.removeAttribute(iu),t.isInfinite||(c<=0&&d.setAttribute(iu,""),c>=o-1&&x.setAttribute(iu,"")))}addBtn(t){var o;const c=this.instance,d=document.createElement("button");d.setAttribute("tabindex","0"),d.setAttribute("title",c.localize(`{{${t.toUpperCase()}}}`)),dt(d,this.cn("button")+" "+this.cn(t===nu?"isNext":"isPrev"));const x=c.isRTL?t===nu?Vy:nu:t;var y;return d.innerHTML=c.localize(this.option(`${x}Tpl`)),d.dataset[`carousel${y=t,y?y.match("^[a-z]")?y.charAt(0).toUpperCase()+y.substring(1):y:""}`]="true",(o=this.container)===null||o===void 0||o.appendChild(d),d}build(){const t=this.instance.container,o=this.cn("container");let{container:c,prev:d,next:x}=this;c||(c=t.querySelector("."+o),this.isDom=!!c),c||(c=document.createElement("div"),dt(c,o),t.appendChild(c)),this.container=c,x||(x=c.querySelector("[data-carousel-next]")),x||(x=this.addBtn(nu)),this.next=x,d||(d=c.querySelector("[data-carousel-prev]")),d||(d=this.addBtn(Vy)),this.prev=d}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($y,"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>'}});class jy extends Vr{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(t){this.target=this.instance,this.nav=t,this.attachEvents()}addAsNavFor(t){this.nav=this.instance,this.target=t,this.attachEvents()}attachEvents(){const{nav:t,target:o}=this;t&&o&&(t.options.initialSlide=o.options.initialPage,t.state===Ni.Ready?this.onNavReady(t):t.on("ready",this.onNavReady),o.state===Ni.Ready?this.onTargetReady(o):o.on("ready",this.onTargetReady))}onNavReady(t){t.on("createSlide",this.onNavCreateSlide),t.on("Panzoom.click",this.onNavClick),t.on("Panzoom.touchEnd",this.onNavTouch),this.onTargetChange()}onTargetReady(t){t.on("change",this.onTargetChange),t.on("Panzoom.refresh",this.onTargetChange),this.onTargetChange()}onNavClick(t,o,c){this.onNavTouch(t,t.panzoom,c)}onNavTouch(t,o,c){var d,x;if(Math.abs(o.dragOffset.x)>3||Math.abs(o.dragOffset.y)>3)return;const y=c.target,{nav:h,target:M}=this;if(!h||!M||!y)return;const D=y.closest("[data-index]");if(c.stopPropagation(),c.preventDefault(),!D)return;const A=parseInt(D.dataset.index||"",10)||0,z=M.getPageForSlide(A),L=h.getPageForSlide(A);h.slideTo(L),M.slideTo(z,{friction:((x=(d=this.nav)===null||d===void 0?void 0:d.plugins)===null||x===void 0?void 0:x.Sync.option("friction"))||0}),this.markSelectedSlide(A)}onNavCreateSlide(t,o){o.index===this.selectedIndex&&this.markSelectedSlide(o.index)}onTargetChange(){var t,o;const{target:c,nav:d}=this;if(!c||!d||d.state!==Ni.Ready||c.state!==Ni.Ready)return;const x=(o=(t=c.pages[c.page])===null||t===void 0?void 0:t.slides[0])===null||o===void 0?void 0:o.index,y=d.getPageForSlide(x);this.markSelectedSlide(x),d.slideTo(y,d.prevPage===null&&c.prevPage===null?{friction:0}:void 0)}markSelectedSlide(t){const o=this.nav;o&&o.state===Ni.Ready&&(this.selectedIndex=t,[...o.slides].map(c=>{c.el&&c.el.classList[c.index===t?"add":"remove"]("is-nav-selected")}))}attach(){const t=this;let o=t.options.target,c=t.options.nav;o?t.addAsNavFor(o):c&&t.addAsTargetFor(c)}detach(){const t=this,o=t.nav,c=t.target;o&&(o.off("ready",t.onNavReady),o.off("createSlide",t.onNavCreateSlide),o.off("Panzoom.click",t.onNavClick),o.off("Panzoom.touchEnd",t.onNavTouch)),t.nav=null,c&&(c.off("ready",t.onTargetReady),c.off("refresh",t.onTargetChange),c.off("change",t.onTargetChange)),t.target=null}}Object.defineProperty(jy,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{friction:.35}});const VE={Navigation:$y,Dots:Ny,Sync:jy},ru="animationend",Uy="isSelected",su="slide";class jo extends Tp{get axis(){return this.isHorizontal?"e":"f"}get isEnabled(){return this.state===Ni.Ready}get isInfinite(){let t=!1;const{contentDim:o,viewportDim:c,pages:d,slides:x}=this,y=x[0];return d.length>=2&&y&&o+y.dim>=c&&(t=this.option("infinite")),t}get isRTL(){return this.option("direction")==="rtl"}get isHorizontal(){return this.option("axis")==="x"}constructor(t,o={},c={}){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:Ni.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 t=="string"&&(t=document.querySelector(t)),!t||!Hn(t))throw new Error("No Element found");this.container=t,this.slideNext=By(this.slideNext.bind(this),150),this.slidePrev=By(this.slidePrev.bind(this),150),this.userOptions=o,this.userPlugins=c,queueMicrotask(()=>{this.processOptions()})}processOptions(){var t,o;const c=Un({},jo.defaults,this.userOptions);let d="";const x=c.breakpoints;if(x&&Sp(x))for(const[y,h]of Object.entries(x))window.matchMedia(y).matches&&Sp(h)&&(d+=y,Un(c,h));d===this.bp&&this.state!==Ni.Init||(this.bp=d,this.state===Ni.Ready&&(c.initialSlide=((o=(t=this.pages[this.page])===null||t===void 0?void 0:t.slides[0])===null||o===void 0?void 0:o.index)||0),this.state!==Ni.Init&&this.destroy(),super.setOptions(c),this.option("enabled")===!1?this.attachEvents():setTimeout(()=>{this.init()},0))}init(){this.state=Ni.Init,this.emit("init"),this.attachPlugins(Object.assign(Object.assign({},jo.Plugins),this.userPlugins)),this.emit("attachPlugins"),this.initLayout(),this.initSlides(),this.updateMetrics(),this.setInitialPosition(),this.initPanzoom(),this.attachEvents(),this.state=Ni.Ready,this.emit("ready")}initLayout(){const{container:t}=this,o=this.option("classes");dt(t,this.cn("container")),es(t,o.isLTR,!this.isRTL),es(t,o.isRTL,this.isRTL),es(t,o.isVertical,!this.isHorizontal),es(t,o.isHorizontal,this.isHorizontal);let c=this.option("viewport")||t.querySelector(`.${o.viewport}`);c||(c=document.createElement("div"),dt(c,o.viewport),c.append(...Fy(t,`.${o.slide}`)),t.prepend(c)),c.addEventListener("scroll",this.onScroll);let d=this.option("track")||t.querySelector(`.${o.track}`);d||(d=document.createElement("div"),dt(d,o.track),d.append(...Array.from(c.childNodes))),d.setAttribute("aria-live","polite"),c.contains(d)||c.prepend(d),this.viewport=c,this.track=d,this.emit("initLayout")}initSlides(){const{track:t}=this;if(!t)return;const o=[...this.slides],c=[];[...Fy(t,`.${this.cn(su)}`)].forEach(d=>{if(Hn(d)){const x=Ip({el:d,isDom:!0,index:this.slides.length});c.push(x)}});for(let d of[...this.option("slides",[])||[],...o])c.push(Ip(d));this.slides=c;for(let d=0;d<this.slides.length;d++)this.slides[d].index=d;for(const d of c)this.emit("beforeInitSlide",d,d.index),this.emit("initSlide",d,d.index);this.emit("initSlides")}setInitialPage(){const t=this.option("initialSlide");this.page=typeof t=="number"?this.getPageForSlide(t):parseInt(this.option("initialPage",0)+"",10)||0}setInitialPosition(){const{track:t,pages:o,isHorizontal:c}=this;if(!t||!o.length)return;let d=this.page;o[d]||(this.page=d=0);const x=(o[d].pos||0)*(this.isRTL&&c?1:-1),y=c?`${x}px`:"0",h=c?"0":`${x}px`;t.style.transform=`translate3d(${y}, ${h}, 0) scale(1)`,this.option("adaptiveHeight")&&this.setViewportHeight()}initPanzoom(){this.panzoom&&(this.panzoom.destroy(),this.panzoom=null);const t=this.option("Panzoom")||{};this.panzoom=new $o(this.viewport,Un({},{content:this.track,zoom:!1,panOnlyZoomed:!1,lockAxis:this.isHorizontal?"x":"y",infinite:this.isInfinite,click:!1,dblClick:!1,touch:o=>!(this.pages.length<2&&!o.options.infinite),bounds:()=>this.getBounds(),maxVelocity:o=>Math.abs(o.target[this.axis]-o.current[this.axis])<2*this.viewportDim?100:0},t)),this.panzoom.on("*",(o,c,...d)=>{this.emit(`Panzoom.${c}`,o,...d)}),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 t=this.container;t&&(t.addEventListener("click",this.onClick,{passive:!1,capture:!1}),t.addEventListener("slideTo",this.onSlideTo)),window.addEventListener("resize",this.onResize)}createPages(){let t=[];const{contentDim:o,viewportDim:c}=this;let d=this.option("slidesPerPage");d=(d==="auto"||o<=c)&&this.option("fill")!==!1?1/0:parseFloat(d+"");let x=0,y=0,h=0;for(const M of this.slides)(!t.length||y+M.dim-c>.05||h>=d)&&(t.push(FE()),x=t.length-1,y=0,h=0),t[x].slides.push(M),y+=M.dim+M.gap,h++;return t}processPages(){const t=this.pages,{contentDim:o,viewportDim:c,isInfinite:d}=this,x=this.option("center"),y=this.option("fill"),h=y&&x&&o>c&&!d;if(t.forEach((A,z)=>{var L;A.index=z,A.pos=((L=A.slides[0])===null||L===void 0?void 0:L.pos)||0,A.dim=0;for(const[N,Y]of A.slides.entries())A.dim+=Y.dim,N<A.slides.length-1&&(A.dim+=Y.gap);h&&A.pos+.5*A.dim<.5*c?A.pos=0:h&&A.pos+.5*A.dim>=o-.5*c?A.pos=o-c:x&&(A.pos+=-.5*(c-A.dim))}),t.forEach(A=>{y&&!d&&o>c&&(A.pos=Math.max(A.pos,0),A.pos=Math.min(A.pos,o-c)),A.pos=Ye(A.pos,1e3),A.dim=Ye(A.dim,1e3),Math.abs(A.pos)<=.1&&(A.pos=0)}),d)return t;const M=[];let D;return t.forEach(A=>{const z=Object.assign({},A);D&&z.pos===D.pos?(D.dim+=z.dim,D.slides=[...D.slides,...z.slides]):(z.index=M.length,D=z,M.push(z))}),M}getPageFromIndex(t=0){const o=this.pages.length;let c;return t=parseInt((t||0).toString())||0,c=this.isInfinite?(t%o+o)%o:Math.max(Math.min(t,o-1),0),c}getSlideMetrics(t){var o,c;const d=this.isHorizontal?"width":"height";let x=0,y=0,h=t.el;const M=!(!h||h.parentNode);if(h?x=parseFloat(h.dataset[d]||"")||0:(h=document.createElement("div"),h.style.visibility="hidden",(this.track||document.body).prepend(h)),dt(h,this.cn(su)+" "+t.class+" "+t.customClass),x)h.style[d]=`${x}px`,h.style[d==="width"?"height":"width"]="";else{M&&(this.track||document.body).prepend(h),x=h.getBoundingClientRect()[d]*Math.max(1,((o=window.visualViewport)===null||o===void 0?void 0:o.scale)||1);let A=h[this.isHorizontal?"offsetWidth":"offsetHeight"];A-1>x&&(x=A)}const D=getComputedStyle(h);return D.boxSizing==="content-box"&&(this.isHorizontal?(x+=parseFloat(D.paddingLeft)||0,x+=parseFloat(D.paddingRight)||0):(x+=parseFloat(D.paddingTop)||0,x+=parseFloat(D.paddingBottom)||0)),y=parseFloat(D[this.isHorizontal?"marginRight":"marginBottom"])||0,M?(c=h.parentElement)===null||c===void 0||c.removeChild(h):t.el||h.remove(),{dim:Ye(x,1e3),gap:Ye(y,1e3)}}getBounds(){const{isInfinite:t,isRTL:o,isHorizontal:c,pages:d}=this;let x={min:0,max:0};if(t)x={min:-1/0,max:1/0};else if(d.length){const y=d[0].pos,h=d[d.length-1].pos;x=o&&c?{min:y,max:h}:{min:-1*h,max:-1*y}}return{x:c?x:{min:0,max:0},y:c?{min:0,max:0}:x}}repositionSlides(){let t,{isHorizontal:o,isRTL:c,isInfinite:d,viewport:x,viewportDim:y,contentDim:h,page:M,pages:D,slides:A,panzoom:z}=this,L=0,N=0,Y=0,ee=0;z?ee=-1*z.current[this.axis]:D[M]&&(ee=D[M].pos||0),t=o?c?"right":"left":"top",c&&o&&(ee*=-1);for(const me of A){const Ie=me.el;Ie?(t==="top"?(Ie.style.right="",Ie.style.left=""):Ie.style.top="",me.index!==L?Ie.style[t]=N===0?"":`${Ye(N,1e3)}px`:Ie.style[t]="",Y+=me.dim+me.gap,L++):N+=me.dim+me.gap}if(d&&Y&&x){let me=getComputedStyle(x),Ie="padding",tt=o?"Right":"Bottom",gt=parseFloat(me[Ie+(o?"Left":"Top")]);ee-=gt,y+=gt,y+=parseFloat(me[Ie+tt]);for(const Ve of A)Ve.el&&(Ye(Ve.pos)<Ye(y)&&Ye(Ve.pos+Ve.dim+Ve.gap)<Ye(ee)&&Ye(ee)>Ye(h-y)&&(Ve.el.style[t]=`${Ye(N+Y,1e3)}px`),Ye(Ve.pos+Ve.gap)>=Ye(h-y)&&Ye(Ve.pos)>Ye(ee+y)&&Ye(ee)<Ye(y)&&(Ve.el.style[t]=`-${Ye(Y,1e3)}px`))}let oe,he,_e=[...this.inTransition];if(_e.length>1&&(oe=D[_e[0]],he=D[_e[1]]),oe&&he){let me=0;for(const Ie of A)Ie.el?this.inTransition.has(Ie.index)&&oe.slides.indexOf(Ie)<0&&(Ie.el.style[t]=`${Ye(me+(oe.pos-he.pos),1e3)}px`):me+=Ie.dim+Ie.gap}}createSlideEl(t){const{track:o,slides:c}=this;if(!o||!t||t.el&&t.el.parentNode)return;const d=t.el||document.createElement("div");dt(d,this.cn(su)),dt(d,t.class),dt(d,t.customClass);const x=t.html;x&&(x instanceof HTMLElement?d.appendChild(x):d.innerHTML=t.html+"");const y=[];c.forEach((A,z)=>{A.el&&y.push(z)});const h=t.index;let M=null;y.length&&(M=c[y.reduce((A,z)=>Math.abs(z-h)<Math.abs(A-h)?z:A)]);const D=M&&M.el&&M.el.parentNode?M.index<t.index?M.el.nextSibling:M.el:null;o.insertBefore(d,o.contains(D)?D:null),t.el=d,this.emit("createSlide",t)}removeSlideEl(t,o=!1){const c=t==null?void 0:t.el;if(!c||!c.parentNode)return;const d=this.cn(Uy);if(c.classList.contains(d)&&(ni(c,d),this.emit("unselectSlide",t)),t.isDom&&!o)return c.removeAttribute("aria-hidden"),c.removeAttribute("data-index"),void(c.style.left="");this.emit("removeSlide",t);const x=new CustomEvent(ru);c.dispatchEvent(x),t.el&&(t.el.remove(),t.el=null)}transitionTo(t=0,o=this.option("transition")){var c,d,x,y;if(!o)return!1;const h=this.page,{pages:M,panzoom:D}=this;t=parseInt((t||0).toString())||0;const A=this.getPageFromIndex(t);if(!D||!M[A]||M.length<2||Math.abs((((d=(c=M[h])===null||c===void 0?void 0:c.slides[0])===null||d===void 0?void 0:d.dim)||0)-this.viewportDim)>1)return!1;let z=t>h?1:-1;this.isInfinite&&(h===0&&t===M.length-1&&(z=-1),h===M.length-1&&t===0&&(z=1));const L=M[A].pos*(this.isRTL?1:-1);if(h===A&&Math.abs(L-D.target[this.axis])<1)return!1;this.clearTransitions();const N=D.isResting;dt(this.container,this.cn("inTransition"));const Y=((x=M[h])===null||x===void 0?void 0:x.slides[0])||null,ee=((y=M[A])===null||y===void 0?void 0:y.slides[0])||null;this.inTransition.add(ee.index),this.createSlideEl(ee);let oe=Y.el,he=ee.el;N||o===su||(o="fadeFast",oe=null);const _e=this.isRTL?"next":"prev",me=this.isRTL?"prev":"next";return oe&&(this.inTransition.add(Y.index),Y.transition=o,oe.addEventListener(ru,this.onAnimationEnd),oe.classList.add(`f-${o}Out`,`to-${z>0?me:_e}`)),he&&(ee.transition=o,he.addEventListener(ru,this.onAnimationEnd),he.classList.add(`f-${o}In`,`from-${z>0?_e:me}`)),D.current[this.axis]=L,D.target[this.axis]=L,D.requestTick(),this.onChange(A),!0}manageSlideVisiblity(){const t=new Set,o=new Set,c=this.getVisibleSlides(parseFloat(this.option("preload",0)+"")||0);for(const d of this.slides)c.has(d)?t.add(d):o.add(d);for(const d of this.inTransition)t.add(this.slides[d]);for(const d of t)this.createSlideEl(d),this.lazyLoadSlide(d);for(const d of o)t.has(d)||this.removeSlideEl(d);this.markSelectedSlides(),this.repositionSlides()}markSelectedSlides(){if(!this.pages[this.page]||!this.pages[this.page].slides)return;const t="aria-hidden";let o=this.cn(Uy);if(o)for(const c of this.slides){const d=c.el;d&&(d.dataset.index=`${c.index}`,d.classList.contains("f-thumbs__slide")?this.getVisibleSlides(0).has(c)?d.removeAttribute(t):d.setAttribute(t,"true"):this.pages[this.page].slides.includes(c)?(d.classList.contains(o)||(dt(d,o),this.emit("selectSlide",c)),d.removeAttribute(t)):(d.classList.contains(o)&&(ni(d,o),this.emit("unselectSlide",c)),d.setAttribute(t,"true")))}}flipInfiniteTrack(){const{axis:t,isHorizontal:o,isInfinite:c,isRTL:d,viewportDim:x,contentDim:y}=this,h=this.panzoom;if(!h||!c)return;let M=h.current[t],D=h.target[t]-M,A=0,z=.5*x;d&&o?(M<-z&&(A=-1,M+=y),M>y-z&&(A=1,M-=y)):(M>z&&(A=1,M-=y),M<-y+z&&(A=-1,M+=y)),A&&(h.current[t]=M,h.target[t]=M+D)}lazyLoadImg(t,o){const c=this,d="f-fadeIn",x="is-preloading";let y=!1,h=null;const M=()=>{y||(y=!0,h&&(h.remove(),h=null),ni(o,x),o.complete&&(dt(o,d),setTimeout(()=>{ni(o,d)},350)),this.option("adaptiveHeight")&&t.el&&this.pages[this.page].slides.indexOf(t)>-1&&(c.updateMetrics(),c.setViewportHeight()),this.emit("load",t))};dt(o,x),o.src=o.dataset.lazySrcset||o.dataset.lazySrc||"",delete o.dataset.lazySrc,delete o.dataset.lazySrcset,o.addEventListener("error",()=>{M()}),o.addEventListener("load",()=>{M()}),setTimeout(()=>{const D=o.parentNode;D&&t.el&&(o.complete?M():y||(h=Qr(Cp),D.insertBefore(h,o)))},300)}lazyLoadSlide(t){const o=t&&t.el;if(!o)return;const c=new Set;let d=Array.from(o.querySelectorAll("[data-lazy-src],[data-lazy-srcset]"));o.dataset.lazySrc&&d.push(o),d.map(x=>{x instanceof HTMLImageElement?c.add(x):x instanceof HTMLElement&&x.dataset.lazySrc&&(x.style.backgroundImage=`url('${x.dataset.lazySrc}')`,delete x.dataset.lazySrc)});for(const x of c)this.lazyLoadImg(t,x)}onAnimationEnd(t){var o;const c=t.target,d=c?parseInt(c.dataset.index||"",10)||0:-1,x=this.slides[d],y=t.animationName;if(!c||!x||!y)return;const h=!!this.inTransition.has(d)&&x.transition;h&&y.substring(0,h.length+2)===`f-${h}`&&this.inTransition.delete(d),this.inTransition.size||this.clearTransitions(),d===this.page&&(!((o=this.panzoom)===null||o===void 0)&&o.isResting)&&this.emit("settle")}onDecel(t,o=0,c=0,d=0,x=0){if(this.option("dragFree"))return void this.setPageFromPosition();const{isRTL:y,isHorizontal:h,axis:M,pages:D}=this,A=D.length,z=Math.abs(Math.atan2(c,o)/(Math.PI/180));let L=0;if(L=z>45&&z<135?h?0:c:h?o:0,!A)return;let N=this.page,Y=y&&h?1:-1;const ee=t.current[M]*Y;let{pageIndex:oe}=this.getPageFromPosition(ee);Math.abs(L)>5?(D[N].dim<document.documentElement["client"+(this.isHorizontal?"Width":"Height")]-1&&(N=oe),N=y&&h?L<0?N-1:N+1:L<0?N+1:N-1):N=d===0&&x===0?N:oe,this.slideTo(N,{transition:!1,friction:t.option("decelFriction")})}onClick(t){const o=t.target,c=o&&Hn(o)?o.dataset:null;let d,x;c&&(c.carouselPage!==void 0?(x="slideTo",d=c.carouselPage):c.carouselNext!==void 0?x="slideNext":c.carouselPrev!==void 0&&(x="slidePrev")),x?(t.preventDefault(),t.stopPropagation(),o&&!o.hasAttribute("disabled")&&this[x](d)):this.emit("click",t)}onSlideTo(t){const o=t.detail||0;this.slideTo(this.getPageForSlide(o),{friction:0})}onChange(t,o=0){const c=this.page;this.prevPage=c,this.page=t,this.option("adaptiveHeight")&&this.setViewportHeight(),t!==c&&(this.markSelectedSlides(),this.emit("change",t,c,o))}onRefresh(){let t=this.contentDim,o=this.viewportDim;this.updateMetrics(),this.contentDim===t&&this.viewportDim===o||this.slideTo(this.page,{friction:0,transition:!1})}onScroll(){var t;(t=this.viewport)===null||t===void 0||t.scroll(0,0)}onResize(){this.option("breakpoints")&&this.processOptions()}onBeforeTransform(t){this.lp!==t.current[this.axis]&&(this.flipInfiniteTrack(),this.manageSlideVisiblity()),this.lp=t.current.e}onEndAnimation(){this.inTransition.size||this.emit("settle")}reInit(t=null,o=null){this.destroy(),this.state=Ni.Init,this.prevPage=null,this.userOptions=t||this.userOptions,this.userPlugins=o||this.userPlugins,this.processOptions()}slideTo(t=0,{friction:o=this.option("friction"),transition:c=this.option("transition")}={}){if(this.state===Ni.Destroy)return;t=parseInt((t||0).toString())||0;const d=this.getPageFromIndex(t),{axis:x,isHorizontal:y,isRTL:h,pages:M,panzoom:D}=this,A=M.length,z=h&&y?1:-1;if(!D||!A)return;if(this.page!==d){const N=new Event("beforeChange",{bubbles:!0,cancelable:!0});if(this.emit("beforeChange",N,t),N.defaultPrevented)return}if(this.transitionTo(t,c))return;let L=M[d].pos;if(this.isInfinite){const N=this.contentDim,Y=D.target[x]*z;A===2?L+=N*Math.floor(parseFloat(t+"")/2):L=[L,L-N,L+N].reduce(function(ee,oe){return Math.abs(oe-Y)<Math.abs(ee-Y)?oe:ee})}L*=z,Math.abs(D.target[x]-L)<1||(D.panTo({x:y?L:0,y:y?0:L,friction:o}),this.onChange(d))}slideToClosest(t){if(this.panzoom){const{pageIndex:o}=this.getPageFromPosition();this.slideTo(o,t)}}slideNext(){this.slideTo(this.page+1)}slidePrev(){this.slideTo(this.page-1)}clearTransitions(){this.inTransition.clear(),ni(this.container,this.cn("inTransition"));const t=["to-prev","to-next","from-prev","from-next"];for(const o of this.slides){const c=o.el;if(c){c.removeEventListener(ru,this.onAnimationEnd),c.classList.remove(...t);const d=o.transition;d&&c.classList.remove(`f-${d}Out`,`f-${d}In`)}}this.manageSlideVisiblity()}addSlide(t,o){var c,d,x,y;const h=this.panzoom,M=((c=this.pages[this.page])===null||c===void 0?void 0:c.pos)||0,D=((d=this.pages[this.page])===null||d===void 0?void 0:d.dim)||0,A=this.contentDim<this.viewportDim;let z=Array.isArray(o)?o:[o];const L=[];for(const N of z)L.push(Ip(N));this.slides.splice(t,0,...L);for(let N=0;N<this.slides.length;N++)this.slides[N].index=N;for(const N of L)this.emit("beforeInitSlide",N,N.index);if(this.page>=t&&(this.page+=L.length),this.updateMetrics(),h){const N=((x=this.pages[this.page])===null||x===void 0?void 0:x.pos)||0,Y=((y=this.pages[this.page])===null||y===void 0?void 0:y.dim)||0,ee=this.pages.length||1,oe=this.isRTL?D-Y:Y-D,he=this.isRTL?M-N:N-M;A&&ee===1?(t<=this.page&&(h.current[this.axis]-=oe,h.target[this.axis]-=oe),h.panTo({[this.isHorizontal?"x":"y"]:-1*N})):he&&t<=this.page&&(h.target[this.axis]-=he,h.current[this.axis]-=he,h.requestTick())}for(const N of L)this.emit("initSlide",N,N.index)}prependSlide(t){this.addSlide(0,t)}appendSlide(t){this.addSlide(this.slides.length,t)}removeSlide(t){const o=this.slides.length;t=(t%o+o)%o;const c=this.slides[t];if(c){this.removeSlideEl(c,!0),this.slides.splice(t,1);for(let d=0;d<this.slides.length;d++)this.slides[d].index=d;this.updateMetrics(),this.slideTo(this.page,{friction:0,transition:!1}),this.emit("destroySlide",c)}}updateMetrics(){const{panzoom:t,viewport:o,track:c,slides:d,isHorizontal:x,isInfinite:y}=this;if(!c)return;const h=x?"width":"height",M=x?"offsetWidth":"offsetHeight";if(o){let z=Math.max(o[M],Ye(o.getBoundingClientRect()[h],1e3)),L=getComputedStyle(o),N="padding",Y=x?"Right":"Bottom";z-=parseFloat(L[N+(x?"Left":"Top")])+parseFloat(L[N+Y]),this.viewportDim=z}let D,A=0;for(const[z,L]of d.entries()){let N=0,Y=0;!L.el&&D?(N=D.dim,Y=D.gap):({dim:N,gap:Y}=this.getSlideMetrics(L),D=L),N=Ye(N,1e3),Y=Ye(Y,1e3),L.dim=N,L.gap=Y,L.pos=A,A+=N,(y||z<d.length-1)&&(A+=Y)}A=Ye(A,1e3),this.contentDim=A,t&&(t.contentRect[h]=A,t.contentRect[x?"fullWidth":"fullHeight"]=A),this.pages=this.createPages(),this.pages=this.processPages(),this.state===Ni.Init&&this.setInitialPage(),this.page=Math.max(0,Math.min(this.page,this.pages.length-1)),this.manageSlideVisiblity(),this.emit("refresh")}getProgress(t,o=!1,c=!1){t===void 0&&(t=this.page);const d=this,x=d.panzoom,y=d.contentDim,h=d.pages[t]||0;if(!h||!x)return t>this.page?-1:1;let M=-1*x.current.e,D=Ye((M-h.pos)/(1*h.dim),1e3),A=D,z=D;this.isInfinite&&c!==!0&&(A=Ye((M-h.pos+y)/(1*h.dim),1e3),z=Ye((M-h.pos-y)/(1*h.dim),1e3));let L=[D,A,z].reduce(function(N,Y){return Math.abs(Y)<Math.abs(N)?Y:N});return o?L:L>1?1:L<-1?-1:L}setViewportHeight(){const{page:t,pages:o,viewport:c,isHorizontal:d}=this;if(!c||!o[t])return;let x=0;d&&this.track&&(this.track.style.height="auto",o[t].slides.forEach(y=>{y.el&&(x=Math.max(x,y.el.offsetHeight))})),c.style.height=x?`${x}px`:""}getPageForSlide(t){for(const o of this.pages)for(const c of o.slides)if(c.index===t)return o.index;return-1}getVisibleSlides(t=0){var o;const c=new Set;let{panzoom:d,contentDim:x,viewportDim:y,pages:h,page:M}=this;if(y){x=x+((o=this.slides[this.slides.length-1])===null||o===void 0?void 0:o.gap)||0;let D=0;D=d&&d.state!==ci.Init&&d.state!==ci.Destroy?-1*d.current[this.axis]:h[M]&&h[M].pos||0,this.isInfinite&&(D-=Math.floor(D/x)*x),this.isRTL&&this.isHorizontal&&(D*=-1);const A=D-y*t,z=D+y*(t+1),L=this.isInfinite?[-1,0,1]:[0];for(const N of this.slides)for(const Y of L){const ee=N.pos+Y*x,oe=ee+N.dim+N.gap;ee<z&&oe>A&&c.add(N)}}return c}getPageFromPosition(t){const{viewportDim:o,contentDim:c,slides:d,pages:x,panzoom:y}=this,h=x.length,M=d.length,D=d[0],A=d[M-1],z=this.option("center");let L=0,N=0,Y=0,ee=t===void 0?-1*((y==null?void 0:y.target[this.axis])||0):t;z&&(ee+=.5*o),this.isInfinite?(ee<D.pos-.5*A.gap&&(ee-=c,Y=-1),ee>A.pos+A.dim+.5*A.gap&&(ee-=c,Y=1)):ee=Math.max(D.pos||0,Math.min(ee,A.pos));let oe=A,he=d.find(_e=>{const me=_e.pos-.5*oe.gap,Ie=_e.pos+_e.dim+.5*_e.gap;return oe=_e,ee>=me&&ee<Ie});return he||(he=A),N=this.getPageForSlide(he.index),L=N+Y*h,{page:L,pageIndex:N}}setPageFromPosition(){const{pageIndex:t}=this.getPageFromPosition();this.onChange(t)}destroy(){if([Ni.Destroy].includes(this.state))return;this.state=Ni.Destroy;const{container:t,viewport:o,track:c,slides:d,panzoom:x}=this,y=this.option("classes");t.removeEventListener("click",this.onClick,{passive:!1,capture:!1}),t.removeEventListener("slideTo",this.onSlideTo),window.removeEventListener("resize",this.onResize),x&&(x.destroy(),this.panzoom=null),d&&d.forEach(M=>{this.removeSlideEl(M)}),this.detachPlugins(),o&&(o.removeEventListener("scroll",this.onScroll),o.offsetParent&&c&&c.offsetParent&&o.replaceWith(...c.childNodes));for(const[M,D]of Object.entries(y))M!=="container"&&D&&t.classList.remove(D);this.track=null,this.viewport=null,this.page=0,this.slides=[];const h=this.events.get("ready");this.events=new Map,h&&this.events.set("ready",h)}}Object.defineProperty(jo,"Panzoom",{enumerable:!0,configurable:!0,writable:!0,value:$o}),Object.defineProperty(jo,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:BE}),Object.defineProperty(jo,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:VE});const Hy=function(n){if(!Hn(n))return 0;const t=window.scrollY,o=window.innerHeight,c=t+o,d=n.getBoundingClientRect(),x=d.y+t,y=d.height,h=x+y;if(t>h||c<x)return 0;if(t<x&&c>h||x<t&&h>c)return 100;let M=y;x<t&&(M-=t-x),h>c&&(M-=h-c);const D=M/o*100;return Math.round(D)},sc=!(typeof window>"u"||!window.document||!window.document.createElement);let Ap;const Dp=["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(","),qy=n=>{if(n&&sc){Ap===void 0&&document.createElement("div").focus({get preventScroll(){return Ap=!0,!1}});try{if(Ap)n.focus({preventScroll:!0});else{const t=window.scrollY||document.body.scrollTop,o=window.scrollX||document.body.scrollLeft;n.focus(),document.body.scrollTo({top:t,left:o,behavior:"auto"})}}catch{}}},Zy=()=>{const n=document;let t,o="",c="",d="";return n.fullscreenEnabled?(o="requestFullscreen",c="exitFullscreen",d="fullscreenElement"):n.webkitFullscreenEnabled&&(o="webkitRequestFullscreen",c="webkitExitFullscreen",d="webkitFullscreenElement"),o&&(t={request:function(x=n.documentElement){return o==="webkitRequestFullscreen"?x[o](Element.ALLOW_KEYBOARD_INPUT):x[o]()},exit:function(){return n[d]&&n[c]()},isFullscreen:function(){return n[d]}}),t},zp={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({},zy),{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">
|
|
624
|
+
`),X=E.createShader(E.FRAGMENT_SHADER);if(E.isContextLost())return void(this.failedToCreate=!0);if(E.shaderSource(X,re),E.compileShader(X),!E.getShaderParameter(X,E.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${E.getShaderInfoLog(X)}`);E.attachShader(this.program,X);const ue=E.createShader(E.VERTEX_SHADER);if(E.isContextLost())return void(this.failedToCreate=!0);if(E.shaderSource(ue,ae),E.compileShader(ue),!E.getShaderParameter(ue,E.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${E.getShaderInfoLog(ue)}`);E.attachShader(this.program,ue),this.attributes={};const pe={};this.numAttributes=O.length;for(let xe=0;xe<this.numAttributes;xe++)O[xe]&&(E.bindAttribLocation(this.program,xe,O[xe]),this.attributes[O[xe]]=xe);if(E.linkProgram(this.program),!E.getProgramParameter(this.program,E.LINK_STATUS))throw new Error(`Program failed to link: ${E.getProgramInfoLog(this.program)}`);E.deleteShader(ue),E.deleteShader(X);for(let xe=0;xe<Q.length;xe++){const Ce=Q[xe];if(Ce&&!pe[Ce]){const Ae=E.getUniformLocation(this.program,Ce);Ae&&(pe[Ce]=Ae)}}this.fixedUniforms=p(e,pe),this.terrainUniforms=((xe,Ce)=>({u_depth:new h.aH(xe,Ce.u_depth),u_terrain:new h.aH(xe,Ce.u_terrain),u_terrain_dim:new h.aI(xe,Ce.u_terrain_dim),u_terrain_matrix:new h.aJ(xe,Ce.u_terrain_matrix),u_terrain_unpack:new h.aK(xe,Ce.u_terrain_unpack),u_terrain_exaggeration:new h.aI(xe,Ce.u_terrain_exaggeration)}))(e,pe),this.binderUniforms=u?u.getUniforms(e,pe):[]}draw(e,a,u,p,m,k,E,T,I,O,B,U,Z,G,Q,ne,re,ae){const X=e.gl;if(this.failedToCreate)return;if(e.program.set(this.program),e.setDepthMode(u),e.setStencilMode(p),e.setColorMode(m),e.setCullFace(k),T){e.activeTexture.set(X.TEXTURE2),X.bindTexture(X.TEXTURE_2D,T.depthTexture),e.activeTexture.set(X.TEXTURE3),X.bindTexture(X.TEXTURE_2D,T.texture);for(const pe in this.terrainUniforms)this.terrainUniforms[pe].set(T[pe])}for(const pe in this.fixedUniforms)this.fixedUniforms[pe].set(E[pe]);Q&&Q.setUniforms(e,this.binderUniforms,Z,{zoom:G});let ue=0;switch(a){case X.LINES:ue=2;break;case X.TRIANGLES:ue=3;break;case X.LINE_STRIP:ue=1}for(const pe of U.get()){const xe=pe.vaos||(pe.vaos={});(xe[I]||(xe[I]=new dc)).bind(e,this,O,Q?Q.getPaintVertexBuffers():[],B,pe.vertexOffset,ne,re,ae),X.drawElements(a,pe.primitiveLength*ue,X.UNSIGNED_SHORT,pe.primitiveOffset*ue*2)}}}function Wa(g,e,a){const u=1/Rt(a,1,e.transform.tileZoom),p=Math.pow(2,a.tileID.overscaledZ),m=a.tileSize*Math.pow(2,e.transform.tileZoom)/p,k=m*(a.tileID.canonical.x+a.tileID.wrap*p),E=m*a.tileID.canonical.y;return{u_image:0,u_texsize:a.imageAtlasTexture.size,u_scale:[u,g.fromScale,g.toScale],u_fade:g.t,u_pixel_coord_upper:[k>>16,E>>16],u_pixel_coord_lower:[65535&k,65535&E]}}const Qo=(g,e,a,u)=>{const p=e.style.light,m=p.properties.get("position"),k=[m.x,m.y,m.z],E=function(){var I=new h.A(9);return h.A!=Float32Array&&(I[1]=0,I[2]=0,I[3]=0,I[5]=0,I[6]=0,I[7]=0),I[0]=1,I[4]=1,I[8]=1,I}();p.properties.get("anchor")==="viewport"&&function(I,O){var B=Math.sin(O),U=Math.cos(O);I[0]=U,I[1]=B,I[2]=0,I[3]=-B,I[4]=U,I[5]=0,I[6]=0,I[7]=0,I[8]=1}(E,-e.transform.angle),function(I,O,B){var U=O[0],Z=O[1],G=O[2];I[0]=U*B[0]+Z*B[3]+G*B[6],I[1]=U*B[1]+Z*B[4]+G*B[7],I[2]=U*B[2]+Z*B[5]+G*B[8]}(k,k,E);const T=p.properties.get("color");return{u_matrix:g,u_lightpos:k,u_lightintensity:p.properties.get("intensity"),u_lightcolor:[T.r,T.g,T.b],u_vertical_gradient:+a,u_opacity:u}},Ga=(g,e,a,u,p,m,k)=>h.e(Qo(g,e,a,u),Wa(m,e,k),{u_height_factor:-Math.pow(2,p.overscaledZ)/k.tileSize/8}),io=g=>({u_matrix:g}),pu=(g,e,a,u)=>h.e(io(g),Wa(a,e,u)),Zp=(g,e)=>({u_matrix:g,u_world:e}),fu=(g,e,a,u,p)=>h.e(pu(g,e,a,u),{u_world:p}),Wp=(g,e,a,u)=>{const p=g.transform;let m,k;if(u.paint.get("circle-pitch-alignment")==="map"){const E=Rt(a,1,p.zoom);m=!0,k=[E,E]}else m=!1,k=p.pixelsToGLUnits;return{u_camera_to_center_distance:p.cameraToCenterDistance,u_scale_with_map:+(u.paint.get("circle-pitch-scale")==="map"),u_matrix:g.translatePosMatrix(e.posMatrix,a,u.paint.get("circle-translate"),u.paint.get("circle-translate-anchor")),u_pitch_with_map:+m,u_device_pixel_ratio:g.pixelRatio,u_extrude_scale:k}},Ps=(g,e,a)=>({u_matrix:g,u_inv_matrix:e,u_camera_to_center_distance:a.cameraToCenterDistance,u_viewport_size:[a.width,a.height]}),ea=(g,e,a=1)=>({u_matrix:g,u_color:e,u_overlay:0,u_overlay_scale:a}),xn=g=>({u_matrix:g}),bn=(g,e,a,u)=>({u_matrix:g,u_extrude_scale:Rt(e,1,a),u_intensity:u}),Ya=(g,e,a,u)=>{const p=h.H();h.aP(p,0,g.width,g.height,0,0,1);const m=g.context.gl;return{u_matrix:p,u_world:[m.drawingBufferWidth,m.drawingBufferHeight],u_image:a,u_color_ramp:u,u_opacity:e.paint.get("heatmap-opacity")}};function Xa(g,e){const a=Math.pow(2,e.canonical.z),u=e.canonical.y;return[new h.Z(0,u/a).toLngLat().lat,new h.Z(0,(u+1)/a).toLngLat().lat]}const Ka=(g,e,a,u)=>{const p=g.transform;return{u_matrix:yu(g,e,a,u),u_ratio:1/Rt(e,1,p.zoom),u_device_pixel_ratio:g.pixelRatio,u_units_to_pixels:[1/p.pixelsToGLUnits[0],1/p.pixelsToGLUnits[1]]}},mu=(g,e,a,u,p)=>h.e(Ka(g,e,a,p),{u_image:0,u_image_height:u}),no=(g,e,a,u,p)=>{const m=g.transform,k=gu(e,m);return{u_matrix:yu(g,e,a,p),u_texsize:e.imageAtlasTexture.size,u_ratio:1/Rt(e,1,m.zoom),u_device_pixel_ratio:g.pixelRatio,u_image:0,u_scale:[k,u.fromScale,u.toScale],u_fade:u.t,u_units_to_pixels:[1/m.pixelsToGLUnits[0],1/m.pixelsToGLUnits[1]]}},Gp=(g,e,a,u,p,m)=>{const k=g.lineAtlas,E=gu(e,g.transform),T=a.layout.get("line-cap")==="round",I=k.getDash(u.from,T),O=k.getDash(u.to,T),B=I.width*p.fromScale,U=O.width*p.toScale;return h.e(Ka(g,e,a,m),{u_patternscale_a:[E/B,-I.height/2],u_patternscale_b:[E/U,-O.height/2],u_sdfgamma:k.width/(256*Math.min(B,U)*g.pixelRatio)/2,u_image:0,u_tex_y_a:I.y,u_tex_y_b:O.y,u_mix:p.t})};function gu(g,e){return 1/Rt(g,1,e.tileZoom)}function yu(g,e,a,u){return g.translatePosMatrix(u?u.posMatrix:e.tileID.posMatrix,e,a.paint.get("line-translate"),a.paint.get("line-translate-anchor"))}const Yp=(g,e,a,u,p)=>{return{u_matrix:g,u_tl_parent:e,u_scale_parent:a,u_buffer_scale:1,u_fade_t:u.mix,u_opacity:u.opacity*p.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:p.paint.get("raster-brightness-min"),u_brightness_high:p.paint.get("raster-brightness-max"),u_saturation_factor:(k=p.paint.get("raster-saturation"),k>0?1-1/(1.001-k):-k),u_contrast_factor:(m=p.paint.get("raster-contrast"),m>0?1/(1-m):1+m),u_spin_weights:Xp(p.paint.get("raster-hue-rotate"))};var m,k};function Xp(g){g*=Math.PI/180;const e=Math.sin(g),a=Math.cos(g);return[(2*a+1)/3,(-Math.sqrt(3)*e-a+1)/3,(Math.sqrt(3)*e-a+1)/3]}const _u=(g,e,a,u,p,m,k,E,T,I,O,B,U,Z)=>{const G=k.transform;return{u_is_size_zoom_constant:+(g==="constant"||g==="source"),u_is_size_feature_constant:+(g==="constant"||g==="camera"),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:G.cameraToCenterDistance,u_pitch:G.pitch/360*2*Math.PI,u_rotate_symbol:+a,u_aspect_ratio:G.width/G.height,u_fade_change:k.options.fadeDuration?k.symbolFadeChange:1,u_matrix:E,u_label_plane_matrix:T,u_coord_matrix:I,u_is_text:+B,u_pitch_with_map:+u,u_is_along_line:p,u_is_variable_anchor:m,u_texsize:U,u_texture:0,u_translation:O,u_pitched_scale:Z}},ta=(g,e,a,u,p,m,k,E,T,I,O,B,U,Z,G)=>{const Q=k.transform;return h.e(_u(g,e,a,u,p,m,k,E,T,I,O,B,U,G),{u_gamma_scale:u?Math.cos(Q._pitch)*Q.cameraToCenterDistance:1,u_device_pixel_ratio:k.pixelRatio,u_is_halo:+Z})},mc=(g,e,a,u,p,m,k,E,T,I,O,B,U,Z)=>h.e(ta(g,e,a,u,p,m,k,E,T,I,O,!0,B,!0,Z),{u_texsize_icon:U,u_texture_icon:1}),Ja=(g,e,a)=>({u_matrix:g,u_opacity:e,u_color:a}),gc=(g,e,a,u,p,m)=>h.e(function(k,E,T,I){const O=T.imageManager.getPattern(k.from.toString()),B=T.imageManager.getPattern(k.to.toString()),{width:U,height:Z}=T.imageManager.getPixelSize(),G=Math.pow(2,I.tileID.overscaledZ),Q=I.tileSize*Math.pow(2,T.transform.tileZoom)/G,ne=Q*(I.tileID.canonical.x+I.tileID.wrap*G),re=Q*I.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:O.tl,u_pattern_br_a:O.br,u_pattern_tl_b:B.tl,u_pattern_br_b:B.br,u_texsize:[U,Z],u_mix:E.t,u_pattern_size_a:O.displaySize,u_pattern_size_b:B.displaySize,u_scale_a:E.fromScale,u_scale_b:E.toScale,u_tile_units_to_pixels:1/Rt(I,1,T.transform.tileZoom),u_pixel_coord_upper:[ne>>16,re>>16],u_pixel_coord_lower:[65535&ne,65535&re]}}(u,m,a,p),{u_matrix:g,u_opacity:e}),yc={fillExtrusion:(g,e)=>({u_matrix:new h.aJ(g,e.u_matrix),u_lightpos:new h.aN(g,e.u_lightpos),u_lightintensity:new h.aI(g,e.u_lightintensity),u_lightcolor:new h.aN(g,e.u_lightcolor),u_vertical_gradient:new h.aI(g,e.u_vertical_gradient),u_opacity:new h.aI(g,e.u_opacity)}),fillExtrusionPattern:(g,e)=>({u_matrix:new h.aJ(g,e.u_matrix),u_lightpos:new h.aN(g,e.u_lightpos),u_lightintensity:new h.aI(g,e.u_lightintensity),u_lightcolor:new h.aN(g,e.u_lightcolor),u_vertical_gradient:new h.aI(g,e.u_vertical_gradient),u_height_factor:new h.aI(g,e.u_height_factor),u_image:new h.aH(g,e.u_image),u_texsize:new h.aO(g,e.u_texsize),u_pixel_coord_upper:new h.aO(g,e.u_pixel_coord_upper),u_pixel_coord_lower:new h.aO(g,e.u_pixel_coord_lower),u_scale:new h.aN(g,e.u_scale),u_fade:new h.aI(g,e.u_fade),u_opacity:new h.aI(g,e.u_opacity)}),fill:(g,e)=>({u_matrix:new h.aJ(g,e.u_matrix)}),fillPattern:(g,e)=>({u_matrix:new h.aJ(g,e.u_matrix),u_image:new h.aH(g,e.u_image),u_texsize:new h.aO(g,e.u_texsize),u_pixel_coord_upper:new h.aO(g,e.u_pixel_coord_upper),u_pixel_coord_lower:new h.aO(g,e.u_pixel_coord_lower),u_scale:new h.aN(g,e.u_scale),u_fade:new h.aI(g,e.u_fade)}),fillOutline:(g,e)=>({u_matrix:new h.aJ(g,e.u_matrix),u_world:new h.aO(g,e.u_world)}),fillOutlinePattern:(g,e)=>({u_matrix:new h.aJ(g,e.u_matrix),u_world:new h.aO(g,e.u_world),u_image:new h.aH(g,e.u_image),u_texsize:new h.aO(g,e.u_texsize),u_pixel_coord_upper:new h.aO(g,e.u_pixel_coord_upper),u_pixel_coord_lower:new h.aO(g,e.u_pixel_coord_lower),u_scale:new h.aN(g,e.u_scale),u_fade:new h.aI(g,e.u_fade)}),circle:(g,e)=>({u_camera_to_center_distance:new h.aI(g,e.u_camera_to_center_distance),u_scale_with_map:new h.aH(g,e.u_scale_with_map),u_pitch_with_map:new h.aH(g,e.u_pitch_with_map),u_extrude_scale:new h.aO(g,e.u_extrude_scale),u_device_pixel_ratio:new h.aI(g,e.u_device_pixel_ratio),u_matrix:new h.aJ(g,e.u_matrix)}),collisionBox:(g,e)=>({u_matrix:new h.aJ(g,e.u_matrix),u_pixel_extrude_scale:new h.aO(g,e.u_pixel_extrude_scale)}),collisionCircle:(g,e)=>({u_matrix:new h.aJ(g,e.u_matrix),u_inv_matrix:new h.aJ(g,e.u_inv_matrix),u_camera_to_center_distance:new h.aI(g,e.u_camera_to_center_distance),u_viewport_size:new h.aO(g,e.u_viewport_size)}),debug:(g,e)=>({u_color:new h.aL(g,e.u_color),u_matrix:new h.aJ(g,e.u_matrix),u_overlay:new h.aH(g,e.u_overlay),u_overlay_scale:new h.aI(g,e.u_overlay_scale)}),clippingMask:(g,e)=>({u_matrix:new h.aJ(g,e.u_matrix)}),heatmap:(g,e)=>({u_extrude_scale:new h.aI(g,e.u_extrude_scale),u_intensity:new h.aI(g,e.u_intensity),u_matrix:new h.aJ(g,e.u_matrix)}),heatmapTexture:(g,e)=>({u_matrix:new h.aJ(g,e.u_matrix),u_world:new h.aO(g,e.u_world),u_image:new h.aH(g,e.u_image),u_color_ramp:new h.aH(g,e.u_color_ramp),u_opacity:new h.aI(g,e.u_opacity)}),hillshade:(g,e)=>({u_matrix:new h.aJ(g,e.u_matrix),u_image:new h.aH(g,e.u_image),u_latrange:new h.aO(g,e.u_latrange),u_light:new h.aO(g,e.u_light),u_shadow:new h.aL(g,e.u_shadow),u_highlight:new h.aL(g,e.u_highlight),u_accent:new h.aL(g,e.u_accent)}),hillshadePrepare:(g,e)=>({u_matrix:new h.aJ(g,e.u_matrix),u_image:new h.aH(g,e.u_image),u_dimension:new h.aO(g,e.u_dimension),u_zoom:new h.aI(g,e.u_zoom),u_unpack:new h.aK(g,e.u_unpack)}),line:(g,e)=>({u_matrix:new h.aJ(g,e.u_matrix),u_ratio:new h.aI(g,e.u_ratio),u_device_pixel_ratio:new h.aI(g,e.u_device_pixel_ratio),u_units_to_pixels:new h.aO(g,e.u_units_to_pixels)}),lineGradient:(g,e)=>({u_matrix:new h.aJ(g,e.u_matrix),u_ratio:new h.aI(g,e.u_ratio),u_device_pixel_ratio:new h.aI(g,e.u_device_pixel_ratio),u_units_to_pixels:new h.aO(g,e.u_units_to_pixels),u_image:new h.aH(g,e.u_image),u_image_height:new h.aI(g,e.u_image_height)}),linePattern:(g,e)=>({u_matrix:new h.aJ(g,e.u_matrix),u_texsize:new h.aO(g,e.u_texsize),u_ratio:new h.aI(g,e.u_ratio),u_device_pixel_ratio:new h.aI(g,e.u_device_pixel_ratio),u_image:new h.aH(g,e.u_image),u_units_to_pixels:new h.aO(g,e.u_units_to_pixels),u_scale:new h.aN(g,e.u_scale),u_fade:new h.aI(g,e.u_fade)}),lineSDF:(g,e)=>({u_matrix:new h.aJ(g,e.u_matrix),u_ratio:new h.aI(g,e.u_ratio),u_device_pixel_ratio:new h.aI(g,e.u_device_pixel_ratio),u_units_to_pixels:new h.aO(g,e.u_units_to_pixels),u_patternscale_a:new h.aO(g,e.u_patternscale_a),u_patternscale_b:new h.aO(g,e.u_patternscale_b),u_sdfgamma:new h.aI(g,e.u_sdfgamma),u_image:new h.aH(g,e.u_image),u_tex_y_a:new h.aI(g,e.u_tex_y_a),u_tex_y_b:new h.aI(g,e.u_tex_y_b),u_mix:new h.aI(g,e.u_mix)}),raster:(g,e)=>({u_matrix:new h.aJ(g,e.u_matrix),u_tl_parent:new h.aO(g,e.u_tl_parent),u_scale_parent:new h.aI(g,e.u_scale_parent),u_buffer_scale:new h.aI(g,e.u_buffer_scale),u_fade_t:new h.aI(g,e.u_fade_t),u_opacity:new h.aI(g,e.u_opacity),u_image0:new h.aH(g,e.u_image0),u_image1:new h.aH(g,e.u_image1),u_brightness_low:new h.aI(g,e.u_brightness_low),u_brightness_high:new h.aI(g,e.u_brightness_high),u_saturation_factor:new h.aI(g,e.u_saturation_factor),u_contrast_factor:new h.aI(g,e.u_contrast_factor),u_spin_weights:new h.aN(g,e.u_spin_weights)}),symbolIcon:(g,e)=>({u_is_size_zoom_constant:new h.aH(g,e.u_is_size_zoom_constant),u_is_size_feature_constant:new h.aH(g,e.u_is_size_feature_constant),u_size_t:new h.aI(g,e.u_size_t),u_size:new h.aI(g,e.u_size),u_camera_to_center_distance:new h.aI(g,e.u_camera_to_center_distance),u_pitch:new h.aI(g,e.u_pitch),u_rotate_symbol:new h.aH(g,e.u_rotate_symbol),u_aspect_ratio:new h.aI(g,e.u_aspect_ratio),u_fade_change:new h.aI(g,e.u_fade_change),u_matrix:new h.aJ(g,e.u_matrix),u_label_plane_matrix:new h.aJ(g,e.u_label_plane_matrix),u_coord_matrix:new h.aJ(g,e.u_coord_matrix),u_is_text:new h.aH(g,e.u_is_text),u_pitch_with_map:new h.aH(g,e.u_pitch_with_map),u_is_along_line:new h.aH(g,e.u_is_along_line),u_is_variable_anchor:new h.aH(g,e.u_is_variable_anchor),u_texsize:new h.aO(g,e.u_texsize),u_texture:new h.aH(g,e.u_texture),u_translation:new h.aO(g,e.u_translation),u_pitched_scale:new h.aI(g,e.u_pitched_scale)}),symbolSDF:(g,e)=>({u_is_size_zoom_constant:new h.aH(g,e.u_is_size_zoom_constant),u_is_size_feature_constant:new h.aH(g,e.u_is_size_feature_constant),u_size_t:new h.aI(g,e.u_size_t),u_size:new h.aI(g,e.u_size),u_camera_to_center_distance:new h.aI(g,e.u_camera_to_center_distance),u_pitch:new h.aI(g,e.u_pitch),u_rotate_symbol:new h.aH(g,e.u_rotate_symbol),u_aspect_ratio:new h.aI(g,e.u_aspect_ratio),u_fade_change:new h.aI(g,e.u_fade_change),u_matrix:new h.aJ(g,e.u_matrix),u_label_plane_matrix:new h.aJ(g,e.u_label_plane_matrix),u_coord_matrix:new h.aJ(g,e.u_coord_matrix),u_is_text:new h.aH(g,e.u_is_text),u_pitch_with_map:new h.aH(g,e.u_pitch_with_map),u_is_along_line:new h.aH(g,e.u_is_along_line),u_is_variable_anchor:new h.aH(g,e.u_is_variable_anchor),u_texsize:new h.aO(g,e.u_texsize),u_texture:new h.aH(g,e.u_texture),u_gamma_scale:new h.aI(g,e.u_gamma_scale),u_device_pixel_ratio:new h.aI(g,e.u_device_pixel_ratio),u_is_halo:new h.aH(g,e.u_is_halo),u_translation:new h.aO(g,e.u_translation),u_pitched_scale:new h.aI(g,e.u_pitched_scale)}),symbolTextAndIcon:(g,e)=>({u_is_size_zoom_constant:new h.aH(g,e.u_is_size_zoom_constant),u_is_size_feature_constant:new h.aH(g,e.u_is_size_feature_constant),u_size_t:new h.aI(g,e.u_size_t),u_size:new h.aI(g,e.u_size),u_camera_to_center_distance:new h.aI(g,e.u_camera_to_center_distance),u_pitch:new h.aI(g,e.u_pitch),u_rotate_symbol:new h.aH(g,e.u_rotate_symbol),u_aspect_ratio:new h.aI(g,e.u_aspect_ratio),u_fade_change:new h.aI(g,e.u_fade_change),u_matrix:new h.aJ(g,e.u_matrix),u_label_plane_matrix:new h.aJ(g,e.u_label_plane_matrix),u_coord_matrix:new h.aJ(g,e.u_coord_matrix),u_is_text:new h.aH(g,e.u_is_text),u_pitch_with_map:new h.aH(g,e.u_pitch_with_map),u_is_along_line:new h.aH(g,e.u_is_along_line),u_is_variable_anchor:new h.aH(g,e.u_is_variable_anchor),u_texsize:new h.aO(g,e.u_texsize),u_texsize_icon:new h.aO(g,e.u_texsize_icon),u_texture:new h.aH(g,e.u_texture),u_texture_icon:new h.aH(g,e.u_texture_icon),u_gamma_scale:new h.aI(g,e.u_gamma_scale),u_device_pixel_ratio:new h.aI(g,e.u_device_pixel_ratio),u_is_halo:new h.aH(g,e.u_is_halo),u_translation:new h.aO(g,e.u_translation),u_pitched_scale:new h.aI(g,e.u_pitched_scale)}),background:(g,e)=>({u_matrix:new h.aJ(g,e.u_matrix),u_opacity:new h.aI(g,e.u_opacity),u_color:new h.aL(g,e.u_color)}),backgroundPattern:(g,e)=>({u_matrix:new h.aJ(g,e.u_matrix),u_opacity:new h.aI(g,e.u_opacity),u_image:new h.aH(g,e.u_image),u_pattern_tl_a:new h.aO(g,e.u_pattern_tl_a),u_pattern_br_a:new h.aO(g,e.u_pattern_br_a),u_pattern_tl_b:new h.aO(g,e.u_pattern_tl_b),u_pattern_br_b:new h.aO(g,e.u_pattern_br_b),u_texsize:new h.aO(g,e.u_texsize),u_mix:new h.aI(g,e.u_mix),u_pattern_size_a:new h.aO(g,e.u_pattern_size_a),u_pattern_size_b:new h.aO(g,e.u_pattern_size_b),u_scale_a:new h.aI(g,e.u_scale_a),u_scale_b:new h.aI(g,e.u_scale_b),u_pixel_coord_upper:new h.aO(g,e.u_pixel_coord_upper),u_pixel_coord_lower:new h.aO(g,e.u_pixel_coord_lower),u_tile_units_to_pixels:new h.aI(g,e.u_tile_units_to_pixels)}),terrain:(g,e)=>({u_matrix:new h.aJ(g,e.u_matrix),u_texture:new h.aH(g,e.u_texture),u_ele_delta:new h.aI(g,e.u_ele_delta),u_fog_matrix:new h.aJ(g,e.u_fog_matrix),u_fog_color:new h.aL(g,e.u_fog_color),u_fog_ground_blend:new h.aI(g,e.u_fog_ground_blend),u_fog_ground_blend_opacity:new h.aI(g,e.u_fog_ground_blend_opacity),u_horizon_color:new h.aL(g,e.u_horizon_color),u_horizon_fog_blend:new h.aI(g,e.u_horizon_fog_blend)}),terrainDepth:(g,e)=>({u_matrix:new h.aJ(g,e.u_matrix),u_ele_delta:new h.aI(g,e.u_ele_delta)}),terrainCoords:(g,e)=>({u_matrix:new h.aJ(g,e.u_matrix),u_texture:new h.aH(g,e.u_texture),u_terrain_coords_id:new h.aI(g,e.u_terrain_coords_id),u_ele_delta:new h.aI(g,e.u_ele_delta)}),sky:(g,e)=>({u_sky_color:new h.aL(g,e.u_sky_color),u_horizon_color:new h.aL(g,e.u_horizon_color),u_horizon:new h.aI(g,e.u_horizon),u_sky_horizon_blend:new h.aI(g,e.u_sky_horizon_blend)})};class Pr{constructor(e,a,u){this.context=e;const p=e.gl;this.buffer=p.createBuffer(),this.dynamicDraw=!!u,this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),p.bufferData(p.ELEMENT_ARRAY_BUFFER,a.arrayBuffer,this.dynamicDraw?p.DYNAMIC_DRAW:p.STATIC_DRAW),this.dynamicDraw||delete a.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){const a=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),a.bufferSubData(a.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Kp={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class _c{constructor(e,a,u,p){this.length=a.length,this.attributes=u,this.itemSize=a.bytesPerElement,this.dynamicDraw=p,this.context=e;const m=e.gl;this.buffer=m.createBuffer(),e.bindVertexBuffer.set(this.buffer),m.bufferData(m.ARRAY_BUFFER,a.arrayBuffer,this.dynamicDraw?m.DYNAMIC_DRAW:m.STATIC_DRAW),this.dynamicDraw||delete a.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){if(e.length!==this.length)throw new Error(`Length of new data is ${e.length}, which doesn't match current length of ${this.length}`);const a=this.context.gl;this.bind(),a.bufferSubData(a.ARRAY_BUFFER,0,e.arrayBuffer)}enableAttributes(e,a){for(let u=0;u<this.attributes.length;u++){const p=a.attributes[this.attributes[u].name];p!==void 0&&e.enableVertexAttribArray(p)}}setVertexAttribPointers(e,a,u){for(let p=0;p<this.attributes.length;p++){const m=this.attributes[p],k=a.attributes[m.name];k!==void 0&&e.vertexAttribPointer(k,m.components,e[Kp[m.type]],!1,this.itemSize,m.offset+this.itemSize*(u||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Is=new WeakMap;function os(g){var e;if(Is.has(g))return Is.get(g);{const a=(e=g.getParameter(g.VERSION))===null||e===void 0?void 0:e.startsWith("WebGL 2.0");return Is.set(g,a),a}}class Yt{constructor(e){this.gl=e.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(e){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class Qa extends Yt{getDefault(){return h.aM.transparent}set(e){const a=this.current;(e.r!==a.r||e.g!==a.g||e.b!==a.b||e.a!==a.a||this.dirty)&&(this.gl.clearColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class Jp extends Yt{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}}class ro extends Yt{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}}class Qp extends Yt{getDefault(){return[!0,!0,!0,!0]}set(e){const a=this.current;(e[0]!==a[0]||e[1]!==a[1]||e[2]!==a[2]||e[3]!==a[3]||this.dirty)&&(this.gl.colorMask(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class xu extends Yt{getDefault(){return!0}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}}class ef extends Yt{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}}class bu extends Yt{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(e){const a=this.current;(e.func!==a.func||e.ref!==a.ref||e.mask!==a.mask||this.dirty)&&(this.gl.stencilFunc(e.func,e.ref,e.mask),this.current=e,this.dirty=!1)}}class xc extends Yt{getDefault(){const e=this.gl;return[e.KEEP,e.KEEP,e.KEEP]}set(e){const a=this.current;(e[0]!==a[0]||e[1]!==a[1]||e[2]!==a[2]||this.dirty)&&(this.gl.stencilOp(e[0],e[1],e[2]),this.current=e,this.dirty=!1)}}class vu extends Yt{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const a=this.gl;e?a.enable(a.STENCIL_TEST):a.disable(a.STENCIL_TEST),this.current=e,this.dirty=!1}}class wu extends Yt{getDefault(){return[0,1]}set(e){const a=this.current;(e[0]!==a[0]||e[1]!==a[1]||this.dirty)&&(this.gl.depthRange(e[0],e[1]),this.current=e,this.dirty=!1)}}class ku extends Yt{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const a=this.gl;e?a.enable(a.DEPTH_TEST):a.disable(a.DEPTH_TEST),this.current=e,this.dirty=!1}}class Su extends Yt{getDefault(){return this.gl.LESS}set(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}}class As extends Yt{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const a=this.gl;e?a.enable(a.BLEND):a.disable(a.BLEND),this.current=e,this.dirty=!1}}class Eu extends Yt{getDefault(){const e=this.gl;return[e.ONE,e.ZERO]}set(e){const a=this.current;(e[0]!==a[0]||e[1]!==a[1]||this.dirty)&&(this.gl.blendFunc(e[0],e[1]),this.current=e,this.dirty=!1)}}class tf extends Yt{getDefault(){return h.aM.transparent}set(e){const a=this.current;(e.r!==a.r||e.g!==a.g||e.b!==a.b||e.a!==a.a||this.dirty)&&(this.gl.blendColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class Tu extends Yt{getDefault(){return this.gl.FUNC_ADD}set(e){(e!==this.current||this.dirty)&&(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}}class ia extends Yt{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const a=this.gl;e?a.enable(a.CULL_FACE):a.disable(a.CULL_FACE),this.current=e,this.dirty=!1}}class nf extends Yt{getDefault(){return this.gl.BACK}set(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1)}}class el extends Yt{getDefault(){return this.gl.CCW}set(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1)}}class rf extends Yt{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}}class sf extends Yt{getDefault(){return this.gl.TEXTURE0}set(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}}class Cu extends Yt{getDefault(){const e=this.gl;return[0,0,e.drawingBufferWidth,e.drawingBufferHeight]}set(e){const a=this.current;(e[0]!==a[0]||e[1]!==a[1]||e[2]!==a[2]||e[3]!==a[3]||this.dirty)&&(this.gl.viewport(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class Mu extends Yt{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const a=this.gl;a.bindFramebuffer(a.FRAMEBUFFER,e),this.current=e,this.dirty=!1}}class Pu extends Yt{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const a=this.gl;a.bindRenderbuffer(a.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class bc extends Yt{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const a=this.gl;a.bindTexture(a.TEXTURE_2D,e),this.current=e,this.dirty=!1}}class Iu extends Yt{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const a=this.gl;a.bindBuffer(a.ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class tl extends Yt{getDefault(){return null}set(e){const a=this.gl;a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class Ur extends Yt{getDefault(){return null}set(e){var a;if(e===this.current&&!this.dirty)return;const u=this.gl;os(u)?u.bindVertexArray(e):(a=u.getExtension("OES_vertex_array_object"))===null||a===void 0||a.bindVertexArrayOES(e),this.current=e,this.dirty=!1}}class vc extends Yt{getDefault(){return 4}set(e){if(e===this.current&&!this.dirty)return;const a=this.gl;a.pixelStorei(a.UNPACK_ALIGNMENT,e),this.current=e,this.dirty=!1}}class wc extends Yt{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const a=this.gl;a.pixelStorei(a.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e),this.current=e,this.dirty=!1}}class kc extends Yt{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const a=this.gl;a.pixelStorei(a.UNPACK_FLIP_Y_WEBGL,e),this.current=e,this.dirty=!1}}class il extends Yt{constructor(e,a){super(e),this.context=e,this.parent=a}getDefault(){return null}}class Sc extends il{setDirty(){this.dirty=!0}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const a=this.gl;a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}}class Ds extends il{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const a=this.gl;a.framebufferRenderbuffer(a.FRAMEBUFFER,a.DEPTH_ATTACHMENT,a.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class Ec extends il{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const a=this.gl;a.framebufferRenderbuffer(a.FRAMEBUFFER,a.DEPTH_STENCIL_ATTACHMENT,a.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class of{constructor(e,a,u,p,m){this.context=e,this.width=a,this.height=u;const k=e.gl,E=this.framebuffer=k.createFramebuffer();if(this.colorAttachment=new Sc(e,E),p)this.depthAttachment=m?new Ec(e,E):new Ds(e,E);else if(m)throw new Error("Stencil cannot be set without depth");if(k.checkFramebufferStatus(k.FRAMEBUFFER)!==k.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer is not complete")}destroy(){const e=this.context.gl,a=this.colorAttachment.get();if(a&&e.deleteTexture(a),this.depthAttachment){const u=this.depthAttachment.get();u&&e.deleteRenderbuffer(u)}e.deleteFramebuffer(this.framebuffer)}}class Mi{constructor(e,a,u){this.blendFunction=e,this.blendColor=a,this.mask=u}}Mi.Replace=[1,0],Mi.disabled=new Mi(Mi.Replace,h.aM.transparent,[!1,!1,!1,!1]),Mi.unblended=new Mi(Mi.Replace,h.aM.transparent,[!0,!0,!0,!0]),Mi.alphaBlended=new Mi([1,771],h.aM.transparent,[!0,!0,!0,!0]);class af{constructor(e){var a,u;if(this.gl=e,this.clearColor=new Qa(this),this.clearDepth=new Jp(this),this.clearStencil=new ro(this),this.colorMask=new Qp(this),this.depthMask=new xu(this),this.stencilMask=new ef(this),this.stencilFunc=new bu(this),this.stencilOp=new xc(this),this.stencilTest=new vu(this),this.depthRange=new wu(this),this.depthTest=new ku(this),this.depthFunc=new Su(this),this.blend=new As(this),this.blendFunc=new Eu(this),this.blendColor=new tf(this),this.blendEquation=new Tu(this),this.cullFace=new ia(this),this.cullFaceSide=new nf(this),this.frontFace=new el(this),this.program=new rf(this),this.activeTexture=new sf(this),this.viewport=new Cu(this),this.bindFramebuffer=new Mu(this),this.bindRenderbuffer=new Pu(this),this.bindTexture=new bc(this),this.bindVertexBuffer=new Iu(this),this.bindElementBuffer=new tl(this),this.bindVertexArray=new Ur(this),this.pixelStoreUnpack=new vc(this),this.pixelStoreUnpackPremultiplyAlpha=new wc(this),this.pixelStoreUnpackFlipY=new kc(this),this.extTextureFilterAnisotropic=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=e.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE),os(e)){this.HALF_FLOAT=e.HALF_FLOAT;const p=e.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(a=e.RGBA16F)!==null&&a!==void 0?a:p==null?void 0:p.RGBA16F_EXT,this.RGB16F=(u=e.RGB16F)!==null&&u!==void 0?u:p==null?void 0:p.RGB16F_EXT,e.getExtension("EXT_color_buffer_float")}else{e.getExtension("EXT_color_buffer_half_float"),e.getExtension("OES_texture_half_float_linear");const p=e.getExtension("OES_texture_half_float");this.HALF_FLOAT=p==null?void 0:p.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(e,a){return new Pr(this,e,a)}createVertexBuffer(e,a,u){return new _c(this,e,a,u)}createRenderbuffer(e,a,u){const p=this.gl,m=p.createRenderbuffer();return this.bindRenderbuffer.set(m),p.renderbufferStorage(p.RENDERBUFFER,e,a,u),this.bindRenderbuffer.set(null),m}createFramebuffer(e,a,u,p){return new of(this,e,a,u,p)}clear({color:e,depth:a,stencil:u}){const p=this.gl;let m=0;e&&(m|=p.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),a!==void 0&&(m|=p.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(a),this.depthMask.set(!0)),u!==void 0&&(m|=p.STENCIL_BUFFER_BIT,this.clearStencil.set(u),this.stencilMask.set(255)),p.clear(m)}setCullFace(e){e.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(e.mode),this.frontFace.set(e.frontFace))}setDepthMode(e){e.func!==this.gl.ALWAYS||e.mask?(this.depthTest.set(!0),this.depthFunc.set(e.func),this.depthMask.set(e.mask),this.depthRange.set(e.range)):this.depthTest.set(!1)}setStencilMode(e){e.test.func!==this.gl.ALWAYS||e.mask?(this.stencilTest.set(!0),this.stencilMask.set(e.mask),this.stencilOp.set([e.fail,e.depthFail,e.pass]),this.stencilFunc.set({func:e.test.func,ref:e.ref,mask:e.test.mask})):this.stencilTest.set(!1)}setColorMode(e){h.aE(e.blendFunction,Mi.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(e.blendFunction),this.blendColor.set(e.blendColor)),this.colorMask.set(e.mask)}createVertexArray(){var e;return os(this.gl)?this.gl.createVertexArray():(e=this.gl.getExtension("OES_vertex_array_object"))===null||e===void 0?void 0:e.createVertexArrayOES()}deleteVertexArray(e){var a;return os(this.gl)?this.gl.deleteVertexArray(e):(a=this.gl.getExtension("OES_vertex_array_object"))===null||a===void 0?void 0:a.deleteVertexArrayOES(e)}unbindVAO(){this.bindVertexArray.set(null)}}class At{constructor(e,a,u){this.func=e,this.mask=a,this.range=u}}At.ReadOnly=!1,At.ReadWrite=!0,At.disabled=new At(519,At.ReadOnly,[0,1]);const nl=7680;class di{constructor(e,a,u,p,m,k){this.test=e,this.ref=a,this.mask=u,this.fail=p,this.depthFail=m,this.pass=k}}di.disabled=new di({func:519,mask:0},0,0,nl,nl,nl);class oi{constructor(e,a,u){this.enable=e,this.mode=a,this.frontFace=u}}let zs;function na(g,e,a,u,p){const m=g.context,k=m.gl,E=g.useProgram("collisionBox"),T=[];let I=0,O=0;for(let re=0;re<u.length;re++){const ae=u[re],X=e.getTile(ae).getBucket(a);if(!X)continue;const ue=p?X.textCollisionBox:X.iconCollisionBox,pe=X.collisionCircleArray;if(pe.length>0){const xe=h.H();h.aQ(xe,X.placementInvProjMatrix,g.transform.glCoordMatrix),h.aQ(xe,xe,X.placementViewportMatrix),T.push({circleArray:pe,circleOffset:O,transform:ae.posMatrix,invTransform:xe,coord:ae}),I+=pe.length/4,O=I}ue&&E.draw(m,k.LINES,At.disabled,di.disabled,g.colorModeForRenderPass(),oi.disabled,{u_matrix:ae.posMatrix,u_pixel_extrude_scale:[1/(B=g.transform).width,1/B.height]},g.style.map.terrain&&g.style.map.terrain.getTerrainData(ae),a.id,ue.layoutVertexBuffer,ue.indexBuffer,ue.segments,null,g.transform.zoom,null,null,ue.collisionVertexBuffer)}var B;if(!p||!T.length)return;const U=g.useProgram("collisionCircle"),Z=new h.aR;Z.resize(4*I),Z._trim();let G=0;for(const re of T)for(let ae=0;ae<re.circleArray.length/4;ae++){const X=4*ae,ue=re.circleArray[X+0],pe=re.circleArray[X+1],xe=re.circleArray[X+2],Ce=re.circleArray[X+3];Z.emplace(G++,ue,pe,xe,Ce,0),Z.emplace(G++,ue,pe,xe,Ce,1),Z.emplace(G++,ue,pe,xe,Ce,2),Z.emplace(G++,ue,pe,xe,Ce,3)}(!zs||zs.length<2*I)&&(zs=function(re){const ae=2*re,X=new h.aT;X.resize(ae),X._trim();for(let ue=0;ue<ae;ue++){const pe=6*ue;X.uint16[pe+0]=4*ue+0,X.uint16[pe+1]=4*ue+1,X.uint16[pe+2]=4*ue+2,X.uint16[pe+3]=4*ue+2,X.uint16[pe+4]=4*ue+3,X.uint16[pe+5]=4*ue+0}return X}(I));const Q=m.createIndexBuffer(zs,!0),ne=m.createVertexBuffer(Z,h.aS.members,!0);for(const re of T){const ae=Ps(re.transform,re.invTransform,g.transform);U.draw(m,k.TRIANGLES,At.disabled,di.disabled,g.colorModeForRenderPass(),oi.disabled,ae,g.style.map.terrain&&g.style.map.terrain.getTerrainData(re.coord),a.id,ne,Q,h.a0.simpleSegment(0,2*re.circleOffset,re.circleArray.length,re.circleArray.length/2),null,g.transform.zoom,null,null,null)}ne.destroy(),Q.destroy()}oi.disabled=new oi(!1,1029,2305),oi.backCCW=new oi(!0,1029,2305);const ra=h.an(new Float32Array(16));function Tc(g,e,a,u,p,m){const{horizontalAlign:k,verticalAlign:E}=h.au(g);return new h.P((-(k-.5)*e/p+u[0])*m,(-(E-.5)*a/p+u[1])*m)}function Ls(g,e,a,u,p,m){const k=e.tileAnchorPoint.add(new h.P(e.translation[0],e.translation[1]));if(e.pitchWithMap){let E=u.mult(m);a||(E=E.rotate(-p));const T=k.add(E);return te(T.x,T.y,e.labelPlaneMatrix,e.getElevation).point}if(a){const E=ke(e.tileAnchorPoint.x+1,e.tileAnchorPoint.y,e).point.sub(g),T=Math.atan(E.y/E.x)+(E.x<0?Math.PI:0);return g.add(u.rotate(T))}return g.add(u)}function so(g,e,a,u,p,m,k,E,T,I,O,B,U,Z){const G=g.text.placedSymbolArray,Q=g.text.dynamicLayoutVertexArray,ne=g.icon.dynamicLayoutVertexArray,re={};Q.clear();for(let ae=0;ae<G.length;ae++){const X=G.get(ae),ue=X.hidden||!X.crossTileID||g.allowVerticalPlacement&&!X.placedOrientation?null:u[X.crossTileID];if(ue){const pe=new h.P(X.anchorX,X.anchorY),xe={getElevation:Z,width:p.width,height:p.height,labelPlaneMatrix:m,lineVertexArray:null,pitchWithMap:a,projection:O,projectionCache:null,tileAnchorPoint:pe,translation:B,unwrappedTileID:U},Ce=a?te(pe.x,pe.y,k,Z):ke(pe.x,pe.y,xe),Ae=$(p.cameraToCenterDistance,Ce.signedDistanceFromCamera);let $e=h.ai(g.textSizeData,T,X)*Ae/h.ap;a&&($e*=g.tilePixelRatio/E);const{width:We,height:Oe,anchor:Re,textOffset:et,textBoxScale:bt}=ue,Fe=Tc(Re,We,Oe,et,bt,$e),Ue=O.getPitchedTextCorrection(p,pe.add(new h.P(B[0],B[1])),U),yt=Ls(Ce.point,xe,e,Fe,p.angle,Ue),gi=g.allowVerticalPlacement&&X.placedOrientation===h.ah.vertical?Math.PI/2:0;for(let Ct=0;Ct<X.numGlyphs;Ct++)h.aj(Q,yt,gi);I&&X.associatedIconIndex>=0&&(re[X.associatedIconIndex]={shiftedAnchor:yt,angle:gi})}else ct(X.numGlyphs,Q)}if(I){ne.clear();const ae=g.icon.placedSymbolArray;for(let X=0;X<ae.length;X++){const ue=ae.get(X);if(ue.hidden)ct(ue.numGlyphs,ne);else{const pe=re[X];if(pe)for(let xe=0;xe<ue.numGlyphs;xe++)h.aj(ne,pe.shiftedAnchor,pe.angle);else ct(ue.numGlyphs,ne)}}g.icon.dynamicLayoutVertexBuffer.updateData(ne)}g.text.dynamicLayoutVertexBuffer.updateData(Q)}function Wn(g,e,a){return a.iconsInText&&e?"symbolTextAndIcon":g?"symbolSDF":"symbolIcon"}function Cc(g,e,a,u,p,m,k,E,T,I,O,B){const U=g.context,Z=U.gl,G=g.transform,Q=Cs(),ne=E==="map",re=T==="map",ae=E!=="viewport"&&a.layout.get("symbol-placement")!=="point",X=ne&&!re&&!ae,ue=!re&&ae,pe=!a.layout.get("symbol-sort-key").isConstant();let xe=!1;const Ce=g.depthModeForSublayer(0,At.ReadOnly),Ae=a._unevaluatedLayout.hasValue("text-variable-anchor")||a._unevaluatedLayout.hasValue("text-variable-anchor-offset"),$e=[],We=Q.getCircleRadiusCorrection(G);for(const Oe of u){const Re=e.getTile(Oe),et=Re.getBucket(a);if(!et)continue;const bt=p?et.text:et.icon;if(!bt||!bt.segments.get().length||!bt.hasVisibleVertices)continue;const Fe=bt.programConfigurations.get(a.id),Ue=p||et.sdfIcons,yt=p?et.textSizeData:et.iconSizeData,gi=re||G.pitch!==0,Ct=g.useProgram(Wn(Ue,p,et),Fe),Ot=h.ag(yt,G.zoom),yi=g.style.map.terrain&&g.style.map.terrain.getTerrainData(Oe);let Qi,hr,_i,vn,un=[0,0],en=null;if(p)hr=Re.glyphAtlasTexture,_i=Z.LINEAR,Qi=Re.glyphAtlasTexture.size,et.iconsInText&&(un=Re.imageAtlasTexture.size,en=Re.imageAtlasTexture,vn=gi||g.options.rotating||g.options.zooming||yt.kind==="composite"||yt.kind==="camera"?Z.LINEAR:Z.NEAREST);else{const Ft=a.layout.get("icon-size").constantOr(0)!==1||et.iconsNeedLinear;hr=Re.imageAtlasTexture,_i=Ue||g.options.rotating||g.options.zooming||Ft||gi?Z.LINEAR:Z.NEAREST,Qi=Re.imageAtlasTexture.size}const dn=Rt(Re,1,g.transform.zoom),Dr=ue?Oe.posMatrix:ra,wo=rs(Dr,re,ne,g.transform,dn),wl=Mr(Dr,re,ne,g.transform,dn),ko=Mr(Oe.posMatrix,re,ne,g.transform,dn),Xn=Q.translatePosition(g.transform,Re,m,k),kl=Ae&&et.hasTextData(),Jc=a.layout.get("icon-text-fit")!=="none"&&kl&&et.hasIconData();if(ae){const Ft=g.style.map.terrain?(So,Eo)=>g.style.map.terrain.getElevation(Oe,So,Eo):null,Ns=a.layout.get("text-rotation-alignment")==="map";W(et,Oe.posMatrix,g,p,wo,ko,re,I,Ns,Q,Oe.toUnwrapped(),G.width,G.height,Xn,Ft)}const Kn=Oe.posMatrix,Jn=p&&Ae||Jc,as=ae||Jn?ra:wo,ur=wl,Gi=Ue&&a.paint.get(p?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let tn;tn=Ue?et.iconsInText?mc(yt.kind,Ot,X,re,ae,Jn,g,Kn,as,ur,Xn,Qi,un,We):ta(yt.kind,Ot,X,re,ae,Jn,g,Kn,as,ur,Xn,p,Qi,!0,We):_u(yt.kind,Ot,X,re,ae,Jn,g,Kn,as,ur,Xn,p,Qi,We);const On={program:Ct,buffers:bt,uniformValues:tn,atlasTexture:hr,atlasTextureIcon:en,atlasInterpolation:_i,atlasInterpolationIcon:vn,isSDF:Ue,hasHalo:Gi};if(pe&&et.canOverlap){xe=!0;const Ft=bt.segments.get();for(const Ns of Ft)$e.push({segments:new h.a0([Ns]),sortKey:Ns.sortKey,state:On,terrainData:yi})}else $e.push({segments:bt.segments,sortKey:0,state:On,terrainData:yi})}xe&&$e.sort((Oe,Re)=>Oe.sortKey-Re.sortKey);for(const Oe of $e){const Re=Oe.state;if(U.activeTexture.set(Z.TEXTURE0),Re.atlasTexture.bind(Re.atlasInterpolation,Z.CLAMP_TO_EDGE),Re.atlasTextureIcon&&(U.activeTexture.set(Z.TEXTURE1),Re.atlasTextureIcon&&Re.atlasTextureIcon.bind(Re.atlasInterpolationIcon,Z.CLAMP_TO_EDGE)),Re.isSDF){const et=Re.uniformValues;Re.hasHalo&&(et.u_is_halo=1,Mc(Re.buffers,Oe.segments,a,g,Re.program,Ce,O,B,et,Oe.terrainData)),et.u_is_halo=0}Mc(Re.buffers,Oe.segments,a,g,Re.program,Ce,O,B,Re.uniformValues,Oe.terrainData)}}function Mc(g,e,a,u,p,m,k,E,T,I){const O=u.context;p.draw(O,O.gl.TRIANGLES,m,k,E,oi.disabled,T,I,a.id,g.layoutVertexBuffer,g.indexBuffer,e,a.paint,u.transform.zoom,g.programConfigurations.get(a.id),g.dynamicLayoutVertexBuffer,g.opacityVertexBuffer)}function Pc(g,e,a,u){const p=g.context,m=p.gl,k=di.disabled,E=new Mi([m.ONE,m.ONE],h.aM.transparent,[!0,!0,!0,!0]),T=e.getBucket(a);if(!T)return;const I=u.key;let O=a.heatmapFbos.get(I);O||(O=sa(p,e.tileSize,e.tileSize),a.heatmapFbos.set(I,O)),p.bindFramebuffer.set(O.framebuffer),p.viewport.set([0,0,e.tileSize,e.tileSize]),p.clear({color:h.aM.transparent});const B=T.programConfigurations.get(a.id),U=g.useProgram("heatmap",B),Z=g.style.map.terrain.getTerrainData(u);U.draw(p,m.TRIANGLES,At.disabled,k,E,oi.disabled,bn(u.posMatrix,e,g.transform.zoom,a.paint.get("heatmap-intensity")),Z,a.id,T.layoutVertexBuffer,T.indexBuffer,T.segments,a.paint,g.transform.zoom,B)}function Rs(g,e,a){const u=g.context,p=u.gl;u.setColorMode(g.colorModeForRenderPass());const m=oa(u,e),k=a.key,E=e.heatmapFbos.get(k);E&&(u.activeTexture.set(p.TEXTURE0),p.bindTexture(p.TEXTURE_2D,E.colorAttachment.get()),u.activeTexture.set(p.TEXTURE1),m.bind(p.LINEAR,p.CLAMP_TO_EDGE),g.useProgram("heatmapTexture").draw(u,p.TRIANGLES,At.disabled,di.disabled,g.colorModeForRenderPass(),oi.disabled,Ya(g,e,0,1),null,e.id,g.rasterBoundsBuffer,g.quadTriangleIndexBuffer,g.rasterBoundsSegments,e.paint,g.transform.zoom),E.destroy(),e.heatmapFbos.delete(k))}function sa(g,e,a){var u,p;const m=g.gl,k=m.createTexture();m.bindTexture(m.TEXTURE_2D,k),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_S,m.CLAMP_TO_EDGE),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_T,m.CLAMP_TO_EDGE),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MIN_FILTER,m.LINEAR),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MAG_FILTER,m.LINEAR);const E=(u=g.HALF_FLOAT)!==null&&u!==void 0?u:m.UNSIGNED_BYTE,T=(p=g.RGBA16F)!==null&&p!==void 0?p:m.RGBA;m.texImage2D(m.TEXTURE_2D,0,T,e,a,0,m.RGBA,E,null);const I=g.createFramebuffer(e,a,!1,!1);return I.colorAttachment.set(k),I}function oa(g,e){return e.colorRampTexture||(e.colorRampTexture=new Et(g,e.colorRamp,g.gl.RGBA)),e.colorRampTexture}function oo(g,e,a,u,p){if(!a||!u||!u.imageAtlas)return;const m=u.imageAtlas.patternPositions;let k=m[a.to.toString()],E=m[a.from.toString()];if(!k&&E&&(k=E),!E&&k&&(E=k),!k||!E){const T=p.getPaintProperty(e);k=m[T],E=m[T]}k&&E&&g.setConstantPatternPositions(k,E)}function aa(g,e,a,u,p,m,k){const E=g.context.gl,T="fill-pattern",I=a.paint.get(T),O=I&&I.constantOr(1),B=a.getCrossfadeParameters();let U,Z,G,Q,ne;k?(Z=O&&!a.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",U=E.LINES):(Z=O?"fillPattern":"fill",U=E.TRIANGLES);const re=I.constantOr(null);for(const ae of u){const X=e.getTile(ae);if(O&&!X.patternsLoaded())continue;const ue=X.getBucket(a);if(!ue)continue;const pe=ue.programConfigurations.get(a.id),xe=g.useProgram(Z,pe),Ce=g.style.map.terrain&&g.style.map.terrain.getTerrainData(ae);O&&(g.context.activeTexture.set(E.TEXTURE0),X.imageAtlasTexture.bind(E.LINEAR,E.CLAMP_TO_EDGE),pe.updatePaintBuffers(B)),oo(pe,T,re,X,a);const Ae=Ce?ae:null,$e=g.translatePosMatrix(Ae?Ae.posMatrix:ae.posMatrix,X,a.paint.get("fill-translate"),a.paint.get("fill-translate-anchor"));if(k){Q=ue.indexBuffer2,ne=ue.segments2;const We=[E.drawingBufferWidth,E.drawingBufferHeight];G=Z==="fillOutlinePattern"&&O?fu($e,g,B,X,We):Zp($e,We)}else Q=ue.indexBuffer,ne=ue.segments,G=O?pu($e,g,B,X):io($e);xe.draw(g.context,U,p,g.stencilModeForClipping(ae),m,oi.disabled,G,Ce,a.id,ue.layoutVertexBuffer,Q,ne,a.paint,g.transform.zoom,pe)}}function rl(g,e,a,u,p,m,k){const E=g.context,T=E.gl,I="fill-extrusion-pattern",O=a.paint.get(I),B=O.constantOr(1),U=a.getCrossfadeParameters(),Z=a.paint.get("fill-extrusion-opacity"),G=O.constantOr(null);for(const Q of u){const ne=e.getTile(Q),re=ne.getBucket(a);if(!re)continue;const ae=g.style.map.terrain&&g.style.map.terrain.getTerrainData(Q),X=re.programConfigurations.get(a.id),ue=g.useProgram(B?"fillExtrusionPattern":"fillExtrusion",X);B&&(g.context.activeTexture.set(T.TEXTURE0),ne.imageAtlasTexture.bind(T.LINEAR,T.CLAMP_TO_EDGE),X.updatePaintBuffers(U)),oo(X,I,G,ne,a);const pe=g.translatePosMatrix(Q.posMatrix,ne,a.paint.get("fill-extrusion-translate"),a.paint.get("fill-extrusion-translate-anchor")),xe=a.paint.get("fill-extrusion-vertical-gradient"),Ce=B?Ga(pe,g,xe,Z,Q,U,ne):Qo(pe,g,xe,Z);ue.draw(E,E.gl.TRIANGLES,p,m,k,oi.backCCW,Ce,ae,a.id,re.layoutVertexBuffer,re.indexBuffer,re.segments,a.paint,g.transform.zoom,X,g.style.map.terrain&&re.centroidVertexBuffer)}}function ao(g,e,a,u,p,m,k){const E=g.context,T=E.gl,I=a.fbo;if(!I)return;const O=g.useProgram("hillshade"),B=g.style.map.terrain&&g.style.map.terrain.getTerrainData(e);E.activeTexture.set(T.TEXTURE0),T.bindTexture(T.TEXTURE_2D,I.colorAttachment.get()),O.draw(E,T.TRIANGLES,p,m,k,oi.disabled,((U,Z,G,Q)=>{const ne=G.paint.get("hillshade-shadow-color"),re=G.paint.get("hillshade-highlight-color"),ae=G.paint.get("hillshade-accent-color");let X=G.paint.get("hillshade-illumination-direction")*(Math.PI/180);G.paint.get("hillshade-illumination-anchor")==="viewport"&&(X-=U.transform.angle);const ue=!U.options.moving;return{u_matrix:Q?Q.posMatrix:U.transform.calculatePosMatrix(Z.tileID.toUnwrapped(),ue),u_image:0,u_latrange:Xa(0,Z.tileID),u_light:[G.paint.get("hillshade-exaggeration"),X],u_shadow:ne,u_highlight:re,u_accent:ae}})(g,a,u,B?e:null),B,u.id,g.rasterBoundsBuffer,g.quadTriangleIndexBuffer,g.rasterBoundsSegments)}function lo(g,e,a,u,p,m){const k=g.context,E=k.gl,T=e.dem;if(T&&T.data){const I=T.dim,O=T.stride,B=T.getPixels();if(k.activeTexture.set(E.TEXTURE1),k.pixelStoreUnpackPremultiplyAlpha.set(!1),e.demTexture=e.demTexture||g.getTileTexture(O),e.demTexture){const Z=e.demTexture;Z.update(B,{premultiply:!1}),Z.bind(E.NEAREST,E.CLAMP_TO_EDGE)}else e.demTexture=new Et(k,B,E.RGBA,{premultiply:!1}),e.demTexture.bind(E.NEAREST,E.CLAMP_TO_EDGE);k.activeTexture.set(E.TEXTURE0);let U=e.fbo;if(!U){const Z=new Et(k,{width:I,height:I,data:null},E.RGBA);Z.bind(E.LINEAR,E.CLAMP_TO_EDGE),U=e.fbo=k.createFramebuffer(I,I,!0,!1),U.colorAttachment.set(Z.texture)}k.bindFramebuffer.set(U.framebuffer),k.viewport.set([0,0,I,I]),g.useProgram("hillshadePrepare").draw(k,E.TRIANGLES,u,p,m,oi.disabled,((Z,G)=>{const Q=G.stride,ne=h.H();return h.aP(ne,0,h.X,-h.X,0,0,1),h.J(ne,ne,[0,-h.X,0]),{u_matrix:ne,u_image:1,u_dimension:[Q,Q],u_zoom:Z.overscaledZ,u_unpack:G.getUnpackVector()}})(e.tileID,T),null,a.id,g.rasterBoundsBuffer,g.quadTriangleIndexBuffer,g.rasterBoundsSegments),e.needsHillshadePrepare=!1}}function Au(g,e,a,u,p,m){const k=u.paint.get("raster-fade-duration");if(!m&&k>0){const E=z.now(),T=(E-g.timeAdded)/k,I=e?(E-e.timeAdded)/k:-1,O=a.getSource(),B=p.coveringZoomLevel({tileSize:O.tileSize,roundZoom:O.roundZoom}),U=!e||Math.abs(e.tileID.overscaledZ-B)>Math.abs(g.tileID.overscaledZ-B),Z=U&&g.refreshedUponExpiration?1:h.ac(U?T:1-I,0,1);return g.refreshedUponExpiration&&T>=1&&(g.refreshedUponExpiration=!1),e?{opacity:1,mix:1-Z}:{opacity:Z,mix:0}}return{opacity:1,mix:0}}const Ic=new h.aM(1,0,0,1),Ht=new h.aM(0,1,0,1),sl=new h.aM(0,0,1,1),lf=new h.aM(1,0,1,1),Du=new h.aM(0,1,1,1);function co(g,e,a,u){ol(g,0,e+a/2,g.transform.width,a,u)}function zu(g,e,a,u){ol(g,e-a/2,0,a,g.transform.height,u)}function ol(g,e,a,u,p,m){const k=g.context,E=k.gl;E.enable(E.SCISSOR_TEST),E.scissor(e*g.pixelRatio,a*g.pixelRatio,u*g.pixelRatio,p*g.pixelRatio),k.clear({color:m}),E.disable(E.SCISSOR_TEST)}function Lu(g,e,a){const u=g.context,p=u.gl,m=a.posMatrix,k=g.useProgram("debug"),E=At.disabled,T=di.disabled,I=g.colorModeForRenderPass(),O="$debug",B=g.style.map.terrain&&g.style.map.terrain.getTerrainData(a);u.activeTexture.set(p.TEXTURE0);const U=e.getTileByID(a.key).latestRawTileData,Z=Math.floor((U&&U.byteLength||0)/1024),G=e.getTile(a).tileSize,Q=512/Math.min(G,512)*(a.overscaledZ/g.transform.zoom)*.5;let ne=a.canonical.toString();a.overscaledZ!==a.canonical.z&&(ne+=` => ${a.overscaledZ}`),function(re,ae){re.initDebugOverlayCanvas();const X=re.debugOverlayCanvas,ue=re.context.gl,pe=re.debugOverlayCanvas.getContext("2d");pe.clearRect(0,0,X.width,X.height),pe.shadowColor="white",pe.shadowBlur=2,pe.lineWidth=1.5,pe.strokeStyle="white",pe.textBaseline="top",pe.font="bold 36px Open Sans, sans-serif",pe.fillText(ae,5,5),pe.strokeText(ae,5,5),re.debugOverlayTexture.update(X),re.debugOverlayTexture.bind(ue.LINEAR,ue.CLAMP_TO_EDGE)}(g,`${ne} ${Z}kB`),k.draw(u,p.TRIANGLES,E,T,Mi.alphaBlended,oi.disabled,ea(m,h.aM.transparent,Q),null,O,g.debugBuffer,g.quadTriangleIndexBuffer,g.debugSegments),k.draw(u,p.LINE_STRIP,E,T,I,oi.disabled,ea(m,h.aM.red),B,O,g.debugBuffer,g.tileBorderIndexBuffer,g.debugSegments)}function Ru(g,e,a){const u=g.context,p=u.gl,m=g.colorModeForRenderPass(),k=new At(p.LEQUAL,At.ReadWrite,g.depthRangeFor3D),E=g.useProgram("terrain"),T=e.getTerrainMesh();u.bindFramebuffer.set(null),u.viewport.set([0,0,g.width,g.height]);for(const I of a){const O=g.renderToTexture.getTexture(I),B=e.getTerrainData(I.tileID);u.activeTexture.set(p.TEXTURE0),p.bindTexture(p.TEXTURE_2D,O.texture);const U=g.transform.calculatePosMatrix(I.tileID.toUnwrapped()),Z=e.getMeshFrameDelta(g.transform.zoom),G=g.transform.calculateFogMatrix(I.tileID.toUnwrapped()),Q=pc(U,Z,G,g.style.sky,g.transform.pitch);E.draw(u,p.TRIANGLES,k,di.disabled,m,oi.backCCW,Q,B,"terrain",T.vertexBuffer,T.indexBuffer,T.segments)}}class al{constructor(e,a,u){this.vertexBuffer=e,this.indexBuffer=a,this.segments=u}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}class ll{constructor(e,a){this.context=new af(e),this.transform=a,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:h.an(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=ft.maxUnderzooming+ft.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new uc}resize(e,a,u){if(this.width=Math.floor(e*u),this.height=Math.floor(a*u),this.pixelRatio=u,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const p of this.style._order)this.style._layers[p].resize()}setup(){const e=this.context,a=new h.aX;a.emplaceBack(0,0),a.emplaceBack(h.X,0),a.emplaceBack(0,h.X),a.emplaceBack(h.X,h.X),this.tileExtentBuffer=e.createVertexBuffer(a,Ms.members),this.tileExtentSegments=h.a0.simpleSegment(0,0,4,2);const u=new h.aX;u.emplaceBack(0,0),u.emplaceBack(h.X,0),u.emplaceBack(0,h.X),u.emplaceBack(h.X,h.X),this.debugBuffer=e.createVertexBuffer(u,Ms.members),this.debugSegments=h.a0.simpleSegment(0,0,4,5);const p=new h.$;p.emplaceBack(0,0,0,0),p.emplaceBack(h.X,0,h.X,0),p.emplaceBack(0,h.X,0,h.X),p.emplaceBack(h.X,h.X,h.X,h.X),this.rasterBoundsBuffer=e.createVertexBuffer(p,is.members),this.rasterBoundsSegments=h.a0.simpleSegment(0,0,4,2);const m=new h.aX;m.emplaceBack(0,0),m.emplaceBack(1,0),m.emplaceBack(0,1),m.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(m,Ms.members),this.viewportSegments=h.a0.simpleSegment(0,0,4,2);const k=new h.aZ;k.emplaceBack(0),k.emplaceBack(1),k.emplaceBack(3),k.emplaceBack(2),k.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(k);const E=new h.aY;E.emplaceBack(0,1,2),E.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(E);const T=this.context.gl;this.stencilClearMode=new di({func:T.ALWAYS,mask:0},0,255,T.ZERO,T.ZERO,T.ZERO)}clearStencil(){const e=this.context,a=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const u=h.H();h.aP(u,0,this.width,this.height,0,0,1),h.K(u,u,[a.drawingBufferWidth,a.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(e,a.TRIANGLES,At.disabled,this.stencilClearMode,Mi.disabled,oi.disabled,xn(u),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(e,a){if(this.currentStencilSource===e.source||!e.isTileClipped()||!a||!a.length)return;this.currentStencilSource=e.source;const u=this.context,p=u.gl;this.nextStencilID+a.length>256&&this.clearStencil(),u.setColorMode(Mi.disabled),u.setDepthMode(At.disabled);const m=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const k of a){const E=this._tileClippingMaskIDs[k.key]=this.nextStencilID++,T=this.style.map.terrain&&this.style.map.terrain.getTerrainData(k);m.draw(u,p.TRIANGLES,At.disabled,new di({func:p.ALWAYS,mask:0},E,255,p.KEEP,p.KEEP,p.REPLACE),Mi.disabled,oi.disabled,xn(k.posMatrix),T,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const e=this.nextStencilID++,a=this.context.gl;return new di({func:a.NOTEQUAL,mask:255},e,255,a.KEEP,a.KEEP,a.REPLACE)}stencilModeForClipping(e){const a=this.context.gl;return new di({func:a.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,a.KEEP,a.KEEP,a.REPLACE)}stencilConfigForOverlap(e){const a=this.context.gl,u=e.sort((k,E)=>E.overscaledZ-k.overscaledZ),p=u[u.length-1].overscaledZ,m=u[0].overscaledZ-p+1;if(m>1){this.currentStencilSource=void 0,this.nextStencilID+m>256&&this.clearStencil();const k={};for(let E=0;E<m;E++)k[E+p]=new di({func:a.GEQUAL,mask:255},E+this.nextStencilID,255,a.KEEP,a.KEEP,a.REPLACE);return this.nextStencilID+=m,[k,u]}return[{[p]:di.disabled},u]}colorModeForRenderPass(){const e=this.context.gl;return this._showOverdrawInspector?new Mi([e.CONSTANT_COLOR,e.ONE],new h.aM(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Mi.unblended:Mi.alphaBlended}depthModeForSublayer(e,a,u){if(!this.opaquePassEnabledForLayer())return At.disabled;const p=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new At(u||this.context.gl.LEQUAL,a,[p,p])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(e,a){this.style=e,this.options=a,this.lineAtlas=e.lineAtlas,this.imageManager=e.imageManager,this.glyphManager=e.glyphManager,this.symbolFadeChange=e.placement.symbolFadeChange(z.now()),this.imageManager.beginFrame();const u=this.style._order,p=this.style.sourceCaches,m={},k={},E={};for(const T in p){const I=p[T];I.used&&I.prepare(this.context),m[T]=I.getVisibleCoordinates(),k[T]=m[T].slice().reverse(),E[T]=I.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let T=0;T<u.length;T++)if(this.style._layers[u[T]].is3D()){this.opaquePassCutoff=T;break}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const T of u){const I=this.style._layers[T];if(!I.hasOffscreenPass()||I.isHidden(this.transform.zoom))continue;const O=k[I.source];(I.type==="custom"||O.length)&&this.renderLayer(this,p[I.source],I,O)}if(this.context.bindFramebuffer.set(null),this.context.clear({color:a.showOverdrawInspector?h.aM.black:h.aM.transparent,depth:1}),this.clearStencil(),this.style.sky&&function(T,I){const O=T.context,B=O.gl,U=((re,ae,X)=>({u_sky_color:re.properties.get("sky-color"),u_horizon_color:re.properties.get("horizon-color"),u_horizon:(ae.height/2+ae.getHorizon())*X,u_sky_horizon_blend:re.properties.get("sky-horizon-blend")*ae.height/2*X}))(I,T.style.map.transform,T.pixelRatio),Z=new At(B.LEQUAL,At.ReadWrite,[0,1]),G=di.disabled,Q=T.colorModeForRenderPass(),ne=T.useProgram("sky");if(!I.mesh){const re=new h.aX;re.emplaceBack(-1,-1),re.emplaceBack(1,-1),re.emplaceBack(1,1),re.emplaceBack(-1,1);const ae=new h.aY;ae.emplaceBack(0,1,2),ae.emplaceBack(0,2,3),I.mesh=new al(O.createVertexBuffer(re,Ms.members),O.createIndexBuffer(ae),h.a0.simpleSegment(0,0,re.length,ae.length))}ne.draw(O,B.TRIANGLES,Z,G,Q,oi.disabled,U,void 0,"sky",I.mesh.vertexBuffer,I.mesh.indexBuffer,I.mesh.segments)}(this,this.style.sky),this._showOverdrawInspector=a.showOverdrawInspector,this.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=u.length-1;this.currentLayer>=0;this.currentLayer--){const T=this.style._layers[u[this.currentLayer]],I=p[T.source],O=m[T.source];this._renderTileClippingMasks(T,O),this.renderLayer(this,I,T,O)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<u.length;this.currentLayer++){const T=this.style._layers[u[this.currentLayer]],I=p[T.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(T))continue;const O=(T.type==="symbol"?E:k)[T.source];this._renderTileClippingMasks(T,m[T.source]),this.renderLayer(this,I,T,O)}if(this.options.showTileBoundaries){const T=function(I,O){let B=null;const U=Object.values(I._layers).flatMap(ne=>ne.source&&!ne.isHidden(O)?[I.sourceCaches[ne.source]]:[]),Z=U.filter(ne=>ne.getSource().type==="vector"),G=U.filter(ne=>ne.getSource().type!=="vector"),Q=ne=>{(!B||B.getSource().maxzoom<ne.getSource().maxzoom)&&(B=ne)};return Z.forEach(ne=>Q(ne)),B||G.forEach(ne=>Q(ne)),B}(this.style,this.transform.zoom);T&&function(I,O,B){for(let U=0;U<B.length;U++)Lu(I,O,B[U])}(this,T,T.getVisibleCoordinates())}this.options.showPadding&&function(T){const I=T.transform.padding;co(T,T.transform.height-(I.top||0),3,Ic),co(T,I.bottom||0,3,Ht),zu(T,I.left||0,3,sl),zu(T,T.transform.width-(I.right||0),3,lf);const O=T.transform.centerPoint;(function(B,U,Z,G){ol(B,U-1,Z-10,2,20,G),ol(B,U-10,Z-1,20,2,G)})(T,O.x,T.transform.height-O.y,Du)}(this),this.context.setDefault()}maybeDrawDepthAndCoords(e){if(!this.style||!this.style.map||!this.style.map.terrain)return;const a=this.terrainFacilitator.matrix,u=this.transform.modelViewProjectionMatrix;let p=this.terrainFacilitator.dirty;p||(p=e?!h.a_(a,u):!h.a$(a,u)),p||(p=this.style.map.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime).length>0),p&&(h.b0(a,u),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(m,k){const E=m.context,T=E.gl,I=Mi.unblended,O=new At(T.LEQUAL,At.ReadWrite,[0,1]),B=k.getTerrainMesh(),U=k.sourceCache.getRenderableTiles(),Z=m.useProgram("terrainDepth");E.bindFramebuffer.set(k.getFramebuffer("depth").framebuffer),E.viewport.set([0,0,m.width/devicePixelRatio,m.height/devicePixelRatio]),E.clear({color:h.aM.transparent,depth:1});for(const G of U){const Q=k.getTerrainData(G.tileID),ne={u_matrix:m.transform.calculatePosMatrix(G.tileID.toUnwrapped()),u_ele_delta:k.getMeshFrameDelta(m.transform.zoom)};Z.draw(E,T.TRIANGLES,O,di.disabled,I,oi.backCCW,ne,Q,"terrain",B.vertexBuffer,B.indexBuffer,B.segments)}E.bindFramebuffer.set(null),E.viewport.set([0,0,m.width,m.height])}(this,this.style.map.terrain),function(m,k){const E=m.context,T=E.gl,I=Mi.unblended,O=new At(T.LEQUAL,At.ReadWrite,[0,1]),B=k.getTerrainMesh(),U=k.getCoordsTexture(),Z=k.sourceCache.getRenderableTiles(),G=m.useProgram("terrainCoords");E.bindFramebuffer.set(k.getFramebuffer("coords").framebuffer),E.viewport.set([0,0,m.width/devicePixelRatio,m.height/devicePixelRatio]),E.clear({color:h.aM.transparent,depth:1}),k.coordsIndex=[];for(const Q of Z){const ne=k.getTerrainData(Q.tileID);E.activeTexture.set(T.TEXTURE0),T.bindTexture(T.TEXTURE_2D,U.texture);const re={u_matrix:m.transform.calculatePosMatrix(Q.tileID.toUnwrapped()),u_terrain_coords_id:(255-k.coordsIndex.length)/255,u_texture:0,u_ele_delta:k.getMeshFrameDelta(m.transform.zoom)};G.draw(E,T.TRIANGLES,O,di.disabled,I,oi.backCCW,re,ne,"terrain",B.vertexBuffer,B.indexBuffer,B.segments),k.coordsIndex.push(Q.tileID.key)}E.bindFramebuffer.set(null),E.viewport.set([0,0,m.width,m.height])}(this,this.style.map.terrain))}renderLayer(e,a,u,p){if(!u.isHidden(this.transform.zoom)&&(u.type==="background"||u.type==="custom"||(p||[]).length))switch(this.id=u.id,u.type){case"symbol":(function(m,k,E,T,I){if(m.renderPass!=="translucent")return;const O=di.disabled,B=m.colorModeForRenderPass();(E._unevaluatedLayout.hasValue("text-variable-anchor")||E._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(U,Z,G,Q,ne,re,ae,X,ue){const pe=Z.transform,xe=Cs(),Ce=ne==="map",Ae=re==="map";for(const $e of U){const We=Q.getTile($e),Oe=We.getBucket(G);if(!Oe||!Oe.text||!Oe.text.segments.get().length)continue;const Re=h.ag(Oe.textSizeData,pe.zoom),et=Rt(We,1,Z.transform.zoom),bt=rs($e.posMatrix,Ae,Ce,Z.transform,et),Fe=G.layout.get("icon-text-fit")!=="none"&&Oe.hasIconData();if(Re){const Ue=Math.pow(2,pe.zoom-We.tileID.overscaledZ),yt=Z.style.map.terrain?(Ct,Ot)=>Z.style.map.terrain.getElevation($e,Ct,Ot):null,gi=xe.translatePosition(pe,We,ae,X);so(Oe,Ce,Ae,ue,pe,bt,$e.posMatrix,Ue,Re,Fe,xe,gi,$e.toUnwrapped(),yt)}}}(T,m,E,k,E.layout.get("text-rotation-alignment"),E.layout.get("text-pitch-alignment"),E.paint.get("text-translate"),E.paint.get("text-translate-anchor"),I),E.paint.get("icon-opacity").constantOr(1)!==0&&Cc(m,k,E,T,!1,E.paint.get("icon-translate"),E.paint.get("icon-translate-anchor"),E.layout.get("icon-rotation-alignment"),E.layout.get("icon-pitch-alignment"),E.layout.get("icon-keep-upright"),O,B),E.paint.get("text-opacity").constantOr(1)!==0&&Cc(m,k,E,T,!0,E.paint.get("text-translate"),E.paint.get("text-translate-anchor"),E.layout.get("text-rotation-alignment"),E.layout.get("text-pitch-alignment"),E.layout.get("text-keep-upright"),O,B),k.map.showCollisionBoxes&&(na(m,k,E,T,!0),na(m,k,E,T,!1))})(e,a,u,p,this.style.placement.variableOffsets);break;case"circle":(function(m,k,E,T){if(m.renderPass!=="translucent")return;const I=E.paint.get("circle-opacity"),O=E.paint.get("circle-stroke-width"),B=E.paint.get("circle-stroke-opacity"),U=!E.layout.get("circle-sort-key").isConstant();if(I.constantOr(1)===0&&(O.constantOr(1)===0||B.constantOr(1)===0))return;const Z=m.context,G=Z.gl,Q=m.depthModeForSublayer(0,At.ReadOnly),ne=di.disabled,re=m.colorModeForRenderPass(),ae=[];for(let X=0;X<T.length;X++){const ue=T[X],pe=k.getTile(ue),xe=pe.getBucket(E);if(!xe)continue;const Ce=xe.programConfigurations.get(E.id),Ae=m.useProgram("circle",Ce),$e=xe.layoutVertexBuffer,We=xe.indexBuffer,Oe=m.style.map.terrain&&m.style.map.terrain.getTerrainData(ue),Re={programConfiguration:Ce,program:Ae,layoutVertexBuffer:$e,indexBuffer:We,uniformValues:Wp(m,ue,pe,E),terrainData:Oe};if(U){const et=xe.segments.get();for(const bt of et)ae.push({segments:new h.a0([bt]),sortKey:bt.sortKey,state:Re})}else ae.push({segments:xe.segments,sortKey:0,state:Re})}U&&ae.sort((X,ue)=>X.sortKey-ue.sortKey);for(const X of ae){const{programConfiguration:ue,program:pe,layoutVertexBuffer:xe,indexBuffer:Ce,uniformValues:Ae,terrainData:$e}=X.state;pe.draw(Z,G.TRIANGLES,Q,ne,re,oi.disabled,Ae,$e,E.id,xe,Ce,X.segments,E.paint,m.transform.zoom,ue)}})(e,a,u,p);break;case"heatmap":(function(m,k,E,T){if(E.paint.get("heatmap-opacity")===0)return;const I=m.context;if(m.style.map.terrain){for(const O of T){const B=k.getTile(O);k.hasRenderableParent(O)||(m.renderPass==="offscreen"?Pc(m,B,E,O):m.renderPass==="translucent"&&Rs(m,E,O))}I.viewport.set([0,0,m.width,m.height])}else m.renderPass==="offscreen"?function(O,B,U,Z){const G=O.context,Q=G.gl,ne=di.disabled,re=new Mi([Q.ONE,Q.ONE],h.aM.transparent,[!0,!0,!0,!0]);(function(ae,X,ue){const pe=ae.gl;ae.activeTexture.set(pe.TEXTURE1),ae.viewport.set([0,0,X.width/4,X.height/4]);let xe=ue.heatmapFbos.get(h.aU);xe?(pe.bindTexture(pe.TEXTURE_2D,xe.colorAttachment.get()),ae.bindFramebuffer.set(xe.framebuffer)):(xe=sa(ae,X.width/4,X.height/4),ue.heatmapFbos.set(h.aU,xe))})(G,O,U),G.clear({color:h.aM.transparent});for(let ae=0;ae<Z.length;ae++){const X=Z[ae];if(B.hasRenderableParent(X))continue;const ue=B.getTile(X),pe=ue.getBucket(U);if(!pe)continue;const xe=pe.programConfigurations.get(U.id),Ce=O.useProgram("heatmap",xe),{zoom:Ae}=O.transform;Ce.draw(G,Q.TRIANGLES,At.disabled,ne,re,oi.disabled,bn(X.posMatrix,ue,Ae,U.paint.get("heatmap-intensity")),null,U.id,pe.layoutVertexBuffer,pe.indexBuffer,pe.segments,U.paint,O.transform.zoom,xe)}G.viewport.set([0,0,O.width,O.height])}(m,k,E,T):m.renderPass==="translucent"&&function(O,B){const U=O.context,Z=U.gl;U.setColorMode(O.colorModeForRenderPass());const G=B.heatmapFbos.get(h.aU);G&&(U.activeTexture.set(Z.TEXTURE0),Z.bindTexture(Z.TEXTURE_2D,G.colorAttachment.get()),U.activeTexture.set(Z.TEXTURE1),oa(U,B).bind(Z.LINEAR,Z.CLAMP_TO_EDGE),O.useProgram("heatmapTexture").draw(U,Z.TRIANGLES,At.disabled,di.disabled,O.colorModeForRenderPass(),oi.disabled,Ya(O,B,0,1),null,B.id,O.viewportBuffer,O.quadTriangleIndexBuffer,O.viewportSegments,B.paint,O.transform.zoom))}(m,E)})(e,a,u,p);break;case"line":(function(m,k,E,T){if(m.renderPass!=="translucent")return;const I=E.paint.get("line-opacity"),O=E.paint.get("line-width");if(I.constantOr(1)===0||O.constantOr(1)===0)return;const B=m.depthModeForSublayer(0,At.ReadOnly),U=m.colorModeForRenderPass(),Z=E.paint.get("line-dasharray"),G=E.paint.get("line-pattern"),Q=G.constantOr(1),ne=E.paint.get("line-gradient"),re=E.getCrossfadeParameters(),ae=Q?"linePattern":Z?"lineSDF":ne?"lineGradient":"line",X=m.context,ue=X.gl;let pe=!0;for(const xe of T){const Ce=k.getTile(xe);if(Q&&!Ce.patternsLoaded())continue;const Ae=Ce.getBucket(E);if(!Ae)continue;const $e=Ae.programConfigurations.get(E.id),We=m.context.program.get(),Oe=m.useProgram(ae,$e),Re=pe||Oe.program!==We,et=m.style.map.terrain&&m.style.map.terrain.getTerrainData(xe),bt=G.constantOr(null);if(bt&&Ce.imageAtlas){const yt=Ce.imageAtlas,gi=yt.patternPositions[bt.to.toString()],Ct=yt.patternPositions[bt.from.toString()];gi&&Ct&&$e.setConstantPatternPositions(gi,Ct)}const Fe=et?xe:null,Ue=Q?no(m,Ce,E,re,Fe):Z?Gp(m,Ce,E,Z,re,Fe):ne?mu(m,Ce,E,Ae.lineClipsArray.length,Fe):Ka(m,Ce,E,Fe);if(Q)X.activeTexture.set(ue.TEXTURE0),Ce.imageAtlasTexture.bind(ue.LINEAR,ue.CLAMP_TO_EDGE),$e.updatePaintBuffers(re);else if(Z&&(Re||m.lineAtlas.dirty))X.activeTexture.set(ue.TEXTURE0),m.lineAtlas.bind(X);else if(ne){const yt=Ae.gradients[E.id];let gi=yt.texture;if(E.gradientVersion!==yt.version){let Ct=256;if(E.stepInterpolant){const Ot=k.getSource().maxzoom,yi=xe.canonical.z===Ot?Math.ceil(1<<m.transform.maxZoom-xe.canonical.z):1;Ct=h.ac(h.aV(Ae.maxLineLength/h.X*1024*yi),256,X.maxTextureSize)}yt.gradient=h.aW({expression:E.gradientExpression(),evaluationKey:"lineProgress",resolution:Ct,image:yt.gradient||void 0,clips:Ae.lineClipsArray}),yt.texture?yt.texture.update(yt.gradient):yt.texture=new Et(X,yt.gradient,ue.RGBA),yt.version=E.gradientVersion,gi=yt.texture}X.activeTexture.set(ue.TEXTURE0),gi.bind(E.stepInterpolant?ue.NEAREST:ue.LINEAR,ue.CLAMP_TO_EDGE)}Oe.draw(X,ue.TRIANGLES,B,m.stencilModeForClipping(xe),U,oi.disabled,Ue,et,E.id,Ae.layoutVertexBuffer,Ae.indexBuffer,Ae.segments,E.paint,m.transform.zoom,$e,Ae.layoutVertexBuffer2),pe=!1}})(e,a,u,p);break;case"fill":(function(m,k,E,T){const I=E.paint.get("fill-color"),O=E.paint.get("fill-opacity");if(O.constantOr(1)===0)return;const B=m.colorModeForRenderPass(),U=E.paint.get("fill-pattern"),Z=m.opaquePassEnabledForLayer()&&!U.constantOr(1)&&I.constantOr(h.aM.transparent).a===1&&O.constantOr(0)===1?"opaque":"translucent";if(m.renderPass===Z){const G=m.depthModeForSublayer(1,m.renderPass==="opaque"?At.ReadWrite:At.ReadOnly);aa(m,k,E,T,G,B,!1)}if(m.renderPass==="translucent"&&E.paint.get("fill-antialias")){const G=m.depthModeForSublayer(E.getPaintProperty("fill-outline-color")?2:0,At.ReadOnly);aa(m,k,E,T,G,B,!0)}})(e,a,u,p);break;case"fill-extrusion":(function(m,k,E,T){const I=E.paint.get("fill-extrusion-opacity");if(I!==0&&m.renderPass==="translucent"){const O=new At(m.context.gl.LEQUAL,At.ReadWrite,m.depthRangeFor3D);if(I!==1||E.paint.get("fill-extrusion-pattern").constantOr(1))rl(m,k,E,T,O,di.disabled,Mi.disabled),rl(m,k,E,T,O,m.stencilModeFor3D(),m.colorModeForRenderPass());else{const B=m.colorModeForRenderPass();rl(m,k,E,T,O,di.disabled,B)}}})(e,a,u,p);break;case"hillshade":(function(m,k,E,T){if(m.renderPass!=="offscreen"&&m.renderPass!=="translucent")return;const I=m.context,O=m.depthModeForSublayer(0,At.ReadOnly),B=m.colorModeForRenderPass(),[U,Z]=m.renderPass==="translucent"?m.stencilConfigForOverlap(T):[{},T];for(const G of Z){const Q=k.getTile(G);Q.needsHillshadePrepare!==void 0&&Q.needsHillshadePrepare&&m.renderPass==="offscreen"?lo(m,Q,E,O,di.disabled,B):m.renderPass==="translucent"&&ao(m,G,Q,E,O,U[G.overscaledZ],B)}I.viewport.set([0,0,m.width,m.height])})(e,a,u,p);break;case"raster":(function(m,k,E,T){if(m.renderPass!=="translucent"||E.paint.get("raster-opacity")===0||!T.length)return;const I=m.context,O=I.gl,B=k.getSource(),U=m.useProgram("raster"),Z=m.colorModeForRenderPass(),[G,Q]=B instanceof $r?[{},T]:m.stencilConfigForOverlap(T),ne=Q[Q.length-1].overscaledZ,re=!m.options.moving;for(const ae of Q){const X=m.depthModeForSublayer(ae.overscaledZ-ne,E.paint.get("raster-opacity")===1?At.ReadWrite:At.ReadOnly,O.LESS),ue=k.getTile(ae);ue.registerFadeDuration(E.paint.get("raster-fade-duration"));const pe=k.findLoadedParent(ae,0),xe=k.findLoadedSibling(ae),Ce=Au(ue,pe||xe||null,k,E,m.transform,m.style.map.terrain);let Ae,$e;const We=E.paint.get("raster-resampling")==="nearest"?O.NEAREST:O.LINEAR;I.activeTexture.set(O.TEXTURE0),ue.texture.bind(We,O.CLAMP_TO_EDGE,O.LINEAR_MIPMAP_NEAREST),I.activeTexture.set(O.TEXTURE1),pe?(pe.texture.bind(We,O.CLAMP_TO_EDGE,O.LINEAR_MIPMAP_NEAREST),Ae=Math.pow(2,pe.tileID.overscaledZ-ue.tileID.overscaledZ),$e=[ue.tileID.canonical.x*Ae%1,ue.tileID.canonical.y*Ae%1]):ue.texture.bind(We,O.CLAMP_TO_EDGE,O.LINEAR_MIPMAP_NEAREST),ue.texture.useMipmap&&I.extTextureFilterAnisotropic&&m.transform.pitch>20&&O.texParameterf(O.TEXTURE_2D,I.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,I.extTextureFilterAnisotropicMax);const Oe=m.style.map.terrain&&m.style.map.terrain.getTerrainData(ae),Re=Oe?ae:null,et=Re?Re.posMatrix:m.transform.calculatePosMatrix(ae.toUnwrapped(),re),bt=Yp(et,$e||[0,0],Ae||1,Ce,E);B instanceof $r?U.draw(I,O.TRIANGLES,X,di.disabled,Z,oi.disabled,bt,Oe,E.id,B.boundsBuffer,m.quadTriangleIndexBuffer,B.boundsSegments):U.draw(I,O.TRIANGLES,X,G[ae.overscaledZ],Z,oi.disabled,bt,Oe,E.id,m.rasterBoundsBuffer,m.quadTriangleIndexBuffer,m.rasterBoundsSegments)}})(e,a,u,p);break;case"background":(function(m,k,E,T){const I=E.paint.get("background-color"),O=E.paint.get("background-opacity");if(O===0)return;const B=m.context,U=B.gl,Z=m.transform,G=Z.tileSize,Q=E.paint.get("background-pattern");if(m.isPatternMissing(Q))return;const ne=!Q&&I.a===1&&O===1&&m.opaquePassEnabledForLayer()?"opaque":"translucent";if(m.renderPass!==ne)return;const re=di.disabled,ae=m.depthModeForSublayer(0,ne==="opaque"?At.ReadWrite:At.ReadOnly),X=m.colorModeForRenderPass(),ue=m.useProgram(Q?"backgroundPattern":"background"),pe=T||Z.coveringTiles({tileSize:G,terrain:m.style.map.terrain});Q&&(B.activeTexture.set(U.TEXTURE0),m.imageManager.bind(m.context));const xe=E.getCrossfadeParameters();for(const Ce of pe){const Ae=T?Ce.posMatrix:m.transform.calculatePosMatrix(Ce.toUnwrapped()),$e=Q?gc(Ae,O,m,Q,{tileID:Ce,tileSize:G},xe):Ja(Ae,O,I),We=m.style.map.terrain&&m.style.map.terrain.getTerrainData(Ce);ue.draw(B,U.TRIANGLES,ae,re,X,oi.disabled,$e,We,E.id,m.tileExtentBuffer,m.quadTriangleIndexBuffer,m.tileExtentSegments)}})(e,0,u,p);break;case"custom":(function(m,k,E){const T=m.context,I=E.implementation;if(m.renderPass==="offscreen"){const O=I.prerender;O&&(m.setCustomLayerDefaults(),T.setColorMode(m.colorModeForRenderPass()),O.call(I,T.gl,m.transform.customLayerMatrix()),T.setDirty(),m.setBaseState())}else if(m.renderPass==="translucent"){m.setCustomLayerDefaults(),T.setColorMode(m.colorModeForRenderPass()),T.setStencilMode(di.disabled);const O=I.renderingMode==="3d"?new At(m.context.gl.LEQUAL,At.ReadWrite,m.depthRangeFor3D):m.depthModeForSublayer(0,At.ReadOnly);T.setDepthMode(O),I.render(T.gl,m.transform.customLayerMatrix(),{farZ:m.transform.farZ,nearZ:m.transform.nearZ,fov:m.transform._fov,modelViewProjectionMatrix:m.transform.modelViewProjectionMatrix,projectionMatrix:m.transform.projectionMatrix}),T.setDirty(),m.setBaseState(),T.bindFramebuffer.set(null)}})(e,0,u)}}translatePosMatrix(e,a,u,p,m){if(!u[0]&&!u[1])return e;const k=m?p==="map"?this.transform.angle:0:p==="viewport"?-this.transform.angle:0;if(k){const I=Math.sin(k),O=Math.cos(k);u=[u[0]*O-u[1]*I,u[0]*I+u[1]*O]}const E=[m?u[0]:Rt(a,u[0],this.transform.zoom),m?u[1]:Rt(a,u[1],this.transform.zoom),0],T=new Float32Array(16);return h.J(T,e,E),T}saveTileTexture(e){const a=this._tileTextures[e.size[0]];a?a.push(e):this._tileTextures[e.size[0]]=[e]}getTileTexture(e){const a=this._tileTextures[e];return a&&a.length>0?a.pop():null}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;const a=this.imageManager.getPattern(e.from.toString()),u=this.imageManager.getPattern(e.to.toString());return!a||!u}useProgram(e,a){this.cache=this.cache||{};const u=e+(a?a.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[u]||(this.cache[u]=new fc(this.context,ss[e],a,yc[e],this._showOverdrawInspector,this.style.map.terrain)),this.cache[u]}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 e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new Et(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:e,drawingBufferHeight:a}=this.context.gl;return this.width!==e||this.height!==a}}class ho{constructor(e,a){this.points=e,this.planes=a}static fromInvProjectionMatrix(e,a,u){const p=Math.pow(2,u),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(E=>{const T=1/(E=h.af([],E,e))[3]/a*p;return h.b1(E,E,[T,T,1/E[3],T])}),k=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(E=>{const T=function(U,Z){var G=Z[0],Q=Z[1],ne=Z[2],re=G*G+Q*Q+ne*ne;return re>0&&(re=1/Math.sqrt(re)),U[0]=Z[0]*re,U[1]=Z[1]*re,U[2]=Z[2]*re,U}([],function(U,Z,G){var Q=Z[0],ne=Z[1],re=Z[2],ae=G[0],X=G[1],ue=G[2];return U[0]=ne*ue-re*X,U[1]=re*ae-Q*ue,U[2]=Q*X-ne*ae,U}([],Ve([],m[E[0]],m[E[1]]),Ve([],m[E[2]],m[E[1]]))),I=-((O=T)[0]*(B=m[E[1]])[0]+O[1]*B[1]+O[2]*B[2]);var O,B;return T.concat(I)});return new ho(m,k)}}class uo{constructor(e,a){this.min=e,this.max=a,this.center=function(u,p,m){return u[0]=.5*p[0],u[1]=.5*p[1],u[2]=.5*p[2],u}([],function(u,p,m){return u[0]=p[0]+m[0],u[1]=p[1]+m[1],u[2]=p[2]+m[2],u}([],this.min,this.max))}quadrant(e){const a=[e%2==0,e<2],u=tt(this.min),p=tt(this.max);for(let m=0;m<a.length;m++)u[m]=a[m]?this.min[m]:this.center[m],p[m]=a[m]?this.center[m]:this.max[m];return p[2]=this.max[2],new uo(u,p)}distanceX(e){return Math.max(Math.min(this.max[0],e[0]),this.min[0])-e[0]}distanceY(e){return Math.max(Math.min(this.max[1],e[1]),this.min[1])-e[1]}intersects(e){const a=[[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 u=!0;for(let p=0;p<e.planes.length;p++){const m=e.planes[p];let k=0;for(let E=0;E<a.length;E++)h.b2(m,a[E])>=0&&k++;if(k===0)return 0;k!==a.length&&(u=!1)}if(u)return 2;for(let p=0;p<3;p++){let m=Number.MAX_VALUE,k=-Number.MAX_VALUE;for(let E=0;E<e.points.length;E++){const T=e.points[E][p]-this.min[p];m=Math.min(m,T),k=Math.max(k,T)}if(k<0||m>this.max[p]-this.min[p])return 0}return 1}}class po{constructor(e=0,a=0,u=0,p=0){if(isNaN(e)||e<0||isNaN(a)||a<0||isNaN(u)||u<0||isNaN(p)||p<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=e,this.bottom=a,this.left=u,this.right=p}interpolate(e,a,u){return a.top!=null&&e.top!=null&&(this.top=h.y.number(e.top,a.top,u)),a.bottom!=null&&e.bottom!=null&&(this.bottom=h.y.number(e.bottom,a.bottom,u)),a.left!=null&&e.left!=null&&(this.left=h.y.number(e.left,a.left,u)),a.right!=null&&e.right!=null&&(this.right=h.y.number(e.right,a.right,u)),this}getCenter(e,a){const u=h.ac((this.left+e-this.right)/2,0,e),p=h.ac((this.top+a-this.bottom)/2,0,a);return new h.P(u,p)}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new po(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const Ac=85.051129;class fo{constructor(e,a,u,p,m){this.tileSize=512,this._renderWorldCopies=m===void 0||!!m,this._minZoom=e||0,this._maxZoom=a||22,this._minPitch=u??0,this._maxPitch=p??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new h.N(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new po,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={},this.minElevationForCurrentTile=0}clone(){const e=new fo(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return e.apply(this),e}apply(e){this.tileSize=e.tileSize,this.latRange=e.latRange,this.lngRange=e.lngRange,this.width=e.width,this.height=e.height,this._center=e._center,this._elevation=e._elevation,this.minElevationForCurrentTile=e.minElevationForCurrentTile,this.zoom=e.zoom,this.angle=e.angle,this._fov=e._fov,this._pitch=e._pitch,this._unmodified=e._unmodified,this._edgeInsets=e._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(e){this._minZoom!==e&&(this._minZoom=e,this.zoom=Math.max(this.zoom,e))}get maxZoom(){return this._maxZoom}set maxZoom(e){this._maxZoom!==e&&(this._maxZoom=e,this.zoom=Math.min(this.zoom,e))}get minPitch(){return this._minPitch}set minPitch(e){this._minPitch!==e&&(this._minPitch=e,this.pitch=Math.max(this.pitch,e))}get maxPitch(){return this._maxPitch}set maxPitch(e){this._maxPitch!==e&&(this._maxPitch=e,this.pitch=Math.min(this.pitch,e))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(e){e===void 0?e=!0:e===null&&(e=!1),this._renderWorldCopies=e}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new h.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(e){const a=-h.b3(e,-180,180)*Math.PI/180;this.angle!==a&&(this._unmodified=!1,this.angle=a,this._calcMatrices(),this.rotationMatrix=function(){var u=new h.A(4);return h.A!=Float32Array&&(u[1]=0,u[2]=0),u[0]=1,u[3]=1,u}(),function(u,p,m){var k=p[0],E=p[1],T=p[2],I=p[3],O=Math.sin(m),B=Math.cos(m);u[0]=k*B+T*O,u[1]=E*B+I*O,u[2]=k*-O+T*B,u[3]=E*-O+I*B}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(e){const a=h.ac(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==a&&(this._unmodified=!1,this._pitch=a,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(e){e=Math.max(.01,Math.min(60,e)),this._fov!==e&&(this._unmodified=!1,this._fov=e/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(e){const a=Math.min(Math.max(e,this.minZoom),this.maxZoom);this._zoom!==a&&(this._unmodified=!1,this._zoom=a,this.tileZoom=Math.max(0,Math.floor(a)),this.scale=this.zoomScale(a),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(e){e.lat===this._center.lat&&e.lng===this._center.lng||(this._unmodified=!1,this._center=e,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(e){e!==this._elevation&&(this._elevation=e,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(e){this._edgeInsets.equals(e)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,e,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(e){return this._edgeInsets.equals(e)}interpolatePadding(e,a,u){this._unmodified=!1,this._edgeInsets.interpolate(e,a,u),this._constrain(),this._calcMatrices()}coveringZoomLevel(e){const a=(e.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/e.tileSize));return Math.max(0,a)}getVisibleUnwrappedCoordinates(e){const a=[new h.b4(0,e)];if(this._renderWorldCopies){const u=this.pointCoordinate(new h.P(0,0)),p=this.pointCoordinate(new h.P(this.width,0)),m=this.pointCoordinate(new h.P(this.width,this.height)),k=this.pointCoordinate(new h.P(0,this.height)),E=Math.floor(Math.min(u.x,p.x,m.x,k.x)),T=Math.floor(Math.max(u.x,p.x,m.x,k.x)),I=1;for(let O=E-I;O<=T+I;O++)O!==0&&a.push(new h.b4(O,e))}return a}coveringTiles(e){var a,u;let p=this.coveringZoomLevel(e);const m=p;if(e.minzoom!==void 0&&p<e.minzoom)return[];e.maxzoom!==void 0&&p>e.maxzoom&&(p=e.maxzoom);const k=this.pointCoordinate(this.getCameraPoint()),E=h.Z.fromLngLat(this.center),T=Math.pow(2,p),I=[T*k.x,T*k.y,0],O=[T*E.x,T*E.y,0],B=ho.fromInvProjectionMatrix(this.invModelViewProjectionMatrix,this.worldSize,p);let U=e.minzoom||0;!e.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(U=p);const Z=e.terrain?2/Math.min(this.tileSize,e.tileSize)*this.tileSize:3,G=X=>({aabb:new uo([X*T,0,0],[(X+1)*T,T,0]),zoom:0,x:0,y:0,wrap:X,fullyVisible:!1}),Q=[],ne=[],re=p,ae=e.reparseOverscaled?m:p;if(this._renderWorldCopies)for(let X=1;X<=3;X++)Q.push(G(-X)),Q.push(G(X));for(Q.push(G(0));Q.length>0;){const X=Q.pop(),ue=X.x,pe=X.y;let xe=X.fullyVisible;if(!xe){const Oe=X.aabb.intersects(B);if(Oe===0)continue;xe=Oe===2}const Ce=e.terrain?I:O,Ae=X.aabb.distanceX(Ce),$e=X.aabb.distanceY(Ce),We=Math.max(Math.abs(Ae),Math.abs($e));if(X.zoom===re||We>Z+(1<<re-X.zoom)-2&&X.zoom>=U){const Oe=re-X.zoom,Re=I[0]-.5-(ue<<Oe),et=I[1]-.5-(pe<<Oe);ne.push({tileID:new h.S(X.zoom===re?ae:X.zoom,X.wrap,X.zoom,ue,pe),distanceSq:rt([O[0]-.5-ue,O[1]-.5-pe]),tileDistanceToCamera:Math.sqrt(Re*Re+et*et)})}else for(let Oe=0;Oe<4;Oe++){const Re=(ue<<1)+Oe%2,et=(pe<<1)+(Oe>>1),bt=X.zoom+1;let Fe=X.aabb.quadrant(Oe);if(e.terrain){const Ue=new h.S(bt,X.wrap,bt,Re,et),yt=e.terrain.getMinMaxElevation(Ue),gi=(a=yt.minElevation)!==null&&a!==void 0?a:this.elevation,Ct=(u=yt.maxElevation)!==null&&u!==void 0?u:this.elevation;Fe=new uo([Fe.min[0],Fe.min[1],gi],[Fe.max[0],Fe.max[1],Ct])}Q.push({aabb:Fe,zoom:bt,x:Re,y:et,wrap:X.wrap,fullyVisible:xe})}}return ne.sort((X,ue)=>X.distanceSq-ue.distanceSq).map(X=>X.tileID)}resize(e,a){this.width=e,this.height=a,this.pixelsToGLUnits=[2/e,-2/a],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(e){return Math.pow(2,e)}scaleZoom(e){return Math.log(e)/Math.LN2}project(e){const a=h.ac(e.lat,-85.051129,Ac);return new h.P(h.O(e.lng)*this.worldSize,h.Q(a)*this.worldSize)}unproject(e){return new h.Z(e.x/this.worldSize,e.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(e){const a=this.elevation,u=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,p=this.pointLocation(this.centerPoint,e),m=e.getElevationForLngLatZoom(p,this.tileZoom);if(!(this.elevation-m))return;const k=u+a-m,E=Math.cos(this._pitch)*this.cameraToCenterDistance/k/h.b5(1,p.lat),T=this.scaleZoom(E/this.tileSize);this._elevation=m,this._center=p,this.zoom=T}setLocationAtPoint(e,a){const u=this.pointCoordinate(a),p=this.pointCoordinate(this.centerPoint),m=this.locationCoordinate(e),k=new h.Z(m.x-(u.x-p.x),m.y-(u.y-p.y));this.center=this.coordinateLocation(k),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(e,a){return a?this.coordinatePoint(this.locationCoordinate(e),a.getElevationForLngLatZoom(e,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(e))}pointLocation(e,a){return this.coordinateLocation(this.pointCoordinate(e,a))}locationCoordinate(e){return h.Z.fromLngLat(e)}coordinateLocation(e){return e&&e.toLngLat()}pointCoordinate(e,a){if(a){const U=a.pointCoordinate(e);if(U!=null)return U}const u=[e.x,e.y,0,1],p=[e.x,e.y,1,1];h.af(u,u,this.pixelMatrixInverse),h.af(p,p,this.pixelMatrixInverse);const m=u[3],k=p[3],E=u[1]/m,T=p[1]/k,I=u[2]/m,O=p[2]/k,B=I===O?0:(0-I)/(O-I);return new h.Z(h.y.number(u[0]/m,p[0]/k,B)/this.worldSize,h.y.number(E,T,B)/this.worldSize)}coordinatePoint(e,a=0,u=this.pixelMatrix){const p=[e.x*this.worldSize,e.y*this.worldSize,a,1];return h.af(p,p,u),new h.P(p[0]/p[3],p[1]/p[3])}getBounds(){const e=Math.max(0,this.height/2-this.getHorizon());return new be().extend(this.pointLocation(new h.P(0,e))).extend(this.pointLocation(new h.P(this.width,e))).extend(this.pointLocation(new h.P(this.width,this.height))).extend(this.pointLocation(new h.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new be([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(e){e?(this.lngRange=[e.getWest(),e.getEast()],this.latRange=[e.getSouth(),e.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-85.051129,Ac])}calculateTileMatrix(e){const a=e.canonical,u=this.worldSize/this.zoomScale(a.z),p=a.x+Math.pow(2,a.z)*e.wrap,m=h.an(new Float64Array(16));return h.J(m,m,[p*u,a.y*u,0]),h.K(m,m,[u/h.X,u/h.X,1]),m}calculatePosMatrix(e,a=!1){const u=e.key,p=a?this._alignedPosMatrixCache:this._posMatrixCache;if(p[u])return p[u];const m=this.calculateTileMatrix(e);return h.L(m,a?this.alignedModelViewProjectionMatrix:this.modelViewProjectionMatrix,m),p[u]=new Float32Array(m),p[u]}calculateFogMatrix(e){const a=e.key,u=this._fogMatrixCache;if(u[a])return u[a];const p=this.calculateTileMatrix(e);return h.L(p,this.fogMatrix,p),u[a]=new Float32Array(p),u[a]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(e,a){a=h.ac(+a,this.minZoom,this.maxZoom);const u={center:new h.N(e.lng,e.lat),zoom:a};let p=this.lngRange;if(!this._renderWorldCopies&&p===null){const X=179.9999999999;p=[-X,X]}const m=this.tileSize*this.zoomScale(u.zoom);let k=0,E=m,T=0,I=m,O=0,B=0;const{x:U,y:Z}=this.size;if(this.latRange){const X=this.latRange;k=h.Q(X[1])*m,E=h.Q(X[0])*m,E-k<Z&&(O=Z/(E-k))}p&&(T=h.b3(h.O(p[0])*m,0,m),I=h.b3(h.O(p[1])*m,0,m),I<T&&(I+=m),I-T<U&&(B=U/(I-T)));const{x:G,y:Q}=this.project.call({worldSize:m},e);let ne,re;const ae=Math.max(B||0,O||0);if(ae){const X=new h.P(B?(I+T)/2:G,O?(E+k)/2:Q);return u.center=this.unproject.call({worldSize:m},X).wrap(),u.zoom+=this.scaleZoom(ae),u}if(this.latRange){const X=Z/2;Q-X<k&&(re=k+X),Q+X>E&&(re=E-X)}if(p){const X=(T+I)/2;let ue=G;this._renderWorldCopies&&(ue=h.b3(G,X-m/2,X+m/2));const pe=U/2;ue-pe<T&&(ne=T+pe),ue+pe>I&&(ne=I-pe)}if(ne!==void 0||re!==void 0){const X=new h.P(ne??G,re??Q);u.center=this.unproject.call({worldSize:m},X).wrap()}return u}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const e=this._unmodified,{center:a,zoom:u}=this.getConstrained(this.center,this.zoom);this.center=a,this.zoom=u,this._unmodified=e,this._constraining=!1}_calcMatrices(){if(!this.height)return;const e=this.centerOffset,a=this.point.x,u=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=h.b5(1,this.center.lat)*this.worldSize;let p=h.an(new Float64Array(16));h.K(p,p,[this.width/2,-this.height/2,1]),h.J(p,p,[1,-1,0]),this.labelPlaneMatrix=p,p=h.an(new Float64Array(16)),h.K(p,p,[1,-1,1]),h.J(p,p,[-1,-1,0]),h.K(p,p,[2/this.width,2/this.height,1]),this.glCoordMatrix=p;const m=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),k=Math.min(this.elevation,this.minElevationForCurrentTile),E=m-k*this._pixelPerMeter/Math.cos(this._pitch),T=k<0?E:m,I=Math.PI/2+this._pitch,O=this._fov*(.5+e.y/this.height),B=Math.sin(O)*T/Math.sin(h.ac(Math.PI-I-O,.01,Math.PI-.01)),U=this.getHorizon(),Z=2*Math.atan(U/this.cameraToCenterDistance)*(.5+e.y/(2*U)),G=Math.sin(Z)*T/Math.sin(h.ac(Math.PI-I-Z,.01,Math.PI-.01)),Q=Math.min(B,G);this.farZ=1.01*(Math.cos(Math.PI/2-this._pitch)*Q+T),this.nearZ=this.height/50,p=new Float64Array(16),h.b6(p,this._fov,this.width/this.height,this.nearZ,this.farZ),p[8]=2*-e.x/this.width,p[9]=2*e.y/this.height,this.projectionMatrix=h.ae(p),h.K(p,p,[1,-1,1]),h.J(p,p,[0,0,-this.cameraToCenterDistance]),h.b7(p,p,this._pitch),h.ad(p,p,this.angle),h.J(p,p,[-a,-u,0]),this.mercatorMatrix=h.K([],p,[this.worldSize,this.worldSize,this.worldSize]),h.K(p,p,[1,1,this._pixelPerMeter]),this.pixelMatrix=h.L(new Float64Array(16),this.labelPlaneMatrix,p),h.J(p,p,[0,0,-this.elevation]),this.modelViewProjectionMatrix=p,this.invModelViewProjectionMatrix=h.as([],p),this.fogMatrix=new Float64Array(16),h.b6(this.fogMatrix,this._fov,this.width/this.height,m,this.farZ),this.fogMatrix[8]=2*-e.x/this.width,this.fogMatrix[9]=2*e.y/this.height,h.K(this.fogMatrix,this.fogMatrix,[1,-1,1]),h.J(this.fogMatrix,this.fogMatrix,[0,0,-this.cameraToCenterDistance]),h.b7(this.fogMatrix,this.fogMatrix,this._pitch),h.ad(this.fogMatrix,this.fogMatrix,this.angle),h.J(this.fogMatrix,this.fogMatrix,[-a,-u,0]),h.K(this.fogMatrix,this.fogMatrix,[1,1,this._pixelPerMeter]),h.J(this.fogMatrix,this.fogMatrix,[0,0,-this.elevation]),this.pixelMatrix3D=h.L(new Float64Array(16),this.labelPlaneMatrix,p);const ne=this.width%2/2,re=this.height%2/2,ae=Math.cos(this.angle),X=Math.sin(this.angle),ue=a-Math.round(a)+ae*ne+X*re,pe=u-Math.round(u)+ae*re+X*ne,xe=new Float64Array(p);if(h.J(xe,xe,[ue>.5?ue-1:ue,pe>.5?pe-1:pe,0]),this.alignedModelViewProjectionMatrix=xe,p=h.as(new Float64Array(16),this.pixelMatrix),!p)throw new Error("failed to invert matrix");this.pixelMatrixInverse=p,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const e=this.pointCoordinate(new h.P(0,0)),a=[e.x*this.worldSize,e.y*this.worldSize,0,1];return h.af(a,a,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const e=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new h.P(0,e))}getCameraQueryGeometry(e){const a=this.getCameraPoint();if(e.length===1)return[e[0],a];{let u=a.x,p=a.y,m=a.x,k=a.y;for(const E of e)u=Math.min(u,E.x),p=Math.min(p,E.y),m=Math.max(m,E.x),k=Math.max(k,E.y);return[new h.P(u,p),new h.P(m,p),new h.P(m,k),new h.P(u,k),new h.P(u,p)]}}lngLatToCameraDepth(e,a){const u=this.locationCoordinate(e),p=[u.x*this.worldSize,u.y*this.worldSize,a,1];return h.af(p,p,this.modelViewProjectionMatrix),p[2]/p[3]}}function la(g,e){let a,u=!1,p=null,m=null;const k=()=>{p=null,u&&(g.apply(m,a),p=setTimeout(k,e),u=!1)};return(...E)=>(u=!0,m=this,a=E,p||k(),p)}class cl{constructor(e){this._getCurrentHash=()=>{const a=window.location.hash.replace("#","");if(this._hashName){let u;return a.split("&").map(p=>p.split("=")).forEach(p=>{p[0]===this._hashName&&(u=p)}),(u&&u[1]||"").split("/")}return a.split("/")},this._onHashChange=()=>{const a=this._getCurrentHash();if(a.length>=3&&!a.some(u=>isNaN(u))){const u=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(a[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+a[2],+a[1]],zoom:+a[0],bearing:u,pitch:+(a[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const a=window.location.href.replace(/(#.+)?$/,this.getHashString());window.history.replaceState(window.history.state,null,a)},this._removeHash=()=>{const a=this._getCurrentHash();if(a.length===0)return;const u=a.join("/");let p=u;p.split("&").length>0&&(p=p.split("&")[0]),this._hashName&&(p=`${this._hashName}=${u}`);let m=window.location.hash.replace(p,"");m.startsWith("#&")?m=m.slice(0,1)+m.slice(2):m==="#"&&(m="");let k=window.location.href.replace(/(#.+)?$/,m);k=k.replace("&&","&"),window.history.replaceState(window.history.state,null,k)},this._updateHash=la(this._updateHashUnthrottled,300),this._hashName=e&&encodeURIComponent(e)}addTo(e){return this._map=e,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(e){const a=this._map.getCenter(),u=Math.round(100*this._map.getZoom())/100,p=Math.ceil((u*Math.LN2+Math.log(512/360/.5))/Math.LN10),m=Math.pow(10,p),k=Math.round(a.lng*m)/m,E=Math.round(a.lat*m)/m,T=this._map.getBearing(),I=this._map.getPitch();let O="";if(O+=e?`/${k}/${E}/${u}`:`${u}/${E}/${k}`,(T||I)&&(O+="/"+Math.round(10*T)/10),I&&(O+=`/${Math.round(I)}`),this._hashName){const B=this._hashName;let U=!1;const Z=window.location.hash.slice(1).split("&").map(G=>{const Q=G.split("=")[0];return Q===B?(U=!0,`${Q}=${O}`):G}).filter(G=>G);return U||Z.push(`${B}=${O}`),`#${Z.join("&")}`}return`#${O}`}}const hl={linearity:.3,easing:h.b8(0,0,.3,1)},Dc=h.e({deceleration:2500,maxSpeed:1400},hl),cf=h.e({deceleration:20,maxSpeed:1400},hl),Ou=h.e({deceleration:1e3,maxSpeed:360},hl),ul=h.e({deceleration:1e3,maxSpeed:90},hl);class zc{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:z.now(),settings:e})}_drainInertiaBuffer(){const e=this._inertiaBuffer,a=z.now();for(;e.length>0&&a-e[0].time>160;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const a={zoom:0,bearing:0,pitch:0,pan:new h.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:m}of this._inertiaBuffer)a.zoom+=m.zoomDelta||0,a.bearing+=m.bearingDelta||0,a.pitch+=m.pitchDelta||0,m.panDelta&&a.pan._add(m.panDelta),m.around&&(a.around=m.around),m.pinchAround&&(a.pinchAround=m.pinchAround);const u=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,p={};if(a.pan.mag()){const m=ha(a.pan.mag(),u,h.e({},Dc,e||{}));p.offset=a.pan.mult(m.amount/a.pan.mag()),p.center=this._map.transform.center,ca(p,m)}if(a.zoom){const m=ha(a.zoom,u,cf);p.zoom=this._map.transform.zoom+m.amount,ca(p,m)}if(a.bearing){const m=ha(a.bearing,u,Ou);p.bearing=this._map.transform.bearing+h.ac(m.amount,-179,179),ca(p,m)}if(a.pitch){const m=ha(a.pitch,u,ul);p.pitch=this._map.transform.pitch+m.amount,ca(p,m)}if(p.zoom||p.bearing){const m=a.pinchAround===void 0?a.around:a.pinchAround;p.around=m?this._map.unproject(m):this._map.getCenter()}return this.clear(),h.e(p,{noMoveStart:!0})}}function ca(g,e){(!g.duration||g.duration<e.duration)&&(g.duration=e.duration,g.easing=e.easing)}function ha(g,e,a){const{maxSpeed:u,linearity:p,deceleration:m}=a,k=h.ac(g*p/(e/1e3),-u,u),E=Math.abs(k)/(m*p);return{easing:a.easing,duration:1e3*E,amount:k*(E/2)}}class Ji extends h.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,a,u,p={}){const m=L.mousePos(a.getCanvas(),u),k=a.unproject(m);super(e,h.e({point:m,lngLat:k,originalEvent:u},p)),this._defaultPrevented=!1,this.target=a}}class Os extends h.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,a,u){const p=e==="touchend"?u.changedTouches:u.touches,m=L.touchPos(a.getCanvasContainer(),p),k=m.map(T=>a.unproject(T)),E=m.reduce((T,I,O,B)=>T.add(I.div(B.length)),new h.P(0,0));super(e,{points:m,point:E,lngLats:k,lngLat:a.unproject(E),originalEvent:u}),this._defaultPrevented=!1}}class Bu extends h.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,a,u){super(e,{originalEvent:u}),this._defaultPrevented=!1}}class Fu{constructor(e,a){this._map=e,this._clickTolerance=a.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new Bu(e.type,this._map,e))}mousedown(e,a){return this._mousedownPos=a,this._firePreventable(new Ji(e.type,this._map,e))}mouseup(e){this._map.fire(new Ji(e.type,this._map,e))}click(e,a){this._mousedownPos&&this._mousedownPos.dist(a)>=this._clickTolerance||this._map.fire(new Ji(e.type,this._map,e))}dblclick(e){return this._firePreventable(new Ji(e.type,this._map,e))}mouseover(e){this._map.fire(new Ji(e.type,this._map,e))}mouseout(e){this._map.fire(new Ji(e.type,this._map,e))}touchstart(e){return this._firePreventable(new Os(e.type,this._map,e))}touchmove(e){this._map.fire(new Os(e.type,this._map,e))}touchend(e){this._map.fire(new Os(e.type,this._map,e))}touchcancel(e){this._map.fire(new Os(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Pi{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new Ji(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Ji("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new Ji(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class lr{constructor(e){this._map=e}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(e){return this.transform.pointLocation(h.P.convert(e),this._map.terrain)}}class Ln{constructor(e,a){this._map=e,this._tr=new lr(e),this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=a.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,a){this.isEnabled()&&e.shiftKey&&e.button===0&&(L.disableDrag(),this._startPos=this._lastPos=a,this._active=!0)}mousemoveWindow(e,a){if(!this._active)return;const u=a;if(this._lastPos.equals(u)||!this._box&&u.dist(this._startPos)<this._clickTolerance)return;const p=this._startPos;this._lastPos=u,this._box||(this._box=L.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",e));const m=Math.min(p.x,u.x),k=Math.max(p.x,u.x),E=Math.min(p.y,u.y),T=Math.max(p.y,u.y);L.setTransform(this._box,`translate(${m}px,${E}px)`),this._box.style.width=k-m+"px",this._box.style.height=T-E+"px"}mouseupWindow(e,a){if(!this._active||e.button!==0)return;const u=this._startPos,p=a;if(this.reset(),L.suppressClick(),u.x!==p.x||u.y!==p.y)return this._map.fire(new h.k("boxzoomend",{originalEvent:e})),{cameraAnimation:m=>m.fitScreenCoordinates(u,p,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",e)}keydown(e){this._active&&e.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",e))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(L.remove(this._box),this._box=null),L.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,a){return this._map.fire(new h.k(e,{originalEvent:a}))}}function ua(g,e){if(g.length!==e.length)throw new Error(`The number of touches and points are not equal - touches ${g.length}, points ${e.length}`);const a={};for(let u=0;u<g.length;u++)a[g[u].identifier]=e[u];return a}class Lc{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(e,a,u){(this.centroid||u.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=e.timeStamp),u.length===this.numTouches&&(this.centroid=function(p){const m=new h.P(0,0);for(const k of p)m._add(k);return m.div(p.length)}(a),this.touches=ua(u,a)))}touchmove(e,a,u){if(this.aborted||!this.centroid)return;const p=ua(u,a);for(const m in this.touches){const k=p[m];(!k||k.dist(this.touches[m])>30)&&(this.aborted=!0)}}touchend(e,a,u){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),u.length===0){const p=!this.aborted&&this.centroid;if(this.reset(),p)return p}}}class dl{constructor(e){this.singleTap=new Lc(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,a,u){this.singleTap.touchstart(e,a,u)}touchmove(e,a,u){this.singleTap.touchmove(e,a,u)}touchend(e,a,u){const p=this.singleTap.touchend(e,a,u);if(p){const m=e.timeStamp-this.lastTime<500,k=!this.lastTap||this.lastTap.dist(p)<30;if(m&&k||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=p,this.count===this.numTaps)return this.reset(),p}}}class mo{constructor(e){this._tr=new lr(e),this._zoomIn=new dl({numTouches:1,numTaps:2}),this._zoomOut=new dl({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,a,u){this._zoomIn.touchstart(e,a,u),this._zoomOut.touchstart(e,a,u)}touchmove(e,a,u){this._zoomIn.touchmove(e,a,u),this._zoomOut.touchmove(e,a,u)}touchend(e,a,u){const p=this._zoomIn.touchend(e,a,u),m=this._zoomOut.touchend(e,a,u),k=this._tr;return p?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:E=>E.easeTo({duration:300,zoom:k.zoom+1,around:k.unproject(p)},{originalEvent:e})}):m?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:E=>E.easeTo({duration:300,zoom:k.zoom-1,around:k.unproject(m)},{originalEvent:e})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Hr{constructor(e){this._enabled=!!e.enable,this._moveStateManager=e.moveStateManager,this._clickTolerance=e.clickTolerance||1,this._moveFunction=e.move,this._activateOnStart=!!e.activateOnStart,e.assignEvents(this),this.reset()}reset(e){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(e)}_move(...e){const a=this._moveFunction(...e);if(a.bearingDelta||a.pitchDelta||a.around||a.panDelta)return this._active=!0,a}dragStart(e,a){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(e)&&(this._moveStateManager.startMove(e),this._lastPoint=a.length?a[0]:a,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(e,a){if(!this.isEnabled())return;const u=this._lastPoint;if(!u)return;if(e.preventDefault(),!this._moveStateManager.isValidMoveEvent(e))return void this.reset(e);const p=a.length?a[0]:a;return!this._moved&&p.dist(u)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=p,this._move(u,p))}dragEnd(e){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(e)&&(this._moved&&L.suppressClick(),this.reset(e))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}const Rc={0:1,2:2};class pl{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){const a=L.mouseButton(e);this._eventButton=a}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){return!function(a,u){const p=Rc[u];return a.buttons===void 0||(a.buttons&p)!==p}(e,this._eventButton)}isValidEndEvent(e){return L.mouseButton(e)===this._eventButton}}class Oc{constructor(){this._firstTouch=void 0}_isOneFingerTouch(e){return e.targetTouches.length===1}_isSameTouchEvent(e){return e.targetTouches[0].identifier===this._firstTouch}startMove(e){this._firstTouch=e.targetTouches[0].identifier}endMove(e){delete this._firstTouch}isValidStartEvent(e){return this._isOneFingerTouch(e)}isValidMoveEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}isValidEndEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}}const fl=g=>{g.mousedown=g.dragStart,g.mousemoveWindow=g.dragMove,g.mouseup=g.dragEnd,g.contextmenu=e=>{e.preventDefault()}},Bc=({enable:g,clickTolerance:e,bearingDegreesPerPixelMoved:a=.8})=>{const u=new pl({checkCorrectEvent:p=>L.mouseButton(p)===0&&p.ctrlKey||L.mouseButton(p)===2});return new Hr({clickTolerance:e,move:(p,m)=>({bearingDelta:(m.x-p.x)*a}),moveStateManager:u,enable:g,assignEvents:fl})},Fc=({enable:g,clickTolerance:e,pitchDegreesPerPixelMoved:a=-.5})=>{const u=new pl({checkCorrectEvent:p=>L.mouseButton(p)===0&&p.ctrlKey||L.mouseButton(p)===2});return new Hr({clickTolerance:e,move:(p,m)=>({pitchDelta:(m.y-p.y)*a}),moveStateManager:u,enable:g,assignEvents:fl})};class Bs{constructor(e,a){this._clickTolerance=e.clickTolerance||1,this._map=a,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new h.P(0,0)}_shouldBePrevented(e){return e<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(e,a,u){return this._calculateTransform(e,a,u)}touchmove(e,a,u){if(this._active){if(!this._shouldBePrevented(u.length))return e.preventDefault(),this._calculateTransform(e,a,u);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",e)}}touchend(e,a,u){this._calculateTransform(e,a,u),this._active&&this._shouldBePrevented(u.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,a,u){u.length>0&&(this._active=!0);const p=ua(u,a),m=new h.P(0,0),k=new h.P(0,0);let E=0;for(const I in p){const O=p[I],B=this._touches[I];B&&(m._add(O),k._add(O.sub(B)),E++,p[I]=O)}if(this._touches=p,this._shouldBePrevented(E)||!k.mag())return;const T=k.div(E);return this._sum._add(T),this._sum.mag()<this._clickTolerance?void 0:{around:m.div(E),panDelta:T}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class ml{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(e,a,u){this._firstTwoTouches||u.length<2||(this._firstTwoTouches=[u[0].identifier,u[1].identifier],this._start([a[0],a[1]]))}touchmove(e,a,u){if(!this._firstTwoTouches)return;e.preventDefault();const[p,m]=this._firstTwoTouches,k=da(u,a,p),E=da(u,a,m);if(!k||!E)return;const T=this._aroundCenter?null:k.add(E).div(2);return this._move([k,E],T,e)}touchend(e,a,u){if(!this._firstTwoTouches)return;const[p,m]=this._firstTwoTouches,k=da(u,a,p),E=da(u,a,m);k&&E||(this._active&&L.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(e){this._enabled=!0,this._aroundCenter=!!e&&e.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function da(g,e,a){for(let u=0;u<g.length;u++)if(g[u].identifier===a)return e[u]}function Nc(g,e){return Math.log(g/e)/Math.LN2}class Vc extends ml{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(e){this._startDistance=this._distance=e[0].dist(e[1])}_move(e,a){const u=this._distance;if(this._distance=e[0].dist(e[1]),this._active||!(Math.abs(Nc(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Nc(this._distance,u),pinchAround:a}}}function $c(g,e){return 180*g.angleWith(e)/Math.PI}class jc extends ml{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(e){this._startVector=this._vector=e[0].sub(e[1]),this._minDiameter=e[0].dist(e[1])}_move(e,a,u){const p=this._vector;if(this._vector=e[0].sub(e[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:$c(this._vector,p),pinchAround:a}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());const a=25/(Math.PI*this._minDiameter)*360,u=$c(e,this._startVector);return Math.abs(u)<a}}function gl(g){return Math.abs(g.y)>Math.abs(g.x)}class go extends ml{constructor(e){super(),this._currentTouchCount=0,this._map=e}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(e,a,u){super.touchstart(e,a,u),this._currentTouchCount=u.length}_start(e){this._lastPoints=e,gl(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,a,u){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const p=e[0].sub(this._lastPoints[0]),m=e[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(p,m,u.timeStamp),this._valid?(this._lastPoints=e,this._active=!0,{pitchDelta:(p.y+m.y)/2*-.5}):void 0}gestureBeginsVertically(e,a,u){if(this._valid!==void 0)return this._valid;const p=e.mag()>=2,m=a.mag()>=2;if(!p&&!m)return;if(!p||!m)return this._firstMove===void 0&&(this._firstMove=u),u-this._firstMove<100&&void 0;const k=e.y>0==a.y>0;return gl(e)&&gl(a)&&k}}const Nu={panStep:100,bearingStep:15,pitchStep:10};class Gn{constructor(e){this._tr=new lr(e);const a=Nu;this._panStep=a.panStep,this._bearingStep=a.bearingStep,this._pitchStep=a.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let a=0,u=0,p=0,m=0,k=0;switch(e.keyCode){case 61:case 107:case 171:case 187:a=1;break;case 189:case 109:case 173:a=-1;break;case 37:e.shiftKey?u=-1:(e.preventDefault(),m=-1);break;case 39:e.shiftKey?u=1:(e.preventDefault(),m=1);break;case 38:e.shiftKey?p=1:(e.preventDefault(),k=-1);break;case 40:e.shiftKey?p=-1:(e.preventDefault(),k=1);break;default:return}return this._rotationDisabled&&(u=0,p=0),{cameraAnimation:E=>{const T=this._tr;E.easeTo({duration:300,easeId:"keyboardHandler",easing:Ir,zoom:a?Math.round(T.zoom)+a*(e.shiftKey?2:1):T.zoom,bearing:T.bearing+u*this._bearingStep,pitch:T.pitch+p*this._pitchStep,offset:[-m*this._panStep,-k*this._panStep],center:T.center},{originalEvent:e})}}}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 Ir(g){return g*(2-g)}const Uc=4.000244140625;class cr{constructor(e,a){this._onTimeout=u=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(u)},this._map=e,this._tr=new lr(e),this._triggerRenderFrame=a,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&e.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(e){return!!this._map.cooperativeGestures.isEnabled()&&!(e.ctrlKey||this._map.cooperativeGestures.isBypassed(e))}wheel(e){if(!this.isEnabled())return;if(this._shouldBePrevented(e))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",e);let a=e.deltaMode===WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY;const u=z.now(),p=u-(this._lastWheelEventTime||0);this._lastWheelEventTime=u,a!==0&&a%Uc==0?this._type="wheel":a!==0&&Math.abs(a)<4?this._type="trackpad":p>400?(this._type=null,this._lastValue=a,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(p*a)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,a+=this._lastValue)),e.shiftKey&&a&&(a/=4),this._type&&(this._lastWheelEvent=e,this._delta-=a,this._active||this._start(e)),e.preventDefault()}_start(e){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 a=L.mousePos(this._map.getCanvas(),e),u=this._tr;this._around=a.y>u.transform.height/2-u.transform.getHorizon()?h.N.convert(this._aroundCenter?u.center:u.unproject(a)):h.N.convert(u.center),this._aroundPoint=u.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const e=this._tr.transform;if(this._delta!==0){const T=this._type==="wheel"&&Math.abs(this._delta)>Uc?this._wheelZoomRate:this._defaultZoomRate;let I=2/(1+Math.exp(-Math.abs(this._delta*T)));this._delta<0&&I!==0&&(I=1/I);const O=typeof this._targetZoom=="number"?e.zoomScale(this._targetZoom):e.scale;this._targetZoom=Math.min(e.maxZoom,Math.max(e.minZoom,e.scaleZoom(O*I))),this._type==="wheel"&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const a=typeof this._targetZoom=="number"?this._targetZoom:e.zoom,u=this._startZoom,p=this._easing;let m,k=!1;const E=z.now()-this._lastWheelEventTime;if(this._type==="wheel"&&u&&p&&E){const T=Math.min(E/200,1),I=p(T);m=h.y.number(u,a,I),T<1?this._frameId||(this._frameId=!0):k=!0}else m=a,k=!0;return this._active=!0,k&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!k,zoomDelta:m-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let a=h.b9;if(this._prevEase){const u=this._prevEase,p=(z.now()-u.start)/u.duration,m=u.easing(p+.01)-u.easing(p),k=.27/Math.sqrt(m*m+1e-4)*.01,E=Math.sqrt(.0729-k*k);a=h.b8(k,E,.25,1)}return this._prevEase={start:z.now(),duration:e,easing:a},a}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class Fs{constructor(e,a){this._clickZoom=e,this._tapZoom=a}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 hf{constructor(e){this._tr=new lr(e),this.reset()}reset(){this._active=!1}dblclick(e,a){return e.preventDefault(),{cameraAnimation:u=>{u.easeTo({duration:300,zoom:this._tr.zoom+(e.shiftKey?-1:1),around:this._tr.unproject(a)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class uf{constructor(){this._tap=new dl({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(e,a,u){if(!this._swipePoint)if(this._tapTime){const p=a[0],m=e.timeStamp-this._tapTime<500,k=this._tapPoint.dist(p)<30;m&&k?u.length>0&&(this._swipePoint=p,this._swipeTouch=u[0].identifier):this.reset()}else this._tap.touchstart(e,a,u)}touchmove(e,a,u){if(this._tapTime){if(this._swipePoint){if(u[0].identifier!==this._swipeTouch)return;const p=a[0],m=p.y-this._swipePoint.y;return this._swipePoint=p,e.preventDefault(),this._active=!0,{zoomDelta:m/128}}}else this._tap.touchmove(e,a,u)}touchend(e,a,u){if(this._tapTime)this._swipePoint&&u.length===0&&this.reset();else{const p=this._tap.touchend(e,a,u);p&&(this._tapTime=e.timeStamp,this._tapPoint=p)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Vu{constructor(e,a,u){this._el=e,this._mousePan=a,this._touchPan=u}enable(e){this._inertiaOptions=e||{},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 $u{constructor(e,a,u){this._pitchWithRotate=e.pitchWithRotate,this._mouseRotate=a,this._mousePitch=u}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 Hc{constructor(e,a,u,p){this._el=e,this._touchZoom=a,this._touchRotate=u,this._tapDragZoom=p,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),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 yo{constructor(e,a){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=e,this._options=a,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const e=this._map.getCanvasContainer();e.classList.add("maplibregl-cooperative-gestures"),this._container=L.create("div","maplibregl-cooperative-gesture-screen",e);let a=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(a=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const u=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),p=document.createElement("div");p.className="maplibregl-desktop-message",p.textContent=a,this._container.appendChild(p);const m=document.createElement("div");m.className="maplibregl-mobile-message",m.textContent=u,this._container.appendChild(m),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(L.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(e){return e[this._bypassKey]}notifyGestureBlocked(e,a){this._enabled&&(this._map.fire(new h.k("cooperativegestureprevented",{gestureType:e,originalEvent:a})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const Yn=g=>g.zoom||g.drag||g.pitch||g.rotate;class Xe extends h.k{}function yl(g){return g.panDelta&&g.panDelta.mag()||g.zoomDelta||g.bearingDelta||g.pitchDelta}class qc{constructor(e,a){this.handleWindowEvent=p=>{this.handleEvent(p,`${p.type}Window`)},this.handleEvent=(p,m)=>{if(p.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const k=p.type==="renderFrame"?void 0:p,E={needsRenderFrame:!1},T={},I={},O=p.touches,B=O?this._getMapTouches(O):void 0,U=B?L.touchPos(this._map.getCanvas(),B):L.mousePos(this._map.getCanvas(),p);for(const{handlerName:Q,handler:ne,allowed:re}of this._handlers){if(!ne.isEnabled())continue;let ae;this._blockedByActive(I,re,Q)?ne.reset():ne[m||p.type]&&(ae=ne[m||p.type](p,U,B),this.mergeHandlerResult(E,T,ae,Q,k),ae&&ae.needsRenderFrame&&this._triggerRenderFrame()),(ae||ne.isActive())&&(I[Q]=ne)}const Z={};for(const Q in this._previousActiveHandlers)I[Q]||(Z[Q]=k);this._previousActiveHandlers=I,(Object.keys(Z).length||yl(E))&&(this._changes.push([E,T,Z]),this._triggerRenderFrame()),(Object.keys(I).length||yl(E))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:G}=E;G&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],G(this._map))},this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new zc(e),this._bearingSnap=a.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(a);const u=this._el;this._listeners=[[u,"touchstart",{passive:!0}],[u,"touchmove",{passive:!1}],[u,"touchend",void 0],[u,"touchcancel",void 0],[u,"mousedown",void 0],[u,"mousemove",void 0],[u,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[u,"mouseover",void 0],[u,"mouseout",void 0],[u,"dblclick",void 0],[u,"click",void 0],[u,"keydown",{capture:!1}],[u,"keyup",void 0],[u,"wheel",{passive:!1}],[u,"contextmenu",void 0],[window,"blur",void 0]];for(const[p,m,k]of this._listeners)L.addEventListener(p,m,p===document?this.handleWindowEvent:this.handleEvent,k)}destroy(){for(const[e,a,u]of this._listeners)L.removeEventListener(e,a,e===document?this.handleWindowEvent:this.handleEvent,u)}_addDefaultHandlers(e){const a=this._map,u=a.getCanvasContainer();this._add("mapEvent",new Fu(a,e));const p=a.boxZoom=new Ln(a,e);this._add("boxZoom",p),e.interactive&&e.boxZoom&&p.enable();const m=a.cooperativeGestures=new yo(a,e.cooperativeGestures);this._add("cooperativeGestures",m),e.cooperativeGestures&&m.enable();const k=new mo(a),E=new hf(a);a.doubleClickZoom=new Fs(E,k),this._add("tapZoom",k),this._add("clickZoom",E),e.interactive&&e.doubleClickZoom&&a.doubleClickZoom.enable();const T=new uf;this._add("tapDragZoom",T);const I=a.touchPitch=new go(a);this._add("touchPitch",I),e.interactive&&e.touchPitch&&a.touchPitch.enable(e.touchPitch);const O=Bc(e),B=Fc(e);a.dragRotate=new $u(e,O,B),this._add("mouseRotate",O,["mousePitch"]),this._add("mousePitch",B,["mouseRotate"]),e.interactive&&e.dragRotate&&a.dragRotate.enable();const U=(({enable:ae,clickTolerance:X})=>{const ue=new pl({checkCorrectEvent:pe=>L.mouseButton(pe)===0&&!pe.ctrlKey});return new Hr({clickTolerance:X,move:(pe,xe)=>({around:xe,panDelta:xe.sub(pe)}),activateOnStart:!0,moveStateManager:ue,enable:ae,assignEvents:fl})})(e),Z=new Bs(e,a);a.dragPan=new Vu(u,U,Z),this._add("mousePan",U),this._add("touchPan",Z,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&a.dragPan.enable(e.dragPan);const G=new jc,Q=new Vc;a.touchZoomRotate=new Hc(u,Q,G,T),this._add("touchRotate",G,["touchPan","touchZoom"]),this._add("touchZoom",Q,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&a.touchZoomRotate.enable(e.touchZoomRotate);const ne=a.scrollZoom=new cr(a,()=>this._triggerRenderFrame());this._add("scrollZoom",ne,["mousePan"]),e.interactive&&e.scrollZoom&&a.scrollZoom.enable(e.scrollZoom);const re=a.keyboard=new Gn(a);this._add("keyboard",re),e.interactive&&e.keyboard&&a.keyboard.enable(),this._add("blockableMapEvent",new Pi(a))}_add(e,a,u){this._handlers.push({handlerName:e,handler:a,allowed:u}),this._handlersById[e]=a}stop(e){if(!this._updatingCamera){for(const{handler:a}of this._handlers)a.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[]}}isActive(){for(const{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Yn(this._eventsInProgress)||this.isZooming()}_blockedByActive(e,a,u){for(const p in e)if(p!==u&&(!a||a.indexOf(p)<0))return!0;return!1}_getMapTouches(e){const a=[];for(const u of e)this._el.contains(u.target)&&a.push(u);return a}mergeHandlerResult(e,a,u,p,m){if(!u)return;h.e(e,u);const k={handlerName:p,originalEvent:u.originalEvent||m};u.zoomDelta!==void 0&&(a.zoom=k),u.panDelta!==void 0&&(a.drag=k),u.pitchDelta!==void 0&&(a.pitch=k),u.bearingDelta!==void 0&&(a.rotate=k)}_applyChanges(){const e={},a={},u={};for(const[p,m,k]of this._changes)p.panDelta&&(e.panDelta=(e.panDelta||new h.P(0,0))._add(p.panDelta)),p.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+p.zoomDelta),p.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+p.bearingDelta),p.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+p.pitchDelta),p.around!==void 0&&(e.around=p.around),p.pinchAround!==void 0&&(e.pinchAround=p.pinchAround),p.noInertia&&(e.noInertia=p.noInertia),h.e(a,m),h.e(u,k);this._updateMapTransform(e,a,u),this._changes=[]}_updateMapTransform(e,a,u){const p=this._map,m=p._getTransformForUpdate(),k=p.terrain;if(!(yl(e)||k&&this._terrainMovement))return this._fireEvents(a,u,!0);let{panDelta:E,zoomDelta:T,bearingDelta:I,pitchDelta:O,around:B,pinchAround:U}=e;U!==void 0&&(B=U),p._stop(!0),B=B||p.transform.centerPoint;const Z=m.pointLocation(E?B.sub(E):B);I&&(m.bearing+=I),O&&(m.pitch+=O),T&&(m.zoom+=T),k?this._terrainMovement||!a.drag&&!a.zoom?a.drag&&this._terrainMovement?m.center=m.pointLocation(m.centerPoint.sub(E)):m.setLocationAtPoint(Z,B):(this._terrainMovement=!0,this._map._elevationFreeze=!0,m.setLocationAtPoint(Z,B)):m.setLocationAtPoint(Z,B),p._applyUpdatedTransform(m),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(a,u,!0)}_fireEvents(e,a,u){const p=Yn(this._eventsInProgress),m=Yn(e),k={};for(const B in e){const{originalEvent:U}=e[B];this._eventsInProgress[B]||(k[`${B}start`]=U),this._eventsInProgress[B]=e[B]}!p&&m&&this._fireEvent("movestart",m.originalEvent);for(const B in k)this._fireEvent(B,k[B]);m&&this._fireEvent("move",m.originalEvent);for(const B in e){const{originalEvent:U}=e[B];this._fireEvent(B,U)}const E={};let T;for(const B in this._eventsInProgress){const{handlerName:U,originalEvent:Z}=this._eventsInProgress[B];this._handlersById[U].isActive()||(delete this._eventsInProgress[B],T=a[U]||Z,E[`${B}end`]=T)}for(const B in E)this._fireEvent(B,E[B]);const I=Yn(this._eventsInProgress),O=(p||m)&&!I;if(O&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const B=this._map._getTransformForUpdate();B.recalculateZoom(this._map.terrain),this._map._applyUpdatedTransform(B)}if(u&&O){this._updatingCamera=!0;const B=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),U=Z=>Z!==0&&-this._bearingSnap<Z&&Z<this._bearingSnap;!B||!B.essential&&z.prefersReducedMotion?(this._map.fire(new h.k("moveend",{originalEvent:T})),U(this._map.getBearing())&&this._map.resetNorth()):(U(B.bearing||this._map.getBearing())&&(B.bearing=0),B.freezeElevation=!0,this._map.easeTo(B,{originalEvent:T})),this._updatingCamera=!1}}_fireEvent(e,a){this._map.fire(new h.k(e,a?{originalEvent:a}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(e=>{delete this._frameId,this.handleEvent(new Xe("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class ju extends h.E{constructor(e,a){super(),this._renderFrameCallback=()=>{const u=Math.min((z.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(u)),u<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=a.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new h.N(this.transform.center.lng,this.transform.center.lat)}setCenter(e,a){return this.jumpTo({center:e},a)}panBy(e,a,u){return e=h.P.convert(e).mult(-1),this.panTo(this.transform.center,h.e({offset:e},a),u)}panTo(e,a,u){return this.easeTo(h.e({center:e},a),u)}getZoom(){return this.transform.zoom}setZoom(e,a){return this.jumpTo({zoom:e},a),this}zoomTo(e,a,u){return this.easeTo(h.e({zoom:e},a),u)}zoomIn(e,a){return this.zoomTo(this.getZoom()+1,e,a),this}zoomOut(e,a){return this.zoomTo(this.getZoom()-1,e,a),this}getBearing(){return this.transform.bearing}setBearing(e,a){return this.jumpTo({bearing:e},a),this}getPadding(){return this.transform.padding}setPadding(e,a){return this.jumpTo({padding:e},a),this}rotateTo(e,a,u){return this.easeTo(h.e({bearing:e},a),u)}resetNorth(e,a){return this.rotateTo(0,h.e({duration:1e3},e),a),this}resetNorthPitch(e,a){return this.easeTo(h.e({bearing:0,pitch:0,duration:1e3},e),a),this}snapToNorth(e,a){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,a):this}getPitch(){return this.transform.pitch}setPitch(e,a){return this.jumpTo({pitch:e},a),this}cameraForBounds(e,a){e=be.convert(e).adjustAntiMeridian();const u=a&&a.bearing||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),u,a)}_cameraForBoxAndBearing(e,a,u,p){const m={top:0,bottom:0,right:0,left:0};if(typeof(p=h.e({padding:m,offset:[0,0],maxZoom:this.transform.maxZoom},p)).padding=="number"){const Oe=p.padding;p.padding={top:Oe,bottom:Oe,right:Oe,left:Oe}}p.padding=h.e(m,p.padding);const k=this.transform,E=k.padding,T=new be(e,a),I=k.project(T.getNorthWest()),O=k.project(T.getNorthEast()),B=k.project(T.getSouthEast()),U=k.project(T.getSouthWest()),Z=h.ba(-u),G=I.rotate(Z),Q=O.rotate(Z),ne=B.rotate(Z),re=U.rotate(Z),ae=new h.P(Math.max(G.x,Q.x,re.x,ne.x),Math.max(G.y,Q.y,re.y,ne.y)),X=new h.P(Math.min(G.x,Q.x,re.x,ne.x),Math.min(G.y,Q.y,re.y,ne.y)),ue=ae.sub(X),pe=(k.width-(E.left+E.right+p.padding.left+p.padding.right))/ue.x,xe=(k.height-(E.top+E.bottom+p.padding.top+p.padding.bottom))/ue.y;if(xe<0||pe<0)return void h.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");const Ce=Math.min(k.scaleZoom(k.scale*Math.min(pe,xe)),p.maxZoom),Ae=h.P.convert(p.offset),$e=new h.P((p.padding.left-p.padding.right)/2,(p.padding.top-p.padding.bottom)/2).rotate(h.ba(u)),We=Ae.add($e).mult(k.scale/k.zoomScale(Ce));return{center:k.unproject(I.add(B).div(2).sub(We)),zoom:Ce,bearing:u}}fitBounds(e,a,u){return this._fitInternal(this.cameraForBounds(e,a),a,u)}fitScreenCoordinates(e,a,u,p,m){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(h.P.convert(e)),this.transform.pointLocation(h.P.convert(a)),u,p),p,m)}_fitInternal(e,a,u){return e?(delete(a=h.e(e,a)).padding,a.linear?this.easeTo(a,u):this.flyTo(a,u)):this}jumpTo(e,a){this.stop();const u=this._getTransformForUpdate();let p=!1,m=!1,k=!1;return"zoom"in e&&u.zoom!==+e.zoom&&(p=!0,u.zoom=+e.zoom),e.center!==void 0&&(u.center=h.N.convert(e.center)),"bearing"in e&&u.bearing!==+e.bearing&&(m=!0,u.bearing=+e.bearing),"pitch"in e&&u.pitch!==+e.pitch&&(k=!0,u.pitch=+e.pitch),e.padding==null||u.isPaddingEqual(e.padding)||(u.padding=e.padding),this._applyUpdatedTransform(u),this.fire(new h.k("movestart",a)).fire(new h.k("move",a)),p&&this.fire(new h.k("zoomstart",a)).fire(new h.k("zoom",a)).fire(new h.k("zoomend",a)),m&&this.fire(new h.k("rotatestart",a)).fire(new h.k("rotate",a)).fire(new h.k("rotateend",a)),k&&this.fire(new h.k("pitchstart",a)).fire(new h.k("pitch",a)).fire(new h.k("pitchend",a)),this.fire(new h.k("moveend",a))}calculateCameraOptionsFromTo(e,a,u,p=0){const m=h.Z.fromLngLat(e,a),k=h.Z.fromLngLat(u,p),E=k.x-m.x,T=k.y-m.y,I=k.z-m.z,O=Math.hypot(E,T,I);if(O===0)throw new Error("Can't calculate camera options with same From and To");const B=Math.hypot(E,T),U=this.transform.scaleZoom(this.transform.cameraToCenterDistance/O/this.transform.tileSize),Z=180*Math.atan2(E,-T)/Math.PI;let G=180*Math.acos(B/O)/Math.PI;return G=I<0?90-G:90+G,{center:k.toLngLat(),zoom:U,pitch:G,bearing:Z}}easeTo(e,a){var u;this._stop(!1,e.easeId),((e=h.e({offset:[0,0],duration:500,easing:h.b9},e)).animate===!1||!e.essential&&z.prefersReducedMotion)&&(e.duration=0);const p=this._getTransformForUpdate(),m=p.zoom,k=p.bearing,E=p.pitch,T=p.padding,I="bearing"in e?this._normalizeBearing(e.bearing,k):k,O="pitch"in e?+e.pitch:E,B="padding"in e?e.padding:p.padding,U=h.P.convert(e.offset);let Z=p.centerPoint.add(U);const G=p.pointLocation(Z),{center:Q,zoom:ne}=p.getConstrained(h.N.convert(e.center||G),(u=e.zoom)!==null&&u!==void 0?u:m);this._normalizeCenter(Q,p);const re=p.project(G),ae=p.project(Q).sub(re),X=p.zoomScale(ne-m);let ue,pe;e.around&&(ue=h.N.convert(e.around),pe=p.locationPoint(ue));const xe={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||ne!==m,this._rotating=this._rotating||k!==I,this._pitching=this._pitching||O!==E,this._padding=!p.isPaddingEqual(B),this._easeId=e.easeId,this._prepareEase(a,e.noMoveStart,xe),this.terrain&&this._prepareElevation(Q),this._ease(Ce=>{if(this._zooming&&(p.zoom=h.y.number(m,ne,Ce)),this._rotating&&(p.bearing=h.y.number(k,I,Ce)),this._pitching&&(p.pitch=h.y.number(E,O,Ce)),this._padding&&(p.interpolatePadding(T,B,Ce),Z=p.centerPoint.add(U)),this.terrain&&!e.freezeElevation&&this._updateElevation(Ce),ue)p.setLocationAtPoint(ue,pe);else{const Ae=p.zoomScale(p.zoom-m),$e=ne>m?Math.min(2,X):Math.max(.5,X),We=Math.pow($e,1-Ce),Oe=p.unproject(re.add(ae.mult(Ce*We)).mult(Ae));p.setLocationAtPoint(p.renderWorldCopies?Oe.wrap():Oe,Z)}this._applyUpdatedTransform(p),this._fireMoveEvents(a)},Ce=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(a,Ce)},e),this}_prepareEase(e,a,u={}){this._moving=!0,a||u.moving||this.fire(new h.k("movestart",e)),this._zooming&&!u.zooming&&this.fire(new h.k("zoomstart",e)),this._rotating&&!u.rotating&&this.fire(new h.k("rotatestart",e)),this._pitching&&!u.pitching&&this.fire(new h.k("pitchstart",e))}_prepareElevation(e){this._elevationCenter=e,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(e,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(e){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const a=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(e<1&&a!==this._elevationTarget){const u=this._elevationTarget-this._elevationStart;this._elevationStart+=e*(u-(a-(u*e+this._elevationStart))/(1-e)),this._elevationTarget=a}this.transform.elevation=h.y.number(this._elevationStart,this._elevationTarget,e)}_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(e){const a=e.getCameraPosition(),u=this.terrain.getElevationForLngLatZoom(a.lngLat,e.zoom);if(a.altitude<u){const p=this.calculateCameraOptionsFromTo(a.lngLat,u,e.center,e.elevation);return{pitch:p.pitch,zoom:p.zoom}}return{}}_applyUpdatedTransform(e){const a=[];if(this.terrain&&a.push(p=>this._elevateCameraIfInsideTerrain(p)),this.transformCameraUpdate&&a.push(p=>this.transformCameraUpdate(p)),!a.length)return;const u=e.clone();for(const p of a){const m=u.clone(),{center:k,zoom:E,pitch:T,bearing:I,elevation:O}=p(m);k&&(m.center=k),E!==void 0&&(m.zoom=E),T!==void 0&&(m.pitch=T),I!==void 0&&(m.bearing=I),O!==void 0&&(m.elevation=O),u.apply(m)}this.transform.apply(u)}_fireMoveEvents(e){this.fire(new h.k("move",e)),this._zooming&&this.fire(new h.k("zoom",e)),this._rotating&&this.fire(new h.k("rotate",e)),this._pitching&&this.fire(new h.k("pitch",e))}_afterEase(e,a){if(this._easeId&&a&&this._easeId===a)return;delete this._easeId;const u=this._zooming,p=this._rotating,m=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,u&&this.fire(new h.k("zoomend",e)),p&&this.fire(new h.k("rotateend",e)),m&&this.fire(new h.k("pitchend",e)),this.fire(new h.k("moveend",e))}flyTo(e,a){var u;if(!e.essential&&z.prefersReducedMotion){const Ue=h.M(e,["center","zoom","bearing","pitch","around"]);return this.jumpTo(Ue,a)}this.stop(),e=h.e({offset:[0,0],speed:1.2,curve:1.42,easing:h.b9},e);const p=this._getTransformForUpdate(),m=p.zoom,k=p.bearing,E=p.pitch,T=p.padding,I="bearing"in e?this._normalizeBearing(e.bearing,k):k,O="pitch"in e?+e.pitch:E,B="padding"in e?e.padding:p.padding,U=h.P.convert(e.offset);let Z=p.centerPoint.add(U);const G=p.pointLocation(Z),{center:Q,zoom:ne}=p.getConstrained(h.N.convert(e.center||G),(u=e.zoom)!==null&&u!==void 0?u:m);this._normalizeCenter(Q,p);const re=p.zoomScale(ne-m),ae=p.project(G),X=p.project(Q).sub(ae);let ue=e.curve;const pe=Math.max(p.width,p.height),xe=pe/re,Ce=X.mag();if("minZoom"in e){const Ue=h.ac(Math.min(e.minZoom,m,ne),p.minZoom,p.maxZoom),yt=pe/p.zoomScale(Ue-m);ue=Math.sqrt(yt/Ce*2)}const Ae=ue*ue;function $e(Ue){const yt=(xe*xe-pe*pe+(Ue?-1:1)*Ae*Ae*Ce*Ce)/(2*(Ue?xe:pe)*Ae*Ce);return Math.log(Math.sqrt(yt*yt+1)-yt)}function We(Ue){return(Math.exp(Ue)-Math.exp(-Ue))/2}function Oe(Ue){return(Math.exp(Ue)+Math.exp(-Ue))/2}const Re=$e(!1);let et=function(Ue){return Oe(Re)/Oe(Re+ue*Ue)},bt=function(Ue){return pe*((Oe(Re)*(We(yt=Re+ue*Ue)/Oe(yt))-We(Re))/Ae)/Ce;var yt},Fe=($e(!0)-Re)/ue;if(Math.abs(Ce)<1e-6||!isFinite(Fe)){if(Math.abs(pe-xe)<1e-6)return this.easeTo(e,a);const Ue=xe<pe?-1:1;Fe=Math.abs(Math.log(xe/pe))/ue,bt=()=>0,et=yt=>Math.exp(Ue*ue*yt)}return e.duration="duration"in e?+e.duration:1e3*Fe/("screenSpeed"in e?+e.screenSpeed/ue:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=k!==I,this._pitching=O!==E,this._padding=!p.isPaddingEqual(B),this._prepareEase(a,!1),this.terrain&&this._prepareElevation(Q),this._ease(Ue=>{const yt=Ue*Fe,gi=1/et(yt);p.zoom=Ue===1?ne:m+p.scaleZoom(gi),this._rotating&&(p.bearing=h.y.number(k,I,Ue)),this._pitching&&(p.pitch=h.y.number(E,O,Ue)),this._padding&&(p.interpolatePadding(T,B,Ue),Z=p.centerPoint.add(U)),this.terrain&&!e.freezeElevation&&this._updateElevation(Ue);const Ct=Ue===1?Q:p.unproject(ae.add(X.mult(bt(yt))).mult(gi));p.setLocationAtPoint(p.renderWorldCopies?Ct.wrap():Ct,Z),this._applyUpdatedTransform(p),this._fireMoveEvents(a)},()=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(a)},e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(e,a){var u;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const p=this._onEaseEnd;delete this._onEaseEnd,p.call(this,a)}return e||(u=this.handlers)===null||u===void 0||u.stop(!1),this}_ease(e,a,u){u.animate===!1||u.duration===0?(e(1),a()):(this._easeStart=z.now(),this._easeOptions=u,this._onEaseFrame=e,this._onEaseEnd=a,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,a){e=h.b3(e,-180,180);const u=Math.abs(e-a);return Math.abs(e-360-a)<u&&(e-=360),Math.abs(e+360-a)<u&&(e+=360),e}_normalizeCenter(e,a){if(!a.renderWorldCopies||a.lngRange)return;const u=e.lng-a.center.lng;e.lng+=u>180?-360:u<-180?360:0}queryTerrainElevation(e){return this.terrain?this.terrain.getElevationForLngLatZoom(h.N.convert(e),this.transform.tileZoom)-this.transform.elevation:null}}const _o={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class xo{constructor(e=_o){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=a=>{!a||a.sourceDataType!=="metadata"&&a.sourceDataType!=="visibility"&&a.dataType!=="style"&&a.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=e}getDefaultPosition(){return"bottom-right"}onAdd(e){return this._map=e,this._compact=this.options.compact,this._container=L.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=L.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=L.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(){L.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(e,a){const u=this._map._getUIString(`AttributionControl.${a}`);e.title=u,e.setAttribute("aria-label",u)}_updateAttributions(){if(!this._map.style)return;let e=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map(p=>typeof p!="string"?"":p)):typeof this.options.customAttribution=="string"&&e.push(this.options.customAttribution)),this._map.style.stylesheet){const p=this._map.style.stylesheet;this.styleOwner=p.owner,this.styleId=p.id}const a=this._map.style.sourceCaches;for(const p in a){const m=a[p];if(m.used||m.usedForTerrain){const k=m.getSource();k.attribution&&e.indexOf(k.attribution)<0&&e.push(k.attribution)}}e=e.filter(p=>String(p).trim()),e.sort((p,m)=>p.length-m.length),e=e.filter((p,m)=>{for(let k=m+1;k<e.length;k++)if(e[k].indexOf(p)>=0)return!1;return!0});const u=e.join(" | ");u!==this._attribHTML&&(this._attribHTML=u,e.length?(this._innerContainer.innerHTML=u,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class Zc{constructor(e={}){this._updateCompact=()=>{const a=this._container.children;if(a.length){const u=a[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&u.classList.add("maplibregl-compact"):u.classList.remove("maplibregl-compact")}},this.options=e}getDefaultPosition(){return"bottom-left"}onAdd(e){this._map=e,this._compact=this.options&&this.options.compact,this._container=L.create("div","maplibregl-ctrl");const a=L.create("a","maplibregl-ctrl-logo");return a.target="_blank",a.rel="noopener nofollow",a.href="https://maplibre.org/",a.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),a.setAttribute("rel","noopener nofollow"),this._container.appendChild(a),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){L.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class Bt{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){const a=++this._id;return this._queue.push({callback:e,id:a,cancelled:!1}),a}remove(e){const a=this._currentlyRunning,u=a?this._queue.concat(a):this._queue;for(const p of u)if(p.id===e)return void(p.cancelled=!0)}run(e=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const a=this._currentlyRunning=this._queue;this._queue=[];for(const u of a)if(!u.cancelled&&(u.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var Wc=h.Y([{name:"a_pos3d",type:"Int16",components:3}]);class df extends h.E{constructor(e){super(),this.sourceCache=e,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,e.usedForTerrain=!0,e.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(e,a){this.sourceCache.update(e,a),this._renderableTilesKeys=[];const u={};for(const p of e.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:a}))u[p.key]=!0,this._renderableTilesKeys.push(p.key),this._tiles[p.key]||(p.posMatrix=new Float64Array(16),h.aP(p.posMatrix,0,h.X,0,h.X,0,1),this._tiles[p.key]=new ns(p,this.tileSize));for(const p in this._tiles)u[p]||delete this._tiles[p]}freeRtt(e){for(const a in this._tiles){const u=this._tiles[a];(!e||u.tileID.equals(e)||u.tileID.isChildOf(e)||e.isChildOf(u.tileID))&&(u.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(e=>this.getTileByID(e))}getTileByID(e){return this._tiles[e]}getTerrainCoords(e){const a={};for(const u of this._renderableTilesKeys){const p=this._tiles[u].tileID;if(p.canonical.equals(e.canonical)){const m=e.clone();m.posMatrix=new Float64Array(16),h.aP(m.posMatrix,0,h.X,0,h.X,0,1),a[u]=m}else if(p.canonical.isChildOf(e.canonical)){const m=e.clone();m.posMatrix=new Float64Array(16);const k=p.canonical.z-e.canonical.z,E=p.canonical.x-(p.canonical.x>>k<<k),T=p.canonical.y-(p.canonical.y>>k<<k),I=h.X>>k;h.aP(m.posMatrix,0,I,0,I,0,1),h.J(m.posMatrix,m.posMatrix,[-E*I,-T*I,0]),a[u]=m}else if(e.canonical.isChildOf(p.canonical)){const m=e.clone();m.posMatrix=new Float64Array(16);const k=e.canonical.z-p.canonical.z,E=e.canonical.x-(e.canonical.x>>k<<k),T=e.canonical.y-(e.canonical.y>>k<<k),I=h.X>>k;h.aP(m.posMatrix,0,h.X,0,h.X,0,1),h.J(m.posMatrix,m.posMatrix,[E*I,T*I,0]),h.K(m.posMatrix,m.posMatrix,[1/2**k,1/2**k,0]),a[u]=m}}return a}getSourceTile(e,a){const u=this.sourceCache._source;let p=e.overscaledZ-this.deltaZoom;if(p>u.maxzoom&&(p=u.maxzoom),p<u.minzoom)return null;this._sourceTileCache[e.key]||(this._sourceTileCache[e.key]=e.scaledTo(p).key);let m=this.sourceCache.getTileByID(this._sourceTileCache[e.key]);if((!m||!m.dem)&&a)for(;p>=u.minzoom&&(!m||!m.dem);)m=this.sourceCache.getTileByID(e.scaledTo(p--).key);return m}tilesAfterTime(e=Date.now()){return Object.values(this._tiles).filter(a=>a.timeAdded>=e)}}class Gc{constructor(e,a,u){this.painter=e,this.sourceCache=new df(a),this.options=u,this.exaggeration=typeof u.exaggeration=="number"?u.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(e,a,u,p=h.X){var m;if(!(a>=0&&a<p&&u>=0&&u<p))return 0;const k=this.getTerrainData(e),E=(m=k.tile)===null||m===void 0?void 0:m.dem;if(!E)return 0;const T=function(G,Q,ne){var re=Q[0],ae=Q[1];return G[0]=ne[0]*re+ne[4]*ae+ne[12],G[1]=ne[1]*re+ne[5]*ae+ne[13],G}([],[a/p*h.X,u/p*h.X],k.u_terrain_matrix),I=[T[0]*E.dim,T[1]*E.dim],O=Math.floor(I[0]),B=Math.floor(I[1]),U=I[0]-O,Z=I[1]-B;return E.get(O,B)*(1-U)*(1-Z)+E.get(O+1,B)*U*(1-Z)+E.get(O,B+1)*(1-U)*Z+E.get(O+1,B+1)*U*Z}getElevationForLngLatZoom(e,a){if(!h.bb(a,e.wrap()))return 0;const{tileID:u,mercatorX:p,mercatorY:m}=this._getOverscaledTileIDFromLngLatZoom(e,a);return this.getElevation(u,p%h.X,m%h.X,h.X)}getElevation(e,a,u,p=h.X){return this.getDEMElevation(e,a,u,p)*this.exaggeration}getTerrainData(e){if(!this._emptyDemTexture){const p=this.painter.context,m=new h.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new Et(p,m,p.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new Et(p,new h.R({width:1,height:1}),p.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(p.gl.NEAREST,p.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=h.an([])}const a=this.sourceCache.getSourceTile(e,!0);if(a&&a.dem&&(!a.demTexture||a.needsTerrainPrepare)){const p=this.painter.context;a.demTexture=this.painter.getTileTexture(a.dem.stride),a.demTexture?a.demTexture.update(a.dem.getPixels(),{premultiply:!1}):a.demTexture=new Et(p,a.dem.getPixels(),p.gl.RGBA,{premultiply:!1}),a.demTexture.bind(p.gl.NEAREST,p.gl.CLAMP_TO_EDGE),a.needsTerrainPrepare=!1}const u=a&&a+a.tileID.key+e.key;if(u&&!this._demMatrixCache[u]){const p=this.sourceCache.sourceCache._source.maxzoom;let m=e.canonical.z-a.tileID.canonical.z;e.overscaledZ>e.canonical.z&&(e.canonical.z>=p?m=e.canonical.z-p:h.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const k=e.canonical.x-(e.canonical.x>>m<<m),E=e.canonical.y-(e.canonical.y>>m<<m),T=h.bc(new Float64Array(16),[1/(h.X<<m),1/(h.X<<m),0]);h.J(T,T,[k*h.X,E*h.X,0]),this._demMatrixCache[e.key]={matrix:T,coord:e}}return{u_depth:2,u_terrain:3,u_terrain_dim:a&&a.dem&&a.dem.dim||1,u_terrain_matrix:u?this._demMatrixCache[e.key].matrix:this._emptyDemMatrix,u_terrain_unpack:a&&a.dem&&a.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(a&&a.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:a}}getFramebuffer(e){const a=this.painter,u=a.width/devicePixelRatio,p=a.height/devicePixelRatio;return!this._fbo||this._fbo.width===u&&this._fbo.height===p||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new Et(a.context,{width:u,height:p,data:null},a.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(a.context.gl.NEAREST,a.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new Et(a.context,{width:u,height:p,data:null},a.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(a.context.gl.NEAREST,a.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=a.context.createFramebuffer(u,p,!0,!1),this._fbo.depthAttachment.set(a.context.createRenderbuffer(a.context.gl.DEPTH_COMPONENT16,u,p))),this._fbo.colorAttachment.set(e==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const e=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const a=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let m=0,k=0;m<this._coordsTextureSize;m++)for(let E=0;E<this._coordsTextureSize;E++,k+=4)a[k+0]=255&E,a[k+1]=255&m,a[k+2]=E>>8<<4|m>>8,a[k+3]=0;const u=new h.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(a.buffer)),p=new Et(e,u,e.gl.RGBA,{premultiply:!1});return p.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._coordsTexture=p,p}pointCoordinate(e){this.painter.maybeDrawDepthAndCoords(!0);const a=new Uint8Array(4),u=this.painter.context,p=u.gl,m=Math.round(e.x*this.painter.pixelRatio/devicePixelRatio),k=Math.round(e.y*this.painter.pixelRatio/devicePixelRatio),E=Math.round(this.painter.height/devicePixelRatio);u.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),p.readPixels(m,E-k-1,1,1,p.RGBA,p.UNSIGNED_BYTE,a),u.bindFramebuffer.set(null);const T=a[0]+(a[2]>>4<<8),I=a[1]+((15&a[2])<<8),O=this.coordsIndex[255-a[3]],B=O&&this.sourceCache.getTileByID(O);if(!B)return null;const U=this._coordsTextureSize,Z=(1<<B.tileID.canonical.z)*U;return new h.Z((B.tileID.canonical.x*U+T)/Z+B.tileID.wrap,(B.tileID.canonical.y*U+I)/Z,this.getElevation(B.tileID,T,I,U))}depthAtPoint(e){const a=new Uint8Array(4),u=this.painter.context,p=u.gl;return u.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),p.readPixels(e.x,this.painter.height/devicePixelRatio-e.y-1,1,1,p.RGBA,p.UNSIGNED_BYTE,a),u.bindFramebuffer.set(null),(a[0]/16777216+a[1]/65536+a[2]/256+a[3])/256}getTerrainMesh(){if(this._mesh)return this._mesh;const e=this.painter.context,a=new h.bd,u=new h.aY,p=this.meshSize,m=h.X/p,k=p*p;for(let B=0;B<=p;B++)for(let U=0;U<=p;U++)a.emplaceBack(U*m,B*m,0);for(let B=0;B<k;B+=p+1)for(let U=0;U<p;U++)u.emplaceBack(U+B,p+U+B+1,p+U+B+2),u.emplaceBack(U+B,p+U+B+2,U+B+1);const E=a.length,T=E+2*(p+1);for(const B of[0,1])for(let U=0;U<=p;U++)for(const Z of[0,1])a.emplaceBack(U*m,B*h.X,Z);for(let B=0;B<2*p;B+=2)u.emplaceBack(T+B,T+B+1,T+B+3),u.emplaceBack(T+B,T+B+3,T+B+2),u.emplaceBack(E+B,E+B+3,E+B+1),u.emplaceBack(E+B,E+B+2,E+B+3);const I=a.length,O=I+2*(p+1);for(const B of[0,1])for(let U=0;U<=p;U++)for(const Z of[0,1])a.emplaceBack(B*h.X,U*m,Z);for(let B=0;B<2*p;B+=2)u.emplaceBack(I+B,I+B+1,I+B+3),u.emplaceBack(I+B,I+B+3,I+B+2),u.emplaceBack(O+B,O+B+3,O+B+1),u.emplaceBack(O+B,O+B+2,O+B+3);return this._mesh=new al(e.createVertexBuffer(a,Wc.members),e.createIndexBuffer(u),h.a0.simpleSegment(0,0,a.length,u.length)),this._mesh}getMeshFrameDelta(e){return 2*Math.PI*h.be/Math.pow(2,e)/5}getMinTileElevationForLngLatZoom(e,a){var u;const{tileID:p}=this._getOverscaledTileIDFromLngLatZoom(e,a);return(u=this.getMinMaxElevation(p).minElevation)!==null&&u!==void 0?u:0}getMinMaxElevation(e){const a=this.getTerrainData(e).tile,u={minElevation:null,maxElevation:null};return a&&a.dem&&(u.minElevation=a.dem.min*this.exaggeration,u.maxElevation=a.dem.max*this.exaggeration),u}_getOverscaledTileIDFromLngLatZoom(e,a){const u=h.Z.fromLngLat(e.wrap()),p=(1<<a)*h.X,m=u.x*p,k=u.y*p,E=Math.floor(m/h.X),T=Math.floor(k/h.X);return{tileID:new h.S(a,0,a,E,T),mercatorX:m,mercatorY:k}}}class pf{constructor(e,a,u){this._context=e,this._size=a,this._tileSize=u,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const e of this._objects)e.texture.destroy(),e.fbo.destroy()}_createObject(e){const a=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),u=new Et(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return u.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),a.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),a.colorAttachment.set(u.texture),{id:e,fbo:a,texture:u,stamp:-1,inUse:!1}}getObjectForId(e){return this._objects[e]}useObject(e){e.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(a=>e.id!==a),this._recentlyUsed.push(e.id)}stampObject(e){e.stamp=++this._stamp}getOrCreateFreeObject(){for(const a of this._recentlyUsed)if(!this._objects[a].inUse)return this._objects[a];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const e=this._createObject(this._objects.length);return this._objects.push(e),e}freeObject(e){e.inUse=!1}freeAllObjects(){for(const e of this._objects)this.freeObject(e)}isFull(){return!(this._objects.length<this._size)&&this._objects.some(e=>!e.inUse)===!1}}const bo={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class Uu{constructor(e,a){this.painter=e,this.terrain=a,this.pool=new pf(e.context,30,a.sourceCache.tileSize*a.qualityFactor)}destruct(){this.pool.destruct()}getTexture(e){return this.pool.getObjectForId(e.rtt[this._stacks.length-1].id).texture}prepareForRender(e,a){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=e._order.filter(u=>!e._layers[u].isHidden(a)),this._coordsDescendingInv={};for(const u in e.sourceCaches){this._coordsDescendingInv[u]={};const p=e.sourceCaches[u].getVisibleCoordinates();for(const m of p){const k=this.terrain.sourceCache.getTerrainCoords(m);for(const E in k)this._coordsDescendingInv[u][E]||(this._coordsDescendingInv[u][E]=[]),this._coordsDescendingInv[u][E].push(k[E])}}this._coordsDescendingInvStr={};for(const u of e._order){const p=e._layers[u],m=p.source;if(bo[p.type]&&!this._coordsDescendingInvStr[m]){this._coordsDescendingInvStr[m]={};for(const k in this._coordsDescendingInv[m])this._coordsDescendingInvStr[m][k]=this._coordsDescendingInv[m][k].map(E=>E.key).sort().join()}}for(const u of this._renderableTiles)for(const p in this._coordsDescendingInvStr){const m=this._coordsDescendingInvStr[p][u.tileID.key];m&&m!==u.rttCoords[p]&&(u.rtt=[])}}renderLayer(e){if(e.isHidden(this.painter.transform.zoom))return!1;const a=e.type,u=this.painter,p=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(bo[a]&&(this._prevType&&bo[this._prevType]||this._stacks.push([]),this._prevType=a,this._stacks[this._stacks.length-1].push(e.id),!p))return!0;if(bo[this._prevType]||bo[a]&&p){this._prevType=a;const m=this._stacks.length-1,k=this._stacks[m]||[];for(const E of this._renderableTiles){if(this.pool.isFull()&&(Ru(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(E),E.rtt[m]){const I=this.pool.getObjectForId(E.rtt[m].id);if(I.stamp===E.rtt[m].stamp){this.pool.useObject(I);continue}}const T=this.pool.getOrCreateFreeObject();this.pool.useObject(T),this.pool.stampObject(T),E.rtt[m]={id:T.id,stamp:T.stamp},u.context.bindFramebuffer.set(T.fbo.framebuffer),u.context.clear({color:h.aM.transparent,stencil:0}),u.currentStencilSource=void 0;for(let I=0;I<k.length;I++){const O=u.style._layers[k[I]],B=O.source?this._coordsDescendingInv[O.source][E.tileID.key]:[E.tileID];u.context.viewport.set([0,0,T.fbo.width,T.fbo.height]),u._renderTileClippingMasks(O,B),u.renderLayer(u,u.style.sourceCaches[O.source],O,B),O.source&&(E.rttCoords[O.source]=this._coordsDescendingInvStr[O.source][E.tileID.key])}}return Ru(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects(),bo[a]}return!1}}const Yc={"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"},Hu=M,ff={hash:!1,interactive:!0,bearingSnap:7,attributionControl:_o,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:h.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},Xc=g=>{g.touchstart=g.dragStart,g.touchmoveWindow=g.dragMove,g.touchend=g.dragEnd},mf={showCompass:!0,showZoom:!0,visualizePitch:!1};class gf{constructor(e,a,u=!1){this.mousedown=k=>{this.startMouse(h.e({},k,{ctrlKey:!0,preventDefault:()=>k.preventDefault()}),L.mousePos(this.element,k)),L.addEventListener(window,"mousemove",this.mousemove),L.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=k=>{this.moveMouse(k,L.mousePos(this.element,k))},this.mouseup=k=>{this.mouseRotate.dragEnd(k),this.mousePitch&&this.mousePitch.dragEnd(k),this.offTemp()},this.touchstart=k=>{k.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=L.touchPos(this.element,k.targetTouches)[0],this.startTouch(k,this._startPos),L.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),L.addEventListener(window,"touchend",this.touchend))},this.touchmove=k=>{k.targetTouches.length!==1?this.reset():(this._lastPos=L.touchPos(this.element,k.targetTouches)[0],this.moveTouch(k,this._lastPos))},this.touchend=k=>{k.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 p=e.dragRotate._mouseRotate.getClickTolerance(),m=e.dragRotate._mousePitch.getClickTolerance();this.element=a,this.mouseRotate=Bc({clickTolerance:p,enable:!0}),this.touchRotate=(({enable:k,clickTolerance:E,bearingDegreesPerPixelMoved:T=.8})=>{const I=new Oc;return new Hr({clickTolerance:E,move:(O,B)=>({bearingDelta:(B.x-O.x)*T}),moveStateManager:I,enable:k,assignEvents:Xc})})({clickTolerance:p,enable:!0}),this.map=e,u&&(this.mousePitch=Fc({clickTolerance:m,enable:!0}),this.touchPitch=(({enable:k,clickTolerance:E,pitchDegreesPerPixelMoved:T=-.5})=>{const I=new Oc;return new Hr({clickTolerance:E,move:(O,B)=>({pitchDelta:(B.y-O.y)*T}),moveStateManager:I,enable:k,assignEvents:Xc})})({clickTolerance:m,enable:!0})),L.addEventListener(a,"mousedown",this.mousedown),L.addEventListener(a,"touchstart",this.touchstart,{passive:!1}),L.addEventListener(a,"touchcancel",this.reset)}startMouse(e,a){this.mouseRotate.dragStart(e,a),this.mousePitch&&this.mousePitch.dragStart(e,a),L.disableDrag()}startTouch(e,a){this.touchRotate.dragStart(e,a),this.touchPitch&&this.touchPitch.dragStart(e,a),L.disableDrag()}moveMouse(e,a){const u=this.map,{bearingDelta:p}=this.mouseRotate.dragMove(e,a)||{};if(p&&u.setBearing(u.getBearing()+p),this.mousePitch){const{pitchDelta:m}=this.mousePitch.dragMove(e,a)||{};m&&u.setPitch(u.getPitch()+m)}}moveTouch(e,a){const u=this.map,{bearingDelta:p}=this.touchRotate.dragMove(e,a)||{};if(p&&u.setBearing(u.getBearing()+p),this.touchPitch){const{pitchDelta:m}=this.touchPitch.dragMove(e,a)||{};m&&u.setPitch(u.getPitch()+m)}}off(){const e=this.element;L.removeEventListener(e,"mousedown",this.mousedown),L.removeEventListener(e,"touchstart",this.touchstart,{passive:!1}),L.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),L.removeEventListener(window,"touchend",this.touchend),L.removeEventListener(e,"touchcancel",this.reset),this.offTemp()}offTemp(){L.enableDrag(),L.removeEventListener(window,"mousemove",this.mousemove),L.removeEventListener(window,"mouseup",this.mouseup),L.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),L.removeEventListener(window,"touchend",this.touchend)}}let Rn;function mi(g,e,a){const u=new h.N(g.lng,g.lat);if(g=new h.N(g.lng,g.lat),e){const p=new h.N(g.lng-360,g.lat),m=new h.N(g.lng+360,g.lat),k=a.locationPoint(g).distSqr(e);a.locationPoint(p).distSqr(e)<k?g=p:a.locationPoint(m).distSqr(e)<k&&(g=m)}for(;Math.abs(g.lng-a.center.lng)>180;){const p=a.locationPoint(g);if(p.x>=0&&p.y>=0&&p.x<=a.width&&p.y<=a.height)break;g.lng>a.center.lng?g.lng-=360:g.lng+=360}return g.lng!==u.lng&&a.locationPoint(g).y>a.height/2-a.getHorizon()?g:u}const vo={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 _l(g,e,a){const u=g.classList;for(const p in vo)u.remove(`maplibregl-${a}-anchor-${p}`);u.add(`maplibregl-${a}-anchor-${e}`)}class xl extends h.E{constructor(e){if(super(),this._onKeyPress=a=>{const u=a.code,p=a.charCode||a.keyCode;u!=="Space"&&u!=="Enter"&&p!==32&&p!==13||this.togglePopup()},this._onMapClick=a=>{const u=a.originalEvent.target,p=this._element;this._popup&&(u===p||p.contains(u))&&this.togglePopup()},this._update=a=>{var u;if(!this._map)return;const p=this._map.loaded()&&!this._map.isMoving();((a==null?void 0:a.type)==="terrain"||(a==null?void 0:a.type)==="render"&&!p)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?mi(this._lngLat,this._flatPos,this._map.transform):(u=this._lngLat)===null||u===void 0?void 0:u.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 m="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?m=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(m=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let k="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?k="rotateX(0deg)":this._pitchAlignment==="map"&&(k=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||a&&a.type!=="moveend"||(this._pos=this._pos.round()),L.setTransform(this._element,`${vo[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${k} ${m}`),z.frameAsync(new AbortController).then(()=>{this._updateOpacity(a&&a.type==="moveend")}).catch(()=>{})},this._onMove=a=>{if(!this._isDragging){const u=this._clickTolerance||this._map._clickTolerance;this._isDragging=a.point.dist(this._pointerdownPos)>=u}this._isDragging&&(this._pos=a.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 h.k("dragstart"))),this.fire(new h.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 h.k("dragend")),this._state="inactive"},this._addDragHandler=a=>{this._element.contains(a.originalEvent.target)&&(a.preventDefault(),this._positionDelta=a.point.sub(this._pos).add(this._offset),this._pointerdownPos=a.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=e&&e.anchor||"center",this._color=e&&e.color||"#3FB1CE",this._scale=e&&e.scale||1,this._draggable=e&&e.draggable||!1,this._clickTolerance=e&&e.clickTolerance||0,this._subpixelPositioning=e&&e.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=e&&e.rotation||0,this._rotationAlignment=e&&e.rotationAlignment||"auto",this._pitchAlignment=e&&e.pitchAlignment&&e.pitchAlignment!=="auto"?e.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(e==null?void 0:e.opacity,e==null?void 0:e.opacityWhenCovered),e&&e.element)this._element=e.element,this._offset=h.P.convert(e&&e.offset||[0,0]);else{this._defaultMarker=!0,this._element=L.create("div");const a=L.createNS("http://www.w3.org/2000/svg","svg"),u=41,p=27;a.setAttributeNS(null,"display","block"),a.setAttributeNS(null,"height",`${u}px`),a.setAttributeNS(null,"width",`${p}px`),a.setAttributeNS(null,"viewBox",`0 0 ${p} ${u}`);const m=L.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"stroke","none"),m.setAttributeNS(null,"stroke-width","1"),m.setAttributeNS(null,"fill","none"),m.setAttributeNS(null,"fill-rule","evenodd");const k=L.createNS("http://www.w3.org/2000/svg","g");k.setAttributeNS(null,"fill-rule","nonzero");const E=L.createNS("http://www.w3.org/2000/svg","g");E.setAttributeNS(null,"transform","translate(3.0, 29.0)"),E.setAttributeNS(null,"fill","#000000");const T=[{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 re of T){const ae=L.createNS("http://www.w3.org/2000/svg","ellipse");ae.setAttributeNS(null,"opacity","0.04"),ae.setAttributeNS(null,"cx","10.5"),ae.setAttributeNS(null,"cy","5.80029008"),ae.setAttributeNS(null,"rx",re.rx),ae.setAttributeNS(null,"ry",re.ry),E.appendChild(ae)}const I=L.createNS("http://www.w3.org/2000/svg","g");I.setAttributeNS(null,"fill",this._color);const O=L.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"),I.appendChild(O);const B=L.createNS("http://www.w3.org/2000/svg","g");B.setAttributeNS(null,"opacity","0.25"),B.setAttributeNS(null,"fill","#000000");const U=L.createNS("http://www.w3.org/2000/svg","path");U.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"),B.appendChild(U);const Z=L.createNS("http://www.w3.org/2000/svg","g");Z.setAttributeNS(null,"transform","translate(6.0, 7.0)"),Z.setAttributeNS(null,"fill","#FFFFFF");const G=L.createNS("http://www.w3.org/2000/svg","g");G.setAttributeNS(null,"transform","translate(8.0, 8.0)");const Q=L.createNS("http://www.w3.org/2000/svg","circle");Q.setAttributeNS(null,"fill","#000000"),Q.setAttributeNS(null,"opacity","0.25"),Q.setAttributeNS(null,"cx","5.5"),Q.setAttributeNS(null,"cy","5.5"),Q.setAttributeNS(null,"r","5.4999962");const ne=L.createNS("http://www.w3.org/2000/svg","circle");ne.setAttributeNS(null,"fill","#FFFFFF"),ne.setAttributeNS(null,"cx","5.5"),ne.setAttributeNS(null,"cy","5.5"),ne.setAttributeNS(null,"r","5.4999962"),G.appendChild(Q),G.appendChild(ne),k.appendChild(E),k.appendChild(I),k.appendChild(B),k.appendChild(Z),k.appendChild(G),a.appendChild(k),a.setAttributeNS(null,"height",u*this._scale+"px"),a.setAttributeNS(null,"width",p*this._scale+"px"),this._element.appendChild(a),this._offset=h.P.convert(e&&e.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",a=>{a.preventDefault()}),this._element.addEventListener("mousedown",a=>{a.preventDefault()}),_l(this._element,this._anchor,"marker"),e&&e.className)for(const a of e.className.split(" "))this._element.classList.add(a);this._popup=null}addTo(e){return this.remove(),this._map=e,this._element.setAttribute("aria-label",e._getUIString("Marker.Title")),e.getCanvasContainer().appendChild(this._element),e.on("move",this._update),e.on("moveend",this._update),e.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),L.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=h.N.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),e){if(!("offset"in e.options)){const p=Math.abs(13.5)/Math.SQRT2;e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[p,-1*(38.1-13.5+p)],"bottom-right":[-p,-1*(38.1-13.5+p)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=e,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(e){return this._subpixelPositioning=e,this}getPopup(){return this._popup}togglePopup(){const e=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:e?(e.isOpen()?e.remove():(e.setLngLat(this._lngLat),e.addTo(this._map)),this):this}_updateOpacity(e=!1){var a,u;if(!(!((a=this._map)===null||a===void 0)&&a.terrain))return void(this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity));if(e)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const p=this._map,m=p.terrain.depthAtPoint(this._pos),k=p.terrain.getElevationForLngLatZoom(this._lngLat,p.transform.tileZoom);if(p.transform.lngLatToCameraDepth(this._lngLat,k)-m<.006)return void(this._element.style.opacity=this._opacity);const E=-this._offset.y/p.transform._pixelPerMeter,T=Math.sin(p.getPitch()*Math.PI/180)*E,I=p.terrain.depthAtPoint(new h.P(this._pos.x,this._pos.y-this._offset.y)),O=p.transform.lngLatToCameraDepth(this._lngLat,k+T)-I>.006;!((u=this._popup)===null||u===void 0)&&u.isOpen()&&O&&this._popup.remove(),this._element.style.opacity=O?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(e){return this._offset=h.P.convert(e),this._update(),this}addClassName(e){this._element.classList.add(e)}removeClassName(e){this._element.classList.remove(e)}toggleClassName(e){return this._element.classList.toggle(e)}setDraggable(e){return this._draggable=!!e,this._map&&(e?(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(e){return this._rotation=e||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(e){return this._rotationAlignment=e||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(e){return this._pitchAlignment=e&&e!=="auto"?e:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(e,a){return e===void 0&&a===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),e!==void 0&&(this._opacity=e),a!==void 0&&(this._opacityWhenCovered=a),this._map&&this._updateOpacity(!0),this}}const qu={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let pa=0,fa=!1;const Ar={maxWidth:100,unit:"metric"};function ma(g,e,a){const u=a&&a.maxWidth||100,p=g._container.clientHeight/2,m=g.unproject([0,p]),k=g.unproject([u,p]),E=m.distanceTo(k);if(a&&a.unit==="imperial"){const T=3.2808*E;T>5280?Qe(e,u,T/5280,g._getUIString("ScaleControl.Miles")):Qe(e,u,T,g._getUIString("ScaleControl.Feet"))}else a&&a.unit==="nautical"?Qe(e,u,E/1852,g._getUIString("ScaleControl.NauticalMiles")):E>=1e3?Qe(e,u,E/1e3,g._getUIString("ScaleControl.Kilometers")):Qe(e,u,E,g._getUIString("ScaleControl.Meters"))}function Qe(g,e,a,u){const p=function(m){const k=Math.pow(10,`${Math.floor(m)}`.length-1);let E=m/k;return E=E>=10?10:E>=5?5:E>=3?3:E>=2?2:E>=1?1:function(T){const I=Math.pow(10,Math.ceil(-Math.log(T)/Math.LN10));return Math.round(T*I)/I}(E),k*E}(a);g.style.width=e*(p/a)+"px",g.innerHTML=`${p} ${u}`}const ut={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},bl=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function vl(g){if(g){if(typeof g=="number"){const e=Math.round(Math.abs(g)/Math.SQRT2);return{center:new h.P(0,0),top:new h.P(0,g),"top-left":new h.P(e,e),"top-right":new h.P(-e,e),bottom:new h.P(0,-g),"bottom-left":new h.P(e,-e),"bottom-right":new h.P(-e,-e),left:new h.P(g,0),right:new h.P(-g,0)}}if(g instanceof h.P||Array.isArray(g)){const e=h.P.convert(g);return{center:e,top:e,"top-left":e,"top-right":e,bottom:e,"bottom-left":e,"bottom-right":e,left:e,right:e}}return{center:h.P.convert(g.center||[0,0]),top:h.P.convert(g.top||[0,0]),"top-left":h.P.convert(g["top-left"]||[0,0]),"top-right":h.P.convert(g["top-right"]||[0,0]),bottom:h.P.convert(g.bottom||[0,0]),"bottom-left":h.P.convert(g["bottom-left"]||[0,0]),"bottom-right":h.P.convert(g["bottom-right"]||[0,0]),left:h.P.convert(g.left||[0,0]),right:h.P.convert(g.right||[0,0])}}return vl(new h.P(0,0))}const Kc=M;y.AJAXError=h.bh,y.Evented=h.E,y.LngLat=h.N,y.MercatorCoordinate=h.Z,y.Point=h.P,y.addProtocol=h.bi,y.config=h.a,y.removeProtocol=h.bj,y.AttributionControl=xo,y.BoxZoomHandler=Ln,y.CanvasSource=qn,y.CooperativeGesturesHandler=yo,y.DoubleClickZoomHandler=Fs,y.DragPanHandler=Vu,y.DragRotateHandler=$u,y.EdgeInsets=po,y.FullscreenControl=class extends h.E{constructor(g={}){super(),this._onFullscreenChange=()=>{var e;let a=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((e=a==null?void 0:a.shadowRoot)===null||e===void 0)&&e.fullscreenElement;)a=a.shadowRoot.fullscreenElement;a===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,g&&g.container&&(g.container instanceof HTMLElement?this._container=g.container:h.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(g){return this._map=g,this._container||(this._container=this._map.getContainer()),this._controlContainer=L.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){L.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const g=this._fullscreenButton=L.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);L.create("span","maplibregl-ctrl-icon",g).setAttribute("aria-hidden","true"),g.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const g=this._getTitle();this._fullscreenButton.setAttribute("aria-label",g),this._fullscreenButton.title=g}_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 h.k("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new h.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()}},y.GeoJSONSource=Yo,y.GeolocateControl=class extends h.E{constructor(g){super(),this._onSuccess=e=>{if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new h.k("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,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(e),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new h.k("geolocate",e)),this._finish()}},this._updateCamera=e=>{const a=new h.N(e.coords.longitude,e.coords.latitude),u=e.coords.accuracy,p=this._map.getBearing(),m=h.e({bearing:p},this.options.fitBoundsOptions),k=be.fromLngLat(a,u);this._map.fitBounds(k,m,{geolocateSource:!0})},this._updateMarker=e=>{if(e){const a=new h.N(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(a).addTo(this._map),this._userLocationDotMarker.setLngLat(a).addTo(this._map),this._accuracy=e.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=e=>{if(this._map){if(this.options.trackUserLocation)if(e.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 a=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=a,this._geolocateButton.setAttribute("aria-label",a),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(e.code===3&&fa)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new h.k("error",e)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",e=>e.preventDefault()),this._geolocateButton=L.create("button","maplibregl-ctrl-geolocate",this._container),L.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=e=>{if(this._map){if(e===!1){h.w("Geolocation support is not available so the GeolocateControl will be disabled.");const a=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=a,this._geolocateButton.setAttribute("aria-label",a)}else{const a=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=a,this._geolocateButton.setAttribute("aria-label",a)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=L.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new xl({element:this._dotElement}),this._circleElement=L.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new xl({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",a=>{a.geolocateSource||this._watchState!=="ACTIVE_LOCK"||a.originalEvent&&a.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 h.k("trackuserlocationend")),this.fire(new h.k("userlocationlostfocus")))})}},this.options=h.e({},qu,g)}onAdd(g){return this._map=g,this._container=L.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return h._(this,arguments,void 0,function*(e=!1){if(Rn!==void 0&&!e)return Rn;if(window.navigator.permissions===void 0)return Rn=!!window.navigator.geolocation,Rn;try{Rn=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{Rn=!!window.navigator.geolocation}return Rn})}().then(e=>this._finishSetupUI(e)),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(),L.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,pa=0,fa=!1}_isOutOfMapMaxBounds(g){const e=this._map.getMaxBounds(),a=g.coords;return e&&(a.longitude<e.getWest()||a.longitude>e.getEast()||a.latitude<e.getSouth()||a.latitude>e.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 g=this._map.getBounds(),e=g.getSouthEast(),a=g.getNorthEast(),u=e.distanceTo(a),p=Math.ceil(this._accuracy/(u/this._map._container.clientHeight)*2);this._circleElement.style.width=`${p}px`,this._circleElement.style.height=`${p}px`}trigger(){if(!this._setup)return h.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 h.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":pa--,fa=!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 h.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 h.k("trackuserlocationstart")),this.fire(new h.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 g;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),pa++,pa>1?(g={maximumAge:6e5,timeout:0},fa=!0):(g=this.options.positionOptions,fa=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,g)}}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)}},y.Hash=cl,y.ImageSource=$r,y.KeyboardHandler=Gn,y.LngLatBounds=be,y.LogoControl=Zc,y.Map=class extends ju{constructor(g){h.bf.mark(h.bg.create);const e=Object.assign(Object.assign({},ff),g);if(e.minZoom!=null&&e.maxZoom!=null&&e.minZoom>e.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(e.minPitch!=null&&e.maxPitch!=null&&e.minPitch>e.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(e.minPitch!=null&&e.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(e.maxPitch!=null&&e.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new fo(e.minZoom,e.maxZoom,e.minPitch,e.maxPitch,e.renderWorldCopies),{bearingSnap:e.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new Bt,this._controls=[],this._mapId=h.a4(),this._contextLost=a=>{a.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new h.k("webglcontextlost",{originalEvent:a}))},this._contextRestored=a=>{this._setupPainter(),this.resize(),this._update(),this.fire(new h.k("webglcontextrestored",{originalEvent:a}))},this._onMapScroll=a=>{if(a.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=e.interactive,this._maxTileCacheSize=e.maxTileCacheSize,this._maxTileCacheZoomLevels=e.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=e.failIfMajorPerformanceCaveat===!0,this._preserveDrawingBuffer=e.preserveDrawingBuffer===!0,this._antialias=e.antialias===!0,this._trackResize=e.trackResize===!0,this._bearingSnap=e.bearingSnap,this._refreshExpiredTiles=e.refreshExpiredTiles===!0,this._fadeDuration=e.fadeDuration,this._crossSourceCollisions=e.crossSourceCollisions===!0,this._collectResourceTiming=e.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},Yc),e.locale),this._clickTolerance=e.clickTolerance,this._overridePixelRatio=e.pixelRatio,this._maxCanvasSize=e.maxCanvasSize,this.transformCameraUpdate=e.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=e.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=me.addThrottleControl(()=>this.isMoving()),this._requestManager=new Ie(e.transformRequest),typeof e.container=="string"){if(this._container=document.getElementById(e.container),!this._container)throw new Error(`Container '${e.container}' not found.`)}else{if(!(e.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=e.container}if(e.maxBounds&&this.setMaxBounds(e.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 a=!1;const u=la(p=>{this._trackResize&&!this._removed&&(this.resize(p),this.redraw())},50);this._resizeObserver=new ResizeObserver(p=>{a?u(p):a=!0}),this._resizeObserver.observe(this._container)}this.handlers=new qc(this,e),this._hash=e.hash&&new cl(typeof e.hash=="string"&&e.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:e.center,zoom:e.zoom,bearing:e.bearing,pitch:e.pitch}),e.bounds&&(this.resize(),this.fitBounds(e.bounds,h.e({},e.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=e.localIdeographFontFamily,this._validateStyle=e.validateStyle,e.style&&this.setStyle(e.style,{localIdeographFontFamily:e.localIdeographFontFamily}),e.attributionControl&&this.addControl(new xo(typeof e.attributionControl=="boolean"?void 0:e.attributionControl)),e.maplibreLogo&&this.addControl(new Zc,e.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",a=>{this._update(a.dataType==="style"),this.fire(new h.k(`${a.dataType}data`,a))}),this.on("dataloading",a=>{this.fire(new h.k(`${a.dataType}dataloading`,a))}),this.on("dataabort",a=>{this.fire(new h.k("sourcedataabort",a))})}_getMapId(){return this._mapId}addControl(g,e){if(e===void 0&&(e=g.getDefaultPosition?g.getDefaultPosition():"top-right"),!g||!g.onAdd)return this.fire(new h.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const a=g.onAdd(this);this._controls.push(g);const u=this._controlPositions[e];return e.indexOf("bottom")!==-1?u.insertBefore(a,u.firstChild):u.appendChild(a),this}removeControl(g){if(!g||!g.onRemove)return this.fire(new h.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const e=this._controls.indexOf(g);return e>-1&&this._controls.splice(e,1),g.onRemove(this),this}hasControl(g){return this._controls.indexOf(g)>-1}calculateCameraOptionsFromTo(g,e,a,u){return u==null&&this.terrain&&(u=this.terrain.getElevationForLngLatZoom(a,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(g,e,a,u)}resize(g){var e;const a=this._containerDimensions(),u=a[0],p=a[1],m=this._getClampedPixelRatio(u,p);if(this._resizeCanvas(u,p,m),this.painter.resize(u,p,m),this.painter.overLimit()){const E=this.painter.context.gl;this._maxCanvasSize=[E.drawingBufferWidth,E.drawingBufferHeight];const T=this._getClampedPixelRatio(u,p);this._resizeCanvas(u,p,T),this.painter.resize(u,p,T)}this.transform.resize(u,p),(e=this._requestedCameraState)===null||e===void 0||e.resize(u,p);const k=!this._moving;return k&&(this.stop(),this.fire(new h.k("movestart",g)).fire(new h.k("move",g))),this.fire(new h.k("resize",g)),k&&this.fire(new h.k("moveend",g)),this}_getClampedPixelRatio(g,e){const{0:a,1:u}=this._maxCanvasSize,p=this.getPixelRatio(),m=g*p,k=e*p;return Math.min(m>a?a/m:1,k>u?u/k:1)*p}getPixelRatio(){var g;return(g=this._overridePixelRatio)!==null&&g!==void 0?g:devicePixelRatio}setPixelRatio(g){this._overridePixelRatio=g,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(g){return this.transform.setMaxBounds(be.convert(g)),this._update()}setMinZoom(g){if((g=g??-2)>=-2&&g<=this.transform.maxZoom)return this.transform.minZoom=g,this._update(),this.getZoom()<g&&this.setZoom(g),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(g){if((g=g??22)>=this.transform.minZoom)return this.transform.maxZoom=g,this._update(),this.getZoom()>g&&this.setZoom(g),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(g){if((g=g??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(g>=0&&g<=this.transform.maxPitch)return this.transform.minPitch=g,this._update(),this.getPitch()<g&&this.setPitch(g),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(g){if((g=g??60)>85)throw new Error("maxPitch must be less than or equal to 85");if(g>=this.transform.minPitch)return this.transform.maxPitch=g,this._update(),this.getPitch()>g&&this.setPitch(g),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(g){return this.transform.renderWorldCopies=g,this._update()}project(g){return this.transform.locationPoint(h.N.convert(g),this.style&&this.terrain)}unproject(g){return this.transform.pointLocation(h.P.convert(g),this.terrain)}isMoving(){var g;return this._moving||((g=this.handlers)===null||g===void 0?void 0:g.isMoving())}isZooming(){var g;return this._zooming||((g=this.handlers)===null||g===void 0?void 0:g.isZooming())}isRotating(){var g;return this._rotating||((g=this.handlers)===null||g===void 0?void 0:g.isRotating())}_createDelegatedListener(g,e,a){if(g==="mouseenter"||g==="mouseover"){let u=!1;return{layers:e,listener:a,delegates:{mousemove:m=>{const k=e.filter(T=>this.getLayer(T)),E=k.length!==0?this.queryRenderedFeatures(m.point,{layers:k}):[];E.length?u||(u=!0,a.call(this,new Ji(g,this,m.originalEvent,{features:E}))):u=!1},mouseout:()=>{u=!1}}}}if(g==="mouseleave"||g==="mouseout"){let u=!1;return{layers:e,listener:a,delegates:{mousemove:k=>{const E=e.filter(T=>this.getLayer(T));(E.length!==0?this.queryRenderedFeatures(k.point,{layers:E}):[]).length?u=!0:u&&(u=!1,a.call(this,new Ji(g,this,k.originalEvent)))},mouseout:k=>{u&&(u=!1,a.call(this,new Ji(g,this,k.originalEvent)))}}}}{const u=p=>{const m=e.filter(E=>this.getLayer(E)),k=m.length!==0?this.queryRenderedFeatures(p.point,{layers:m}):[];k.length&&(p.features=k,a.call(this,p),delete p.features)};return{layers:e,listener:a,delegates:{[g]:u}}}}_saveDelegatedListener(g,e){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[g]=this._delegatedListeners[g]||[],this._delegatedListeners[g].push(e)}_removeDelegatedListener(g,e,a){if(!this._delegatedListeners||!this._delegatedListeners[g])return;const u=this._delegatedListeners[g];for(let p=0;p<u.length;p++){const m=u[p];if(m.listener===a&&m.layers.length===e.length&&m.layers.every(k=>e.includes(k))){for(const k in m.delegates)this.off(k,m.delegates[k]);return void u.splice(p,1)}}}on(g,e,a){if(a===void 0)return super.on(g,e);const u=this._createDelegatedListener(g,typeof e=="string"?[e]:e,a);this._saveDelegatedListener(g,u);for(const p in u.delegates)this.on(p,u.delegates[p]);return this}once(g,e,a){if(a===void 0)return super.once(g,e);const u=typeof e=="string"?[e]:e,p=this._createDelegatedListener(g,u,a);for(const m in p.delegates){const k=p.delegates[m];p.delegates[m]=(...E)=>{this._removeDelegatedListener(g,u,a),k(...E)}}this._saveDelegatedListener(g,p);for(const m in p.delegates)this.once(m,p.delegates[m]);return this}off(g,e,a){return a===void 0?super.off(g,e):(this._removeDelegatedListener(g,typeof e=="string"?[e]:e,a),this)}queryRenderedFeatures(g,e){if(!this.style)return[];let a;const u=g instanceof h.P||Array.isArray(g),p=u?g:[[0,0],[this.transform.width,this.transform.height]];if(e=e||(u?{}:g)||{},p instanceof h.P||typeof p[0]=="number")a=[h.P.convert(p)];else{const m=h.P.convert(p[0]),k=h.P.convert(p[1]);a=[m,new h.P(k.x,m.y),k,new h.P(m.x,k.y),m]}return this.style.queryRenderedFeatures(a,e,this.transform)}querySourceFeatures(g,e){return this.style.querySourceFeatures(g,e)}setStyle(g,e){return(e=h.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},e)).diff!==!1&&e.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&g?(this._diffStyle(g,e),this):(this._localIdeographFontFamily=e.localIdeographFontFamily,this._updateStyle(g,e))}setTransformRequest(g){return this._requestManager.setTransformRequest(g),this}_getUIString(g){const e=this._locale[g];if(e==null)throw new Error(`Missing UI string '${g}'`);return e}_updateStyle(g,e){if(e.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(g,e));const a=this.style&&e.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!g)),g?(this.style=new Za(this,e||{}),this.style.setEventedParent(this,{style:this.style}),typeof g=="string"?this.style.loadURL(g,e,a):this.style.loadJSON(g,e,a),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Za(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(g,e){if(typeof g=="string"){const a=this._requestManager.transformRequest(g,"Style");h.h(a,new AbortController).then(u=>{this._updateDiff(u.data,e)}).catch(u=>{u&&this.fire(new h.j(u))})}else typeof g=="object"&&this._updateDiff(g,e)}_updateDiff(g,e){try{this.style.setState(g,e)&&this._update(!0)}catch(a){h.w(`Unable to perform style diff: ${a.message||a.error||a}. Rebuilding the style from scratch.`),this._updateStyle(g,e)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():h.w("There is no style added to the map.")}addSource(g,e){return this._lazyInitEmptyStyle(),this.style.addSource(g,e),this._update(!0)}isSourceLoaded(g){const e=this.style&&this.style.sourceCaches[g];if(e!==void 0)return e.loaded();this.fire(new h.j(new Error(`There is no source with ID '${g}'`)))}setTerrain(g){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),g){const e=this.style.sourceCaches[g.source];if(!e)throw new Error(`cannot load terrain, because there exists no source with ID: ${g.source}`);this.terrain===null&&e.reload();for(const a in this.style._layers){const u=this.style._layers[a];u.type==="hillshade"&&u.source===g.source&&h.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 Gc(this.painter,e,g),this.painter.renderToTexture=new Uu(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=a=>{a.dataType==="style"?this.terrain.sourceCache.freeRtt():a.dataType==="source"&&a.tile&&(a.sourceId!==g.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(a.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 h.k("terrain",{terrain:g})),this}getTerrain(){var g,e;return(e=(g=this.terrain)===null||g===void 0?void 0:g.options)!==null&&e!==void 0?e:null}areTilesLoaded(){const g=this.style&&this.style.sourceCaches;for(const e in g){const a=g[e]._tiles;for(const u in a){const p=a[u];if(p.state!=="loaded"&&p.state!=="errored")return!1}}return!0}removeSource(g){return this.style.removeSource(g),this._update(!0)}getSource(g){return this.style.getSource(g)}addImage(g,e,a={}){const{pixelRatio:u=1,sdf:p=!1,stretchX:m,stretchY:k,content:E,textFitWidth:T,textFitHeight:I}=a;if(this._lazyInitEmptyStyle(),!(e instanceof HTMLImageElement||h.b(e))){if(e.width===void 0||e.height===void 0)return this.fire(new h.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:B,data:U}=e,Z=e;return this.style.addImage(g,{data:new h.R({width:O,height:B},new Uint8Array(U)),pixelRatio:u,stretchX:m,stretchY:k,content:E,textFitWidth:T,textFitHeight:I,sdf:p,version:0,userImage:Z}),Z.onAdd&&Z.onAdd(this,g),this}}{const{width:O,height:B,data:U}=z.getImageData(e);this.style.addImage(g,{data:new h.R({width:O,height:B},U),pixelRatio:u,stretchX:m,stretchY:k,content:E,textFitWidth:T,textFitHeight:I,sdf:p,version:0})}}updateImage(g,e){const a=this.style.getImage(g);if(!a)return this.fire(new h.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const u=e instanceof HTMLImageElement||h.b(e)?z.getImageData(e):e,{width:p,height:m,data:k}=u;if(p===void 0||m===void 0)return this.fire(new h.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(p!==a.data.width||m!==a.data.height)return this.fire(new h.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));const E=!(e instanceof HTMLImageElement||h.b(e));return a.data.replace(k,E),this.style.updateImage(g,a),this}getImage(g){return this.style.getImage(g)}hasImage(g){return g?!!this.style.getImage(g):(this.fire(new h.j(new Error("Missing required image id"))),!1)}removeImage(g){this.style.removeImage(g)}loadImage(g){return me.getImage(this._requestManager.transformRequest(g,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(g,e){return this._lazyInitEmptyStyle(),this.style.addLayer(g,e),this._update(!0)}moveLayer(g,e){return this.style.moveLayer(g,e),this._update(!0)}removeLayer(g){return this.style.removeLayer(g),this._update(!0)}getLayer(g){return this.style.getLayer(g)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(g,e,a){return this.style.setLayerZoomRange(g,e,a),this._update(!0)}setFilter(g,e,a={}){return this.style.setFilter(g,e,a),this._update(!0)}getFilter(g){return this.style.getFilter(g)}setPaintProperty(g,e,a,u={}){return this.style.setPaintProperty(g,e,a,u),this._update(!0)}getPaintProperty(g,e){return this.style.getPaintProperty(g,e)}setLayoutProperty(g,e,a,u={}){return this.style.setLayoutProperty(g,e,a,u),this._update(!0)}getLayoutProperty(g,e){return this.style.getLayoutProperty(g,e)}setGlyphs(g,e={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(g,e),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(g,e,a={}){return this._lazyInitEmptyStyle(),this.style.addSprite(g,e,a,u=>{u||this._update(!0)}),this}removeSprite(g){return this._lazyInitEmptyStyle(),this.style.removeSprite(g),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(g,e={}){return this._lazyInitEmptyStyle(),this.style.setSprite(g,e,a=>{a||this._update(!0)}),this}setLight(g,e={}){return this._lazyInitEmptyStyle(),this.style.setLight(g,e),this._update(!0)}getLight(){return this.style.getLight()}setSky(g){return this._lazyInitEmptyStyle(),this.style.setSky(g),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(g,e){return this.style.setFeatureState(g,e),this._update()}removeFeatureState(g,e){return this.style.removeFeatureState(g,e),this._update()}getFeatureState(g){return this.style.getFeatureState(g)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let g=0,e=0;return this._container&&(g=this._container.clientWidth||400,e=this._container.clientHeight||300),[g,e]}_setupContainer(){const g=this._container;g.classList.add("maplibregl-map");const e=this._canvasContainer=L.create("div","maplibregl-canvas-container",g);this._interactive&&e.classList.add("maplibregl-interactive"),this._canvas=L.create("canvas","maplibregl-canvas",e),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 a=this._containerDimensions(),u=this._getClampedPixelRatio(a[0],a[1]);this._resizeCanvas(a[0],a[1],u);const p=this._controlContainer=L.create("div","maplibregl-control-container",g),m=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(k=>{m[k]=L.create("div",`maplibregl-ctrl-${k} `,p)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(g,e,a){this._canvas.width=Math.floor(a*g),this._canvas.height=Math.floor(a*e),this._canvas.style.width=`${g}px`,this._canvas.style.height=`${e}px`}_setupPainter(){const g={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let e=null;this._canvas.addEventListener("webglcontextcreationerror",u=>{e={requestedAttributes:g},u&&(e.statusMessage=u.statusMessage,e.type=u.type)},{once:!0});const a=this._canvas.getContext("webgl2",g)||this._canvas.getContext("webgl",g);if(!a){const u="Failed to initialize WebGL";throw e?(e.message=u,new Error(JSON.stringify(e))):new Error(u)}this.painter=new ll(a,this.transform),N.testSupport(a)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(g){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||g,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(g){return this._update(),this._renderTaskQueue.add(g)}_cancelRenderFrame(g){this._renderTaskQueue.remove(g)}_render(g){const e=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(g),this._removed)return;let a=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const p=this.transform.zoom,m=z.now();this.style.zoomHistory.update(p,m);const k=new h.z(p,{now:m,fadeDuration:e,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),E=k.crossFadingFactor();E===1&&E===this._crossFadingFactor||(a=!0,this._crossFadingFactor=E),this.style.update(k)}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,e,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:e,showPadding:this.showPadding}),this.fire(new h.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,h.bf.mark(h.bg.load),this.fire(new h.k("load"))),this.style&&(this.style.hasTransitions()||a)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const u=this._sourcesDirty||this._styleDirty||this._placementDirty;return u||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new h.k("idle")),!this._loaded||this._fullyLoaded||u||(this._fullyLoaded=!0,h.bf.mark(h.bg.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var g;this._hash&&this._hash.remove();for(const a of this._controls)a.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),me.removeThrottleControl(this._imageQueueHandle),(g=this._resizeObserver)===null||g===void 0||g.disconnect();const e=this.painter.context.gl.getExtension("WEBGL_lose_context");e!=null&&e.loseContext&&e.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),L.remove(this._canvasContainer),L.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),h.bf.clearMetrics(),this._removed=!0,this.fire(new h.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,z.frameAsync(this._frameRequest).then(g=>{h.bf.frame(g),this._frameRequest=null,this._render(g)}).catch(()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(g){this._showTileBoundaries!==g&&(this._showTileBoundaries=g,this._update())}get showPadding(){return!!this._showPadding}set showPadding(g){this._showPadding!==g&&(this._showPadding=g,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(g){this._showCollisionBoxes!==g&&(this._showCollisionBoxes=g,g?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(g){this._showOverdrawInspector!==g&&(this._showOverdrawInspector=g,this._update())}get repaint(){return!!this._repaint}set repaint(g){this._repaint!==g&&(this._repaint=g,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(g){this._vertices=g,this._update()}get version(){return Hu}getCameraTargetElevation(){return this.transform.elevation}},y.MapMouseEvent=Ji,y.MapTouchEvent=Os,y.MapWheelEvent=Bu,y.Marker=xl,y.NavigationControl=class{constructor(g){this._updateZoomButtons=()=>{const e=this._map.getZoom(),a=e===this._map.getMaxZoom(),u=e===this._map.getMinZoom();this._zoomInButton.disabled=a,this._zoomOutButton.disabled=u,this._zoomInButton.setAttribute("aria-disabled",a.toString()),this._zoomOutButton.setAttribute("aria-disabled",u.toString())},this._rotateCompassArrow=()=>{const e=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=e},this._setButtonTitle=(e,a)=>{const u=this._map._getUIString(`NavigationControl.${a}`);e.title=u,e.setAttribute("aria-label",u)},this.options=h.e({},mf,g),this._container=L.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",e=>e.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",e=>this._map.zoomIn({},{originalEvent:e})),L.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",e=>this._map.zoomOut({},{originalEvent:e})),L.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",e=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:e}):this._map.resetNorth({},{originalEvent:e})}),this._compassIcon=L.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(g){return this._map=g,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 gf(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){L.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(g,e){const a=L.create("button",g,this._container);return a.type="button",a.addEventListener("click",e),a}},y.Popup=class extends h.E{constructor(g){super(),this.remove=()=>(this._content&&L.remove(this._content),this._container&&(L.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 h.k("close"))),this),this._onMouseUp=e=>{this._update(e.point)},this._onMouseMove=e=>{this._update(e.point)},this._onDrag=e=>{this._update(e.point)},this._update=e=>{var a;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=L.create("div","maplibregl-popup",this._map.getContainer()),this._tip=L.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const E of this.options.className.split(" "))this._container.classList.add(E);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?mi(this._lngLat,this._flatPos,this._map.transform):(a=this._lngLat)===null||a===void 0?void 0:a.wrap(),this._trackPointer&&!e)return;const u=this._flatPos=this._pos=this._trackPointer&&e?e:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&e?e:this._map.transform.locationPoint(this._lngLat));let p=this.options.anchor;const m=vl(this.options.offset);if(!p){const E=this._container.offsetWidth,T=this._container.offsetHeight;let I;I=u.y+m.bottom.y<T?["top"]:u.y>this._map.transform.height-T?["bottom"]:[],u.x<E/2?I.push("left"):u.x>this._map.transform.width-E/2&&I.push("right"),p=I.length===0?"bottom":I.join("-")}let k=u.add(m[p]);this.options.subpixelPositioning||(k=k.round()),L.setTransform(this._container,`${vo[p]} translate(${k.x}px,${k.y}px)`),_l(this._container,p,"popup")},this._onClose=()=>{this.remove()},this.options=h.e(Object.create(ut),g)}addTo(g){return this._map&&this.remove(),this._map=g,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 h.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(g){return this._lngLat=h.N.convert(g),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(g){return this.setDOMContent(document.createTextNode(g))}setHTML(g){const e=document.createDocumentFragment(),a=document.createElement("body");let u;for(a.innerHTML=g;u=a.firstChild,u;)e.appendChild(u);return this.setDOMContent(e)}getMaxWidth(){var g;return(g=this._container)===null||g===void 0?void 0:g.style.maxWidth}setMaxWidth(g){return this.options.maxWidth=g,this._update(),this}setDOMContent(g){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=L.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(g),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(g){return this._container&&this._container.classList.add(g),this}removeClassName(g){return this._container&&this._container.classList.remove(g),this}setOffset(g){return this.options.offset=g,this._update(),this}toggleClassName(g){if(this._container)return this._container.classList.toggle(g)}setSubpixelPositioning(g){this.options.subpixelPositioning=g}_createCloseButton(){this.options.closeButton&&(this._closeButton=L.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 g=this._container.querySelector(bl);g&&g.focus()}},y.RasterDEMTileSource=Si,y.RasterTileSource=Zt,y.ScaleControl=class{constructor(g){this._onMove=()=>{ma(this._map,this._container,this.options)},this.setUnit=e=>{this.options.unit=e,ma(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Ar),g)}getDefaultPosition(){return"bottom-left"}onAdd(g){return this._map=g,this._container=L.create("div","maplibregl-ctrl maplibregl-ctrl-scale",g.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){L.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},y.ScrollZoomHandler=cr,y.Style=Za,y.TerrainControl=class{constructor(g){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=g}onAdd(g){return this._map=g,this._container=L.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=L.create("button","maplibregl-ctrl-terrain",this._container),L.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(){L.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},y.TwoFingersTouchPitchHandler=go,y.TwoFingersTouchRotateHandler=jc,y.TwoFingersTouchZoomHandler=Vc,y.TwoFingersTouchZoomRotateHandler=Hc,y.VectorTileSource=Go,y.VideoSource=Js,y.addSourceType=(g,e)=>h._(void 0,void 0,void 0,function*(){if(Ko(g))throw new Error(`A source type called "${g}" already exists.`);((a,u)=>{Xo[a]=u})(g,e)}),y.clearPrewarmedResources=function(){const g=Se;g&&(g.isPreloaded()&&g.numActive()===1?(g.release(Mn),Se=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()"))},y.getMaxParallelImageRequests=function(){return h.a.MAX_PARALLEL_IMAGE_REQUESTS},y.getRTLTextPluginStatus=function(){return Tr().getRTLTextPluginStatus()},y.getVersion=function(){return Kc},y.getWorkerCount=function(){return Pn.workerCount},y.getWorkerUrl=function(){return h.a.WORKER_URL},y.importScriptInWorkers=function(g){return Vt().broadcast("IS",g)},y.prewarm=function(){Ze().acquire(Mn)},y.setMaxParallelImageRequests=function(g){h.a.MAX_PARALLEL_IMAGE_REQUESTS=g},y.setRTLTextPlugin=function(g,e){return Tr().setRTLTextPlugin(g,e)},y.setWorkerCount=function(g){Pn.workerCount=g},y.setWorkerUrl=function(g){h.a.WORKER_URL=g}});var x=o;return x})})(Py);var eE=Py.exports;const tE=JS(eE),Xh=["#FF6633","#FFB399","#FF33FF","#00B3E6","#E6B333","#3366E6","#999966","#99FF99","#B34D4D","#80B300","#809900","#E6B3B3","#6680B3","#66991A","#FF99E6","#CCFF1A","#FF1A66","#E6331A","#33FFCC","#66994D","#B366CC","#4D8000","#B33300","#CC80CC","#66664D","#991AFF","#E666FF","#4DB3FF","#1AB399","#E666B3","#33991A","#CC9999","#B3B31A","#00E680","#4D8066","#809980","#E6FF80","#1AFF33","#999933","#FF3380","#CCCC00","#66E64D","#4D80CC","#9900B3","#E64D66","#4DB380","#FF4D4D","#99E6E6","#6666FF","#FFFF99"],jn={};async function Kh(n="pin4-sm-mi-plumber+f45942.png",t=null){try{const c=n!=null&&n.includes("/")?n:`/api-user/marker_icon/${n}`,d=await t.loadImage(c);if(t.hasImage(n))return;t==null||t.addImage(n,d.data,{sdf:n==null?void 0:n.includes("+sdf")})}catch(o){console.error(o)}}function iE(n){if(!(n!=null&&n.startsWith("rgba")))return n;const t=n.replace(/^rgba?\(|\s+|\)$/g,"").split(",");return`${((1<<24)+(parseInt(t[0],10)<<16)+(parseInt(t[1],10)<<8)+parseInt(t[2],10)).toString(16).slice(1)}`}jn.point=async(n={},t={},o=null)=>{var z,L,N,Y,ee,oe,he,_e,me,Ie,tt,gt;t||(t={}),((z=t==null?void 0:t.width)==null?void 0:z[0])==="["&&(t.width={stops:JSON.parse(t.width)}),typeof(t==null?void 0:t.width)=="string"&&(t.width-=0),typeof(t==null?void 0:t.opacity)=="string"&&(t.opacity=(t.opacity-0)*100);const c=((L=n.style)==null?void 0:L.colorAttr)||((N=n.style)==null?void 0:N.iconCls);let d={circle:"none-xl-{{marker}}+222.png",circle2:"circle-xl-{{marker}}+222.png",pin2:"pin2-xl-{{marker}}+sdf.png",pin:"pin-xl-{{marker}}+sdf.png"}[t.iconType]||(t==null?void 0:t.icon);const[x,y]=(d==null?void 0:d.split("-"))||[],h=((Y=n.style)==null?void 0:Y.color)||"blue";!((ee=n.style)!=null&&ee.iconAttr)&&(d!=null&&d.includes("{{marker}}"))&&(d=d.replace("{{marker}}","fa-star"));const M="gray",D=(Ve,rt)=>`${Ve==null?void 0:Ve.split("+")[0]}+${rt.replace("#","")}.png`;if(n.legendAuto={icon:[],color:[]},(oe=n.style)!=null&&oe.iconAttr&&d){const Ve=(_e=(he=n.meta)==null?void 0:he.columns)==null?void 0:_e.find(xt=>{var zt;return xt.name===((zt=n==null?void 0:n.style)==null?void 0:zt.iconAttr)}),rt=(Ve==null?void 0:Ve.values)||await mt.get(`/api-user/gis-ir/${n.id}/${(me=n.style)==null?void 0:me.iconAttr}`).then(xt=>xt.data.rows);if(rt!=null&&rt.length){const xt=d.replace("{{color}}",h.length?h:iE(h)||[0]).split("+")[1].split(/[.-]/)[0];rt.forEach((zt,Et)=>{var Ki;return zt.icon=(Ki=zt.icon)!=null&&Ki.includes("png")?zt.icon:`${x}-${y}-${zt.data||zt.icon||`ub-${Et}`}+${d!=null&&d.includes("circle")?"ddd-222":xt}.png`}),d=d!=null&&d.includes("{{")?`${x}-${y}-fa-question+0c53ad.png`:d,n.legendAuto.iconText=(Ve==null?void 0:Ve.title)||n.style.iconAttr,rt.forEach(zt=>n.legendAuto.icon.push(zt)),n.legendAuto.icon.push({icon:d,text:"Не визначено"}),n.style.iconArr=["match",["get",n.style.iconAttr]].concat(rt.filter(zt=>zt.id).reduce((zt,Et)=>zt.concat([Et.id,Et.icon]),[])).concat([d]),await Promise.all(rt.map(zt=>zt.icon).map(zt=>Kh(zt,o))),await Kh(d,o)}else d=c?"pin6-m-fa-star+{{color}}.png":`pin6-m-fa-star+${h==null?void 0:h.replace("#","")}.png`}if(d!=null&&d.includes("{{color}}")?d=d.replace("{{color}}","222"):t!=null&&t.icon&&t.iconAttr,c){const Ve=(tt=(Ie=n.meta)==null?void 0:Ie.columns)==null?void 0:tt.find(xt=>xt.name===c),rt=(Ve==null?void 0:Ve.values)||await mt.get(`/api-user/gis-ir/${n.id}/${c}`).then(xt=>xt.data.rows);n.style.color=rt!=null&&rt.length?["match",["get",c]].concat(rt.filter(xt=>xt.id).reduce((xt,zt,Et)=>xt.concat([zt.id,zt.color||Xh[Et]]),[])).concat(["#aaa"]):h,n.style.colorArr=n.style.color,n.legendAuto.colorText=(Ve==null?void 0:Ve.title)||c,rt.forEach(xt=>n.legendAuto.color.push(xt)),n.legendAuto.color.push({color:"#aaa",text:"Не визначено"}),!((gt=n.style)!=null&>.iconAttr)&&!(d!=null&&d.includes("+sdf"))&&d&&(rt.forEach((xt,zt)=>xt.icon=D(d,xt.color||Xh[zt])),n.style.iconArr=["match",["get",c]].concat(rt.filter(xt=>xt.id).reduce((xt,zt)=>xt.concat([zt.id,zt.icon]),[])).concat([D(d,M)]),await Promise.all(rt.map(xt=>xt.icon).map(xt=>Kh(xt,o))))}if(d&&!(d!=null&&d.includes("{"))){const Ve=t!=null&&t.colorAttr?D(d,M):d;await Kh(Ve,o)}const A=d!=null&&d.includes("sdf")?["interpolate",["linear"],["zoom"],14,.1,18,.2]:["interpolate",["linear"],["zoom"],14,.7,16,1];return t.iconOffset=d!=null&&d.includes("pin")?[0,d!=null&&d.includes("+sdf")?-96:-20]:null,[{id:`${n.id}`,source:n.id,type:"circle",cluster:!0,lsource:t==null?void 0:t.lsource,minzoom:(t==null?void 0:t.minzoom)!==void 0?+(t==null?void 0:t.minzoom):4,maxzoom:(d!=null&&d.includes("+sdf")||!(d!=null&&d.includes("circle"))&&!(d!=null&&d.includes("none"))?+t.iconZoom:null)||+(t==null?void 0:t.maxzoom)||24,filter:["all",["==",["geometry-type"],"Point"],["!",["has","point_count"]]],paint:{"circle-stroke-width":["case",["boolean",["feature-state","select"],!1],(t==null?void 0:t.strokeWidth)||1,["boolean",["feature-state","hover"],!1],2,(t==null?void 0:t.strokeWidth)||1],"circle-stroke-color":["case",["boolean",["feature-state","select"],!1],(t==null?void 0:t.stroke)||(t==null?void 0:t.color)||"#fff",["boolean",["feature-state","hover"],!1],"maroon",(t==null?void 0:t.stroke)||(t==null?void 0:t.color)||"#fff"],"circle-opacity":(t.iconZoom?["interpolate",["exponential",.5],["zoom"],+t.iconZoom-1,1,+t.iconZoom,d!=null&&d.includes("none")?.3:0]:null)||t.opacity||1,"circle-color":t.color||["case",["boolean",["feature-state","hover"],!1],"red","blue"],"circle-radius":(Array.isArray(t.width)?{stops:t.width}:null)||t.width||{stops:t.iconZoom?[[+t.iconZoom,4],[+t.iconZoom,8],[18,16]]:[[13,4],[15,8],[18,12]]}}}].concat(t.iconArr||t.icon?[{id:`${n.id}-5`,source:n.id,lsource:t==null?void 0:t.lsource,type:"symbol",minzoom:+t.iconZoom||16,filter:["all",["!",["has","point_count"]]],layout:{"icon-image":t!=null&&t.colorAttr&&t.iconArr||d,"icon-allow-overlap":!0,...t.iconOffset?{"icon-offset":t.iconOffset||!1}:{},...A?{"icon-size":A||!1}:{}},paint:{"icon-opacity":["case",["boolean",["feature-state","hover"],!1],.5,["boolean",["feature-state","select"],!1],.5,(d!=null&&d.includes("+sdf")?1:null)||(d!=null&&d.includes("circle")?.6:1)],...d!=null&&d.includes("+sdf")?{"icon-color":["case",["boolean",["feature-state","hover"],!1],"#cd0bbf",["boolean",["feature-state","select"],!1],"#8517cf",t.color||"#aa0000"]}:{}}}]:[]).concat(t.label?[{id:`${n.id}-4`,source:n.id,lsource:t==null?void 0:t.lsource,type:"symbol",minzoom:14,filter:["!",["has","point_count"]],layout:{"text-field":t.label,"text-font":["Open Sans Regular"],"text-size":t["text-size"]||8},paint:{"text-color":t["text-color"]||"#ffffff","text-halo-color":t["text-halo-color"]||"black"}}]:[]).concat(n.cluster||t.clusterMaxZoom?[{id:`${n.id}-1`,source:n.id,lsource:t==null?void 0:t.lsource,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]}},{id:`${n.id}-2`,source:n.id,lsource:t==null?void 0:t.lsource,type:"symbol",filter:["has","point_count"],layout:{"text-field":"{point_count_abbreviated}","text-font":["Open Sans Regular"],"text-size":12}}]:[])},jn.label=(n={})=>[{id:n.id,source:n.id,type:"line",layout:{"text-field":"{str_name}","text-font":["DIN Offc Pro Italic","Arial Unicode MS Regular"],"symbol-placement":"line","text-pitch-alignment":"viewport","text-max-angle":30,"text-size":{base:1,stops:[[13,12],[18,16]]}},paint:{"text-halo-width":0,"text-halo-blur":0,"text-color":"#78888a"}}],jn.polygon=async(n={},t={},o=null)=>{var x,y,h,M;const{colorAttr:c}=t,d=((x=n.style)==null?void 0:x.color)||"blue";if(t.colorAttr){o.getSource(n.id)&&o.getSource(o.getSource(n.id).setData(`${o.getSource(n.id)._data.split("&props")[0]}&props=${c}`));const D=((h=(y=n.meta)==null?void 0:y.columns.find(A=>A.name===c))==null?void 0:h.values)||await mt.get(`/api-user/gis-ir/${n.id}/${c}`).then(A=>A.data.rows);n.legendAuto={color:[]},D.forEach(A=>n.legendAuto.color.push(A)),n.legendAuto.color.push({color:"#aaa",text:"Не визначено"}),n.style.color=D?["match",["get",c]].concat(D.filter(A=>A.id).reduce((A,z,L)=>A.concat([z.id,z.color||Xh[L]]),[])).concat(["#aaa"]):d}return[{id:`${n.id}`,source:`${n.id}`,lsource:t==null?void 0:t.lsource,minzoom:(+(t==null?void 0:t.minzoom)||+(t==null?void 0:t.pointZoom)||0)-0,maxzoom:+(t==null?void 0:t.maxzoom)||24,type:"fill",filter:["all",["match",["geometry-type"],["Polygon","MultiPolygon"],!0,!1]],paint:{"fill-color":["case",["boolean",["feature-state","hover"],!1],"red",["boolean",["feature-state","select"],!1],"#c356c1",(t==null?void 0:t.color)||"#0080ff"],"fill-opacity":.5}}].concat(t!=null&&t.pointZoom?[{id:`${n.id}-5`,source:(M=n.url)!=null&&M.includes(".vmt")?`${n.id}`:`${n.id}-point`,type:"circle",minzoom:0,maxzoom:((t==null?void 0:t.pointZoom)||1)-0,paint:{"circle-color":["case",["boolean",["feature-state","hover"],!1],"red",(t==null?void 0:t.color)||"blue"],"circle-stroke-width":1,"circle-stroke-color":"#fff"}}]:[]).concat(t!=null&&t.label?[{id:`${n.id}-1`,source:n.id,type:"symbol",lsource:t==null?void 0:t.lsource,minzoom:15,layout:{"text-field":t==null?void 0:t.label,"text-font":["Open Sans Regular"],"text-size":t["text-size"]||{stops:[[14,4],[18,16]]}},paint:{"text-color":t["text-color"]||"#ffffff","text-halo-color":t["text-halo-color"]||"#fff","text-halo-width":t["text-halo-width"]||0}}]:[]).concat(t!=null&&t.stroke?[{id:`${n.id}-2`,source:n.id,lsource:t==null?void 0:t.lsource,minzoom:(+(t==null?void 0:t.minzoom)||+(t==null?void 0:t.pointZoom)||0)-0,maxzoom:+(t==null?void 0:t.maxzoom)||24,type:"line",paint:{"line-color":["case",["boolean",["feature-state","select"],!1],"#c356c1",t.stroke],"line-width":["case",["boolean",["feature-state","select"],!1],3,(t.width||t["line-width"]||1)-0]}}]:[])},jn.line=(n={},t={})=>[{id:n.id,source:n.id,lsource:t.lsource,type:"line",filter1:["all",["match",["geometry-type"],["LineString","MultiLineString","MultiPolygon","Polygon"],!0,!1]],minzoom:(t==null?void 0:t.minzoom)||n.minzoom||5,layout:{"line-join":"round","line-cap":"round"},paint:{"line-width":["case",["boolean",["feature-state","select"],!1],4,t.width||t["line-width"]||1],"line-color":["case",["boolean",["feature-state","select"],!1],"#c356c1",t.color||t["line-color"]||"#c71ccb"],"line-gap-width":t["line-gap-width"]||0}}].concat(t.label?[{id:`${n.id}-4`,source:n.id,lsource:t.lsource,type:"symbol",minzoom:14,paint:{"text-color":"#111","text-halo-color":"#fff","text-halo-width":2},layout:{"symbol-placement":"line","text-letter-spacing":.2,"text-field":t.label,"text-font":["Open Sans Regular"],"text-size":t["text-size"]||15}}]:[]),jn.linestring=jn.line,jn.circle=jn.point;async function nE(n,t,o){var h,M,D,A,z,L,N,Y,ee,oe,he,_e;typeof t.style=="string"&&(t.style=t.style[0]==="{"?JSON.parse(t.style):(h=window.YAML.parse(t.style))==null?void 0:h.style),(D=(M=t.style)==null?void 0:M.filter)==null||D.call(M,me=>me.source).forEach(me=>{me.lsource=`${t.id}-${me.source}`});const c=((A=t==null?void 0:t.style)==null?void 0:A.type)||((he=((N=(L=(z=t==null?void 0:t.meta)==null?void 0:z.geom)==null?void 0:L.geometry)==null?void 0:N.length)>2?["point"]:[((oe=(ee=(Y=t==null?void 0:t.meta)==null?void 0:Y.geom)==null?void 0:ee.geometry)==null?void 0:oe[0].toLowerCase())||"point"])==null?void 0:he.map(me=>{var Ie;return(Ie=me==null?void 0:me.replace)==null?void 0:Ie.call(me,"multi","")})),d=Array.isArray(c)?c:[c],x=(await Promise.all(Array.isArray(t==null?void 0:t.style)?t.style.map(async me=>{var Ie;return(Ie=jn[me.type])==null?void 0:Ie.call(jn,t,me,o)}):d.map(async me=>{var Ie;return(Ie=jn[me])==null?void 0:Ie.call(jn,t,t.style,o)}))).reduce((me,Ie)=>Ie?me.concat(Ie):me,[]);x.forEach((me,Ie)=>{me.id=`${me.id}-${Ie}`});const y=x;return(t.service==="vtile"||(_e=t.url)!=null&&_e.includes(".vmt"))&&y.forEach(me=>{me.layout||(me.layout={}),me.layout.visibility="visible",me["source-layer"]=me.lsource||t.data||n}),y}const rE={data(){return{layerList:[],layerObj:{},colors:Xh,activeLayer:"",addedLayersSettings:[],hoveredFeatureId:null}},computed:{interactiveSources(){return this.layerList.filter(n=>n==null?void 0:n.interactive).map(n=>n.id)}},methods:{moveLayers(n,t=this.map){t.getStyle().layers.forEach(o=>{o.id.match(n)&&t.moveLayer(o.id)})},getLayersBySourceId(n,t){return t.getStyle().layers.filter(c=>c.id.match(n))},async setVisible(n,t=!0,o={}){const c=typeof n=="object";try{const{style:d,map:x=this.map}=o,y=(n==null?void 0:n.id)||n,h=c?n:await this.getLayerById(y);if(!(h!=null&&h.id))throw new Error("MixinError: Layer has no id");const M=x.getStyle().layers.filter(D=>D.id.match(y));!M.length||d?await this.addToLayers({...h,...(o==null?void 0:o.data)||{},interactive:(h==null?void 0:h.interactive)!==void 0?h==null?void 0:h.interactive:!0,visible:t},{map:x,cb:o==null?void 0:o.onAddLayer}):(this.layerList=this.layerList.map(D=>D.id===h.id?{...D,visible:t}:D),M.forEach(D=>{x.setLayoutProperty(D.id,"visibility",t?"visible":"none")})),o!=null&&o.cb&&await(o==null?void 0:o.cb(h))}catch(d){console.error(d),!o.onAddLayer||o.onAddLayer({data:c?n:{id:n},message:d.message,type:"error"})}},async addToLayers(n,t={}){try{const{map:o=this==null?void 0:this.map}=t;this.layerList.find(d=>d.id===n.id)||(this.layerList=this.layerList.concat(n)),this.layerObj={...this.layerObj,[n.id]:n},n.visible?n!=null&&n.layer?await this.addVectorLayer(n,o):n.service==="vtile"?await this.addVtileLayer(n,o):n.service==="geojson"?await this.addGeojsonLayers(n,o):this.addRasterLayer(n,o):o.getStyle().layers.forEach(async d=>{d.source===n.id&&await o.setLayoutProperty(d.id,"visibility","none")}),!(t!=null&&t.cb&&(n!=null&&n.visible))||await t.cb({data:n,type:"success"}),this.moveLayers("gl-draw")}catch(o){!t.cb||t.cb({data:n,message:o.message,type:"error"}),console.error(o)}},addRasterLayer(n,t){t.addSource(n.id,{type:"raster",tiles:[(n==null?void 0:n.url)||(n==null?void 0:n.url1)],tileSize:256,...n!=null&&n.scheme?{scheme:n==null?void 0:n.scheme}:{}}),t.addLayer({id:n.id,type:"raster",source:n.id,minzoom:0,maxzoom:(n==null?void 0:n.maxzoom)||22})},async addVtileLayer(n){await this.createGeometryLayer({data:n},"vector")},async addVectorLayer(n,t){const{data:o}=await mt.get(n.layer),c={...n,source:n.id,layers:[]};Object.keys(o.sources).forEach(async d=>{await t.addSource(n.id,{type:o.sources[d].type,maxzoom:o.sources[d].maxzoom,url:o.sources[d].url})}),await o.layers.forEach(async d=>{await t.addLayer({...d,source:n.id,id:`${d.id}-${n.id}`}),c.layers=await c.layers.concat(`${d.id}-${n.id}`)})},async addGeojsonLayers(n){const t=o=>{throw this.$notify({type:"error",title:"Відсутня геометрія у обраному шарі",message:o,position:"bottom-right"}),this.layerList=this.layerList.filter(c=>c.id!==n.id),new Error(o)};if(typeof(n==null?void 0:n.geojson)=="object"){this.createGeometryLayer({data:n,geojson:n.geojson},"geojson");return}try{const o=await mt.get((n==null?void 0:n.geojson)||(n==null?void 0:n.url)),c=await o.data;if(o.statusText==="OK")this.createGeometryLayer({data:n,geojson:c},"geojson");else throw new Error((c==null?void 0:c.message)||(o==null?void 0:o.statusText)||"Error addGeojson layer")}catch(o){t(o.message),console.error(o)}},async createGeometryLayer({data:n,geojson:t},o){var h,M,D,A,z;const{map:c}=this,d=await nE(n.id,this.layerList.find(L=>L.id==n.id),c),x={type:o,cluster:((h=n==null?void 0:n.style)==null?void 0:h.cluster)||!1,clusterMaxZoom:((M=n==null?void 0:n.style)==null?void 0:M.clusterMaxZoom)||14};o==="vector"&&(x.tiles=[`${window.location.origin}${(n==null?void 0:n.geojson)||(n==null?void 0:n.url)}${n!=null&&n.version?`?ver=${n.version}`:""}${n.props?`&props=${n.props}`:""}${(D=n==null?void 0:n.style)!=null&&D.pointZoom?`&pointZoom=${n.style.pointZoom}`:""}`]),o==="geojson"&&(x.data=t||`${window.location.origin}${(n==null?void 0:n.geojson)||(n==null?void 0:n.url)}`),c.addSource(n.id,x),d.forEach(L=>{var Y;const N={...L,source:n.id,maxzoom:+(L==null?void 0:L.maxzoom)||24,minzoom:+(L==null?void 0:L.minzoom)||0,cluster:!1,clusterMaxZoom:2};c.addLayer(N),c.moveLayer(L.id),(Y=L==null?void 0:L.layout)!=null&&Y["text-field"]||this.apiLayersHover(L.id,n.id,c),this.addedLayersSettings=this.addedLayersSettings.concat(N)});const y=d.map(L=>L.type).filter(L=>L&&L!=="symbol");(z=(A=n==null?void 0:n.meta)==null?void 0:A.geom)!=null&&z.geometry&&n.meta.geom.geometry.filter(N=>!y.includes(this.geometryByType(N,!0))).forEach(N=>{this.createStyleObj({type:N,style:n.style},n.id)})},async setStyle(n,t,o=this.map){const c=(n==null?void 0:n.id)||n;o.getStyle().layers.forEach(x=>{x.source===c&&o.removeLayer(x.id)}),o.getSource(c)&&(o==null||o.removeSource(c)),this.layerList=this.layerList.map(x=>(x.id===c&&(x.style=t),x));const d=this.layerList.find(x=>x.id===c);this.addToLayers(d)},setLayerData({source:n,data:t}){const o=(n==null?void 0:n.id)||n;this.layerList=this.layerList.map(c=>c.id===o?{...c,...t}:c),this.layerObj={...this.layerObj,[n]:{...this.layerObj[n],...t}}},geometryByType(n,t=!1){if(n==="fill"||n==="Polygon"||n==="MultiPolygon")return t?"fill":"Polygon";if(n==="circle"||n==="Point"||n==="MultiPoint")return t?"circle":"Point";if(n==="line"||n==="LineString"||n==="MultiLineString")return t?"line":"LineString"},async removeLayer(n,t=this.map){const o=(n==null?void 0:n.id)||n;this.layerList=this.layerList.filter(c=>c.id!==o),await t.getStyle().layers.forEach(async c=>{c.source===o&&await t.removeLayer(c.id)}),await t.removeSource(o)},async reloadUrl(n,t=this.map){const o=(n==null?void 0:n.id)||n;await t.getStyle().layers.forEach(c=>{c.id===o&&t.removeLayer(c.id)}),await t.removeSource(o),await this.setVisible(n,!0)},async setFilter(n,t){const o=this.layerObj[n],c=await this.map.getSource(n);if(o.service==="vtile")await c.setTiles([`${window.location.origin}${o.geojson||o.url}${o.url.includes("?")?"&":"?"}filter=${t}${o.props?`&props=${o.props}`:""}`]);else if(o.service==="geojson"){const{data:d}=await mt.get((o==null?void 0:o.geojson)||`${o==null?void 0:o.url}?filter=${t}`);await this.map.getSource(n).setData(d)}},async getLayerById(n,t=null){var c;const o=(n==null?void 0:n.id)||n;try{const d=(c=this.layerList)==null?void 0:c.find(y=>y.id===o);if(d)return d;const x=await mt.get(`/api-user/gis-ir/${o}${n!=null&&n.service?`?service=${n==null?void 0:n.service}`:""}`);if(x.statusText==="OK"){const y=await x.data;return!t||await t(y),y}return this.$notify({type:"warning",message:`Шар ${o} не було знайдено!`}),null}catch(d){this.$notify({type:"warning",message:`Шар ${o} не було знайдено!`}),console.error(d)}},createStyleObj({type:n,style:t},o){const c=this.geometryByType(n,!0);if(!c)throw Error("Geomery type ERROR: Error adding missing layers");const d=`${o}-${c}`;if(this.map.getStyle().layers.find(y=>y.id===d))return;const x={id:d,type:c,source:o,"source-layer":o,layout:{},paint:{[`${c}-color`]:["case",["boolean",["feature-state","hover"],!1],"red",(t==null?void 0:t.color)||"#444e3d"],[`${c}-opacity`]:t!=null&&t.opacity||c==="fill"?.5:1},filter:["all",["==",["geometry-type"],this.geometryByType(n)]]};this.map.addLayer(x),this.addedLayersSettings=this.addedLayersSettings.concat(x),this.apiLayersHover(d,o,this.map)},apiLayersHover(n,t,o){const c=o.getSource(t),d=()=>{const x={source:t,id:this.hoveredFeatureId};return c.type==="vector"&&(x.sourceLayer=t),x};o.on("mousemove",n,x=>{x.features.length>0&&(this.hoveredFeatureId!==null&&o.setFeatureState(d(),{hover:!1}),this.hoveredFeatureId=x.features[0].id,o.setFeatureState(d(),{hover:!0}))}),o.on("mouseleave",n,()=>{this.hoveredFeatureId!==null&&o.setFeatureState(d(),{hover:!1}),this.hoveredFeatureId=null})},async changeBaseLayer(n,t=!0,o=!0){await this.setVisible(n,t);const c=(n==null?void 0:n.id)||n;c!==this.activeLayer&&(o&&this.activeLayer&&await this.setVisible(this.activeLayer,!1),this.map.getStyle().layers.forEach(d=>{d.source!==c&&d.type!=="background"&&this.map.moveLayer(d.id)}),this.activeLayer=c)},async refreshLayer(n,t=this.map){const o=(n==null?void 0:n.id)||n;await t.getStyle().layers.forEach(c=>{c.source===o&&t.removeLayer(c.id)}),await t.removeSource(o),this.layers=await this.layers.filter(c=>c.id!==o),await this.setVisible(typeof n=="object"?n:o)}}},sE={props:{objectData:{type:Array,default:()=>[]},object:{type:Object,default:()=>null},mapRef:{type:Object,default:()=>null}},computed:{currentLayer(){var o;const n=(o=this.object)==null?void 0:o.source;return this.mapRef.layerObj[n]},popupPosition(){var t,o,c;return((c=(o=(t=this.currentLayer)==null?void 0:t.setting)==null?void 0:o.popup)==null?void 0:c.position)||"horizontal"},popupWidth(){var t,o,c;return`${((c=(o=(t=this.currentLayer)==null?void 0:t.setting)==null?void 0:o.popup)==null?void 0:c.width)||240}px`},popupRows(){return this.objectData.filter(n=>n.column!=="image")},positionIsVertical(){return this.popupPosition==="vertical"}},methods:{rowValue(n){return n.value},rowTitle(n){return n.title}}},oE={key:0,class:"vsTailwind map-popup__vertical"},aE={class:"mb-1"},lE={class:"text-sm"},cE={key:1,class:"map__popup-body"},hE=["innerHTML"],uE={key:1};function dE(n,t,o,c,d,x){return v.openBlock(),v.createElementBlock("div",{class:"map-popup",style:v.normalizeStyle({"max-width":x.popupWidth,width:x.popupWidth})},[x.positionIsVertical?(v.openBlock(),v.createElementBlock("div",oE,[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList(x.popupRows,y=>(v.openBlock(),v.createElementBlock("div",{class:"border-b py-1 last:border-none last:pt-1 last:pb-0",key:x.rowTitle(y)},[v.createElementVNode("strong",aE,v.toDisplayString(x.rowTitle(y)),1),v.createElementVNode("div",lE,v.toDisplayString(x.rowValue(y)),1)]))),128))])):(v.openBlock(),v.createElementBlock("table",cE,[v.createElementVNode("tbody",null,[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList(x.popupRows,y=>v.withDirectives((v.openBlock(),v.createElementBlock("tr",{key:x.rowTitle(y),class:"map__popup-body-item"},[v.createElementVNode("td",null,v.toDisplayString(x.rowTitle(y)),1),x.rowValue(y)?(v.openBlock(),v.createElementBlock("td",{key:0,innerHTML:x.rowValue(y)},null,8,hE)):(v.openBlock(),v.createElementBlock("td",uE,t[0]||(t[0]=[v.createElementVNode("div",{class:"text-red-500"}," Не визначено ",-1)])))])),[[v.vShow,!x.rowValue(y).includes("id")]])),128))])]))],4)}const pE=vt(sE,[["render",dE],["__scopeId","data-v-14698eb6"]]),Iy={width:200,show:!0,position:"horizontal"},fE={components:{VsPopupBody:pE},props:{aviableFields:{type:Array,default:()=>[]},mapRef:{type:[Object,Array],default:()=>{}},object:{type:[Object,Array],default:()=>{}}},data(){return{objectData:[],popupSettings:Iy}},computed:{getImage(){return this.objectData.find(n=>n.column==="image")||null},currentLayer(){var n;return(n=this.$parent.layerList)==null?void 0:n.find(t=>{var o;return(t==null?void 0:t.id)===((o=this.object)==null?void 0:o.source)})}},watch:{async object(n,t){n!==null&&(n==null?void 0:n.id)!==(t==null?void 0:t.id)||!(n!=null&&n.id)?await this.getFormatObject(n):n===null&&(this.objectData=[])}},methods:{async getFormatObject(n){var M,D,A,z,L,N;if(!n)return;const t=Object.keys(n.properties).filter(Y=>!Y.match("__text")&&!["id"].includes(Y)),{currentLayer:o}=this;if((M=o==null?void 0:o.setting)!=null&&M.popup&&(this.popupSettings=(o==null?void 0:o.setting.popup)||Iy),!(o!=null&&o.meta)){const Y=t.map(ee=>({title:ee,value:n.properties[ee]}));this.objectData=[...Y,{value:((D=n.properties)==null?void 0:D.image)||"",title:"Фото",column:"image"}];return}const c=o.meta.columns,d=t.map(Y=>{var me,Ie,tt,gt;const ee={},he=Object.assign({values:[]},c.find(Ve=>Ve.name===Y));typeof he.values!="object"&&console.warn(`Warning: Layer ${n.source} has key "values" which is not an object in meta!`);const _e=he!=null&&he.values&&((me=he==null?void 0:he.values)==null?void 0:me.find(Ve=>(Ve==null?void 0:Ve.id)==n.properties[Y]))||null;return ee.value=(he==null?void 0:he.format)==="select"?this.formatBadge({text:(_e==null?void 0:_e.text)||((Ie=n.properties)==null?void 0:Ie[`${Y}__text`])||((tt=n.properties)==null?void 0:tt[Y])||"-",color:(_e==null?void 0:_e.color)||"#1989FA"}):(_e==null?void 0:_e.text)||((gt=n.properties)==null?void 0:gt[`${Y}__text`])||n.properties[Y],ee.column=Y,ee.title=(he==null?void 0:he[window==null?void 0:window.lang])||(he==null?void 0:he.ua)||(he==null?void 0:he.title)||Y,ee});this.objectData=[...d,{value:((A=n.properties)==null?void 0:A.image)||"",title:"Фото",column:"image"}];const x=(L=(z=o==null?void 0:o.setting)==null?void 0:z.popup)==null?void 0:L.popup,y=typeof x=="string"?x==null?void 0:x.split(","):x,h=[...this.aviableFields,...((N=o==null?void 0:o.popup)==null?void 0:N.split(","))||[],...y||[]];this.objectData=h.length?this.objectData.filter(Y=>h.includes(Y.column)||h.includes(Y.title)):[]},noInfoObject(){var c,d,x,y,h;if(!this.object)return"Інформація відсутня";const{currentLayer:n}=this,t=((d=(c=n==null?void 0:n.meta)==null?void 0:c.columns)==null?void 0:d.find(M=>(M==null?void 0:M.meta)==="title"))||((x=n==null?void 0:n.meta)==null?void 0:x.columns[0])||null;return{title:(n==null?void 0:n.name)||(n==null?void 0:n.id)||((y=this.object)==null?void 0:y.sourceLayer)||((h=this.object)==null?void 0:h.source)||"Дані по шару не знайдено",column:t}},formatBadge(n){const t=(n==null?void 0:n.text)||"-";return n!=null&&n.color?`<span >${t}</span>`:t}}},mE={key:0},gE={key:0},yE=["src","alt"],_E={key:1},xE={class:"text-left text-sm m-b-sm"},bE={key:1,class:"text-center"};function vE(n,t,o,c,d,x){var h,M,D,A,z,L,N,Y,ee,oe,he;const y=v.resolveComponent("VsPopupBody");return v.openBlock(),v.createElementBlock("div",{class:v.normalizeClass((((h=d.popupSettings)==null?void 0:h.position)||"horizontal")+"-position")},[d.objectData.filter(_e=>_e.column!=="image").length?(v.openBlock(),v.createElementBlock("div",mE,[x.getImage&&((M=x.getImage)!=null&&M.value)?(v.openBlock(),v.createElementBlock("div",gE,[v.createElementVNode("img",{class:"popup-image",src:"files/"+x.getImage.value,alt:x.getImage.column},null,8,yE)])):v.createCommentVNode("",!0),v.createVNode(y,{"object-data":d.objectData,object:o.object,mapRef:o.mapRef},null,8,["object-data","object","mapRef"])])):(v.openBlock(),v.createElementBlock("div",_E,[(D=x.noInfoObject())!=null&&D.column?(v.openBlock(),v.createElementBlock(v.Fragment,{key:0},[v.createElementVNode("b",xE,v.toDisplayString(x.noInfoObject().title),1),v.createElementVNode("div",null,[v.createElementVNode("b",null,v.toDisplayString(((z=(A=x.noInfoObject())==null?void 0:A.column)==null?void 0:z.ua)||((N=(L=x.noInfoObject())==null?void 0:L.column)==null?void 0:N.title))+":",1),v.createTextVNode(" "+v.toDisplayString(((he=(Y=o.object)==null?void 0:Y.properties)==null?void 0:he[(oe=(ee=x.noInfoObject())==null?void 0:ee.column)==null?void 0:oe.name])||"-"),1)])],64)):(v.openBlock(),v.createElementBlock("div",bE,v.toDisplayString(x.noInfoObject().title),1))]))],2)}const wE=vt(fE,[["render",vE],["__scopeId","data-v-180f4367"]]),{Map:kE,NavigationControl:SE,Popup:EE}=tE,TE={mixins:[rE],components:{VsMapPopup:wE},props:{popupVisible:{type:Boolean,default:()=>!0},map:{type:Object,default:()=>null},height:{type:String,default:()=>"400px"}},data(){var n,t,o,c;return{mapId:`gis-map-${Math.floor(Math.random()*1e3)}`,features:[],katottg:((t=(n=window==null?void 0:window.setting)==null?void 0:n.map)==null?void 0:t.katottg)||((c=(o=window==null?void 0:window.setting)==null?void 0:o.map)==null?void 0:c.city_katottg),popup:{geometry:null,map:null},cityBbox:null}},async mounted(){this.initMap()},computed:{mapRef(){return this}},methods:{initMap(){const n={version:8,glyphs:"https://fonts.openmaptiles.org/{fontstack}/{range}.pbf",sources:{},layers:[]},t=new kE({container:this.mapId,style:n,center:[0,0],zoom:1,interactive:!0});t.addControl(new SE({visualizePitch:!0})),window==null||window.addEventListener("resize",()=>{t.resize()}),t.on("load",this.onMapLoad)},async onMapLoad(n){const t=n.target;t.resize();const o={id:"graymap",name:"Сіра карта",url:"https://basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png",service:"TMS",category:"Базові карти",attribution:"© <a href='http://www.openstreetmap.org/copyright'>OpenStreetMap</a>, © <a href='https://carto.com/attributions'>CARTO</a>",bounds1:"ua",image:"https://basemaps.cartocdn.com/light_all/10/601/348.png",position:0,owner:"OSM",basemap:!0};await this.$emit("update:map",t),await this.setVisible(o,!0),this.$emit("load",t),this.createPopup(),this.createBoundsLayers(),this.createAtuLayer()},createPopup(){var o,c,d,x,y,h;const{map:n}=this,t=["measure","katottg","geometry","mapbox-gl-draw-hot","mapbox-gl-draw-cold"];this.popup.map=new EE({closeOnClick:!1}).setDOMContent((c=(o=this==null?void 0:this.$refs)==null?void 0:o.popup)==null?void 0:c.$el),n&&(n.on("mousemove",M=>{var A,z;const D=n.queryRenderedFeatures(M.point).filter(L=>{var ee,oe,he;const N=this.layerList.find(_e=>_e.id===L.source),Y=((oe=(ee=N==null?void 0:N.setting)==null?void 0:ee.popup)==null?void 0:oe.show)===void 0?!0:N.setting.popup.show;if((this.interactiveSources.includes(L.source)&&!((he=L.properties)!=null&&he.cluster)&&Y||!N&&Object.keys(L.properties).length)&&!t.includes(L.source))return L}).filter(L=>{var N,Y;return!((Y=(N=L.layer)==null?void 0:N.layout)!=null&&Y["text-field"])});D.length&&this.popupVisible?(this.features=(D==null?void 0:D[0])||null,(A=this.popup.map)==null||A.setLngLat(Object.values(M.lngLat)).addTo(n),n.getCanvas().style.cursor=D.length?"pointer":"grab"):(this.features=null,(z=this.popup.map)==null||z.remove()),this.$emit("mouseMove",{event:M,features:D})}),n.on("touchend",this.handleMapClick),n.on("click",this.handleMapClick),n.on("dblclick",M=>{const D=n.queryRenderedFeatures(M.point);this.$emit("dbclick",{features:D,event:M})}),(h=(y=(x=(d=this==null?void 0:this.$refs)==null?void 0:d.popup)==null?void 0:x.$el)==null?void 0:y.parentElement)==null||h.addEventListener("mouseenter",()=>{var M;(M=this.popup.map)==null||M.remove()}))},createBoundsLayers(){const{map:n}=this;n&&(n.addSource("bounds-dataset",{type:"geojson",data:{type:"FeatureCollection",features:[]}}),n.addLayer({id:"bounds-dataset-line",type:"line",source:"bounds-dataset",layout:{},paint:{"line-color":"#a91a9e","line-width":2}}))},handleMapClick(n){if(!this.map)return;const t=this.map.queryRenderedFeatures(n.point);if(!t.length)return;const o=t.filter(c=>this.interactiveSources.includes(c==null?void 0:c.source));this.$emit("mapClick",o)},homeZoom(){const{map:n}=this,t=this.cityBbox?this.cityBbox:[22.1352,44.3909,40.2276,52.3791];n==null||n.fitBounds(t,{duration:0,padding:10})},async createAtuLayer(){try{const n=this.katottg,{map:t}=this;if(!t){console.warn("Map error: Map hasn't loaded");return}const{data:o}=await mt.get(`https://data.gki.com.ua/api-user/atu/${n}`),c=Cy(o);this.cityBbox=c,t.addSource("atu",{type:"geojson",data:o}),t.addLayer({id:"atu",type:"line",source:"atu",paint:{"line-color":"#3b82f6","line-width":2}})}catch(n){console.error(n)}}}},CE={class:"relative"},ME=["id"];function PE(n,t,o,c,d,x){const y=v.resolveComponent("VsMapPopup");return v.openBlock(),v.createElementBlock("div",CE,[v.createElementVNode("div",{id:d.mapId,style:v.normalizeStyle({height:o.height})},null,12,ME),v.createVNode(y,{ref:"popup",object:d.features,"map-ref":x.mapRef},null,8,["object","map-ref"])])}const IE=vt(TE,[["render",PE]]),Jr="widget-map-source",AE={components:{VsMap:IE},props:{geometry:{type:Object,default:()=>null},zoom:{type:String,default:()=>"50"}},data(){return{map:null}},mounted(){this.geometry&&this.initGeometryLayer()},watch:{geometry(){console.log(this.zoom),this.initGeometryLayer()}},methods:{initMap(){this.geometry&&this.map&&this.initGeometryLayer()},handleMapLoad(){this.initMap()},initGeometryLayer(){const{map:n}=this;if(!n)return;const t=this.formatGeojson(this.geometry),o=n.getSource(Jr);if(this.zoomToGeometry(t),o){o.setData(t);return}n.addSource(Jr,{type:"geojson",data:t}),n.addLayer({id:`${Jr}-point`,type:"circle",source:Jr,paint:{"circle-radius":10,"circle-color":"#F84C4C"},filter:["==","$type","Point"]}),n.addLayer({id:`${Jr}-polygon`,type:"fill",source:Jr,layout:{},paint:{"fill-color":"#0080ff","fill-opacity":.5},filter:["==","$type","Polygon"]}),n.addLayer({id:`${Jr}-polygon-line`,type:"line",source:Jr,layout:{},paint:{"line-color":"#0080ff","line-width":2},filter:["==","$type","Polygon"]}),n.addLayer({id:`${Jr}-line`,type:"line",source:Jr,layout:{},paint:{"line-color":"#0080ff","line-width":3},filter:["==","$type","LineString"]})},formatGeojson(n){let t=n;const o=n==null?void 0:n.type;if(Array.isArray(n))return My(n);if(!o)throw new Error("Unknown geometry type!");return o==="FeatureCollection"?n:(o==="Feature"&&(t=[n]),!["FeatureCollection","Feature"].includes(o)&&(t=[QS(n)]),My(t))},zoomToGeometry(n){const{map:t}=this,o=Cy(n);t.fitBounds(o,{zoom:this.zoom,padding:30,duration:0})}}};function DE(n,t,o,c,d,x){const y=v.resolveComponent("VsMap");return v.openBlock(),v.createElementBlock("div",null,[v.createVNode(y,{map:d.map,"onUpdate:map":t[0]||(t[0]=h=>d.map=h),onLoad:x.handleMapLoad},null,8,["map","onLoad"])])}const zE=vt(AE,[["render",DE]]),Ye=(n,t=1e4)=>(n=parseFloat(n+"")||0,Math.round((n+Number.EPSILON)*t)/t),wp=function(n){if(!(n&&n instanceof Element&&n.offsetParent))return!1;const t=n.scrollHeight>n.clientHeight,o=window.getComputedStyle(n).overflowY,c=o.indexOf("hidden")!==-1,d=o.indexOf("visible")!==-1;return t&&!c&&!d},Jh=function(n,t=void 0){return!(!n||n===document.body||t&&n===t)&&(wp(n)?n:Jh(n.parentElement,t))},Qr=function(n){var t=new DOMParser().parseFromString(n,"text/html").body;if(t.childElementCount>1){for(var o=document.createElement("div");t.firstChild;)o.appendChild(t.firstChild);return o}return t.firstChild},kp=n=>`${n||""}`.split(" ").filter(t=>!!t),es=(n,t,o)=>{n&&kp(t).forEach(c=>{n.classList.toggle(c,o||!1)})};class Na{constructor(t){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=t,this.pageX=t.pageX,this.pageY=t.pageY,this.clientX=t.clientX,this.clientY=t.clientY,this.id=self.Touch&&t instanceof Touch?t.identifier:-1,this.time=Date.now()}}const Va={passive:!1};class LE{constructor(t,{start:o=()=>!0,move:c=()=>{},end:d=()=>{}}){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=t,this.startCallback=o,this.moveCallback=c,this.endCallback=d;for(const x of["onPointerStart","onTouchStart","onMove","onTouchEnd","onPointerEnd","onWindowBlur"])this[x]=this[x].bind(this);this.element.addEventListener("mousedown",this.onPointerStart,Va),this.element.addEventListener("touchstart",this.onTouchStart,Va),this.element.addEventListener("touchmove",this.onMove,Va),this.element.addEventListener("touchend",this.onTouchEnd),this.element.addEventListener("touchcancel",this.onTouchEnd)}onPointerStart(t){if(!t.buttons||t.button!==0)return;const o=new Na(t);this.currentPointers.some(c=>c.id===o.id)||this.triggerPointerStart(o,t)&&(window.addEventListener("mousemove",this.onMove),window.addEventListener("mouseup",this.onPointerEnd),window.addEventListener("blur",this.onWindowBlur))}onTouchStart(t){for(const o of Array.from(t.changedTouches||[]))this.triggerPointerStart(new Na(o),t);window.addEventListener("blur",this.onWindowBlur)}onMove(t){const o=this.currentPointers.slice(),c="changedTouches"in t?Array.from(t.changedTouches||[]).map(x=>new Na(x)):[new Na(t)],d=[];for(const x of c){const y=this.currentPointers.findIndex(h=>h.id===x.id);y<0||(d.push(x),this.currentPointers[y]=x)}d.length&&this.moveCallback(t,this.currentPointers.slice(),o)}onPointerEnd(t){t.buttons>0&&t.button!==0||(this.triggerPointerEnd(t,new Na(t)),window.removeEventListener("mousemove",this.onMove),window.removeEventListener("mouseup",this.onPointerEnd),window.removeEventListener("blur",this.onWindowBlur))}onTouchEnd(t){for(const o of Array.from(t.changedTouches||[]))this.triggerPointerEnd(t,new Na(o))}triggerPointerStart(t,o){return!!this.startCallback(o,t,this.currentPointers.slice())&&(this.currentPointers.push(t),this.startPointers.push(t),!0)}triggerPointerEnd(t,o){const c=this.currentPointers.findIndex(d=>d.id===o.id);c<0||(this.currentPointers.splice(c,1),this.startPointers.splice(c,1),this.endCallback(t,o,this.currentPointers.slice()))}onWindowBlur(){this.clear()}clear(){for(;this.currentPointers.length;){const t=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:t.clientX,clientY:t.clientY}),t,this.currentPointers.slice())}}stop(){this.element.removeEventListener("mousedown",this.onPointerStart,Va),this.element.removeEventListener("touchstart",this.onTouchStart,Va),this.element.removeEventListener("touchmove",this.onMove,Va),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 Ay(n,t){return t?Math.sqrt(Math.pow(t.clientX-n.clientX,2)+Math.pow(t.clientY-n.clientY,2)):0}function Dy(n,t){return t?{clientX:(n.clientX+t.clientX)/2,clientY:(n.clientY+t.clientY)/2}:n}const Sp=n=>typeof n=="object"&&n!==null&&n.constructor===Object&&Object.prototype.toString.call(n)==="[object Object]",Un=(n,...t)=>{const o=t.length;for(let c=0;c<o;c++){const d=t[c]||{};Object.entries(d).forEach(([x,y])=>{const h=Array.isArray(y)?[]:{};n[x]||Object.assign(n,{[x]:h}),Sp(y)?Object.assign(n[x],Un(h,y)):Array.isArray(y)?Object.assign(n,{[x]:[...y]}):Object.assign(n,{[x]:y})})}return n},Ep=function(n,t){return n.split(".").reduce((o,c)=>typeof o=="object"?o[c]:void 0,t)};class Qh{constructor(t={}){Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),this.setOptions(t);for(const o of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))o.startsWith("on")&&typeof this[o]=="function"&&(this[o]=this[o].bind(this))}setOptions(t){this.options=t?Un({},this.constructor.defaults,t):{};for(const[o,c]of Object.entries(this.option("on")||{}))this.on(o,c)}option(t,...o){let c=Ep(t,this.options);return c&&typeof c=="function"&&(c=c.call(this,this,...o)),c}optionFor(t,o,c,...d){let x=Ep(o,t);var y;typeof(y=x)!="string"||isNaN(y)||isNaN(parseFloat(y))||(x=parseFloat(x)),x==="true"&&(x=!0),x==="false"&&(x=!1),x&&typeof x=="function"&&(x=x.call(this,this,t,...d));let h=Ep(o,this.options);return h&&typeof h=="function"?x=h.call(this,this,t,...d,x):x===void 0&&(x=h),x===void 0?c:x}cn(t){const o=this.options.classes;return o&&o[t]||""}localize(t,o=[]){t=String(t).replace(/\{\{(\w+).?(\w+)?\}\}/g,(c,d,x)=>{let y="";return x?y=this.option(`${d[0]+d.toLowerCase().substring(1)}.l10n.${x}`):d&&(y=this.option(`l10n.${d}`)),y||(y=c),y});for(let c=0;c<o.length;c++)t=t.split(o[c][0]).join(o[c][1]);return t=t.replace(/\{\{(.*?)\}\}/g,(c,d)=>d)}on(t,o){let c=[];typeof t=="string"?c=t.split(" "):Array.isArray(t)&&(c=t),this.events||(this.events=new Map),c.forEach(d=>{let x=this.events.get(d);x||(this.events.set(d,[]),x=[]),x.includes(o)||x.push(o),this.events.set(d,x)})}off(t,o){let c=[];typeof t=="string"?c=t.split(" "):Array.isArray(t)&&(c=t),c.forEach(d=>{const x=this.events.get(d);if(Array.isArray(x)){const y=x.indexOf(o);y>-1&&x.splice(y,1)}})}emit(t,...o){[...this.events.get(t)||[]].forEach(c=>c(this,...o)),t!=="*"&&this.emit("*",t,...o)}}Object.defineProperty(Qh,"version",{enumerable:!0,configurable:!0,writable:!0,value:"5.0.36"}),Object.defineProperty(Qh,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{}});class Tp extends Qh{constructor(t={}){super(t),Object.defineProperty(this,"plugins",{enumerable:!0,configurable:!0,writable:!0,value:{}})}attachPlugins(t={}){const o=new Map;for(const[c,d]of Object.entries(t)){const x=this.option(c),y=this.plugins[c];y||x===!1?y&&x===!1&&(y.detach(),delete this.plugins[c]):o.set(c,new d(this,x||{}))}for(const[c,d]of o)this.plugins[c]=d,d.attach()}detachPlugins(t){t=t||Object.keys(this.plugins);for(const o of t){const c=this.plugins[o];c&&c.detach(),delete this.plugins[o]}return this.emit("detachPlugins"),this}}var ci;(function(n){n[n.Init=0]="Init",n[n.Error=1]="Error",n[n.Ready=2]="Ready",n[n.Panning=3]="Panning",n[n.Mousemove=4]="Mousemove",n[n.Destroy=5]="Destroy"})(ci||(ci={}));const Ss=["a","b","c","d","e","f"],zy={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"},RE={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:zy},Ly='<circle cx="25" cy="25" r="20"></circle>',Cp='<div class="f-spinner"><svg viewBox="0 0 50 50">'+Ly+Ly+"</svg></div>",Hn=n=>n&&n!==null&&n instanceof Element&&"nodeType"in n,ni=(n,t)=>{n&&kp(t).forEach(o=>{n.classList.remove(o)})},dt=(n,t)=>{n&&kp(t).forEach(o=>{n.classList.add(o)})},eu={a:1,b:0,c:0,d:1,e:0,f:0},OE=1e5,tu=1e4,br="mousemove",Ry="drag",Oy="content",vr="auto";let Mp=null,Pp=null;class $o extends Tp{get fits(){return this.contentRect.width-this.contentRect.fitWidth<1&&this.contentRect.height-this.contentRect.fitHeight<1}get isTouchDevice(){return Pp===null&&(Pp=window.matchMedia("(hover: none)").matches),Pp}get isMobile(){return Mp===null&&(Mp=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)),Mp}get panMode(){return this.options.panMode!==br||this.isTouchDevice?Ry:br}get panOnlyZoomed(){const t=this.options.panOnlyZoomed;return t===vr?this.isTouchDevice:t}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:t,b:o}=this.current;return Math.sqrt(t*t+o*o)||1}get targetScale(){const{a:t,b:o}=this.target;return Math.sqrt(t*t+o*o)||1}get minScale(){return this.option("minScale")||1}get fullScale(){const{contentRect:t}=this;return t.fullWidth/t.fitWidth||1}get maxScale(){return this.fullScale*(this.option("maxScale")||1)||1}get coverScale(){const{containerRect:t,contentRect:o}=this,c=Math.max(t.height/o.fitHeight,t.width/o.fitWidth)||1;return Math.min(this.fullScale,c)}get isScaling(){return Math.abs(this.targetScale-this.scale)>1e-5&&!this.isResting}get isContentLoading(){const t=this.content;return!!(t&&t instanceof HTMLImageElement)&&!t.complete}get isResting(){if(this.isBouncingX||this.isBouncingY)return!1;for(const t of Ss){const o=t=="e"||t==="f"?1e-4:1e-5;if(Math.abs(this.target[t]-this.current[t])>o)return!1}return!(!this.ignoreBounds&&!this.checkBounds().inBounds)}constructor(t,o={},c={}){var d;if(super(o),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:ci.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({},eu)}),Object.defineProperty(this,"target",{enumerable:!0,configurable:!0,writable:!0,value:Object.assign({},eu)}),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}),!t)throw new Error("Container Element Not Found");this.container=t,this.initContent(),this.attachPlugins(Object.assign(Object.assign({},$o.Plugins),c)),this.emit("attachPlugins"),this.emit("init");const x=this.content;if(x.addEventListener("load",this.onLoad),x.addEventListener("error",this.onError),this.isContentLoading){if(this.option("spinner")){t.classList.add(this.cn("isLoading"));const y=Qr(Cp);!t.contains(x)||x.parentElement instanceof HTMLPictureElement?this.spinner=t.appendChild(y):this.spinner=((d=x.parentElement)===null||d===void 0?void 0:d.insertBefore(y,x))||null}this.emit("beforeLoad")}else queueMicrotask(()=>{this.enable()})}initContent(){const{container:t}=this,o=this.cn(Oy);let c=this.option(Oy)||t.querySelector(`.${o}`);if(c||(c=t.querySelector("img,picture")||t.firstElementChild,c&&dt(c,o)),c instanceof HTMLPictureElement&&(c=c.querySelector("img")),!c)throw new Error("No content found");this.content=c}onLoad(){const{spinner:t,container:o,state:c}=this;t&&(t.remove(),this.spinner=null),this.option("spinner")&&o.classList.remove(this.cn("isLoading")),this.emit("afterLoad"),c===ci.Init?this.enable():this.updateMetrics()}onError(){this.state!==ci.Destroy&&(this.spinner&&(this.spinner.remove(),this.spinner=null),this.stop(),this.detachEvents(),this.state=ci.Error,this.emit("error"))}getNextScale(t){const{fullScale:o,targetScale:c,coverScale:d,maxScale:x,minScale:y}=this;let h=y;switch(t){case"toggleMax":h=c-y<.5*(x-y)?x:y;break;case"toggleCover":h=c-y<.5*(d-y)?d:y;break;case"toggleZoom":h=c-y<.5*(o-y)?o:y;break;case"iterateZoom":let M=[1,o,x].sort((A,z)=>A-z),D=M.findIndex(A=>A>c+1e-5);h=M[D]||1}return h}attachObserver(){var t;const o=()=>{const{container:c,containerRect:d}=this;return Math.abs(d.width-c.getBoundingClientRect().width)>.1||Math.abs(d.height-c.getBoundingClientRect().height)>.1};this.resizeObserver||window.ResizeObserver===void 0||(this.resizeObserver=new ResizeObserver(()=>{this.updateTimer||(o()?(this.onResize(),this.isMobile&&(this.updateTimer=setTimeout(()=>{o()&&this.onResize(),this.updateTimer=null},500))):this.updateTimer&&(clearTimeout(this.updateTimer),this.updateTimer=null))})),(t=this.resizeObserver)===null||t===void 0||t.observe(this.container)}detachObserver(){var t;(t=this.resizeObserver)===null||t===void 0||t.disconnect()}attachEvents(){const{container:t}=this;t.addEventListener("click",this.onClick,{passive:!1,capture:!1}),t.addEventListener("wheel",this.onWheel,{passive:!1}),this.pointerTracker=new LE(t,{start:this.onPointerDown,move:this.onPointerMove,end:this.onPointerUp}),document.addEventListener(br,this.onMouseMove)}detachEvents(){var t;const{container:o}=this;o.removeEventListener("click",this.onClick,{passive:!1,capture:!1}),o.removeEventListener("wheel",this.onWheel,{passive:!1}),(t=this.pointerTracker)===null||t===void 0||t.stop(),this.pointerTracker=null,document.removeEventListener(br,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 t=this.friction,o=this.option("maxVelocity");for(const c of Ss)t?(this.velocity[c]*=1-t,o&&!this.isScaling&&(this.velocity[c]=Math.max(Math.min(this.velocity[c],o),-1*o)),this.current[c]+=this.velocity[c]):this.current[c]=this.target[c];this.setTransform(),this.setEdgeForce(),!this.isResting||this.isDragging?this.rAF=requestAnimationFrame(()=>this.animate()):this.stop("current")}setTargetForce(){for(const t of Ss)t==="e"&&this.isBouncingX||t==="f"&&this.isBouncingY||(this.velocity[t]=(1/(1-this.friction)-1)*(this.target[t]-this.current[t]))}checkBounds(t=0,o=0){const{current:c}=this,d=c.e+t,x=c.f+o,y=this.getBounds(),{x:h,y:M}=y,D=h.min,A=h.max,z=M.min,L=M.max;let N=0,Y=0;return D!==1/0&&d<D?N=D-d:A!==1/0&&d>A&&(N=A-d),z!==1/0&&x<z?Y=z-x:L!==1/0&&x>L&&(Y=L-x),Math.abs(N)<1e-4&&(N=0),Math.abs(Y)<1e-4&&(Y=0),Object.assign(Object.assign({},y),{xDiff:N,yDiff:Y,inBounds:!N&&!Y})}clampTargetBounds(){const{target:t}=this,{x:o,y:c}=this.getBounds();o.min!==1/0&&(t.e=Math.max(t.e,o.min)),o.max!==1/0&&(t.e=Math.min(t.e,o.max)),c.min!==1/0&&(t.f=Math.max(t.f,c.min)),c.max!==1/0&&(t.f=Math.min(t.f,c.max))}calculateContentDim(t=this.current){const{content:o,contentRect:c}=this,{fitWidth:d,fitHeight:x,fullWidth:y,fullHeight:h}=c;let M=y,D=h;if(this.option("zoom")||this.angle!==0){const A=!(o instanceof HTMLImageElement)&&(window.getComputedStyle(o).maxWidth==="none"||window.getComputedStyle(o).maxHeight==="none"),z=A?y:d,L=A?h:x,N=this.getMatrix(t),Y=new DOMPoint(0,0).matrixTransform(N),ee=new DOMPoint(0+z,0).matrixTransform(N),oe=new DOMPoint(0+z,0+L).matrixTransform(N),he=new DOMPoint(0,0+L).matrixTransform(N),_e=Math.abs(oe.x-Y.x),me=Math.abs(oe.y-Y.y),Ie=Math.abs(he.x-ee.x),tt=Math.abs(he.y-ee.y);M=Math.max(_e,Ie),D=Math.max(me,tt)}return{contentWidth:M,contentHeight:D}}setEdgeForce(){if(this.ignoreBounds||this.isDragging||this.panMode===br||this.targetScale<this.scale)return this.isBouncingX=!1,void(this.isBouncingY=!1);const{target:t}=this,{x:o,y:c,xDiff:d,yDiff:x}=this.checkBounds(),y=this.option("maxVelocity");let h=this.velocity.e,M=this.velocity.f;d!==0?(this.isBouncingX=!0,d*h<=0?h+=.14*d:(h=.14*d,o.min!==1/0&&(this.target.e=Math.max(t.e,o.min)),o.max!==1/0&&(this.target.e=Math.min(t.e,o.max))),y&&(h=Math.max(Math.min(h,y),-1*y))):this.isBouncingX=!1,x!==0?(this.isBouncingY=!0,x*M<=0?M+=.14*x:(M=.14*x,c.min!==1/0&&(this.target.f=Math.max(t.f,c.min)),c.max!==1/0&&(this.target.f=Math.min(t.f,c.max))),y&&(M=Math.max(Math.min(M,y),-1*y))):this.isBouncingY=!1,this.isBouncingX&&(this.velocity.e=h),this.isBouncingY&&(this.velocity.f=M)}enable(){const{content:t}=this,o=new DOMMatrixReadOnly(window.getComputedStyle(t).transform);for(const c of Ss)this.current[c]=this.target[c]=o[c];this.updateMetrics(),this.attachObserver(),this.attachEvents(),this.state=ci.Ready,this.emit("ready")}onClick(t){var o;t.type==="click"&&t.detail===0&&(this.dragOffset.x=0,this.dragOffset.y=0),this.isDragging&&((o=this.pointerTracker)===null||o===void 0||o.clear(),this.trackingPoints=[],this.startDecelAnim());const c=t.target;if(!c||t.defaultPrevented)return;if(c.hasAttribute("disabled"))return t.preventDefault(),void t.stopPropagation();if((()=>{const N=window.getSelection();return N&&N.type==="Range"})()&&!c.closest("button"))return;const d=c.closest("[data-panzoom-action]"),x=c.closest("[data-panzoom-change]"),y=d||x,h=y&&Hn(y)?y.dataset:null;if(h){const N=h.panzoomChange,Y=h.panzoomAction;if((N||Y)&&t.preventDefault(),N){let ee={};try{ee=JSON.parse(N)}catch{console&&console.warn("The given data was not valid JSON")}return void this.applyChange(ee)}if(Y)return void(this[Y]&&this[Y]())}if(Math.abs(this.dragOffset.x)>3||Math.abs(this.dragOffset.y)>3)return t.preventDefault(),void t.stopPropagation();if(c.closest("[data-fancybox]"))return;const M=this.content.getBoundingClientRect(),D=this.dragStart;if(D.time&&!this.canZoomOut()&&(Math.abs(M.x-D.x)>2||Math.abs(M.y-D.y)>2))return;this.dragStart.time=0;const A=N=>{this.option("zoom",t)&&N&&typeof N=="string"&&/(iterateZoom)|(toggle(Zoom|Full|Cover|Max)|(zoomTo(Fit|Cover|Max)))/.test(N)&&typeof this[N]=="function"&&(t.preventDefault(),this[N]({event:t}))},z=this.option("click",t),L=this.option("dblClick",t);L?(this.clicks++,this.clicks==1&&(this.clickTimer=setTimeout(()=>{this.clicks===1?(this.emit("click",t),!t.defaultPrevented&&z&&A(z)):(this.emit("dblClick",t),t.defaultPrevented||A(L)),this.clicks=0,this.clickTimer=null},350))):(this.emit("click",t),!t.defaultPrevented&&z&&A(z))}addTrackingPoint(t){const o=this.trackingPoints.filter(c=>c.time>Date.now()-100);o.push(t),this.trackingPoints=o}onPointerDown(t,o,c){var d;if(this.option("touch",t)===!1)return!1;this.pwt=0,this.dragOffset={x:0,y:0,time:0},this.trackingPoints=[];const x=this.content.getBoundingClientRect();if(this.dragStart={x:x.x,y:x.y,top:x.top,left:x.left,time:Date.now()},this.clickTimer)return!1;if(this.panMode===br&&this.targetScale>1)return t.preventDefault(),t.stopPropagation(),!1;const y=t.composedPath()[0];if(!c.length){if(["TEXTAREA","OPTION","INPUT","SELECT","VIDEO","IFRAME"].includes(y.nodeName)||y.closest("[contenteditable],[data-selectable],[data-draggable],[data-clickable],[data-panzoom-change],[data-panzoom-action]"))return!1;(d=window.getSelection())===null||d===void 0||d.removeAllRanges()}if(t.type==="mousedown")["A","BUTTON"].includes(y.nodeName)||t.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(o),this.emit("touchStart",t)),!0}onPointerMove(t,o,c){if(this.option("touch",t)===!1||!this.isDragging||o.length<2&&this.panOnlyZoomed&&Ye(this.targetScale)<=Ye(this.minScale)||(this.emit("touchMove",t),t.defaultPrevented))return;this.addTrackingPoint(o[0]);const{content:d}=this,x=Dy(c[0],c[1]),y=Dy(o[0],o[1]);let h=0,M=0;if(o.length>1){const me=d.getBoundingClientRect();h=x.clientX-me.left-.5*me.width,M=x.clientY-me.top-.5*me.height}const D=Ay(c[0],c[1]),A=Ay(o[0],o[1]);let z=D?A/D:1,L=y.clientX-x.clientX,N=y.clientY-x.clientY;this.dragOffset.x+=L,this.dragOffset.y+=N,this.dragOffset.time=Date.now()-this.dragStart.time;let Y=Ye(this.targetScale)===Ye(this.minScale)&&this.option("lockAxis");if(Y&&!this.lockedAxis)if(Y==="xy"||Y==="y"||t.type==="touchmove"){if(Math.abs(this.dragOffset.x)<6&&Math.abs(this.dragOffset.y)<6)return void t.preventDefault();const me=Math.abs(180*Math.atan2(this.dragOffset.y,this.dragOffset.x)/Math.PI);this.lockedAxis=me>45&&me<135?"y":"x",this.dragOffset.x=0,this.dragOffset.y=0,L=0,N=0}else this.lockedAxis=Y;if(Jh(t.target,this.content)&&(Y="x",this.dragOffset.y=0),Y&&Y!=="xy"&&this.lockedAxis!==Y&&Ye(this.targetScale)===Ye(this.minScale))return;t.cancelable&&t.preventDefault(),this.container.classList.add(this.cn("isDragging"));const ee=this.checkBounds(L,N);this.option("rubberband")?(this.isInfinite!=="x"&&(ee.xDiff>0&&L<0||ee.xDiff<0&&L>0)&&(L*=Math.max(0,.5-Math.abs(.75/this.contentRect.fitWidth*ee.xDiff))),this.isInfinite!=="y"&&(ee.yDiff>0&&N<0||ee.yDiff<0&&N>0)&&(N*=Math.max(0,.5-Math.abs(.75/this.contentRect.fitHeight*ee.yDiff)))):(ee.xDiff&&(L=0),ee.yDiff&&(N=0));const oe=this.targetScale,he=this.minScale,_e=this.maxScale;oe<.5*he&&(z=Math.max(z,he)),oe>1.5*_e&&(z=Math.min(z,_e)),this.lockedAxis==="y"&&Ye(oe)===Ye(he)&&(L=0),this.lockedAxis==="x"&&Ye(oe)===Ye(he)&&(N=0),this.applyChange({originX:h,originY:M,panX:L,panY:N,scale:z,friction:this.option("dragFriction"),ignoreBounds:!0})}onPointerUp(t,o,c){if(c.length)return this.dragOffset.x=0,this.dragOffset.y=0,void(this.trackingPoints=[]);this.container.classList.remove(this.cn("isDragging")),this.isDragging&&(this.addTrackingPoint(o),this.panOnlyZoomed&&this.contentRect.width-this.contentRect.fitWidth<1&&this.contentRect.height-this.contentRect.fitHeight<1&&(this.trackingPoints=[]),Jh(t.target,this.content)&&this.lockedAxis==="y"&&(this.trackingPoints=[]),this.emit("touchEnd",t),this.isDragging=!1,this.lockedAxis=!1,this.state!==ci.Destroy&&(t.defaultPrevented||this.startDecelAnim()))}startDecelAnim(){var t;const o=this.isScaling;this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const me of Ss)this.velocity[me]=0;this.target.e=this.current.e,this.target.f=this.current.f,ni(this.container,"is-scaling"),ni(this.container,"is-animating"),this.isTicking=!1;const{trackingPoints:c}=this,d=c[0],x=c[c.length-1];let y=0,h=0,M=0;x&&d&&(y=x.clientX-d.clientX,h=x.clientY-d.clientY,M=x.time-d.time);const D=((t=window.visualViewport)===null||t===void 0?void 0:t.scale)||1;D!==1&&(y*=D,h*=D);let A=0,z=0,L=0,N=0,Y=this.option("decelFriction");const ee=this.targetScale;if(M>0){L=Math.abs(y)>3?y/(M/30):0,N=Math.abs(h)>3?h/(M/30):0;const me=this.option("maxVelocity");me&&(L=Math.max(Math.min(L,me),-1*me),N=Math.max(Math.min(N,me),-1*me))}L&&(A=L/(1/(1-Y)-1)),N&&(z=N/(1/(1-Y)-1)),(this.option("lockAxis")==="y"||this.option("lockAxis")==="xy"&&this.lockedAxis==="y"&&Ye(ee)===this.minScale)&&(A=L=0),(this.option("lockAxis")==="x"||this.option("lockAxis")==="xy"&&this.lockedAxis==="x"&&Ye(ee)===this.minScale)&&(z=N=0);const oe=this.dragOffset.x,he=this.dragOffset.y,_e=this.option("dragMinThreshold")||0;Math.abs(oe)<_e&&Math.abs(he)<_e&&(A=z=0,L=N=0),(this.option("zoom")&&(ee<this.minScale-1e-5||ee>this.maxScale+1e-5)||o&&!A&&!z)&&(Y=.35),this.applyChange({panX:A,panY:z,friction:Y}),this.emit("decel",L,N,oe,he)}onWheel(t){var o=[-t.deltaX||0,-t.deltaY||0,-t.detail||0].reduce(function(x,y){return Math.abs(y)>Math.abs(x)?y:x});const c=Math.max(-1,Math.min(1,o));if(this.emit("wheel",t,c),this.panMode===br||t.defaultPrevented)return;const d=this.option("wheel");d==="pan"?(t.preventDefault(),this.panOnlyZoomed&&!this.canZoomOut()||this.applyChange({panX:2*-t.deltaX,panY:2*-t.deltaY,bounce:!1})):d==="zoom"&&this.option("zoom")!==!1&&this.zoomWithWheel(t)}onMouseMove(t){this.panWithMouse(t)}onKeydown(t){t.key==="Escape"&&this.toggleFS()}onResize(){this.updateMetrics(),this.checkBounds().inBounds||this.requestTick()}setTransform(){this.emit("beforeTransform");const{current:t,target:o,content:c,contentRect:d}=this,x=Object.assign({},eu);for(const oe of Ss){const he=oe=="e"||oe==="f"?tu:OE;x[oe]=Ye(t[oe],he),Math.abs(o[oe]-t[oe])<(oe=="e"||oe==="f"?.51:.001)&&(t[oe]=o[oe])}let{a:y,b:h,c:M,d:D,e:A,f:z}=x,L=`matrix(${y}, ${h}, ${M}, ${D}, ${A}, ${z})`,N=c.parentElement instanceof HTMLPictureElement?c.parentElement:c;if(this.option("transformParent")&&(N=N.parentElement||N),N.style.transform===L)return;N.style.transform=L;const{contentWidth:Y,contentHeight:ee}=this.calculateContentDim();d.width=Y,d.height=ee,this.emit("afterTransform")}updateMetrics(t=!1){var o;if(!this||this.state===ci.Destroy||this.isContentLoading)return;const c=Math.max(1,((o=window.visualViewport)===null||o===void 0?void 0:o.scale)||1),{container:d,content:x}=this,y=x instanceof HTMLImageElement,h=d.getBoundingClientRect(),M=getComputedStyle(this.container);let D=h.width*c,A=h.height*c;const z=parseFloat(M.paddingTop)+parseFloat(M.paddingBottom),L=D-(parseFloat(M.paddingLeft)+parseFloat(M.paddingRight)),N=A-z;this.containerRect={width:D,height:A,innerWidth:L,innerHeight:N};const Y=parseFloat(x.dataset.width||"")||(Pt=>{let ri=0;return ri=Pt instanceof HTMLImageElement?Pt.naturalWidth:Pt instanceof SVGElement?Pt.width.baseVal.value:Math.max(Pt.offsetWidth,Pt.scrollWidth),ri||0})(x),ee=parseFloat(x.dataset.height||"")||(Pt=>{let ri=0;return ri=Pt instanceof HTMLImageElement?Pt.naturalHeight:Pt instanceof SVGElement?Pt.height.baseVal.value:Math.max(Pt.offsetHeight,Pt.scrollHeight),ri||0})(x);let oe=this.option("width",Y)||vr,he=this.option("height",ee)||vr;const _e=oe===vr,me=he===vr;typeof oe!="number"&&(oe=Y),typeof he!="number"&&(he=ee),_e&&(oe=Y*(he/ee)),me&&(he=ee/(Y/oe));let Ie=x.parentElement instanceof HTMLPictureElement?x.parentElement:x;this.option("transformParent")&&(Ie=Ie.parentElement||Ie);const tt=Ie.getAttribute("style")||"";Ie.style.setProperty("transform","none","important"),y&&(Ie.style.width="",Ie.style.height=""),Ie.offsetHeight;const gt=x.getBoundingClientRect();let Ve=gt.width*c,rt=gt.height*c,xt=Ve,zt=rt;Ve=Math.min(Ve,oe),rt=Math.min(rt,he),y?{width:Ve,height:rt}=((Pt,ri,Vi,yn)=>{const zi=Vi/Pt,ui=yn/ri,an=Math.min(zi,ui);return{width:Pt*=an,height:ri*=an}})(oe,he,Ve,rt):(Ve=Math.min(Ve,oe),rt=Math.min(rt,he));let Et=.5*(zt-rt),Ki=.5*(xt-Ve);this.contentRect=Object.assign(Object.assign({},this.contentRect),{top:gt.top-h.top+Et,bottom:h.bottom-gt.bottom+Et,left:gt.left-h.left+Ki,right:h.right-gt.right+Ki,fitWidth:Ve,fitHeight:rt,width:Ve,height:rt,fullWidth:oe,fullHeight:he}),Ie.style.cssText=tt,y&&(Ie.style.width=`${Ve}px`,Ie.style.height=`${rt}px`),this.setTransform(),t!==!0&&this.emit("refresh"),this.ignoreBounds||(Ye(this.targetScale)<Ye(this.minScale)?this.zoomTo(this.minScale,{friction:0}):this.targetScale>this.maxScale?this.zoomTo(this.maxScale,{friction:0}):this.state===ci.Init||this.checkBounds().inBounds||this.requestTick()),this.updateControls()}calculateBounds(){const{contentWidth:t,contentHeight:o}=this.calculateContentDim(this.target),{targetScale:c,lockedAxis:d}=this,{fitWidth:x,fitHeight:y}=this.contentRect;let h=0,M=0,D=0,A=0;const z=this.option("infinite");if(z===!0||d&&z===d)h=-1/0,D=1/0,M=-1/0,A=1/0;else{let{containerRect:L,contentRect:N}=this,Y=Ye(x*c,tu),ee=Ye(y*c,tu),{innerWidth:oe,innerHeight:he}=L;if(L.width===Y&&(oe=L.width),L.width===ee&&(he=L.height),t>oe){D=.5*(t-oe),h=-1*D;let _e=.5*(N.right-N.left);h+=_e,D+=_e}if(x>oe&&t<oe&&(h-=.5*(x-oe),D-=.5*(x-oe)),o>he){A=.5*(o-he),M=-1*A;let _e=.5*(N.bottom-N.top);M+=_e,A+=_e}y>he&&o<he&&(h-=.5*(y-he),D-=.5*(y-he))}return{x:{min:h,max:D},y:{min:M,max:A}}}getBounds(){const t=this.option("bounds");return t!==vr?t:this.calculateBounds()}updateControls(){const t=this,o=t.container,{panMode:c,contentRect:d,targetScale:x,minScale:y}=t;let h=y,M=t.option("click")||!1;M&&(h=t.getNextScale(M));let D=t.canZoomIn(),A=t.canZoomOut(),z=c===Ry&&!!this.option("touch"),L=A&&z;if(z&&(Ye(x)<Ye(y)&&!this.panOnlyZoomed&&(L=!0),(Ye(d.width,1)>Ye(d.fitWidth,1)||Ye(d.height,1)>Ye(d.fitHeight,1))&&(L=!0)),Ye(d.width*x,1)<Ye(d.fitWidth,1)&&(L=!1),c===br&&(L=!1),es(o,this.cn("isDraggable"),L),!this.option("zoom"))return;let N=D&&Ye(h)>Ye(x),Y=!N&&!L&&A&&Ye(h)<Ye(x);es(o,this.cn("canZoomIn"),N),es(o,this.cn("canZoomOut"),Y);for(const ee of o.querySelectorAll("[data-panzoom-action]")){let oe=!1,he=!1;switch(ee.dataset.panzoomAction){case"zoomIn":D?oe=!0:he=!0;break;case"zoomOut":A?oe=!0:he=!0;break;case"toggleZoom":case"iterateZoom":D||A?oe=!0:he=!0;const _e=ee.querySelector("g");_e&&(_e.style.display=D?"":"none")}oe?(ee.removeAttribute("disabled"),ee.removeAttribute("tabindex")):he&&(ee.setAttribute("disabled",""),ee.setAttribute("tabindex","-1"))}}panTo({x:t=this.target.e,y:o=this.target.f,scale:c=this.targetScale,friction:d=this.option("friction"),angle:x=0,originX:y=0,originY:h=0,flipX:M=!1,flipY:D=!1,ignoreBounds:A=!1}){this.state!==ci.Destroy&&this.applyChange({panX:t-this.target.e,panY:o-this.target.f,scale:c/this.targetScale,angle:x,originX:y,originY:h,friction:d,flipX:M,flipY:D,ignoreBounds:A})}applyChange({panX:t=0,panY:o=0,scale:c=1,angle:d=0,originX:x=-this.current.e,originY:y=-this.current.f,friction:h=this.option("friction"),flipX:M=!1,flipY:D=!1,ignoreBounds:A=!1,bounce:z=this.option("bounce")}){const L=this.state;if(L===ci.Destroy)return;this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.friction=h||0,this.ignoreBounds=A;const{current:N}=this,Y=N.e,ee=N.f,oe=this.getMatrix(this.target);let he=new DOMMatrix().translate(Y,ee).translate(x,y).translate(t,o);if(this.option("zoom")){if(!A){const _e=this.targetScale,me=this.minScale,Ie=this.maxScale;_e*c<me&&(c=me/_e),_e*c>Ie&&(c=Ie/_e)}he=he.scale(c)}he=he.translate(-x,-y).translate(-Y,-ee).multiply(oe),d&&(he=he.rotate(d)),M&&(he=he.scale(-1,1)),D&&(he=he.scale(1,-1));for(const _e of Ss)_e!=="e"&&_e!=="f"&&(he[_e]>this.minScale+1e-5||he[_e]<this.minScale-1e-5)?this.target[_e]=he[_e]:this.target[_e]=Ye(he[_e],tu);(this.targetScale<this.scale||Math.abs(c-1)>.1||this.panMode===br||z===!1)&&!A&&this.clampTargetBounds(),L===ci.Init?this.animate():this.isResting||(this.state=ci.Panning,this.requestTick())}stop(t=!1){if(this.state===ci.Init||this.state===ci.Destroy)return;const o=this.isTicking;this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const c of Ss)this.velocity[c]=0,t==="current"?this.current[c]=this.target[c]:t==="target"&&(this.target[c]=this.current[c]);this.setTransform(),ni(this.container,"is-scaling"),ni(this.container,"is-animating"),this.isTicking=!1,this.state=ci.Ready,o&&(this.emit("endAnimation"),this.updateControls())}requestTick(){this.isTicking||(this.emit("startAnimation"),this.updateControls(),dt(this.container,"is-animating"),this.isScaling&&dt(this.container,"is-scaling")),this.isTicking=!0,this.rAF||(this.rAF=requestAnimationFrame(()=>this.animate()))}panWithMouse(t,o=this.option("mouseMoveFriction")){if(this.pmme=t,this.panMode!==br||!t||Ye(this.targetScale)<=Ye(this.minScale))return;this.emit("mouseMove",t);const{container:c,containerRect:d,contentRect:x}=this,y=d.width,h=d.height,M=c.getBoundingClientRect(),D=(t.clientX||0)-M.left,A=(t.clientY||0)-M.top;let{contentWidth:z,contentHeight:L}=this.calculateContentDim(this.target);const N=this.option("mouseMoveFactor");N>1&&(z!==y&&(z*=N),L!==h&&(L*=N));let Y=.5*(z-y)-D/y*100/100*(z-y);Y+=.5*(x.right-x.left);let ee=.5*(L-h)-A/h*100/100*(L-h);ee+=.5*(x.bottom-x.top),this.applyChange({panX:Y-this.target.e,panY:ee-this.target.f,friction:o})}zoomWithWheel(t){if(this.state===ci.Destroy||this.state===ci.Init)return;const o=Date.now();if(o-this.pwt<45)return void t.preventDefault();this.pwt=o;var c=[-t.deltaX||0,-t.deltaY||0,-t.detail||0].reduce(function(D,A){return Math.abs(A)>Math.abs(D)?A:D});const d=Math.max(-1,Math.min(1,c)),{targetScale:x,maxScale:y,minScale:h}=this;let M=x*(100+45*d)/100;Ye(M)<Ye(h)&&Ye(x)<=Ye(h)?(this.cwd+=Math.abs(d),M=h):Ye(M)>Ye(y)&&Ye(x)>=Ye(y)?(this.cwd+=Math.abs(d),M=y):(this.cwd=0,M=Math.max(Math.min(M,y),h)),this.cwd>this.option("wheelLimit")||(t.preventDefault(),Ye(M)!==Ye(x)&&this.zoomTo(M,{event:t}))}canZoomIn(){return this.option("zoom")&&(Ye(this.contentRect.width,1)<Ye(this.contentRect.fitWidth,1)||Ye(this.targetScale)<Ye(this.maxScale))}canZoomOut(){return this.option("zoom")&&Ye(this.targetScale)>Ye(this.minScale)}zoomIn(t=1.25,o){this.zoomTo(this.targetScale*t,o)}zoomOut(t=.8,o){this.zoomTo(this.targetScale*t,o)}zoomToFit(t){this.zoomTo("fit",t)}zoomToCover(t){this.zoomTo("cover",t)}zoomToFull(t){this.zoomTo("full",t)}zoomToMax(t){this.zoomTo("max",t)}toggleZoom(t){this.zoomTo(this.getNextScale("toggleZoom"),t)}toggleMax(t){this.zoomTo(this.getNextScale("toggleMax"),t)}toggleCover(t){this.zoomTo(this.getNextScale("toggleCover"),t)}iterateZoom(t){this.zoomTo("next",t)}zoomTo(t=1,{friction:o=vr,originX:c=vr,originY:d=vr,event:x}={}){if(this.isContentLoading||this.state===ci.Destroy)return;const{targetScale:y,fullScale:h,maxScale:M,coverScale:D}=this;if(this.stop(),this.panMode===br&&(x=this.pmme||x),x||c===vr||d===vr){const z=this.content.getBoundingClientRect(),L=this.container.getBoundingClientRect(),N=x?x.clientX:L.left+.5*L.width,Y=x?x.clientY:L.top+.5*L.height;c=N-z.left-.5*z.width,d=Y-z.top-.5*z.height}let A=1;typeof t=="number"?A=t:t==="full"?A=h:t==="cover"?A=D:t==="max"?A=M:t==="fit"?A=1:t==="next"&&(A=this.getNextScale("iterateZoom")),A=A/y||1,o=o===vr?A>1?.15:.25:o,this.applyChange({scale:A,originX:c,originY:d,friction:o}),x&&this.panMode===br&&this.panWithMouse(x,o)}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:t,contentRect:o,target:c}=this;this.applyChange({panX:.5*t.width-(o.left+.5*o.fitWidth)-c.e,panY:.5*t.height-(o.top+.5*o.fitHeight)-c.f,scale:t.width/o.fitWidth/this.targetScale,originX:0,originY:0,ignoreBounds:!0})}fitY(){this.stop("target");const{containerRect:t,contentRect:o,target:c}=this;this.applyChange({panX:.5*t.width-(o.left+.5*o.fitWidth)-c.e,panY:.5*t.innerHeight-(o.top+.5*o.fitHeight)-c.f,scale:t.height/o.fitHeight/this.targetScale,originX:0,originY:0,ignoreBounds:!0})}toggleFS(){const{container:t}=this,o=this.cn("inFullscreen"),c=this.cn("htmlHasFullscreen");t.classList.toggle(o);const d=t.classList.contains(o);d?(document.documentElement.classList.add(c),document.addEventListener("keydown",this.onKeydown,!0)):(document.documentElement.classList.remove(c),document.removeEventListener("keydown",this.onKeydown,!0)),this.updateMetrics(),this.emit(d?"enterFS":"exitFS")}getMatrix(t=this.current){const{a:o,b:c,c:d,d:x,e:y,f:h}=t;return new DOMMatrix([o,c,d,x,y,h])}reset(t){if(this.state!==ci.Init&&this.state!==ci.Destroy){this.stop("current");for(const o of Ss)this.target[o]=eu[o];this.target.a=this.minScale,this.target.d=this.minScale,this.clampTargetBounds(),this.isResting||(this.friction=t===void 0?this.option("friction"):t,this.state=ci.Panning,this.requestTick())}}destroy(){this.stop(),this.state=ci.Destroy,this.detachEvents(),this.detachObserver();const{container:t,content:o}=this,c=this.option("classes")||{};for(const d of Object.values(c))t.classList.remove(d+"");o&&(o.removeEventListener("load",this.onLoad),o.removeEventListener("error",this.onError)),this.detachPlugins()}}Object.defineProperty($o,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:RE}),Object.defineProperty($o,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:{}});const By=function(n,t){let o=!0;return(...c)=>{o&&(o=!1,n(...c),setTimeout(()=>{o=!0},t))}},Fy=(n,t)=>{let o=[];return n.childNodes.forEach(c=>{c.nodeType!==Node.ELEMENT_NODE||t&&!c.matches(t)||o.push(c)}),o},BE={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 Ni;(function(n){n[n.Init=0]="Init",n[n.Ready=1]="Ready",n[n.Destroy=2]="Destroy"})(Ni||(Ni={}));const Ip=n=>{if(typeof n=="string"||n instanceof HTMLElement)n={html:n};else{const t=n.thumb;t!==void 0&&(typeof t=="string"&&(n.thumbSrc=t),t instanceof HTMLImageElement&&(n.thumbEl=t,n.thumbElSrc=t.src,n.thumbSrc=t.src),delete n.thumb)}return Object.assign({html:"",el:null,isDom:!1,class:"",customClass:"",index:-1,dim:0,gap:0,pos:0,transition:!1},n)},FE=(n={})=>Object.assign({index:-1,slides:[],dim:0,pos:-1},n);class Vr extends Qh{constructor(t,o){super(o),Object.defineProperty(this,"instance",{enumerable:!0,configurable:!0,writable:!0,value:t})}attach(){}detach(){}}const NE={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};class Ny extends Vr{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 t=this.list;if(!t){t=document.createElement("ul"),dt(t,this.cn("list")),t.setAttribute("role","tablist");const o=this.instance.container;o.appendChild(t),dt(o,this.cn("hasDots")),this.list=t}return t}refresh(){var t;const o=this.instance.pages.length,c=Math.min(2,this.option("minCount")),d=Math.max(2e3,this.option("maxCount")),x=this.option("dynamicFrom");if(o<c||o>d)return void this.cleanup();const y=typeof x=="number"&&o>5&&o>=x,h=!this.list||this.isDynamic!==y||this.list.children.length!==o;h&&this.cleanup();const M=this.build();if(es(M,this.cn("isDynamic"),!!y),h)for(let z=0;z<o;z++)M.append(this.createItem(z));let D,A=0;for(const z of[...M.children]){const L=A===this.instance.page;L&&(D=z),es(z,this.cn("isCurrent"),L),(t=z.children[0])===null||t===void 0||t.setAttribute("aria-selected",L?"true":"false");for(const N of["isBeforePrev","isPrev","isNext","isAfterNext"])ni(z,this.cn(N));A++}if(D=D||M.firstChild,y&&D){const z=D.previousElementSibling,L=z&&z.previousElementSibling;dt(z,this.cn("isPrev")),dt(L,this.cn("isBeforePrev"));const N=D.nextElementSibling,Y=N&&N.nextElementSibling;dt(N,this.cn("isNext")),dt(Y,this.cn("isAfterNext"))}this.isDynamic=y}createItem(t=0){var o;const c=document.createElement("li");c.setAttribute("role","presentation");const d=Qr(this.instance.localize(this.option("dotTpl"),[["%d",t+1]]).replace(/\%i/g,t+""));return c.appendChild(d),(o=c.children[0])===null||o===void 0||o.setAttribute("role","tab"),c}cleanup(){this.list&&(this.list.remove(),this.list=null),this.isDynamic=!1,ni(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(Ny,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:NE});const iu="disabled",nu="next",Vy="prev";class $y extends Vr{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 t=this.instance,o=t.pages.length,c=t.page;if(o<2)return void this.cleanup();this.build();let d=this.prev,x=this.next;d&&x&&(d.removeAttribute(iu),x.removeAttribute(iu),t.isInfinite||(c<=0&&d.setAttribute(iu,""),c>=o-1&&x.setAttribute(iu,"")))}addBtn(t){var o;const c=this.instance,d=document.createElement("button");d.setAttribute("tabindex","0"),d.setAttribute("title",c.localize(`{{${t.toUpperCase()}}}`)),dt(d,this.cn("button")+" "+this.cn(t===nu?"isNext":"isPrev"));const x=c.isRTL?t===nu?Vy:nu:t;var y;return d.innerHTML=c.localize(this.option(`${x}Tpl`)),d.dataset[`carousel${y=t,y?y.match("^[a-z]")?y.charAt(0).toUpperCase()+y.substring(1):y:""}`]="true",(o=this.container)===null||o===void 0||o.appendChild(d),d}build(){const t=this.instance.container,o=this.cn("container");let{container:c,prev:d,next:x}=this;c||(c=t.querySelector("."+o),this.isDom=!!c),c||(c=document.createElement("div"),dt(c,o),t.appendChild(c)),this.container=c,x||(x=c.querySelector("[data-carousel-next]")),x||(x=this.addBtn(nu)),this.next=x,d||(d=c.querySelector("[data-carousel-prev]")),d||(d=this.addBtn(Vy)),this.prev=d}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($y,"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>'}});class jy extends Vr{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(t){this.target=this.instance,this.nav=t,this.attachEvents()}addAsNavFor(t){this.nav=this.instance,this.target=t,this.attachEvents()}attachEvents(){const{nav:t,target:o}=this;t&&o&&(t.options.initialSlide=o.options.initialPage,t.state===Ni.Ready?this.onNavReady(t):t.on("ready",this.onNavReady),o.state===Ni.Ready?this.onTargetReady(o):o.on("ready",this.onTargetReady))}onNavReady(t){t.on("createSlide",this.onNavCreateSlide),t.on("Panzoom.click",this.onNavClick),t.on("Panzoom.touchEnd",this.onNavTouch),this.onTargetChange()}onTargetReady(t){t.on("change",this.onTargetChange),t.on("Panzoom.refresh",this.onTargetChange),this.onTargetChange()}onNavClick(t,o,c){this.onNavTouch(t,t.panzoom,c)}onNavTouch(t,o,c){var d,x;if(Math.abs(o.dragOffset.x)>3||Math.abs(o.dragOffset.y)>3)return;const y=c.target,{nav:h,target:M}=this;if(!h||!M||!y)return;const D=y.closest("[data-index]");if(c.stopPropagation(),c.preventDefault(),!D)return;const A=parseInt(D.dataset.index||"",10)||0,z=M.getPageForSlide(A),L=h.getPageForSlide(A);h.slideTo(L),M.slideTo(z,{friction:((x=(d=this.nav)===null||d===void 0?void 0:d.plugins)===null||x===void 0?void 0:x.Sync.option("friction"))||0}),this.markSelectedSlide(A)}onNavCreateSlide(t,o){o.index===this.selectedIndex&&this.markSelectedSlide(o.index)}onTargetChange(){var t,o;const{target:c,nav:d}=this;if(!c||!d||d.state!==Ni.Ready||c.state!==Ni.Ready)return;const x=(o=(t=c.pages[c.page])===null||t===void 0?void 0:t.slides[0])===null||o===void 0?void 0:o.index,y=d.getPageForSlide(x);this.markSelectedSlide(x),d.slideTo(y,d.prevPage===null&&c.prevPage===null?{friction:0}:void 0)}markSelectedSlide(t){const o=this.nav;o&&o.state===Ni.Ready&&(this.selectedIndex=t,[...o.slides].map(c=>{c.el&&c.el.classList[c.index===t?"add":"remove"]("is-nav-selected")}))}attach(){const t=this;let o=t.options.target,c=t.options.nav;o?t.addAsNavFor(o):c&&t.addAsTargetFor(c)}detach(){const t=this,o=t.nav,c=t.target;o&&(o.off("ready",t.onNavReady),o.off("createSlide",t.onNavCreateSlide),o.off("Panzoom.click",t.onNavClick),o.off("Panzoom.touchEnd",t.onNavTouch)),t.nav=null,c&&(c.off("ready",t.onTargetReady),c.off("refresh",t.onTargetChange),c.off("change",t.onTargetChange)),t.target=null}}Object.defineProperty(jy,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{friction:.35}});const VE={Navigation:$y,Dots:Ny,Sync:jy},ru="animationend",Uy="isSelected",su="slide";class jo extends Tp{get axis(){return this.isHorizontal?"e":"f"}get isEnabled(){return this.state===Ni.Ready}get isInfinite(){let t=!1;const{contentDim:o,viewportDim:c,pages:d,slides:x}=this,y=x[0];return d.length>=2&&y&&o+y.dim>=c&&(t=this.option("infinite")),t}get isRTL(){return this.option("direction")==="rtl"}get isHorizontal(){return this.option("axis")==="x"}constructor(t,o={},c={}){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:Ni.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 t=="string"&&(t=document.querySelector(t)),!t||!Hn(t))throw new Error("No Element found");this.container=t,this.slideNext=By(this.slideNext.bind(this),150),this.slidePrev=By(this.slidePrev.bind(this),150),this.userOptions=o,this.userPlugins=c,queueMicrotask(()=>{this.processOptions()})}processOptions(){var t,o;const c=Un({},jo.defaults,this.userOptions);let d="";const x=c.breakpoints;if(x&&Sp(x))for(const[y,h]of Object.entries(x))window.matchMedia(y).matches&&Sp(h)&&(d+=y,Un(c,h));d===this.bp&&this.state!==Ni.Init||(this.bp=d,this.state===Ni.Ready&&(c.initialSlide=((o=(t=this.pages[this.page])===null||t===void 0?void 0:t.slides[0])===null||o===void 0?void 0:o.index)||0),this.state!==Ni.Init&&this.destroy(),super.setOptions(c),this.option("enabled")===!1?this.attachEvents():setTimeout(()=>{this.init()},0))}init(){this.state=Ni.Init,this.emit("init"),this.attachPlugins(Object.assign(Object.assign({},jo.Plugins),this.userPlugins)),this.emit("attachPlugins"),this.initLayout(),this.initSlides(),this.updateMetrics(),this.setInitialPosition(),this.initPanzoom(),this.attachEvents(),this.state=Ni.Ready,this.emit("ready")}initLayout(){const{container:t}=this,o=this.option("classes");dt(t,this.cn("container")),es(t,o.isLTR,!this.isRTL),es(t,o.isRTL,this.isRTL),es(t,o.isVertical,!this.isHorizontal),es(t,o.isHorizontal,this.isHorizontal);let c=this.option("viewport")||t.querySelector(`.${o.viewport}`);c||(c=document.createElement("div"),dt(c,o.viewport),c.append(...Fy(t,`.${o.slide}`)),t.prepend(c)),c.addEventListener("scroll",this.onScroll);let d=this.option("track")||t.querySelector(`.${o.track}`);d||(d=document.createElement("div"),dt(d,o.track),d.append(...Array.from(c.childNodes))),d.setAttribute("aria-live","polite"),c.contains(d)||c.prepend(d),this.viewport=c,this.track=d,this.emit("initLayout")}initSlides(){const{track:t}=this;if(!t)return;const o=[...this.slides],c=[];[...Fy(t,`.${this.cn(su)}`)].forEach(d=>{if(Hn(d)){const x=Ip({el:d,isDom:!0,index:this.slides.length});c.push(x)}});for(let d of[...this.option("slides",[])||[],...o])c.push(Ip(d));this.slides=c;for(let d=0;d<this.slides.length;d++)this.slides[d].index=d;for(const d of c)this.emit("beforeInitSlide",d,d.index),this.emit("initSlide",d,d.index);this.emit("initSlides")}setInitialPage(){const t=this.option("initialSlide");this.page=typeof t=="number"?this.getPageForSlide(t):parseInt(this.option("initialPage",0)+"",10)||0}setInitialPosition(){const{track:t,pages:o,isHorizontal:c}=this;if(!t||!o.length)return;let d=this.page;o[d]||(this.page=d=0);const x=(o[d].pos||0)*(this.isRTL&&c?1:-1),y=c?`${x}px`:"0",h=c?"0":`${x}px`;t.style.transform=`translate3d(${y}, ${h}, 0) scale(1)`,this.option("adaptiveHeight")&&this.setViewportHeight()}initPanzoom(){this.panzoom&&(this.panzoom.destroy(),this.panzoom=null);const t=this.option("Panzoom")||{};this.panzoom=new $o(this.viewport,Un({},{content:this.track,zoom:!1,panOnlyZoomed:!1,lockAxis:this.isHorizontal?"x":"y",infinite:this.isInfinite,click:!1,dblClick:!1,touch:o=>!(this.pages.length<2&&!o.options.infinite),bounds:()=>this.getBounds(),maxVelocity:o=>Math.abs(o.target[this.axis]-o.current[this.axis])<2*this.viewportDim?100:0},t)),this.panzoom.on("*",(o,c,...d)=>{this.emit(`Panzoom.${c}`,o,...d)}),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 t=this.container;t&&(t.addEventListener("click",this.onClick,{passive:!1,capture:!1}),t.addEventListener("slideTo",this.onSlideTo)),window.addEventListener("resize",this.onResize)}createPages(){let t=[];const{contentDim:o,viewportDim:c}=this;let d=this.option("slidesPerPage");d=(d==="auto"||o<=c)&&this.option("fill")!==!1?1/0:parseFloat(d+"");let x=0,y=0,h=0;for(const M of this.slides)(!t.length||y+M.dim-c>.05||h>=d)&&(t.push(FE()),x=t.length-1,y=0,h=0),t[x].slides.push(M),y+=M.dim+M.gap,h++;return t}processPages(){const t=this.pages,{contentDim:o,viewportDim:c,isInfinite:d}=this,x=this.option("center"),y=this.option("fill"),h=y&&x&&o>c&&!d;if(t.forEach((A,z)=>{var L;A.index=z,A.pos=((L=A.slides[0])===null||L===void 0?void 0:L.pos)||0,A.dim=0;for(const[N,Y]of A.slides.entries())A.dim+=Y.dim,N<A.slides.length-1&&(A.dim+=Y.gap);h&&A.pos+.5*A.dim<.5*c?A.pos=0:h&&A.pos+.5*A.dim>=o-.5*c?A.pos=o-c:x&&(A.pos+=-.5*(c-A.dim))}),t.forEach(A=>{y&&!d&&o>c&&(A.pos=Math.max(A.pos,0),A.pos=Math.min(A.pos,o-c)),A.pos=Ye(A.pos,1e3),A.dim=Ye(A.dim,1e3),Math.abs(A.pos)<=.1&&(A.pos=0)}),d)return t;const M=[];let D;return t.forEach(A=>{const z=Object.assign({},A);D&&z.pos===D.pos?(D.dim+=z.dim,D.slides=[...D.slides,...z.slides]):(z.index=M.length,D=z,M.push(z))}),M}getPageFromIndex(t=0){const o=this.pages.length;let c;return t=parseInt((t||0).toString())||0,c=this.isInfinite?(t%o+o)%o:Math.max(Math.min(t,o-1),0),c}getSlideMetrics(t){var o,c;const d=this.isHorizontal?"width":"height";let x=0,y=0,h=t.el;const M=!(!h||h.parentNode);if(h?x=parseFloat(h.dataset[d]||"")||0:(h=document.createElement("div"),h.style.visibility="hidden",(this.track||document.body).prepend(h)),dt(h,this.cn(su)+" "+t.class+" "+t.customClass),x)h.style[d]=`${x}px`,h.style[d==="width"?"height":"width"]="";else{M&&(this.track||document.body).prepend(h),x=h.getBoundingClientRect()[d]*Math.max(1,((o=window.visualViewport)===null||o===void 0?void 0:o.scale)||1);let A=h[this.isHorizontal?"offsetWidth":"offsetHeight"];A-1>x&&(x=A)}const D=getComputedStyle(h);return D.boxSizing==="content-box"&&(this.isHorizontal?(x+=parseFloat(D.paddingLeft)||0,x+=parseFloat(D.paddingRight)||0):(x+=parseFloat(D.paddingTop)||0,x+=parseFloat(D.paddingBottom)||0)),y=parseFloat(D[this.isHorizontal?"marginRight":"marginBottom"])||0,M?(c=h.parentElement)===null||c===void 0||c.removeChild(h):t.el||h.remove(),{dim:Ye(x,1e3),gap:Ye(y,1e3)}}getBounds(){const{isInfinite:t,isRTL:o,isHorizontal:c,pages:d}=this;let x={min:0,max:0};if(t)x={min:-1/0,max:1/0};else if(d.length){const y=d[0].pos,h=d[d.length-1].pos;x=o&&c?{min:y,max:h}:{min:-1*h,max:-1*y}}return{x:c?x:{min:0,max:0},y:c?{min:0,max:0}:x}}repositionSlides(){let t,{isHorizontal:o,isRTL:c,isInfinite:d,viewport:x,viewportDim:y,contentDim:h,page:M,pages:D,slides:A,panzoom:z}=this,L=0,N=0,Y=0,ee=0;z?ee=-1*z.current[this.axis]:D[M]&&(ee=D[M].pos||0),t=o?c?"right":"left":"top",c&&o&&(ee*=-1);for(const me of A){const Ie=me.el;Ie?(t==="top"?(Ie.style.right="",Ie.style.left=""):Ie.style.top="",me.index!==L?Ie.style[t]=N===0?"":`${Ye(N,1e3)}px`:Ie.style[t]="",Y+=me.dim+me.gap,L++):N+=me.dim+me.gap}if(d&&Y&&x){let me=getComputedStyle(x),Ie="padding",tt=o?"Right":"Bottom",gt=parseFloat(me[Ie+(o?"Left":"Top")]);ee-=gt,y+=gt,y+=parseFloat(me[Ie+tt]);for(const Ve of A)Ve.el&&(Ye(Ve.pos)<Ye(y)&&Ye(Ve.pos+Ve.dim+Ve.gap)<Ye(ee)&&Ye(ee)>Ye(h-y)&&(Ve.el.style[t]=`${Ye(N+Y,1e3)}px`),Ye(Ve.pos+Ve.gap)>=Ye(h-y)&&Ye(Ve.pos)>Ye(ee+y)&&Ye(ee)<Ye(y)&&(Ve.el.style[t]=`-${Ye(Y,1e3)}px`))}let oe,he,_e=[...this.inTransition];if(_e.length>1&&(oe=D[_e[0]],he=D[_e[1]]),oe&&he){let me=0;for(const Ie of A)Ie.el?this.inTransition.has(Ie.index)&&oe.slides.indexOf(Ie)<0&&(Ie.el.style[t]=`${Ye(me+(oe.pos-he.pos),1e3)}px`):me+=Ie.dim+Ie.gap}}createSlideEl(t){const{track:o,slides:c}=this;if(!o||!t||t.el&&t.el.parentNode)return;const d=t.el||document.createElement("div");dt(d,this.cn(su)),dt(d,t.class),dt(d,t.customClass);const x=t.html;x&&(x instanceof HTMLElement?d.appendChild(x):d.innerHTML=t.html+"");const y=[];c.forEach((A,z)=>{A.el&&y.push(z)});const h=t.index;let M=null;y.length&&(M=c[y.reduce((A,z)=>Math.abs(z-h)<Math.abs(A-h)?z:A)]);const D=M&&M.el&&M.el.parentNode?M.index<t.index?M.el.nextSibling:M.el:null;o.insertBefore(d,o.contains(D)?D:null),t.el=d,this.emit("createSlide",t)}removeSlideEl(t,o=!1){const c=t==null?void 0:t.el;if(!c||!c.parentNode)return;const d=this.cn(Uy);if(c.classList.contains(d)&&(ni(c,d),this.emit("unselectSlide",t)),t.isDom&&!o)return c.removeAttribute("aria-hidden"),c.removeAttribute("data-index"),void(c.style.left="");this.emit("removeSlide",t);const x=new CustomEvent(ru);c.dispatchEvent(x),t.el&&(t.el.remove(),t.el=null)}transitionTo(t=0,o=this.option("transition")){var c,d,x,y;if(!o)return!1;const h=this.page,{pages:M,panzoom:D}=this;t=parseInt((t||0).toString())||0;const A=this.getPageFromIndex(t);if(!D||!M[A]||M.length<2||Math.abs((((d=(c=M[h])===null||c===void 0?void 0:c.slides[0])===null||d===void 0?void 0:d.dim)||0)-this.viewportDim)>1)return!1;let z=t>h?1:-1;this.isInfinite&&(h===0&&t===M.length-1&&(z=-1),h===M.length-1&&t===0&&(z=1));const L=M[A].pos*(this.isRTL?1:-1);if(h===A&&Math.abs(L-D.target[this.axis])<1)return!1;this.clearTransitions();const N=D.isResting;dt(this.container,this.cn("inTransition"));const Y=((x=M[h])===null||x===void 0?void 0:x.slides[0])||null,ee=((y=M[A])===null||y===void 0?void 0:y.slides[0])||null;this.inTransition.add(ee.index),this.createSlideEl(ee);let oe=Y.el,he=ee.el;N||o===su||(o="fadeFast",oe=null);const _e=this.isRTL?"next":"prev",me=this.isRTL?"prev":"next";return oe&&(this.inTransition.add(Y.index),Y.transition=o,oe.addEventListener(ru,this.onAnimationEnd),oe.classList.add(`f-${o}Out`,`to-${z>0?me:_e}`)),he&&(ee.transition=o,he.addEventListener(ru,this.onAnimationEnd),he.classList.add(`f-${o}In`,`from-${z>0?_e:me}`)),D.current[this.axis]=L,D.target[this.axis]=L,D.requestTick(),this.onChange(A),!0}manageSlideVisiblity(){const t=new Set,o=new Set,c=this.getVisibleSlides(parseFloat(this.option("preload",0)+"")||0);for(const d of this.slides)c.has(d)?t.add(d):o.add(d);for(const d of this.inTransition)t.add(this.slides[d]);for(const d of t)this.createSlideEl(d),this.lazyLoadSlide(d);for(const d of o)t.has(d)||this.removeSlideEl(d);this.markSelectedSlides(),this.repositionSlides()}markSelectedSlides(){if(!this.pages[this.page]||!this.pages[this.page].slides)return;const t="aria-hidden";let o=this.cn(Uy);if(o)for(const c of this.slides){const d=c.el;d&&(d.dataset.index=`${c.index}`,d.classList.contains("f-thumbs__slide")?this.getVisibleSlides(0).has(c)?d.removeAttribute(t):d.setAttribute(t,"true"):this.pages[this.page].slides.includes(c)?(d.classList.contains(o)||(dt(d,o),this.emit("selectSlide",c)),d.removeAttribute(t)):(d.classList.contains(o)&&(ni(d,o),this.emit("unselectSlide",c)),d.setAttribute(t,"true")))}}flipInfiniteTrack(){const{axis:t,isHorizontal:o,isInfinite:c,isRTL:d,viewportDim:x,contentDim:y}=this,h=this.panzoom;if(!h||!c)return;let M=h.current[t],D=h.target[t]-M,A=0,z=.5*x;d&&o?(M<-z&&(A=-1,M+=y),M>y-z&&(A=1,M-=y)):(M>z&&(A=1,M-=y),M<-y+z&&(A=-1,M+=y)),A&&(h.current[t]=M,h.target[t]=M+D)}lazyLoadImg(t,o){const c=this,d="f-fadeIn",x="is-preloading";let y=!1,h=null;const M=()=>{y||(y=!0,h&&(h.remove(),h=null),ni(o,x),o.complete&&(dt(o,d),setTimeout(()=>{ni(o,d)},350)),this.option("adaptiveHeight")&&t.el&&this.pages[this.page].slides.indexOf(t)>-1&&(c.updateMetrics(),c.setViewportHeight()),this.emit("load",t))};dt(o,x),o.src=o.dataset.lazySrcset||o.dataset.lazySrc||"",delete o.dataset.lazySrc,delete o.dataset.lazySrcset,o.addEventListener("error",()=>{M()}),o.addEventListener("load",()=>{M()}),setTimeout(()=>{const D=o.parentNode;D&&t.el&&(o.complete?M():y||(h=Qr(Cp),D.insertBefore(h,o)))},300)}lazyLoadSlide(t){const o=t&&t.el;if(!o)return;const c=new Set;let d=Array.from(o.querySelectorAll("[data-lazy-src],[data-lazy-srcset]"));o.dataset.lazySrc&&d.push(o),d.map(x=>{x instanceof HTMLImageElement?c.add(x):x instanceof HTMLElement&&x.dataset.lazySrc&&(x.style.backgroundImage=`url('${x.dataset.lazySrc}')`,delete x.dataset.lazySrc)});for(const x of c)this.lazyLoadImg(t,x)}onAnimationEnd(t){var o;const c=t.target,d=c?parseInt(c.dataset.index||"",10)||0:-1,x=this.slides[d],y=t.animationName;if(!c||!x||!y)return;const h=!!this.inTransition.has(d)&&x.transition;h&&y.substring(0,h.length+2)===`f-${h}`&&this.inTransition.delete(d),this.inTransition.size||this.clearTransitions(),d===this.page&&(!((o=this.panzoom)===null||o===void 0)&&o.isResting)&&this.emit("settle")}onDecel(t,o=0,c=0,d=0,x=0){if(this.option("dragFree"))return void this.setPageFromPosition();const{isRTL:y,isHorizontal:h,axis:M,pages:D}=this,A=D.length,z=Math.abs(Math.atan2(c,o)/(Math.PI/180));let L=0;if(L=z>45&&z<135?h?0:c:h?o:0,!A)return;let N=this.page,Y=y&&h?1:-1;const ee=t.current[M]*Y;let{pageIndex:oe}=this.getPageFromPosition(ee);Math.abs(L)>5?(D[N].dim<document.documentElement["client"+(this.isHorizontal?"Width":"Height")]-1&&(N=oe),N=y&&h?L<0?N-1:N+1:L<0?N+1:N-1):N=d===0&&x===0?N:oe,this.slideTo(N,{transition:!1,friction:t.option("decelFriction")})}onClick(t){const o=t.target,c=o&&Hn(o)?o.dataset:null;let d,x;c&&(c.carouselPage!==void 0?(x="slideTo",d=c.carouselPage):c.carouselNext!==void 0?x="slideNext":c.carouselPrev!==void 0&&(x="slidePrev")),x?(t.preventDefault(),t.stopPropagation(),o&&!o.hasAttribute("disabled")&&this[x](d)):this.emit("click",t)}onSlideTo(t){const o=t.detail||0;this.slideTo(this.getPageForSlide(o),{friction:0})}onChange(t,o=0){const c=this.page;this.prevPage=c,this.page=t,this.option("adaptiveHeight")&&this.setViewportHeight(),t!==c&&(this.markSelectedSlides(),this.emit("change",t,c,o))}onRefresh(){let t=this.contentDim,o=this.viewportDim;this.updateMetrics(),this.contentDim===t&&this.viewportDim===o||this.slideTo(this.page,{friction:0,transition:!1})}onScroll(){var t;(t=this.viewport)===null||t===void 0||t.scroll(0,0)}onResize(){this.option("breakpoints")&&this.processOptions()}onBeforeTransform(t){this.lp!==t.current[this.axis]&&(this.flipInfiniteTrack(),this.manageSlideVisiblity()),this.lp=t.current.e}onEndAnimation(){this.inTransition.size||this.emit("settle")}reInit(t=null,o=null){this.destroy(),this.state=Ni.Init,this.prevPage=null,this.userOptions=t||this.userOptions,this.userPlugins=o||this.userPlugins,this.processOptions()}slideTo(t=0,{friction:o=this.option("friction"),transition:c=this.option("transition")}={}){if(this.state===Ni.Destroy)return;t=parseInt((t||0).toString())||0;const d=this.getPageFromIndex(t),{axis:x,isHorizontal:y,isRTL:h,pages:M,panzoom:D}=this,A=M.length,z=h&&y?1:-1;if(!D||!A)return;if(this.page!==d){const N=new Event("beforeChange",{bubbles:!0,cancelable:!0});if(this.emit("beforeChange",N,t),N.defaultPrevented)return}if(this.transitionTo(t,c))return;let L=M[d].pos;if(this.isInfinite){const N=this.contentDim,Y=D.target[x]*z;A===2?L+=N*Math.floor(parseFloat(t+"")/2):L=[L,L-N,L+N].reduce(function(ee,oe){return Math.abs(oe-Y)<Math.abs(ee-Y)?oe:ee})}L*=z,Math.abs(D.target[x]-L)<1||(D.panTo({x:y?L:0,y:y?0:L,friction:o}),this.onChange(d))}slideToClosest(t){if(this.panzoom){const{pageIndex:o}=this.getPageFromPosition();this.slideTo(o,t)}}slideNext(){this.slideTo(this.page+1)}slidePrev(){this.slideTo(this.page-1)}clearTransitions(){this.inTransition.clear(),ni(this.container,this.cn("inTransition"));const t=["to-prev","to-next","from-prev","from-next"];for(const o of this.slides){const c=o.el;if(c){c.removeEventListener(ru,this.onAnimationEnd),c.classList.remove(...t);const d=o.transition;d&&c.classList.remove(`f-${d}Out`,`f-${d}In`)}}this.manageSlideVisiblity()}addSlide(t,o){var c,d,x,y;const h=this.panzoom,M=((c=this.pages[this.page])===null||c===void 0?void 0:c.pos)||0,D=((d=this.pages[this.page])===null||d===void 0?void 0:d.dim)||0,A=this.contentDim<this.viewportDim;let z=Array.isArray(o)?o:[o];const L=[];for(const N of z)L.push(Ip(N));this.slides.splice(t,0,...L);for(let N=0;N<this.slides.length;N++)this.slides[N].index=N;for(const N of L)this.emit("beforeInitSlide",N,N.index);if(this.page>=t&&(this.page+=L.length),this.updateMetrics(),h){const N=((x=this.pages[this.page])===null||x===void 0?void 0:x.pos)||0,Y=((y=this.pages[this.page])===null||y===void 0?void 0:y.dim)||0,ee=this.pages.length||1,oe=this.isRTL?D-Y:Y-D,he=this.isRTL?M-N:N-M;A&&ee===1?(t<=this.page&&(h.current[this.axis]-=oe,h.target[this.axis]-=oe),h.panTo({[this.isHorizontal?"x":"y"]:-1*N})):he&&t<=this.page&&(h.target[this.axis]-=he,h.current[this.axis]-=he,h.requestTick())}for(const N of L)this.emit("initSlide",N,N.index)}prependSlide(t){this.addSlide(0,t)}appendSlide(t){this.addSlide(this.slides.length,t)}removeSlide(t){const o=this.slides.length;t=(t%o+o)%o;const c=this.slides[t];if(c){this.removeSlideEl(c,!0),this.slides.splice(t,1);for(let d=0;d<this.slides.length;d++)this.slides[d].index=d;this.updateMetrics(),this.slideTo(this.page,{friction:0,transition:!1}),this.emit("destroySlide",c)}}updateMetrics(){const{panzoom:t,viewport:o,track:c,slides:d,isHorizontal:x,isInfinite:y}=this;if(!c)return;const h=x?"width":"height",M=x?"offsetWidth":"offsetHeight";if(o){let z=Math.max(o[M],Ye(o.getBoundingClientRect()[h],1e3)),L=getComputedStyle(o),N="padding",Y=x?"Right":"Bottom";z-=parseFloat(L[N+(x?"Left":"Top")])+parseFloat(L[N+Y]),this.viewportDim=z}let D,A=0;for(const[z,L]of d.entries()){let N=0,Y=0;!L.el&&D?(N=D.dim,Y=D.gap):({dim:N,gap:Y}=this.getSlideMetrics(L),D=L),N=Ye(N,1e3),Y=Ye(Y,1e3),L.dim=N,L.gap=Y,L.pos=A,A+=N,(y||z<d.length-1)&&(A+=Y)}A=Ye(A,1e3),this.contentDim=A,t&&(t.contentRect[h]=A,t.contentRect[x?"fullWidth":"fullHeight"]=A),this.pages=this.createPages(),this.pages=this.processPages(),this.state===Ni.Init&&this.setInitialPage(),this.page=Math.max(0,Math.min(this.page,this.pages.length-1)),this.manageSlideVisiblity(),this.emit("refresh")}getProgress(t,o=!1,c=!1){t===void 0&&(t=this.page);const d=this,x=d.panzoom,y=d.contentDim,h=d.pages[t]||0;if(!h||!x)return t>this.page?-1:1;let M=-1*x.current.e,D=Ye((M-h.pos)/(1*h.dim),1e3),A=D,z=D;this.isInfinite&&c!==!0&&(A=Ye((M-h.pos+y)/(1*h.dim),1e3),z=Ye((M-h.pos-y)/(1*h.dim),1e3));let L=[D,A,z].reduce(function(N,Y){return Math.abs(Y)<Math.abs(N)?Y:N});return o?L:L>1?1:L<-1?-1:L}setViewportHeight(){const{page:t,pages:o,viewport:c,isHorizontal:d}=this;if(!c||!o[t])return;let x=0;d&&this.track&&(this.track.style.height="auto",o[t].slides.forEach(y=>{y.el&&(x=Math.max(x,y.el.offsetHeight))})),c.style.height=x?`${x}px`:""}getPageForSlide(t){for(const o of this.pages)for(const c of o.slides)if(c.index===t)return o.index;return-1}getVisibleSlides(t=0){var o;const c=new Set;let{panzoom:d,contentDim:x,viewportDim:y,pages:h,page:M}=this;if(y){x=x+((o=this.slides[this.slides.length-1])===null||o===void 0?void 0:o.gap)||0;let D=0;D=d&&d.state!==ci.Init&&d.state!==ci.Destroy?-1*d.current[this.axis]:h[M]&&h[M].pos||0,this.isInfinite&&(D-=Math.floor(D/x)*x),this.isRTL&&this.isHorizontal&&(D*=-1);const A=D-y*t,z=D+y*(t+1),L=this.isInfinite?[-1,0,1]:[0];for(const N of this.slides)for(const Y of L){const ee=N.pos+Y*x,oe=ee+N.dim+N.gap;ee<z&&oe>A&&c.add(N)}}return c}getPageFromPosition(t){const{viewportDim:o,contentDim:c,slides:d,pages:x,panzoom:y}=this,h=x.length,M=d.length,D=d[0],A=d[M-1],z=this.option("center");let L=0,N=0,Y=0,ee=t===void 0?-1*((y==null?void 0:y.target[this.axis])||0):t;z&&(ee+=.5*o),this.isInfinite?(ee<D.pos-.5*A.gap&&(ee-=c,Y=-1),ee>A.pos+A.dim+.5*A.gap&&(ee-=c,Y=1)):ee=Math.max(D.pos||0,Math.min(ee,A.pos));let oe=A,he=d.find(_e=>{const me=_e.pos-.5*oe.gap,Ie=_e.pos+_e.dim+.5*_e.gap;return oe=_e,ee>=me&&ee<Ie});return he||(he=A),N=this.getPageForSlide(he.index),L=N+Y*h,{page:L,pageIndex:N}}setPageFromPosition(){const{pageIndex:t}=this.getPageFromPosition();this.onChange(t)}destroy(){if([Ni.Destroy].includes(this.state))return;this.state=Ni.Destroy;const{container:t,viewport:o,track:c,slides:d,panzoom:x}=this,y=this.option("classes");t.removeEventListener("click",this.onClick,{passive:!1,capture:!1}),t.removeEventListener("slideTo",this.onSlideTo),window.removeEventListener("resize",this.onResize),x&&(x.destroy(),this.panzoom=null),d&&d.forEach(M=>{this.removeSlideEl(M)}),this.detachPlugins(),o&&(o.removeEventListener("scroll",this.onScroll),o.offsetParent&&c&&c.offsetParent&&o.replaceWith(...c.childNodes));for(const[M,D]of Object.entries(y))M!=="container"&&D&&t.classList.remove(D);this.track=null,this.viewport=null,this.page=0,this.slides=[];const h=this.events.get("ready");this.events=new Map,h&&this.events.set("ready",h)}}Object.defineProperty(jo,"Panzoom",{enumerable:!0,configurable:!0,writable:!0,value:$o}),Object.defineProperty(jo,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:BE}),Object.defineProperty(jo,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:VE});const Hy=function(n){if(!Hn(n))return 0;const t=window.scrollY,o=window.innerHeight,c=t+o,d=n.getBoundingClientRect(),x=d.y+t,y=d.height,h=x+y;if(t>h||c<x)return 0;if(t<x&&c>h||x<t&&h>c)return 100;let M=y;x<t&&(M-=t-x),h>c&&(M-=h-c);const D=M/o*100;return Math.round(D)},sc=!(typeof window>"u"||!window.document||!window.document.createElement);let Ap;const Dp=["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(","),qy=n=>{if(n&&sc){Ap===void 0&&document.createElement("div").focus({get preventScroll(){return Ap=!0,!1}});try{if(Ap)n.focus({preventScroll:!0});else{const t=window.scrollY||document.body.scrollTop,o=window.scrollX||document.body.scrollLeft;n.focus(),document.body.scrollTo({top:t,left:o,behavior:"auto"})}}catch{}}},Zy=()=>{const n=document;let t,o="",c="",d="";return n.fullscreenEnabled?(o="requestFullscreen",c="exitFullscreen",d="fullscreenElement"):n.webkitFullscreenEnabled&&(o="webkitRequestFullscreen",c="webkitExitFullscreen",d="webkitFullscreenElement"),o&&(t={request:function(x=n.documentElement){return o==="webkitRequestFullscreen"?x[o](Element.ALLOW_KEYBOARD_INPUT):x[o]()},exit:function(){return n[d]&&n[c]()},isFullscreen:function(){return n[d]}}),t},zp={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({},zy),{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">
|
|
625
625
|
<div class="fancybox__backdrop"></div>
|
|
626
626
|
<div class="fancybox__carousel"></div>
|
|
627
627
|
<div class="fancybox__footer"></div>
|
|
628
628
|
</div>`},trapFocus:!0,wheel:"zoom"};var Xi,gn;(function(n){n[n.Init=0]="Init",n[n.Ready=1]="Ready",n[n.Closing=2]="Closing",n[n.CustomClosing=3]="CustomClosing",n[n.Destroy=4]="Destroy"})(Xi||(Xi={})),function(n){n[n.Loading=0]="Loading",n[n.Opening=1]="Opening",n[n.Ready=2]="Ready",n[n.Closing=3]="Closing"}(gn||(gn={}));let Wy="",oc=!1,ou=!1,Uo=null;const Gy=()=>{let n="",t="";const o=Xt.getInstance();if(o){const c=o.carousel,d=o.getSlide();if(c&&d){let x=d.slug||void 0,y=d.triggerEl||void 0;t=x||o.option("slug")||"",!t&&y&&y.dataset&&(t=y.dataset.fancybox||""),t&&t!=="true"&&(n="#"+t+(!x&&c.slides.length>1?"-"+(d.index+1):""))}}return{hash:n,slug:t,index:1}},au=()=>{const n=new URL(document.URL).hash,t=n.slice(1).split("-"),o=t[t.length-1],c=o&&/^\+?\d+$/.test(o)&&parseInt(t.pop()||"1",10)||1;return{hash:n,slug:t.join("-"),index:c}},Yy=()=>{const{slug:n,index:t}=au();if(!n)return;let o=document.querySelector(`[data-slug="${n}"]`);if(o&&o.dispatchEvent(new CustomEvent("click",{bubbles:!0,cancelable:!0})),Xt.getInstance())return;const c=document.querySelectorAll(`[data-fancybox="${n}"]`);c.length&&(o=c[t-1],o&&o.dispatchEvent(new CustomEvent("click",{bubbles:!0,cancelable:!0})))},Xy=()=>{if(Xt.defaults.Hash===!1)return;const n=Xt.getInstance();if((n==null?void 0:n.options.Hash)===!1)return;const{slug:t,index:o}=au(),{slug:c}=Gy();n&&(t===c?n.jumpTo(o-1):(oc=!0,n.close())),Yy()},Ky=()=>{Uo&&clearTimeout(Uo),queueMicrotask(()=>{Xy()})},Jy=()=>{window.addEventListener("hashchange",Ky,!1),setTimeout(()=>{Xy()},500)};sc&&(/complete|interactive|loaded/.test(document.readyState)?Jy():document.addEventListener("DOMContentLoaded",Jy));const lu="is-zooming-in";class Qy extends Vr{onCreateSlide(t,o,c){const d=this.instance.optionFor(c,"src")||"";c.el&&c.type==="image"&&typeof d=="string"&&this.setImage(c,d)}onRemoveSlide(t,o,c){c.panzoom&&c.panzoom.destroy(),c.panzoom=void 0,c.imageEl=void 0}onChange(t,o,c,d){ni(this.instance.container,lu);for(const x of o.slides){const y=x.panzoom;y&&x.index!==c&&y.reset(.35)}}onClose(){var t;const o=this.instance,c=o.container,d=o.getSlide();if(!c||!c.parentElement||!d)return;const{el:x,contentEl:y,panzoom:h,thumbElSrc:M}=d;if(!x||!M||!y||!h||h.isContentLoading||h.state===ci.Init||h.state===ci.Destroy)return;h.updateMetrics();let D=this.getZoomInfo(d);if(!D)return;this.instance.state=Xi.CustomClosing,c.classList.remove(lu),c.classList.add("is-zooming-out"),y.style.backgroundImage=`url('${M}')`;const A=c.getBoundingClientRect();(((t=window.visualViewport)===null||t===void 0?void 0:t.scale)||1)===1&&Object.assign(c.style,{position:"absolute",top:`${c.offsetTop+window.scrollY}px`,left:`${c.offsetLeft+window.scrollX}px`,bottom:"auto",right:"auto",width:`${A.width}px`,height:`${A.height}px`,overflow:"hidden"});const{x:z,y:L,scale:N,opacity:Y}=D;if(Y){const ee=((oe,he,_e,me)=>{const Ie=he-oe,tt=me-_e;return gt=>_e+((gt-oe)/Ie*tt||0)})(h.scale,N,1,0);h.on("afterTransform",()=>{y.style.opacity=ee(h.scale)+""})}h.on("endAnimation",()=>{o.destroy()}),h.target.a=N,h.target.b=0,h.target.c=0,h.target.d=N,h.panTo({x:z,y:L,scale:N,friction:Y?.2:.33,ignoreBounds:!0}),h.isResting&&o.destroy()}setImage(t,o){const c=this.instance;t.src=o,this.process(t,o).then(d=>{const{contentEl:x,imageEl:y,thumbElSrc:h,el:M}=t;if(c.isClosing()||!x||!y)return;x.offsetHeight;const D=!!c.isOpeningSlide(t)&&this.getZoomInfo(t);if(this.option("protected")&&M){M.addEventListener("contextmenu",L=>{L.preventDefault()});const z=document.createElement("div");dt(z,"fancybox-protected"),x.appendChild(z)}if(h&&D){const z=d.contentRect,L=Math.max(z.fullWidth,z.fullHeight);let N=null;!D.opacity&&L>1200&&(N=document.createElement("img"),dt(N,"fancybox-ghost"),N.src=h,x.appendChild(N));const Y=()=>{N&&(dt(N,"f-fadeFastOut"),setTimeout(()=>{N&&(N.remove(),N=null)},200))};(A=h,new Promise((ee,oe)=>{const he=new Image;he.onload=ee,he.onerror=oe,he.src=A})).then(()=>{c.hideLoading(t),t.state=gn.Opening,this.instance.emit("reveal",t),this.zoomIn(t).then(()=>{Y(),this.instance.done(t)},()=>{}),N&&setTimeout(()=>{Y()},L>2500?800:200)},()=>{c.hideLoading(t),c.revealContent(t)})}else{const z=this.optionFor(t,"initialSize"),L=this.optionFor(t,"zoom"),N={event:c.prevMouseMoveEvent||c.options.event,friction:L?.12:0};let Y=c.optionFor(t,"showClass")||void 0,ee=!0;c.isOpeningSlide(t)&&(z==="full"?d.zoomToFull(N):z==="cover"?d.zoomToCover(N):z==="max"?d.zoomToMax(N):ee=!1,d.stop("current")),ee&&Y&&(Y=d.isDragging?"f-fadeIn":""),c.hideLoading(t),c.revealContent(t,Y)}var A},()=>{c.setError(t,"{{IMAGE_ERROR}}")})}process(t,o){return new Promise((c,d)=>{var x;const y=this.instance,h=t.el;y.clearContent(t),y.showLoading(t);let M=this.optionFor(t,"content");if(typeof M=="string"&&(M=Qr(M)),!M||!Hn(M)){if(M=document.createElement("img"),M instanceof HTMLImageElement){let D="",A=t.caption;D=typeof A=="string"&&A?A.replace(/<[^>]+>/gi,"").substring(0,1e3):`Image ${t.index+1} of ${((x=y.carousel)===null||x===void 0?void 0:x.pages.length)||1}`,M.src=o||"",M.alt=D,M.draggable=!1,t.srcset&&M.setAttribute("srcset",t.srcset),this.instance.isOpeningSlide(t)&&(M.fetchPriority="high")}t.sizes&&M.setAttribute("sizes",t.sizes)}dt(M,"fancybox-image"),t.imageEl=M,y.setContent(t,M,!1),t.panzoom=new $o(h,Un({transformParent:!0},this.option("Panzoom")||{},{content:M,width:(D,A)=>y.optionFor(t,"width","auto",A)||"auto",height:(D,A)=>y.optionFor(t,"height","auto",A)||"auto",wheel:()=>{const D=y.option("wheel");return(D==="zoom"||D=="pan")&&D},click:(D,A)=>{var z,L;if(y.isCompact||y.isClosing()||t.index!==((z=y.getSlide())===null||z===void 0?void 0:z.index))return!1;if(A){const Y=A.composedPath()[0];if(["A","BUTTON","TEXTAREA","OPTION","INPUT","SELECT","VIDEO"].includes(Y.nodeName))return!1}let N=!A||A.target&&((L=t.contentEl)===null||L===void 0?void 0:L.contains(A.target));return y.option(N?"contentClick":"backdropClick")||!1},dblClick:()=>y.isCompact?"toggleZoom":y.option("contentDblClick")||!1,spinner:!1,panOnlyZoomed:!0,wheelLimit:1/0,on:{ready:D=>{c(D)},error:()=>{d()},destroy:()=>{d()}}}))})}zoomIn(t){return new Promise((o,c)=>{const d=this.instance,x=d.container,{panzoom:y,contentEl:h,el:M}=t;y&&y.updateMetrics();const D=this.getZoomInfo(t);if(!(D&&M&&h&&y&&x))return void c();const{x:A,y:z,scale:L,opacity:N}=D,Y=()=>{t.state!==gn.Closing&&(N&&(h.style.opacity=Math.max(Math.min(1,1-(1-y.scale)/(1-L)),0)+""),y.scale>=1&&y.scale>y.targetScale-.1&&o(y))},ee=_e=>{(_e.scale<.99||_e.scale>1.01)&&!_e.isDragging||(ni(x,lu),h.style.opacity="",_e.off("endAnimation",ee),_e.off("touchStart",ee),_e.off("afterTransform",Y),o(_e))};y.on("endAnimation",ee),y.on("touchStart",ee),y.on("afterTransform",Y),y.on(["error","destroy"],()=>{c()}),y.panTo({x:A,y:z,scale:L,friction:0,ignoreBounds:!0}),y.stop("current");const oe={event:y.panMode==="mousemove"?d.prevMouseMoveEvent||d.options.event:void 0},he=this.optionFor(t,"initialSize");dt(x,lu),d.hideLoading(t),he==="full"?y.zoomToFull(oe):he==="cover"?y.zoomToCover(oe):he==="max"?y.zoomToMax(oe):y.reset(.172)})}getZoomInfo(t){const{el:o,imageEl:c,thumbEl:d,panzoom:x}=t,y=this.instance,h=y.container;if(!o||!c||!d||!x||Hy(d)<3||!this.optionFor(t,"zoom")||!h||y.state===Xi.Destroy||getComputedStyle(h).getPropertyValue("--f-images-zoom")==="0")return!1;const M=window.visualViewport||null;if((M?M.scale:1)!==1)return!1;let{top:D,left:A,width:z,height:L}=d.getBoundingClientRect(),{top:N,left:Y,fitWidth:ee,fitHeight:oe}=x.contentRect;if(!(z&&L&&ee&&oe))return!1;const he=x.container.getBoundingClientRect();Y+=he.left,N+=he.top;const _e=-1*(Y+.5*ee-(A+.5*z)),me=-1*(N+.5*oe-(D+.5*L)),Ie=z/ee;let tt=this.option("zoomOpacity")||!1;return tt==="auto"&&(tt=Math.abs(z/L-ee/oe)>.1),{x:_e,y:me,scale:Ie,opacity:tt}}attach(){const t=this,o=t.instance;o.on("Carousel.change",t.onChange),o.on("Carousel.createSlide",t.onCreateSlide),o.on("Carousel.removeSlide",t.onRemoveSlide),o.on("close",t.onClose)}detach(){const t=this,o=t.instance;o.off("Carousel.change",t.onChange),o.off("Carousel.createSlide",t.onCreateSlide),o.off("Carousel.removeSlide",t.onRemoveSlide),o.off("close",t.onClose)}}Object.defineProperty(Qy,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{initialSize:"fit",Panzoom:{maxScale:1},protected:!1,zoom:!0,zoomOpacity:"auto"}}),typeof SuppressedError=="function"&&SuppressedError;const Lp="html",e0="image",Rp="map",Es="youtube",Ho="vimeo",ac="html5video",t0=(n,t={})=>{const o=new URL(n),c=new URLSearchParams(o.search),d=new URLSearchParams;for(const[h,M]of[...c,...Object.entries(t)]){let D=M+"";if(h==="t"){let A=D.match(/((\d*)m)?(\d*)s?/);A&&d.set("start",60*parseInt(A[2]||"0")+parseInt(A[3]||"0")+"")}else d.set(h,D)}let x=d+"",y=n.match(/#t=((.*)?\d+s)/);return y&&(x+=`#t=${y[1]}`),x},$E={ajax:null,autoSize:!0,iframeAttr:{allow:"autoplay; fullscreen",scrolling:"auto"},preload:!0,videoAutoplay:!0,videoRatio:16/9,videoTpl:`<video class="fancybox__html5video" playsinline controls controlsList="nodownload" poster="{{poster}}">
|
|
629
|
-
<source src="{{src}}" type="{{format}}" />Sorry, your browser doesn't support embedded videos.</video>`,videoFormat:"",vimeo:{byline:1,color:"00adef",controls:1,dnt:1,muted:0},youtube:{controls:1,enablejsapi:1,nocookie:1,rel:0,fs:1}},jE=["image","html","ajax","inline","clone","iframe","map","pdf","html5video","youtube","vimeo"];class i0 extends Vr{onBeforeInitSlide(t,o,c){this.processType(c)}onCreateSlide(t,o,c){this.setContent(c)}onClearContent(t,o){o.xhr&&(o.xhr.abort(),o.xhr=null);const c=o.iframeEl;c&&(c.onload=c.onerror=null,c.src="//about:blank",o.iframeEl=null);const d=o.contentEl,x=o.placeholderEl;if(o.type==="inline"&&d&&x)d.classList.remove("fancybox__content"),getComputedStyle(d).getPropertyValue("display")!=="none"&&(d.style.display="none"),setTimeout(()=>{x&&(d&&x.parentNode&&x.parentNode.insertBefore(d,x),x.remove())},0),o.contentEl=void 0,o.placeholderEl=void 0;else for(;o.el&&o.el.firstChild;)o.el.removeChild(o.el.firstChild)}onSelectSlide(t,o,c){c.state===gn.Ready&&this.playVideo()}onUnselectSlide(t,o,c){var d,x;if(c.type===ac){try{(x=(d=c.el)===null||d===void 0?void 0:d.querySelector("video"))===null||x===void 0||x.pause()}catch{}return}let y;c.type===Ho?y={method:"pause",value:"true"}:c.type===Es&&(y={event:"command",func:"pauseVideo"}),y&&c.iframeEl&&c.iframeEl.contentWindow&&c.iframeEl.contentWindow.postMessage(JSON.stringify(y),"*"),c.poller&&clearTimeout(c.poller)}onDone(t,o){t.isCurrentSlide(o)&&!t.isClosing()&&this.playVideo()}onRefresh(t,o){o.slides.forEach(c=>{c.el&&(this.resizeIframe(c),this.setAspectRatio(c))})}onMessage(t){try{let o=JSON.parse(t.data);if(t.origin==="https://player.vimeo.com"){if(o.event==="ready")for(let c of Array.from(document.getElementsByClassName("fancybox__iframe")))c instanceof HTMLIFrameElement&&c.contentWindow===t.source&&(c.dataset.ready="true")}else if(t.origin.match(/^https:\/\/(www.)?youtube(-nocookie)?.com$/)&&o.event==="onReady"){const c=document.getElementById(o.id);c&&(c.dataset.ready="true")}}catch{}}loadAjaxContent(t){const o=this.instance.optionFor(t,"src")||"";this.instance.showLoading(t);const c=this.instance,d=new XMLHttpRequest;c.showLoading(t),d.onreadystatechange=function(){d.readyState===XMLHttpRequest.DONE&&c.state===Xi.Ready&&(c.hideLoading(t),d.status===200?c.setContent(t,d.responseText):c.setError(t,d.status===404?"{{AJAX_NOT_FOUND}}":"{{AJAX_FORBIDDEN}}"))};const x=t.ajax||null;d.open(x?"POST":"GET",o+""),d.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),d.setRequestHeader("X-Requested-With","XMLHttpRequest"),d.send(x),t.xhr=d}setInlineContent(t){let o=null;if(Hn(t.src))o=t.src;else if(typeof t.src=="string"){const c=t.src.split("#",2).pop();o=c?document.getElementById(c):null}if(o){if(t.type==="clone"||o.closest(".fancybox__slide")){o=o.cloneNode(!0);const c=o.dataset.animationName;c&&(o.classList.remove(c),delete o.dataset.animationName);let d=o.getAttribute("id");d=d?`${d}--clone`:`clone-${this.instance.id}-${t.index}`,o.setAttribute("id",d)}else if(o.parentNode){const c=document.createElement("div");c.classList.add("fancybox-placeholder"),o.parentNode.insertBefore(c,o),t.placeholderEl=c}this.instance.setContent(t,o)}else this.instance.setError(t,"{{ELEMENT_NOT_FOUND}}")}setIframeContent(t){const{src:o,el:c}=t;if(!o||typeof o!="string"||!c)return;c.classList.add("is-loading");const d=this.instance,x=document.createElement("iframe");x.className="fancybox__iframe",x.setAttribute("id",`fancybox__iframe_${d.id}_${t.index}`);for(const[h,M]of Object.entries(this.optionFor(t,"iframeAttr")||{}))x.setAttribute(h,M);x.onerror=()=>{d.setError(t,"{{IFRAME_ERROR}}")},t.iframeEl=x;const y=this.optionFor(t,"preload");if(t.type!=="iframe"||y===!1)return x.setAttribute("src",t.src+""),d.setContent(t,x,!1),this.resizeIframe(t),void d.revealContent(t);d.showLoading(t),x.onload=()=>{if(!x.src.length)return;const h=x.dataset.ready!=="true";x.dataset.ready="true",this.resizeIframe(t),h?d.revealContent(t):d.hideLoading(t)},x.setAttribute("src",o),d.setContent(t,x,!1)}resizeIframe(t){const{type:o,iframeEl:c}=t;if(o===Es||o===Ho)return;const d=c==null?void 0:c.parentElement;if(!c||!d)return;let x=t.autoSize;x===void 0&&(x=this.optionFor(t,"autoSize"));let y=t.width||0,h=t.height||0;y&&h&&(x=!1);const M=d&&d.style;if(t.preload!==!1&&x!==!1&&M)try{const D=window.getComputedStyle(d),A=parseFloat(D.paddingLeft)+parseFloat(D.paddingRight),z=parseFloat(D.paddingTop)+parseFloat(D.paddingBottom),L=c.contentWindow;if(L){const N=L.document,Y=N.getElementsByTagName(Lp)[0],ee=N.body;M.width="",ee.style.overflow="hidden",y=y||Y.scrollWidth+A,M.width=`${y}px`,ee.style.overflow="",M.flex="0 0 auto",M.height=`${ee.scrollHeight}px`,h=Y.scrollHeight+z}}catch{}if(y||h){const D={flex:"0 1 auto",width:"",height:""};y&&y!=="auto"&&(D.width=`${y}px`),h&&h!=="auto"&&(D.height=`${h}px`),Object.assign(M,D)}}playVideo(){const t=this.instance.getSlide();if(!t)return;const{el:o}=t;if(!o||!o.offsetParent||!this.optionFor(t,"videoAutoplay"))return;if(t.type===ac)try{const d=o.querySelector("video");if(d){const x=d.play();x!==void 0&&x.then(()=>{}).catch(y=>{d.muted=!0,d.play()})}}catch{}if(t.type!==Es&&t.type!==Ho)return;const c=()=>{if(t.iframeEl&&t.iframeEl.contentWindow){let d;if(t.iframeEl.dataset.ready==="true")return d=t.type===Es?{event:"command",func:"playVideo"}:{method:"play",value:"true"},d&&t.iframeEl.contentWindow.postMessage(JSON.stringify(d),"*"),void(t.poller=void 0);t.type===Es&&(d={event:"listening",id:t.iframeEl.getAttribute("id")},t.iframeEl.contentWindow.postMessage(JSON.stringify(d),"*"))}t.poller=setTimeout(c,250)};c()}processType(t){if(t.html)return t.type=Lp,t.src=t.html,void(t.html="");const o=this.instance.optionFor(t,"src","");if(!o||typeof o!="string")return;let c=t.type,d=null;if(d=o.match(/(youtube\.com|youtu\.be|youtube\-nocookie\.com)\/(?:watch\?(?:.*&)?v=|v\/|u\/|shorts\/|embed\/?)?(videoseries\?list=(?:.*)|[\w-]{11}|\?listType=(?:.*)&list=(?:.*))(?:.*)/i)){const x=this.optionFor(t,Es),{nocookie:y}=x,h=function(z,L){var N={};for(var Y in z)Object.prototype.hasOwnProperty.call(z,Y)&&L.indexOf(Y)<0&&(N[Y]=z[Y]);if(z!=null&&typeof Object.getOwnPropertySymbols=="function"){var ee=0;for(Y=Object.getOwnPropertySymbols(z);ee<Y.length;ee++)L.indexOf(Y[ee])<0&&Object.prototype.propertyIsEnumerable.call(z,Y[ee])&&(N[Y[ee]]=z[Y[ee]])}return N}(x,["nocookie"]),M=`www.youtube${y?"-nocookie":""}.com`,D=t0(o,h),A=encodeURIComponent(d[2]);t.videoId=A,t.src=`https://${M}/embed/${A}?${D}`,t.thumbSrc=t.thumbSrc||`https://i.ytimg.com/vi/${A}/mqdefault.jpg`,c=Es}else if(d=o.match(/^.+vimeo.com\/(?:\/)?([\d]+)((\/|\?h=)([a-z0-9]+))?(.*)?/)){const x=t0(o,this.optionFor(t,Ho)),y=encodeURIComponent(d[1]),h=d[4]||"";t.videoId=y,t.src=`https://player.vimeo.com/video/${y}?${h?`h=${h}${x?"&":""}`:""}${x}`,c=Ho}if(!c&&t.triggerEl){const x=t.triggerEl.dataset.type;jE.includes(x)&&(c=x)}c||typeof o=="string"&&(o.charAt(0)==="#"?c="inline":(d=o.match(/\.(mp4|mov|ogv|webm)((\?|#).*)?$/i))?(c=ac,t.videoFormat=t.videoFormat||"video/"+(d[1]==="ogv"?"ogg":d[1])):o.match(/(^data:image\/[a-z0-9+\/=]*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg|ico)((\?|#).*)?$)/i)?c=e0:o.match(/\.(pdf)((\?|#).*)?$/i)&&(c="pdf")),(d=o.match(/(?:maps\.)?google\.([a-z]{2,3}(?:\.[a-z]{2})?)\/(?:(?:(?:maps\/(?:place\/(?:.*)\/)?\@(.*),(\d+.?\d+?)z))|(?:\?ll=))(.*)?/i))?(t.src=`https://maps.google.${d[1]}/?ll=${(d[2]?d[2]+"&z="+Math.floor(parseFloat(d[3]))+(d[4]?d[4].replace(/^\//,"&"):""):d[4]+"").replace(/\?/,"&")}&output=${d[4]&&d[4].indexOf("layer=c")>0?"svembed":"embed"}`,c=Rp):(d=o.match(/(?:maps\.)?google\.([a-z]{2,3}(?:\.[a-z]{2})?)\/(?:maps\/search\/)(.*)/i))&&(t.src=`https://maps.google.${d[1]}/maps?q=${d[2].replace("query=","q=").replace("api=1","")}&output=embed`,c=Rp),c=c||this.instance.option("defaultType"),t.type=c,c===e0&&(t.thumbSrc=t.thumbSrc||t.src)}setContent(t){const o=this.instance.optionFor(t,"src")||"";if(t&&t.type&&o){switch(t.type){case Lp:this.instance.setContent(t,o);break;case ac:const c=this.option("videoTpl");c&&this.instance.setContent(t,c.replace(/\{\{src\}\}/gi,o+"").replace(/\{\{format\}\}/gi,this.optionFor(t,"videoFormat")||"").replace(/\{\{poster\}\}/gi,t.poster||t.thumbSrc||""));break;case"inline":case"clone":this.setInlineContent(t);break;case"ajax":this.loadAjaxContent(t);break;case"pdf":case Rp:case Es:case Ho:t.preload=!1;case"iframe":this.setIframeContent(t)}this.setAspectRatio(t)}}setAspectRatio(t){const o=t.contentEl;if(!(t.el&&o&&t.type&&[Es,Ho,ac].includes(t.type)))return;let c,d=t.width||"auto",x=t.height||"auto";if(d==="auto"||x==="auto"){c=this.optionFor(t,"videoRatio");const D=(c+"").match(/(\d+)\s*\/\s?(\d+)/);c=D&&D.length>2?parseFloat(D[1])/parseFloat(D[2]):parseFloat(c+"")}else d&&x&&(c=d/x);if(!c)return;o.style.aspectRatio="",o.style.width="",o.style.height="",o.offsetHeight;const y=o.getBoundingClientRect(),h=y.width||1,M=y.height||1;o.style.aspectRatio=c+"",c<h/M?(x=x==="auto"?M:Math.min(M,x),o.style.width="auto",o.style.height=`${x}px`):(d=d==="auto"?h:Math.min(h,d),o.style.width=`${d}px`,o.style.height="auto")}attach(){const t=this,o=t.instance;o.on("Carousel.beforeInitSlide",t.onBeforeInitSlide),o.on("Carousel.createSlide",t.onCreateSlide),o.on("Carousel.selectSlide",t.onSelectSlide),o.on("Carousel.unselectSlide",t.onUnselectSlide),o.on("Carousel.Panzoom.refresh",t.onRefresh),o.on("done",t.onDone),o.on("clearContent",t.onClearContent),window.addEventListener("message",t.onMessage)}detach(){const t=this,o=t.instance;o.off("Carousel.beforeInitSlide",t.onBeforeInitSlide),o.off("Carousel.createSlide",t.onCreateSlide),o.off("Carousel.selectSlide",t.onSelectSlide),o.off("Carousel.unselectSlide",t.onUnselectSlide),o.off("Carousel.Panzoom.refresh",t.onRefresh),o.off("done",t.onDone),o.off("clearContent",t.onClearContent),window.removeEventListener("message",t.onMessage)}}Object.defineProperty(i0,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:$E});const cu="play",hu="pause",lc="ready";class n0 extends Vr{constructor(){super(...arguments),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:lc}),Object.defineProperty(this,"inHover",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"timer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"progressBar",{enumerable:!0,configurable:!0,writable:!0,value:null})}get isActive(){return this.state!==lc}onReady(t){this.option("autoStart")&&(t.isInfinite||t.page<t.pages.length-1)&&this.start()}onChange(){this.removeProgressBar(),this.pause()}onSettle(){this.resume()}onVisibilityChange(){document.visibilityState==="visible"?this.resume():this.pause()}onMouseEnter(){this.inHover=!0,this.pause()}onMouseLeave(){var t;this.inHover=!1,!((t=this.instance.panzoom)===null||t===void 0)&&t.isResting&&this.resume()}onTimerEnd(){const t=this.instance;this.state==="play"&&(t.isInfinite||t.page!==t.pages.length-1?t.slideNext():t.slideTo(0))}removeProgressBar(){this.progressBar&&(this.progressBar.remove(),this.progressBar=null)}createProgressBar(){var t;if(!this.option("showProgress"))return null;this.removeProgressBar();const o=this.instance,c=((t=o.pages[o.page])===null||t===void 0?void 0:t.slides)||[];let d=this.option("progressParentEl");if(d||(d=(c.length===1?c[0].el:null)||o.viewport),!d)return null;const x=document.createElement("div");return dt(x,"f-progress"),d.prepend(x),this.progressBar=x,x.offsetHeight,x}set(){const t=this,o=t.instance;if(o.pages.length<2||t.timer)return;const c=t.option("timeout");t.state=cu,dt(o.container,"has-autoplay");let d=t.createProgressBar();d&&(d.style.transitionDuration=`${c}ms`,d.style.transform="scaleX(1)"),t.timer=setTimeout(()=>{t.timer=null,t.inHover||t.onTimerEnd()},c),t.emit("set")}clear(){const t=this;t.timer&&(clearTimeout(t.timer),t.timer=null),t.removeProgressBar()}start(){const t=this;if(t.set(),t.state!==lc){if(t.option("pauseOnHover")){const o=t.instance.container;o.addEventListener("mouseenter",t.onMouseEnter,!1),o.addEventListener("mouseleave",t.onMouseLeave,!1)}document.addEventListener("visibilitychange",t.onVisibilityChange,!1),t.emit("start")}}stop(){const t=this,o=t.state,c=t.instance.container;t.clear(),t.state=lc,c.removeEventListener("mouseenter",t.onMouseEnter,!1),c.removeEventListener("mouseleave",t.onMouseLeave,!1),document.removeEventListener("visibilitychange",t.onVisibilityChange,!1),ni(c,"has-autoplay"),o!==lc&&t.emit("stop")}pause(){const t=this;t.state===cu&&(t.state=hu,t.clear(),t.emit(hu))}resume(){const t=this,o=t.instance;if(o.isInfinite||o.page!==o.pages.length-1)if(t.state!==cu){if(t.state===hu&&!t.inHover){const c=new Event("resume",{bubbles:!0,cancelable:!0});t.emit("resume",c),c.defaultPrevented||t.set()}}else t.set();else t.stop()}toggle(){this.state===cu||this.state===hu?this.stop():this.start()}attach(){const t=this,o=t.instance;o.on("ready",t.onReady),o.on("Panzoom.startAnimation",t.onChange),o.on("Panzoom.endAnimation",t.onSettle),o.on("Panzoom.touchMove",t.onChange)}detach(){const t=this,o=t.instance;o.off("ready",t.onReady),o.off("Panzoom.startAnimation",t.onChange),o.off("Panzoom.endAnimation",t.onSettle),o.off("Panzoom.touchMove",t.onChange),t.stop()}}Object.defineProperty(n0,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{autoStart:!0,pauseOnHover:!0,progressParentEl:null,showProgress:!0,timeout:3e3}});class r0 extends Vr{constructor(){super(...arguments),Object.defineProperty(this,"ref",{enumerable:!0,configurable:!0,writable:!0,value:null})}onPrepare(t){const o=t.carousel;if(!o)return;const c=t.container;c&&(o.options.Autoplay=Un({autoStart:!1},this.option("Autoplay")||{},{pauseOnHover:!1,timeout:this.option("timeout"),progressParentEl:()=>this.option("progressParentEl")||null,on:{start:()=>{t.emit("startSlideshow")},set:d=>{var x;c.classList.add("has-slideshow"),((x=t.getSlide())===null||x===void 0?void 0:x.state)!==gn.Ready&&d.pause()},stop:()=>{c.classList.remove("has-slideshow"),t.isCompact||t.endIdle(),t.emit("endSlideshow")},resume:(d,x)=>{var y,h,M;!x||!x.cancelable||((y=t.getSlide())===null||y===void 0?void 0:y.state)===gn.Ready&&(!((M=(h=t.carousel)===null||h===void 0?void 0:h.panzoom)===null||M===void 0)&&M.isResting)||x.preventDefault()}}}),o.attachPlugins({Autoplay:n0}),this.ref=o.plugins.Autoplay)}onReady(t){const o=t.carousel,c=this.ref;c&&o&&this.option("playOnStart")&&(o.isInfinite||o.page<o.pages.length-1)&&c.start()}onDone(t,o){const c=this.ref,d=t.carousel;if(!c||!d)return;const x=o.panzoom;x&&x.on("startAnimation",()=>{t.isCurrentSlide(o)&&c.stop()}),t.isCurrentSlide(o)&&c.resume()}onKeydown(t,o){var c;const d=this.ref;d&&o===this.option("key")&&((c=document.activeElement)===null||c===void 0?void 0:c.nodeName)!=="BUTTON"&&d.toggle()}attach(){const t=this,o=t.instance;o.on("Carousel.init",t.onPrepare),o.on("Carousel.ready",t.onReady),o.on("done",t.onDone),o.on("keydown",t.onKeydown)}detach(){const t=this,o=t.instance;o.off("Carousel.init",t.onPrepare),o.off("Carousel.ready",t.onReady),o.off("done",t.onDone),o.off("keydown",t.onKeydown)}}Object.defineProperty(r0,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{key:" ",playOnStart:!1,progressParentEl:n=>{var t;return((t=n.instance.container)===null||t===void 0?void 0:t.querySelector(".fancybox__toolbar [data-fancybox-toggle-slideshow]"))||n.instance.container},timeout:3e3}});const s0={classes:{container:"f-thumbs f-carousel__thumbs",viewport:"f-thumbs__viewport",track:"f-thumbs__track",slide:"f-thumbs__slide",isResting:"is-resting",isSelected:"is-selected",isLoading:"is-loading",hasThumbs:"has-thumbs"},minCount:2,parentEl:null,thumbTpl:'<button class="f-thumbs__slide__button" tabindex="0" type="button" aria-label="{{GOTO}}" data-carousel-index="%i"><img class="f-thumbs__slide__img" data-lazy-src="{{%s}}" alt="" /></button>',type:"modern"};var Ts;(function(n){n[n.Init=0]="Init",n[n.Ready=1]="Ready",n[n.Hidden=2]="Hidden"})(Ts||(Ts={}));const o0="isResting",uu="thumbWidth",$a="thumbHeight",ts="thumbClipWidth";let a0=class extends Vr{constructor(){super(...arguments),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:"modern"}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"track",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"carousel",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"thumbWidth",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbClipWidth",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbHeight",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbGap",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbExtraGap",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:Ts.Init})}get isModern(){return this.type==="modern"}onInitSlide(n,t){const o=t.el?t.el.dataset:void 0;o&&(t.thumbSrc=o.thumbSrc||t.thumbSrc||"",t[ts]=parseFloat(o[ts]||"")||t[ts]||0,t[$a]=parseFloat(o.thumbHeight||"")||t[$a]||0),this.addSlide(t)}onInitSlides(){this.build()}onChange(){var n;if(!this.isModern)return;const t=this.container,o=this.instance,c=o.panzoom,d=this.carousel,x=d?d.panzoom:null,y=o.page;if(c&&d&&x){if(c.isDragging){ni(t,this.cn(o0));let h=((n=d.pages[y])===null||n===void 0?void 0:n.pos)||0;h+=o.getProgress(y)*(this[ts]+this.thumbGap);let M=x.getBounds();-1*h>M.x.min&&-1*h<M.x.max&&x.panTo({x:-1*h,friction:.12})}else es(t,this.cn(o0),c.isResting);this.shiftModern()}}onRefresh(){this.updateProps();for(const n of this.instance.slides||[])this.resizeModernSlide(n);this.shiftModern()}isDisabled(){const n=this.option("minCount")||0;if(n){const o=this.instance;let c=0;for(const d of o.slides||[])d.thumbSrc&&c++;if(c<n)return!0}const t=this.option("type");return["modern","classic"].indexOf(t)<0}getThumb(n){const t=this.option("thumbTpl")||"";return{html:this.instance.localize(t,[["%i",n.index],["%d",n.index+1],["%s",n.thumbSrc||"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"]])}}addSlide(n){const t=this.carousel;t&&t.addSlide(n.index,this.getThumb(n))}getSlides(){const n=[];for(const t of this.instance.slides||[])n.push(this.getThumb(t));return n}resizeModernSlide(n){this.isModern&&(n[uu]=n[ts]&&n[$a]?Math.round(this[$a]*(n[ts]/n[$a])):this[uu])}updateProps(){const n=this.container;if(!n)return;const t=o=>parseFloat(getComputedStyle(n).getPropertyValue("--f-thumb-"+o))||0;this.thumbGap=t("gap"),this.thumbExtraGap=t("extra-gap"),this[uu]=t("width")||40,this[ts]=t("clip-width")||40,this[$a]=t("height")||40}build(){const n=this;if(n.state!==Ts.Init)return;if(n.isDisabled())return void n.emit("disabled");const t=n.instance,o=t.container,c=n.getSlides(),d=n.option("type");n.type=d;const x=n.option("parentEl"),y=n.cn("container"),h=n.cn("track");let M=x==null?void 0:x.querySelector("."+y);M||(M=document.createElement("div"),dt(M,y),x?x.appendChild(M):o.after(M)),dt(M,`is-${d}`),dt(o,n.cn("hasThumbs")),n.container=M,n.updateProps();let D=M.querySelector("."+h);D||(D=document.createElement("div"),dt(D,n.cn("track")),M.appendChild(D)),n.track=D;const A=Un({},{track:D,infinite:!1,center:!0,fill:d==="classic",dragFree:!0,slidesPerPage:1,transition:!1,preload:.25,friction:.12,Panzoom:{maxVelocity:0},Dots:!1,Navigation:!1,classes:{container:"f-thumbs",viewport:"f-thumbs__viewport",track:"f-thumbs__track",slide:"f-thumbs__slide"}},n.option("Carousel")||{},{Sync:{target:t},slides:c}),z=new t.constructor(M,A);z.on("createSlide",(L,N)=>{n.setProps(N.index),n.emit("createSlide",N,N.el)}),z.on("ready",()=>{n.shiftModern(),n.emit("ready")}),z.on("refresh",()=>{n.shiftModern()}),z.on("Panzoom.click",(L,N,Y)=>{n.onClick(Y)}),n.carousel=z,n.state=Ts.Ready}onClick(n){n.preventDefault(),n.stopPropagation();const t=this.instance,{pages:o,page:c}=t,d=ee=>{if(ee){const oe=ee.closest("[data-carousel-index]");if(oe)return[parseInt(oe.dataset.carouselIndex||"",10)||0,oe]}return[-1,void 0]},x=(ee,oe)=>{const he=document.elementFromPoint(ee,oe);return he?d(he):[-1,void 0]};let[y,h]=d(n.target);if(y>-1)return;const M=this[ts],D=n.clientX,A=n.clientY;let[z,L]=x(D-M,A),[N,Y]=x(D+M,A);L&&Y?(y=Math.abs(D-L.getBoundingClientRect().right)<Math.abs(D-Y.getBoundingClientRect().left)?z:N,y===c&&(y=y===z?N:z)):L?y=z:Y&&(y=N),y>-1&&o[y]&&t.slideTo(y)}getShift(n){var t;const o=this,{instance:c}=o,d=o.carousel;if(!c||!d)return 0;const x=o[uu],y=o[ts],h=o.thumbGap,M=o.thumbExtraGap;if(!(!((t=d.slides[n])===null||t===void 0)&&t.el))return 0;const D=.5*(x-y),A=c.pages.length-1;let z=c.getProgress(0),L=c.getProgress(A),N=c.getProgress(n,!1,!0),Y=0,ee=D+M+h;const oe=z<0&&z>-1,he=L>0&&L<1;return n===0?(Y=ee*Math.abs(z),he&&z===1&&(Y-=ee*Math.abs(L))):n===A?(Y=ee*Math.abs(L)*-1,oe&&L===-1&&(Y+=ee*Math.abs(z))):oe||he?(Y=-1*ee,Y+=ee*Math.abs(z),Y+=ee*(1-Math.abs(L))):Y=ee*N,Y}setProps(n){var t;const o=this;if(!o.isModern)return;const{instance:c}=o,d=o.carousel;if(c&&d){const x=(t=d.slides[n])===null||t===void 0?void 0:t.el;if(x&&x.childNodes.length){let y=Ye(1-Math.abs(c.getProgress(n))),h=Ye(o.getShift(n));x.style.setProperty("--progress",y?y+"":""),x.style.setProperty("--shift",h+"")}}}shiftModern(){const n=this;if(!n.isModern)return;const{instance:t,track:o}=n,c=t.panzoom,d=n.carousel;if(!(t&&o&&c&&d)||c.state===ci.Init||c.state===ci.Destroy)return;for(const y of t.slides)n.setProps(y.index);let x=(n[ts]+n.thumbGap)*(d.slides.length||0);o.style.setProperty("--width",x+"")}cleanup(){const n=this;n.carousel&&n.carousel.destroy(),n.carousel=null,n.container&&n.container.remove(),n.container=null,n.track&&n.track.remove(),n.track=null,n.state=Ts.Init,ni(n.instance.container,n.cn("hasThumbs"))}attach(){const n=this,t=n.instance;t.on("initSlide",n.onInitSlide),t.state===Ni.Init?t.on("initSlides",n.onInitSlides):n.onInitSlides(),t.on(["change","Panzoom.afterTransform"],n.onChange),t.on("Panzoom.refresh",n.onRefresh)}detach(){const n=this,t=n.instance;t.off("initSlide",n.onInitSlide),t.off("initSlides",n.onInitSlides),t.off(["change","Panzoom.afterTransform"],n.onChange),t.off("Panzoom.refresh",n.onRefresh),n.cleanup()}};Object.defineProperty(a0,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:s0});const UE=Object.assign(Object.assign({},s0),{key:"t",showOnStart:!0,parentEl:null}),l0="is-masked",c0="aria-hidden";class h0 extends Vr{constructor(){super(...arguments),Object.defineProperty(this,"ref",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"hidden",{enumerable:!0,configurable:!0,writable:!0,value:!1})}get isEnabled(){const t=this.ref;return t&&!t.isDisabled()}get isHidden(){return this.hidden}onClick(t,o){o.stopPropagation()}onCreateSlide(t,o){var c,d,x;const y=((x=(d=(c=this.instance)===null||c===void 0?void 0:c.carousel)===null||d===void 0?void 0:d.slides[o.index])===null||x===void 0?void 0:x.type)||"",h=o.el;if(h&&y){let M=`for-${y}`;["video","youtube","vimeo","html5video"].includes(y)&&(M+=" for-video"),dt(h,M)}}onInit(){var t;const o=this,c=o.instance,d=c.carousel;if(o.ref||!d)return;const x=o.option("parentEl")||c.footer||c.container;if(!x)return;const y=Un({},o.options,{parentEl:x,classes:{container:"f-thumbs fancybox__thumbs"},Carousel:{Sync:{friction:c.option("Carousel.friction")||0}},on:{ready:h=>{const M=h.container;M&&this.hidden&&(o.refresh(),M.style.transition="none",o.hide(),M.offsetHeight,queueMicrotask(()=>{M.style.transition="",o.show()}))}}});y.Carousel=y.Carousel||{},y.Carousel.on=Un(((t=o.options.Carousel)===null||t===void 0?void 0:t.on)||{},{click:this.onClick,createSlide:this.onCreateSlide}),d.options.Thumbs=y,d.attachPlugins({Thumbs:a0}),o.ref=d.plugins.Thumbs,o.option("showOnStart")||(o.ref.state=Ts.Hidden,o.hidden=!0)}onResize(){var t;const o=(t=this.ref)===null||t===void 0?void 0:t.container;o&&(o.style.maxHeight="")}onKeydown(t,o){const c=this.option("key");c&&c===o&&this.toggle()}toggle(){const t=this.ref;if(t&&!t.isDisabled())return t.state===Ts.Hidden?(t.state=Ts.Init,void t.build()):void(this.hidden?this.show():this.hide())}show(){const t=this.ref;if(!t||t.isDisabled())return;const o=t.container;o&&(this.refresh(),o.offsetHeight,o.removeAttribute(c0),o.classList.remove(l0),this.hidden=!1)}hide(){const t=this.ref,o=t&&t.container;o&&(this.refresh(),o.offsetHeight,o.classList.add(l0),o.setAttribute(c0,"true")),this.hidden=!0}refresh(){const t=this.ref;if(!t||!t.state)return;const o=t.container,c=(o==null?void 0:o.firstChild)||null;o&&c&&c.childNodes.length&&(o.style.maxHeight=`${c.getBoundingClientRect().height}px`)}attach(){const t=this,o=t.instance;o.state===Xi.Init?o.on("Carousel.init",t.onInit):t.onInit(),o.on("resize",t.onResize),o.on("keydown",t.onKeydown)}detach(){var t;const o=this,c=o.instance;c.off("Carousel.init",o.onInit),c.off("resize",o.onResize),c.off("keydown",o.onKeydown),(t=c.carousel)===null||t===void 0||t.detachPlugins(["Thumbs"]),o.ref=null}}Object.defineProperty(h0,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:UE});const Op={panLeft:{icon:'<svg><path d="M5 12h14M5 12l6 6M5 12l6-6"/></svg>',change:{panX:-100}},panRight:{icon:'<svg><path d="M5 12h14M13 18l6-6M13 6l6 6"/></svg>',change:{panX:100}},panUp:{icon:'<svg><path d="M12 5v14M18 11l-6-6M6 11l6-6"/></svg>',change:{panY:-100}},panDown:{icon:'<svg><path d="M12 5v14M18 13l-6 6M6 13l6 6"/></svg>',change:{panY:100}},zoomIn:{icon:'<svg><circle cx="11" cy="11" r="7.5"/><path d="m21 21-4.35-4.35M11 8v6M8 11h6"/></svg>',action:"zoomIn"},zoomOut:{icon:'<svg><circle cx="11" cy="11" r="7.5"/><path d="m21 21-4.35-4.35M8 11h6"/></svg>',action:"zoomOut"},toggle1to1:{icon:'<svg><path d="M3.51 3.07c5.74.02 11.48-.02 17.22.02 1.37.1 2.34 1.64 2.18 3.13 0 4.08.02 8.16 0 12.23-.1 1.54-1.47 2.64-2.79 2.46-5.61-.01-11.24.02-16.86-.01-1.36-.12-2.33-1.65-2.17-3.14 0-4.07-.02-8.16 0-12.23.1-1.36 1.22-2.48 2.42-2.46Z"/><path d="M5.65 8.54h1.49v6.92m8.94-6.92h1.49v6.92M11.5 9.4v.02m0 5.18v0"/></svg>',action:"toggleZoom"},toggleZoom:{icon:'<svg><g><line x1="11" y1="8" x2="11" y2="14"></line></g><circle cx="11" cy="11" r="7.5"/><path d="m21 21-4.35-4.35M8 11h6"/></svg>',action:"toggleZoom"},iterateZoom:{icon:'<svg><g><line x1="11" y1="8" x2="11" y2="14"></line></g><circle cx="11" cy="11" r="7.5"/><path d="m21 21-4.35-4.35M8 11h6"/></svg>',action:"iterateZoom"},rotateCCW:{icon:'<svg><path d="M15 4.55a8 8 0 0 0-6 14.9M9 15v5H4M18.37 7.16v.01M13 19.94v.01M16.84 18.37v.01M19.37 15.1v.01M19.94 11v.01"/></svg>',action:"rotateCCW"},rotateCW:{icon:'<svg><path d="M9 4.55a8 8 0 0 1 6 14.9M15 15v5h5M5.63 7.16v.01M4.06 11v.01M4.63 15.1v.01M7.16 18.37v.01M11 19.94v.01"/></svg>',action:"rotateCW"},flipX:{icon:'<svg style="stroke-width: 1.3"><path d="M12 3v18M16 7v10h5L16 7M8 7v10H3L8 7"/></svg>',action:"flipX"},flipY:{icon:'<svg style="stroke-width: 1.3"><path d="M3 12h18M7 16h10L7 21v-5M7 8h10L7 3v5"/></svg>',action:"flipY"},fitX:{icon:'<svg><path d="M4 12V6a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v6M10 18H3M21 18h-7M6 15l-3 3 3 3M18 15l3 3-3 3"/></svg>',action:"fitX"},fitY:{icon:'<svg><path d="M12 20H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h6M18 14v7M18 3v7M15 18l3 3 3-3M15 6l3-3 3 3"/></svg>',action:"fitY"},reset:{icon:'<svg><path d="M20 11A8.1 8.1 0 0 0 4.5 9M4 5v4h4M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4"/></svg>',action:"reset"},toggleFS:{icon:'<svg><g><path d="M14.5 9.5 21 3m0 0h-6m6 0v6M3 21l6.5-6.5M3 21v-6m0 6h6"/></g><g><path d="m14 10 7-7m-7 7h6m-6 0V4M3 21l7-7m0 0v6m0-6H4"/></g></svg>',action:"toggleFS"}};var qo;(function(n){n[n.Init=0]="Init",n[n.Ready=1]="Ready",n[n.Disabled=2]="Disabled"})(qo||(qo={}));const HE={absolute:"auto",display:{left:["infobar"],middle:[],right:["iterateZoom","slideshow","fullscreen","thumbs","close"]},enabled:"auto",items:{infobar:{tpl:'<div class="fancybox__infobar" tabindex="-1"><span data-fancybox-current-index></span>/<span data-fancybox-count></span></div>'},download:{tpl:'<a class="f-button" title="{{DOWNLOAD}}" data-fancybox-download href="javasript:;"><svg><path d="M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2M7 11l5 5 5-5M12 4v12"/></svg></a>'},prev:{tpl:'<button class="f-button" title="{{PREV}}" data-fancybox-prev><svg><path d="m15 6-6 6 6 6"/></svg></button>'},next:{tpl:'<button class="f-button" title="{{NEXT}}" data-fancybox-next><svg><path d="m9 6 6 6-6 6"/></svg></button>'},slideshow:{tpl:'<button class="f-button" title="{{TOGGLE_SLIDESHOW}}" data-fancybox-toggle-slideshow><svg><g><path d="M8 4v16l13 -8z"></path></g><g><path d="M8 4v15M17 4v15"/></g></svg></button>'},fullscreen:{tpl:'<button class="f-button" title="{{TOGGLE_FULLSCREEN}}" data-fancybox-toggle-fullscreen><svg><g><path d="M4 8V6a2 2 0 0 1 2-2h2M4 16v2a2 2 0 0 0 2 2h2M16 4h2a2 2 0 0 1 2 2v2M16 20h2a2 2 0 0 0 2-2v-2"/></g><g><path d="M15 19v-2a2 2 0 0 1 2-2h2M15 5v2a2 2 0 0 0 2 2h2M5 15h2a2 2 0 0 1 2 2v2M5 9h2a2 2 0 0 0 2-2V5"/></g></svg></button>'},thumbs:{tpl:'<button class="f-button" title="{{TOGGLE_THUMBS}}" data-fancybox-toggle-thumbs><svg><circle cx="5.5" cy="5.5" r="1"/><circle cx="12" cy="5.5" r="1"/><circle cx="18.5" cy="5.5" r="1"/><circle cx="5.5" cy="12" r="1"/><circle cx="12" cy="12" r="1"/><circle cx="18.5" cy="12" r="1"/><circle cx="5.5" cy="18.5" r="1"/><circle cx="12" cy="18.5" r="1"/><circle cx="18.5" cy="18.5" r="1"/></svg></button>'},close:{tpl:'<button class="f-button" title="{{CLOSE}}" data-fancybox-close><svg><path d="m19.5 4.5-15 15M4.5 4.5l15 15"/></svg></button>'}},parentEl:null},qE={tabindex:"-1",width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},u0="has-toolbar",Bp="fancybox__toolbar";class d0 extends Vr{constructor(){super(...arguments),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:qo.Init}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null})}onReady(t){var o;if(!t.carousel)return;let c=this.option("display"),d=this.option("absolute"),x=this.option("enabled");if(x==="auto"){const D=this.instance.carousel;let A=0;if(D)for(const z of D.slides)(z.panzoom||z.type==="image")&&A++;A||(x=!1)}x||(c=void 0);let y=0;const h={left:[],middle:[],right:[]};if(c)for(const D of["left","middle","right"])for(const A of c[D]){const z=this.createEl(A);z&&((o=h[D])===null||o===void 0||o.push(z),y++)}let M=null;if(y&&(M=this.createContainer()),M){for(const[D,A]of Object.entries(h)){const z=document.createElement("div");dt(z,Bp+"__column is-"+D);for(const L of A)z.appendChild(L);d!=="auto"||D!=="middle"||A.length||(d=!0),M.appendChild(z)}d===!0&&dt(M,"is-absolute"),this.state=qo.Ready,this.onRefresh()}else this.state=qo.Disabled}onClick(t){var o,c;const d=this.instance,x=d.getSlide(),y=x==null?void 0:x.panzoom,h=t.target,M=h&&Hn(h)?h.dataset:null;if(!M)return;if(M.fancyboxToggleThumbs!==void 0)return t.preventDefault(),t.stopPropagation(),void((o=d.plugins.Thumbs)===null||o===void 0||o.toggle());if(M.fancyboxToggleFullscreen!==void 0)return t.preventDefault(),t.stopPropagation(),void this.instance.toggleFullscreen();if(M.fancyboxToggleSlideshow!==void 0){t.preventDefault(),t.stopPropagation();const z=(c=d.carousel)===null||c===void 0?void 0:c.plugins.Autoplay;let L=z.isActive;return y&&y.panMode==="mousemove"&&!L&&y.reset(),void(L?z.stop():z.start())}const D=M.panzoomAction,A=M.panzoomChange;if((A||D)&&(t.preventDefault(),t.stopPropagation()),A){let z={};try{z=JSON.parse(A)}catch{}y&&y.applyChange(z)}else D&&y&&y[D]&&y[D]()}onChange(){this.onRefresh()}onRefresh(){if(this.instance.isClosing())return;const t=this.container;if(!t)return;const o=this.instance.getSlide();if(!o||o.state!==gn.Ready)return;const c=o&&!o.error&&o.panzoom;for(const y of t.querySelectorAll("[data-panzoom-action]"))c?(y.removeAttribute("disabled"),y.removeAttribute("tabindex")):(y.setAttribute("disabled",""),y.setAttribute("tabindex","-1"));let d=c&&c.canZoomIn(),x=c&&c.canZoomOut();for(const y of t.querySelectorAll('[data-panzoom-action="zoomIn"]'))d?(y.removeAttribute("disabled"),y.removeAttribute("tabindex")):(y.setAttribute("disabled",""),y.setAttribute("tabindex","-1"));for(const y of t.querySelectorAll('[data-panzoom-action="zoomOut"]'))x?(y.removeAttribute("disabled"),y.removeAttribute("tabindex")):(y.setAttribute("disabled",""),y.setAttribute("tabindex","-1"));for(const y of t.querySelectorAll('[data-panzoom-action="toggleZoom"],[data-panzoom-action="iterateZoom"]')){x||d?(y.removeAttribute("disabled"),y.removeAttribute("tabindex")):(y.setAttribute("disabled",""),y.setAttribute("tabindex","-1"));const h=y.querySelector("g");h&&(h.style.display=d?"":"none")}}onDone(t,o){var c;(c=o.panzoom)===null||c===void 0||c.on("afterTransform",()=>{this.instance.isCurrentSlide(o)&&this.onRefresh()}),this.instance.isCurrentSlide(o)&&this.onRefresh()}createContainer(){const t=this.instance.container;if(!t)return null;const o=this.option("parentEl")||t;let c=o.querySelector("."+Bp);return c||(c=document.createElement("div"),dt(c,Bp),o.prepend(c)),c.addEventListener("click",this.onClick,{passive:!1,capture:!0}),t&&dt(t,u0),this.container=c,c}createEl(t){const o=this.instance,c=o.carousel;if(!c||t==="toggleFS"||t==="fullscreen"&&!Zy())return null;let d=null;const x=c.slides.length||0;let y=0,h=0;for(const D of c.slides)(D.panzoom||D.type==="image")&&y++,(D.type==="image"||D.downloadSrc)&&h++;if(x<2&&["infobar","prev","next"].includes(t))return d;if(Op[t]!==void 0&&!y||t==="download"&&!h)return null;if(t==="thumbs"){const D=o.plugins.Thumbs;if(!D||!D.isEnabled)return null}if(t==="slideshow"&&(!c.plugins.Autoplay||x<2))return null;if(Op[t]!==void 0){const D=Op[t];d=document.createElement("button"),d.setAttribute("title",this.instance.localize(`{{${t.toUpperCase()}}}`)),dt(d,"f-button"),D.action&&(d.dataset.panzoomAction=D.action),D.change&&(d.dataset.panzoomChange=JSON.stringify(D.change)),d.appendChild(Qr(this.instance.localize(D.icon)))}else{const D=(this.option("items")||[])[t];D&&(d=Qr(this.instance.localize(D.tpl)),typeof D.click=="function"&&d.addEventListener("click",A=>{A.preventDefault(),A.stopPropagation(),typeof D.click=="function"&&D.click.call(this,this,A)}))}const M=d==null?void 0:d.querySelector("svg");if(M)for(const[D,A]of Object.entries(qE))M.getAttribute(D)||M.setAttribute(D,String(A));return d}removeContainer(){const t=this.container;t&&t.remove(),this.container=null,this.state=qo.Disabled;const o=this.instance.container;o&&ni(o,u0)}attach(){const t=this,o=t.instance;o.on("Carousel.initSlides",t.onReady),o.on("done",t.onDone),o.on(["reveal","Carousel.change"],t.onChange),t.onReady(t.instance)}detach(){const t=this,o=t.instance;o.off("Carousel.initSlides",t.onReady),o.off("done",t.onDone),o.off(["reveal","Carousel.change"],t.onChange),t.removeContainer()}}Object.defineProperty(d0,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:HE});const ZE={Hash:class extends Vr{onReady(){oc=!1}onChange(n){Uo&&clearTimeout(Uo);const{hash:t}=Gy(),{hash:o}=au(),c=n.isOpeningSlide(n.getSlide());c&&(Wy=o===t?"":o),t&&t!==o&&(Uo=setTimeout(()=>{try{if(n.state===Xi.Ready){let d="replaceState";c&&!ou&&(d="pushState",ou=!0),window.history[d]({},document.title,window.location.pathname+window.location.search+t)}}catch{}},300))}onClose(n){if(Uo&&clearTimeout(Uo),!oc&&ou)return ou=!1,oc=!1,void window.history.back();if(!oc)try{window.history.replaceState({},document.title,window.location.pathname+window.location.search+(Wy||""))}catch{}}attach(){const n=this.instance;n.on("ready",this.onReady),n.on(["Carousel.ready","Carousel.change"],this.onChange),n.on("close",this.onClose)}detach(){const n=this.instance;n.off("ready",this.onReady),n.off(["Carousel.ready","Carousel.change"],this.onChange),n.off("close",this.onClose)}static parseURL(){return au()}static startFromUrl(){Yy()}static destroy(){window.removeEventListener("hashchange",Ky,!1)}},Html:i0,Images:Qy,Slideshow:r0,Thumbs:h0,Toolbar:d0},p0="with-fancybox",Fp="hide-scrollbar",f0="--fancybox-scrollbar-compensate",m0="--fancybox-body-margin",Np="aria-hidden",Vp="is-using-tab",$p="is-animated",g0="is-compact",y0="is-loading",jp="is-opening",du="has-caption",ja="disabled",Zo="tabindex",_0="download",Up="href",Ua="src",Ks=n=>typeof n=="string",x0=function(){var n=window.getSelection();return!!n&&n.type==="Range"};let wr,kr=null,Wo=null,b0=0,v0=0,w0=0,k0=0;const Ha=new Map;let WE=0;class Xt extends Tp{get isIdle(){return this.idle}get isCompact(){return this.option("compact")}constructor(t=[],o={},c={}){super(o),Object.defineProperty(this,"userSlides",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"userPlugins",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"idle",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"idleTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"clickTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"pwt",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"ignoreFocusChange",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"startedFs",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:Xi.Init}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"caption",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"footer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"carousel",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"lastFocus",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"prevMouseMoveEvent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),wr||(wr=Zy()),this.id=o.id||++WE,Ha.set(this.id,this),this.userSlides=t,this.userPlugins=c,queueMicrotask(()=>{this.init()})}init(){if(this.state===Xi.Destroy)return;this.state=Xi.Init,this.attachPlugins(Object.assign(Object.assign({},Xt.Plugins),this.userPlugins)),this.emit("init"),this.emit("attachPlugins"),this.option("hideScrollbar")===!0&&(()=>{if(!sc)return;const o=document,c=o.body,d=o.documentElement;if(c.classList.contains(Fp))return;let x=window.innerWidth-d.getBoundingClientRect().width;const y=parseFloat(window.getComputedStyle(c).marginRight);x<0&&(x=0),d.style.setProperty(f0,`${x}px`),y&&c.style.setProperty(m0,`${y}px`),c.classList.add(Fp)})(),this.initLayout(),this.scale();const t=()=>{this.initCarousel(this.userSlides),this.state=Xi.Ready,this.attachEvents(),this.emit("ready"),setTimeout(()=>{this.container&&this.container.setAttribute(Np,"false")},16)};this.option("Fullscreen.autoStart")&&wr&&!wr.isFullscreen()?wr.request().then(()=>{this.startedFs=!0,t()}).catch(()=>t()):t()}initLayout(){var t,o;const c=this.option("parentEl")||document.body,d=Qr(this.localize(this.option("tpl.main")||""));if(d){if(d.setAttribute("id",`fancybox-${this.id}`),d.setAttribute("aria-label",this.localize("{{MODAL}}")),d.classList.toggle(g0,this.isCompact),dt(d,this.option("mainClass")||""),dt(d,jp),this.container=d,this.footer=d.querySelector(".fancybox__footer"),c.appendChild(d),dt(document.documentElement,p0),kr&&Wo||(kr=document.createElement("span"),dt(kr,"fancybox-focus-guard"),kr.setAttribute(Zo,"0"),kr.setAttribute(Np,"true"),kr.setAttribute("aria-label","Focus guard"),Wo=kr.cloneNode(),(t=d.parentElement)===null||t===void 0||t.insertBefore(kr,d),(o=d.parentElement)===null||o===void 0||o.append(Wo)),d.addEventListener("mousedown",x=>{b0=x.pageX,v0=x.pageY,ni(d,Vp)}),this.option("closeExisting"))for(const x of Ha.values())x.id!==this.id&&x.close();else this.option("animated")&&(dt(d,$p),setTimeout(()=>{this.isClosing()||ni(d,$p)},350));this.emit("initLayout")}}initCarousel(t){const o=this.container;if(!o)return;const c=o.querySelector(".fancybox__carousel");if(!c)return;const d=this.carousel=new jo(c,Un({},{slides:t,transition:"fade",Panzoom:{lockAxis:this.option("dragToClose")?"xy":"x",infinite:!!this.option("dragToClose")&&"y"},Dots:!1,Navigation:{classes:{container:"fancybox__nav",button:"f-button",isNext:"is-next",isPrev:"is-prev"}},initialPage:this.option("startIndex"),l10n:this.option("l10n")},this.option("Carousel")||{}));d.on("*",(x,y,...h)=>{this.emit(`Carousel.${y}`,x,...h)}),d.on(["ready","change"],()=>{this.manageCaption()}),this.on("Carousel.removeSlide",(x,y,h)=>{this.clearContent(h),h.state=void 0}),d.on("Panzoom.touchStart",()=>{var x,y;this.isCompact||this.endIdle(),!((x=document.activeElement)===null||x===void 0)&&x.closest(".f-thumbs")&&((y=this.container)===null||y===void 0||y.focus())}),d.on("settle",()=>{this.idleTimer||this.isCompact||!this.option("idle")||this.setIdle(),this.option("autoFocus")&&!this.isClosing&&this.checkFocus()}),this.option("dragToClose")&&(d.on("Panzoom.afterTransform",(x,y)=>{const h=this.getSlide();if(h&&wp(h.el))return;const M=this.container;if(M){const D=Math.abs(y.current.f),A=D<1?"":Math.max(.5,Math.min(1,1-D/y.contentRect.fitHeight*1.5));M.style.setProperty("--fancybox-ts",A?"0s":""),M.style.setProperty("--fancybox-opacity",A+"")}}),d.on("Panzoom.touchEnd",(x,y,h)=>{var M;const D=this.getSlide();if(D&&wp(D.el)||y.isMobile&&document.activeElement&&["TEXTAREA","INPUT"].indexOf((M=document.activeElement)===null||M===void 0?void 0:M.nodeName)!==-1)return;const A=Math.abs(y.dragOffset.y);y.lockedAxis==="y"&&(A>=200||A>=50&&y.dragOffset.time<300)&&(h&&h.cancelable&&h.preventDefault(),this.close(h,"f-throwOut"+(y.current.f<0?"Up":"Down")))})),d.on("change",x=>{var y;let h=(y=this.getSlide())===null||y===void 0?void 0:y.triggerEl;if(h){const M=new CustomEvent("slideTo",{bubbles:!0,cancelable:!0,detail:x.page});h.dispatchEvent(M)}}),d.on(["refresh","change"],x=>{const y=this.container;if(!y)return;for(const D of y.querySelectorAll("[data-fancybox-current-index]"))D.innerHTML=x.page+1;for(const D of y.querySelectorAll("[data-fancybox-count]"))D.innerHTML=x.pages.length;if(!x.isInfinite){for(const D of y.querySelectorAll("[data-fancybox-next]"))x.page<x.pages.length-1?(D.removeAttribute(ja),D.removeAttribute(Zo)):(D.setAttribute(ja,""),D.setAttribute(Zo,"-1"));for(const D of y.querySelectorAll("[data-fancybox-prev]"))x.page>0?(D.removeAttribute(ja),D.removeAttribute(Zo)):(D.setAttribute(ja,""),D.setAttribute(Zo,"-1"))}const h=this.getSlide();if(!h)return;let M=h.downloadSrc||"";M||h.type!=="image"||h.error||!Ks(h[Ua])||(M=h[Ua]);for(const D of y.querySelectorAll("[data-fancybox-download]")){const A=h.downloadFilename;M?(D.removeAttribute(ja),D.removeAttribute(Zo),D.setAttribute(Up,M),D.setAttribute(_0,A||M),D.setAttribute("target","_blank")):(D.setAttribute(ja,""),D.setAttribute(Zo,"-1"),D.removeAttribute(Up),D.removeAttribute(_0))}}),this.emit("initCarousel")}attachEvents(){const t=this,o=t.container;if(!o)return;o.addEventListener("click",t.onClick,{passive:!1,capture:!1}),o.addEventListener("wheel",t.onWheel,{passive:!1,capture:!1}),document.addEventListener("keydown",t.onKeydown,{passive:!1,capture:!0}),document.addEventListener("visibilitychange",t.onVisibilityChange,!1),document.addEventListener("mousemove",t.onMousemove),t.option("trapFocus")&&document.addEventListener("focus",t.onFocus,!0),window.addEventListener("resize",t.onResize);const c=window.visualViewport;c&&(c.addEventListener("scroll",t.onResize),c.addEventListener("resize",t.onResize))}detachEvents(){const t=this,o=t.container;if(!o)return;document.removeEventListener("keydown",t.onKeydown,{passive:!1,capture:!0}),o.removeEventListener("wheel",t.onWheel,{passive:!1,capture:!1}),o.removeEventListener("click",t.onClick,{passive:!1,capture:!1}),document.removeEventListener("mousemove",t.onMousemove),window.removeEventListener("resize",t.onResize);const c=window.visualViewport;c&&(c.removeEventListener("resize",t.onResize),c.removeEventListener("scroll",t.onResize)),document.removeEventListener("visibilitychange",t.onVisibilityChange,!1),document.removeEventListener("focus",t.onFocus,!0)}scale(){const t=this.container;if(!t)return;const o=window.visualViewport,c=Math.max(1,(o==null?void 0:o.scale)||1);let d="",x="",y="";if(o&&c>1){let h=`${o.offsetLeft}px`,M=`${o.offsetTop}px`;d=o.width*c+"px",x=o.height*c+"px",y=`translate3d(${h}, ${M}, 0) scale(${1/c})`}t.style.transform=y,t.style.width=d,t.style.height=x}onClick(t){var o;const{container:c,isCompact:d}=this;if(!c||this.isClosing())return;!d&&this.option("idle")&&this.resetIdle();const x=t.composedPath()[0];if(x.closest(".fancybox-spinner")||x.closest("[data-fancybox-close]"))return t.preventDefault(),void this.close(t);if(x.closest("[data-fancybox-prev]"))return t.preventDefault(),void this.prev();if(x.closest("[data-fancybox-next]"))return t.preventDefault(),void this.next();if(t.type==="click"&&t.detail===0||Math.abs(t.pageX-b0)>30||Math.abs(t.pageY-v0)>30)return;const y=document.activeElement;if(x0()&&y&&c.contains(y))return;if(d&&((o=this.getSlide())===null||o===void 0?void 0:o.type)==="image")return void(this.clickTimer?(clearTimeout(this.clickTimer),this.clickTimer=null):this.clickTimer=setTimeout(()=>{this.toggleIdle(),this.clickTimer=null},350));if(this.emit("click",t),t.defaultPrevented)return;let h=!1;if(x.closest(".fancybox__content")){if(y){if(y.closest("[contenteditable]"))return;x.matches(Dp)||y.blur()}if(x0())return;h=this.option("contentClick")}else x.closest(".fancybox__carousel")&&!x.matches(Dp)&&(h=this.option("backdropClick"));h==="close"?(t.preventDefault(),this.close(t)):h==="next"?(t.preventDefault(),this.next()):h==="prev"&&(t.preventDefault(),this.prev())}onWheel(t){const o=t.target;let c=this.option("wheel",t);o.closest(".fancybox__thumbs")&&(c="slide");const d=c==="slide",x=[-t.deltaX||0,-t.deltaY||0,-t.detail||0].reduce(function(M,D){return Math.abs(D)>Math.abs(M)?D:M}),y=Math.max(-1,Math.min(1,x)),h=Date.now();this.pwt&&h-this.pwt<300?d&&t.preventDefault():(this.pwt=h,this.emit("wheel",t,y),t.defaultPrevented||(c==="close"?(t.preventDefault(),this.close(t)):c==="slide"&&(Jh(o)||(t.preventDefault(),this[y>0?"prev":"next"]()))))}onScroll(){window.scrollTo(w0,k0)}onKeydown(t){if(!this.isTopmost())return;this.isCompact||!this.option("idle")||this.isClosing()||this.resetIdle();const o=t.key,c=this.option("keyboard");if(!c)return;const d=t.composedPath()[0],x=document.activeElement&&document.activeElement.classList,y=x&&x.contains("f-button")||d.dataset.carouselPage||d.dataset.carouselIndex;if(o!=="Escape"&&!y&&Hn(d)&&(d.isContentEditable||["TEXTAREA","OPTION","INPUT","SELECT","VIDEO"].indexOf(d.nodeName)!==-1)||(t.key==="Tab"?dt(this.container,Vp):ni(this.container,Vp),t.ctrlKey||t.altKey||t.shiftKey))return;this.emit("keydown",o,t);const h=c[o];h&&typeof this[h]=="function"&&(t.preventDefault(),this[h]())}onResize(){const t=this.container;if(!t)return;const o=this.isCompact;t.classList.toggle(g0,o),this.manageCaption(this.getSlide()),this.isCompact?this.clearIdle():this.endIdle(),this.scale(),this.emit("resize")}onFocus(t){this.isTopmost()&&this.checkFocus(t)}onMousemove(t){this.prevMouseMoveEvent=t,!this.isCompact&&this.option("idle")&&this.resetIdle()}onVisibilityChange(){document.visibilityState==="visible"?this.checkFocus():this.endIdle()}manageCloseBtn(t){const o=this.optionFor(t,"closeButton")||!1;if(o==="auto"){const d=this.plugins.Toolbar;if(d&&d.state===qo.Ready)return}if(!o||!t.contentEl||t.closeBtnEl)return;const c=this.option("tpl.closeButton");if(c){const d=Qr(this.localize(c));t.closeBtnEl=t.contentEl.appendChild(d),t.el&&dt(t.el,"has-close-btn")}}manageCaption(t=void 0){var o,c;const d="fancybox__caption",x=this.container;if(!x)return;ni(x,du);const y=this.isCompact||this.option("commonCaption"),h=!y;if(this.caption&&this.stop(this.caption),h&&this.caption&&(this.caption.remove(),this.caption=null),y&&!this.caption)for(const z of((o=this.carousel)===null||o===void 0?void 0:o.slides)||[])z.captionEl&&(z.captionEl.remove(),z.captionEl=void 0,ni(z.el,du),(c=z.el)===null||c===void 0||c.removeAttribute("aria-labelledby"));if(t||(t=this.getSlide()),!t||y&&!this.isCurrentSlide(t))return;const M=t.el;let D=this.optionFor(t,"caption","");if(!D)return void(y&&this.caption&&this.animate(this.caption,"f-fadeOut",()=>{this.caption&&(this.caption.innerHTML="")}));let A=null;if(h){if(A=t.captionEl||null,M&&!A){const z=d+`_${this.id}_${t.index}`;A=document.createElement("div"),dt(A,d),A.setAttribute("id",z),t.captionEl=M.appendChild(A),dt(M,du),M.setAttribute("aria-labelledby",z)}}else A=this.caption,A||(A=x.querySelector("."+d)),!A&&(A=document.createElement("div"),A.dataset.fancyboxCaption="",dt(A,d),(this.footer||x).prepend(A)),dt(x,du),this.caption=A;A&&(A.innerHTML="",Ks(D)||typeof D=="number"?A.innerHTML=D+"":D instanceof HTMLElement&&A.appendChild(D))}checkFocus(t){this.focus(t)}focus(t){var o;if(this.ignoreFocusChange)return;const c=document.activeElement||null,d=(t==null?void 0:t.target)||null,x=this.container,y=(o=this.carousel)===null||o===void 0?void 0:o.viewport;if(!x||!y||!t&&c&&x.contains(c))return;const h=this.getSlide(),M=h&&h.state===gn.Ready?h.el:null;if(!M||M.contains(c)||x===c)return;t&&t.cancelable&&t.preventDefault(),this.ignoreFocusChange=!0;const D=Array.from(x.querySelectorAll(Dp));let A=[],z=null;for(let N of D){const Y=!N.offsetParent||!!N.closest('[aria-hidden="true"]'),ee=M&&M.contains(N),oe=!y.contains(N);if(N===x||(ee||oe)&&!Y){A.push(N);const he=N.dataset.origTabindex;he!==void 0&&he&&(N.tabIndex=parseFloat(he)),N.removeAttribute("data-orig-tabindex"),!N.hasAttribute("autoFocus")&&z||(z=N)}else{const he=N.dataset.origTabindex===void 0?N.getAttribute("tabindex")||"":N.dataset.origTabindex;he&&(N.dataset.origTabindex=he),N.tabIndex=-1}}let L=null;t?(!d||A.indexOf(d)<0)&&(L=z||x,A.length&&(c===Wo?L=A[0]:this.lastFocus!==x&&c!==kr||(L=A[A.length-1]))):L=h&&h.type==="image"?x:z||x,L&&qy(L),this.lastFocus=document.activeElement,this.ignoreFocusChange=!1}next(){const t=this.carousel;t&&t.pages.length>1&&t.slideNext()}prev(){const t=this.carousel;t&&t.pages.length>1&&t.slidePrev()}jumpTo(...t){this.carousel&&this.carousel.slideTo(...t)}isTopmost(){var t;return((t=Xt.getInstance())===null||t===void 0?void 0:t.id)==this.id}animate(t=null,o="",c){if(!t||!o)return void(c&&c());this.stop(t);const d=x=>{x.target===t&&t.dataset.animationName&&(t.removeEventListener("animationend",d),delete t.dataset.animationName,c&&c(),ni(t,o))};t.dataset.animationName=o,t.addEventListener("animationend",d),dt(t,o)}stop(t){t&&t.dispatchEvent(new CustomEvent("animationend",{bubbles:!1,cancelable:!0,currentTarget:t}))}setContent(t,o="",c=!0){if(this.isClosing())return;const d=t.el;if(!d)return;let x=null;if(Hn(o)?x=o:(x=Qr(o+""),Hn(x)||(x=document.createElement("div"),x.innerHTML=o+"")),["img","picture","iframe","video","audio"].includes(x.nodeName.toLowerCase())){const y=document.createElement("div");y.appendChild(x),x=y}Hn(x)&&t.filter&&!t.error&&(x=x.querySelector(t.filter)),x&&Hn(x)?(dt(x,"fancybox__content"),t.id&&x.setAttribute("id",t.id),d.classList.add(`has-${t.error?"error":t.type||"unknown"}`),d.prepend(x),x.style.display==="none"&&(x.style.display=""),getComputedStyle(x).getPropertyValue("display")==="none"&&(x.style.display=t.display||this.option("defaultDisplay")||"flex"),t.contentEl=x,c&&this.revealContent(t),this.manageCloseBtn(t),this.manageCaption(t)):this.setError(t,"{{ELEMENT_NOT_FOUND}}")}revealContent(t,o){const c=t.el,d=t.contentEl;c&&d&&(this.emit("reveal",t),this.hideLoading(t),t.state=gn.Opening,(o=this.isOpeningSlide(t)?o===void 0?this.optionFor(t,"showClass"):o:"f-fadeIn")?this.animate(d,o,()=>{this.done(t)}):this.done(t))}done(t){this.isClosing()||(t.state=gn.Ready,this.emit("done",t),dt(t.el,"is-done"),this.isCurrentSlide(t)&&this.option("autoFocus")&&queueMicrotask(()=>{var o;(o=t.panzoom)===null||o===void 0||o.updateControls(),this.option("autoFocus")&&this.focus()}),this.isOpeningSlide(t)&&(ni(this.container,jp),!this.isCompact&&this.option("idle")&&this.setIdle()))}isCurrentSlide(t){const o=this.getSlide();return!(!t||!o)&&o.index===t.index}isOpeningSlide(t){var o,c;return((o=this.carousel)===null||o===void 0?void 0:o.prevPage)===null&&t&&t.index===((c=this.getSlide())===null||c===void 0?void 0:c.index)}showLoading(t){t.state=gn.Loading;const o=t.el;o&&(dt(o,y0),this.emit("loading",t),t.spinnerEl||setTimeout(()=>{if(!this.isClosing()&&!t.spinnerEl&&t.state===gn.Loading){let c=Qr(Cp);dt(c,"fancybox-spinner"),t.spinnerEl=c,o.prepend(c),this.animate(c,"f-fadeIn")}},250))}hideLoading(t){const o=t.el;if(!o)return;const c=t.spinnerEl;this.isClosing()?c==null||c.remove():(ni(o,y0),c&&this.animate(c,"f-fadeOut",()=>{c.remove()}),t.state===gn.Loading&&(this.emit("loaded",t),t.state=gn.Ready))}setError(t,o){if(this.isClosing())return;const c=new Event("error",{bubbles:!0,cancelable:!0});if(this.emit("error",c,t),c.defaultPrevented)return;t.error=o,this.hideLoading(t),this.clearContent(t);const d=document.createElement("div");d.classList.add("fancybox-error"),d.innerHTML=this.localize(o||"<p>{{ERROR}}</p>"),this.setContent(t,d)}clearContent(t){if(t.state===void 0)return;this.emit("clearContent",t),t.contentEl&&(t.contentEl.remove(),t.contentEl=void 0);const o=t.el;o&&(ni(o,"has-error"),ni(o,"has-unknown"),ni(o,`has-${t.type||"unknown"}`)),t.closeBtnEl&&t.closeBtnEl.remove(),t.closeBtnEl=void 0,t.captionEl&&t.captionEl.remove(),t.captionEl=void 0,t.spinnerEl&&t.spinnerEl.remove(),t.spinnerEl=void 0}getSlide(){var t;const o=this.carousel;return((t=o==null?void 0:o.pages[o==null?void 0:o.page])===null||t===void 0?void 0:t.slides[0])||void 0}close(t,o){if(this.isClosing())return;const c=new Event("shouldClose",{bubbles:!0,cancelable:!0});if(this.emit("shouldClose",c,t),c.defaultPrevented)return;t&&t.cancelable&&(t.preventDefault(),t.stopPropagation());const d=()=>{this.proceedClose(t,o)};this.startedFs&&wr&&wr.isFullscreen()?Promise.resolve(wr.exit()).then(()=>d()):d()}clearIdle(){this.idleTimer&&clearTimeout(this.idleTimer),this.idleTimer=null}setIdle(t=!1){const o=()=>{this.clearIdle(),this.idle=!0,dt(this.container,"is-idle"),this.emit("setIdle")};if(this.clearIdle(),!this.isClosing())if(t)o();else{const c=this.option("idle");c&&(this.idleTimer=setTimeout(o,c))}}endIdle(){this.clearIdle(),this.idle&&!this.isClosing()&&(this.idle=!1,ni(this.container,"is-idle"),this.emit("endIdle"))}resetIdle(){this.endIdle(),this.setIdle()}toggleIdle(){this.idle?this.endIdle():this.setIdle(!0)}toggleFullscreen(){wr&&(wr.isFullscreen()?wr.exit():wr.request().then(()=>{this.startedFs=!0}))}isClosing(){return[Xi.Closing,Xi.CustomClosing,Xi.Destroy].includes(this.state)}proceedClose(t,o){var c,d;this.state=Xi.Closing,this.clearIdle(),this.detachEvents();const x=this.container,y=this.carousel,h=this.getSlide(),M=h&&this.option("placeFocusBack")?h.triggerEl||this.option("triggerEl"):null;if(M&&(Hy(M)?qy(M):M.focus()),x&&(ni(x,jp),dt(x,"is-closing"),x.setAttribute(Np,"true"),this.option("animated")&&dt(x,$p),x.style.pointerEvents="none"),y){y.clearTransitions(),(c=y.panzoom)===null||c===void 0||c.destroy(),(d=y.plugins.Navigation)===null||d===void 0||d.detach();for(const D of y.slides){D.state=gn.Closing,this.hideLoading(D);const A=D.contentEl;A&&this.stop(A);const z=D==null?void 0:D.panzoom;z&&(z.stop(),z.detachEvents(),z.detachObserver()),this.isCurrentSlide(D)||y.emit("removeSlide",D)}}w0=window.scrollX,k0=window.scrollY,window.addEventListener("scroll",this.onScroll),this.emit("close",t),this.state!==Xi.CustomClosing?(o===void 0&&h&&(o=this.optionFor(h,"hideClass")),o&&h?(this.animate(h.contentEl,o,()=>{y&&y.emit("removeSlide",h)}),setTimeout(()=>{this.destroy()},500)):this.destroy()):setTimeout(()=>{this.destroy()},500)}destroy(){var t;if(this.state===Xi.Destroy)return;window.removeEventListener("scroll",this.onScroll),this.state=Xi.Destroy,(t=this.carousel)===null||t===void 0||t.destroy();const o=this.container;o&&o.remove(),Ha.delete(this.id);const c=Xt.getInstance();c?c.focus():(kr&&(kr.remove(),kr=null),Wo&&(Wo.remove(),Wo=null),ni(document.documentElement,p0),(()=>{if(!sc)return;const d=document,x=d.body;x.classList.remove(Fp),x.style.setProperty(m0,""),d.documentElement.style.setProperty(f0,"")})(),this.emit("destroy"))}static bind(t,o,c){if(!sc)return;let d,x="",y={};if(t===void 0?d=document.body:Ks(t)?(d=document.body,x=t,typeof o=="object"&&(y=o||{})):(d=t,Ks(o)&&(x=o),typeof c=="object"&&(y=c||{})),!d||!Hn(d))return;x=x||"[data-fancybox]";const h=Xt.openers.get(d)||new Map;h.set(x,y),Xt.openers.set(d,h),h.size===1&&d.addEventListener("click",Xt.fromEvent)}static unbind(t,o){let c,d="";if(Ks(t)?(c=document.body,d=t):(c=t,Ks(o)&&(d=o)),!c)return;const x=Xt.openers.get(c);x&&d&&x.delete(d),d&&x||(Xt.openers.delete(c),c.removeEventListener("click",Xt.fromEvent))}static destroy(){let t;for(;t=Xt.getInstance();)t.destroy();for(const o of Xt.openers.keys())o.removeEventListener("click",Xt.fromEvent);Xt.openers=new Map}static fromEvent(t){if(t.defaultPrevented||t.button&&t.button!==0||t.ctrlKey||t.metaKey||t.shiftKey)return;let o=t.composedPath()[0];const c=o.closest("[data-fancybox-trigger]");if(c){const Y=c.dataset.fancyboxTrigger||"",ee=document.querySelectorAll(`[data-fancybox="${Y}"]`),oe=parseInt(c.dataset.fancyboxIndex||"",10)||0;o=ee[oe]||o}if(!(o&&o instanceof Element))return;let d,x,y,h;if([...Xt.openers].reverse().find(([Y,ee])=>!(!Y.contains(o)||![...ee].reverse().find(([oe,he])=>{let _e=o.closest(oe);return!!_e&&(d=Y,x=oe,y=_e,h=he,!0)}))),!d||!x||!y)return;h=h||{},t.preventDefault(),o=y;let M=[],D=Un({},zp,h);D.event=t,D.triggerEl=o,D.delegate=c;const A=D.groupAll,z=D.groupAttr,L=z&&o?o.getAttribute(`${z}`):"";if((!o||L||A)&&(M=[].slice.call(d.querySelectorAll(x))),o&&!A&&(M=L?M.filter(Y=>Y.getAttribute(`${z}`)===L):[o]),!M.length)return;const N=Xt.getInstance();return N&&N.options.triggerEl&&M.indexOf(N.options.triggerEl)>-1?void 0:(o&&(D.startIndex=M.indexOf(o)),Xt.fromNodes(M,D))}static fromSelector(t,o,c){let d=null,x="",y={};if(Ks(t)?(d=document.body,x=t,typeof o=="object"&&(y=o||{})):t instanceof HTMLElement&&Ks(o)&&(d=t,x=o,typeof c=="object"&&(y=c||{})),!d||!x)return!1;const h=Xt.openers.get(d);return!!h&&(y=Un({},h.get(x)||{},y),!!y&&Xt.fromNodes(Array.from(d.querySelectorAll(x)),y))}static fromNodes(t,o){o=Un({},zp,o||{});const c=[];for(const d of t){const x=d.dataset||{},y=x[Ua]||d.getAttribute(Up)||d.getAttribute("currentSrc")||d.getAttribute(Ua)||void 0;let h;const M=o.delegate;let D;M&&c.length===o.startIndex&&(h=M instanceof HTMLImageElement?M:M.querySelector("img:not([aria-hidden])")),h||(h=d instanceof HTMLImageElement?d:d.querySelector("img:not([aria-hidden])")),h&&(D=h.currentSrc||h[Ua]||void 0,!D&&h.dataset&&(D=h.dataset.lazySrc||h.dataset[Ua]||void 0));const A={src:y,triggerEl:d,thumbEl:h,thumbElSrc:D,thumbSrc:D};for(const z in x){let L=x[z]+"";L=L!=="false"&&(L==="true"||L),A[z]=L}c.push(A)}return new Xt(c,o)}static getInstance(t){return t?Ha.get(t):Array.from(Ha.values()).reverse().find(o=>!o.isClosing()&&o)||null}static getSlide(){var t;return((t=Xt.getInstance())===null||t===void 0?void 0:t.getSlide())||null}static show(t=[],o={}){return new Xt(t,o)}static next(){const t=Xt.getInstance();t&&t.next()}static prev(){const t=Xt.getInstance();t&&t.prev()}static close(t=!0,...o){if(t)for(const c of Ha.values())c.close(...o);else{const c=Xt.getInstance();c&&c.close(...o)}}}Object.defineProperty(Xt,"version",{enumerable:!0,configurable:!0,writable:!0,value:"5.0.36"}),Object.defineProperty(Xt,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:zp}),Object.defineProperty(Xt,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:ZE}),Object.defineProperty(Xt,"openers",{enumerable:!0,configurable:!0,writable:!0,value:new Map});const GE={props:{options:Object},mounted(){(void 0)(this.$refs.container,"[data-fancybox]",{...this.options||{}})},updated(){(void 0)(this.$refs.container),(void 0)(),(void 0)(this.$refs.container,"[data-fancybox]",{...this.options||{}})},unmounted(){(void 0)()}},YE={ref:"container"};function XE(n,t,o,c,d,x){return v.openBlock(),v.createElementBlock("div",YE,[v.renderSlot(n.$slots,"default")],512)}const KE=vt(GE,[["render",XE]]),JE={props:["text"]},QE={class:"pl-3 text-sm font-medium text-gray-600"};function eT(n,t,o,c,d,x){return v.openBlock(),v.createElementBlock("div",null,[v.createElementVNode("p",QE,v.toDisplayString(o.text),1)])}const tT={components:{Fancybox:KE,VsEmptyWidget:vt(JE,[["render",eT]])},props:{id:{type:String,default:""},readonly:{type:Boolean,default:!1},prefilledData:{type:Array,default:()=>null}},data(){return{carouselOptions:{Carousel:{infinite:!1}},isModalVisible:!1,modal:{},images:[],editAction:!1,selectedFile:null,imageExtensions:["png","jpg","jpeg","gif"]}},watch:{id(){this.getFiles()}},mounted(){this.getFiles()},methods:{async downloadFile(n){const t=document.createElement("a");t.setAttribute("download",n.uploaded_name),t.href=n.file_path,t.click()},handleOpenModal(n){this.selectedFile=n,this.modal=this.prepareModal({title:"Ви впевнені?",message:"Ви впевнені, що хочете видалити це зображення?",confirmButtonText:"Так, я впевнена/ий",cancelButtonText:"Скасувати",confirm:this.deleteFile,updateListOnConfirm:!0}),this.isModalVisible=!0},prepareModal(n){const t={...n};return n.cancel||(t.cancel=()=>{this.isModalVisible=!1}),n.updateListOnConfirm&&(t.confirm=async()=>{await n.confirm(),this.isModalVisible=!1,this.getFiles()}),t},async deleteFile(){try{await mt.delete(`/api/widget/gallery/${this.selectedFile.entity_id}/${this.selectedFile.file_id}`),this.isModalVisible=!1,this.selectedFile="",this.$emit("update","images"),this.getFiles()}catch(n){console.log(n)}},async addFile(n){console.log(n),await Promise.all(Array.from(n.target.files).map(async t=>{const o=new FormData;o.append("file",t);try{const c=`/api/widget/file/${this.id}`;return await mt.post(c,o),this.$emit("update","file-list"),t}catch(c){return console.error(c),null}})),await this.getFiles()},async getFiles(){if(this.prefilledData){this.images=this.prefilledData;return}try{const{data:n}=await mt.get(`/api/widget/gallery/${this.id}`);this.images=n.rows}catch(n){console.error(n)}},size(n,t=2){if(n===0)return"0 Bytes";const o=1024,c=t<0?0:t,d=["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"],x=Math.floor(Math.log(n)/Math.log(o));return`${parseFloat((n/o**x).toFixed(c))} ${d[x]}`},dateFormat(n){const t={day:"numeric",month:"long",year:"numeric",hour:"numeric",minute:"numeric"};return new Date(n).toLocaleDateString("uk-UK",t)}}},iT={class:"vs-widget-images flex flex-col xl:bg-white xl:rounded-xl dark:xl:bg-neutral-800 dark:xl:border-neutral-700"},nT={class:"flex justify-between items-center gap-x-2 mb-4"},rT={class:"flex justify-end items-center gap-x-2"},sT=["href"],oT=["src","alt"],aT={class:"item__text-content bg-white opacity-0 rounded-b-lg absolute w-full bottom-0 p-3 flex gap-2.5 items-center justify-between"},lT={class:"text-xs"},cT={class:"widget-images__item-desc flex items-center text-xs text-gray-600 flex-wrap"},hT={class:"flex items-center"},uT={class:"text-xs"},dT=["onClick"],pT=["onClick"],fT={class:"p-4"},mT={class:"mt-1 text-gray-500 dark:text-neutral-500"},gT={class:"mt-4 flex justify-end gap-x-3"};function yT(n,t,o,c,d,x){var D;const y=v.resolveComponent("Fancybox"),h=v.resolveComponent("VsEmptyWidget"),M=v.resolveComponent("VsDialog");return v.openBlock(),v.createElementBlock("div",iT,[v.createElementVNode("div",nT,[t[5]||(t[5]=v.createElementVNode("h2",{class:"inline-block font-semibold text-gray-800 dark:text-neutral-200"}," Зображення ",-1)),v.createElementVNode("div",rT,[v.createElementVNode("div",null,[v.createElementVNode("label",null,[v.createElementVNode("input",{type:"file",class:"hidden",onChange:t[0]||(t[0]=A=>x.addFile(A))},null,32),t[4]||(t[4]=v.createElementVNode("div",{class:"py-2 px-2.5 inline-flex relative items-center gap-x-1.5 text-xs rounded-lg border border-blue-200 bg-blue-500 text-white shadow-sm hover:bg-blue-700 cursor-pointer"},[v.createElementVNode("i",{class:"ti ti-upload"}),v.createTextVNode(" Завантажити файл ")],-1))])])])]),(D=d.images)!=null&&D.length?(v.openBlock(),v.createBlock(y,{key:0,options:d.carouselOptions,class:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4"},{default:v.withCtx(()=>[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList(d.images,A=>(v.openBlock(),v.createElementBlock("div",{key:A.file_path,class:"relative cursor-pointer rounded-b-lg item hover:shadow-lg h-[200px]"},[v.createElementVNode("a",{"data-fancybox":"gallery",href:A.file_path},[v.createElementVNode("img",{class:"h-full w-full rounded-lg",src:A.file_path||"/icons/no-image.jpg",alt:A.uploaded_name,width:"100%",height:"100%"},null,8,oT),v.createElementVNode("div",aT,[v.createElementVNode("div",null,[v.createElementVNode("span",lT,v.toDisplayString(A.uploaded_name),1),v.createElementVNode("div",cT,[v.createElementVNode("span",hT,v.toDisplayString(x.size(A.size)),1),v.createElementVNode("span",null,v.toDisplayString(x.dateFormat(A.cdate)),1)]),v.createElementVNode("span",uT,v.toDisplayString(A.username),1)]),v.createElementVNode("div",null,[v.createElementVNode("div",{class:v.normalizeClass(["flex items-center justify-center gap-2 hover:bg-gray-200 p-1 rounded",{disabled:o.readonly,"hover:cursor-pointer":!o.readonly}]),onClick:v.withModifiers(z=>x.downloadFile(A),["prevent"])},t[6]||(t[6]=[v.createElementVNode("i",{class:"ti ti-edit"},null,-1)]),10,dT),v.createElementVNode("div",{class:"flex items-center gap-2 hover:bg-gray-200 p-1 rounded hover:cursor-pointer",onClick:v.withModifiers(z=>x.handleOpenModal(A),["prevent"])},t[7]||(t[7]=[v.createElementVNode("i",{class:"ti ti-trash"},null,-1)]),8,pT)])])],8,sT)]))),128))]),_:1},8,["options"])):(v.openBlock(),v.createBlock(h,{key:1,text:"Зображення відсутні"})),v.createVNode(M,{title:d.modal.title,size:"small",visible:d.isModalVisible,"onUpdate:visible":t[3]||(t[3]=A=>d.isModalVisible=A)},{default:v.withCtx(()=>[v.createElementVNode("div",fT,[v.createElementVNode("p",mT,v.toDisplayString(d.modal.message),1),v.createElementVNode("div",gT,[v.createElementVNode("button",{type:"button",class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:t[1]||(t[1]=(...A)=>d.modal.cancel&&d.modal.cancel(...A))},v.toDisplayString(d.modal.cancelButtonText),1),v.createElementVNode("button",{type:"button",class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-semibold rounded-lg border border-transparent bg-red-500 text-white hover:bg-red-600 disabled:opacity-50 disabled:pointer-events-none",onClick:t[2]||(t[2]=(...A)=>d.modal.confirm&&d.modal.confirm(...A))},v.toDisplayString(d.modal.confirmButtonText),1)])])]),_:1},8,["title","visible"])])}const _T=vt(tT,[["render",yT]]),xT=n=>{const t=/(\b\S)?/g,o=n.match(t);return o?o.join("").toUpperCase():""},bT={props:{name:{type:String,default(){return""}},avatar:{type:String,default(){return""}}},computed:{inItials(){return xT(this.name)}}},vT={class:"mr-2"},wT=["src"],kT={key:1,class:"flex flex-shrink-0 items-center justify-center w-6 h-6 bg-gray-500 text-xs text-white rounded-full"},ST={key:0},ET={key:1,class:"text-sm"};function TT(n,t,o,c,d,x){return v.openBlock(),v.createElementBlock("div",vT,[o.avatar?(v.openBlock(),v.createElementBlock("img",{key:0,src:o.avatar,alt:"avatar",class:"flex flex-shrink-0 items-center justify-center w-6 h-6 rounded-full"},null,8,wT)):o.name?(v.openBlock(),v.createElementBlock("div",kT,[x.inItials.length?(v.openBlock(),v.createElementBlock("span",ST,v.toDisplayString(x.inItials),1)):(v.openBlock(),v.createElementBlock("span",ET,t[0]||(t[0]=[v.createElementVNode("i",{class:"ti ti-user"},null,-1)])))])):v.createCommentVNode("",!0)])}const CT={components:{VsWidgetCommentsAvatar:vt(bT,[["render",TT]])},props:{comment:{type:Object,default:()=>({})},user:{type:Object,default:()=>({})},id:{type:String,default:""}},data(){return{commentContent:this.comment.body,isCommentActionVisible:!1,isOpen:!1,textareaValue:""}},computed:{isUserAutor(){return this.user.uid===this.comment.uid},createDate(){try{const n=Je(this.comment.cdate,"YYYY-MM-DD");return new Date(n).toLocaleDateString("uk-UA",{day:"2-digit",month:"long",year:"numeric"})}catch{return""}}},watch:{isOpen(n){n&&(this.textareaValue=this.comment.body)}},methods:{confirnDeleteComment(){document.body.click(),this.$emit("openModal",{title:"Ви впевнені?",message:"Ви впевнені, що хочете видалити цей коментар?",confirmButtonText:"Так, я впевнена/ий",cancelButtonText:"Скасувати",confirm:this.deleteComment,updateListOnConfirm:!0})},async updateComment(){try{await mt.put(`/api/widget/comment/${this.id}/${this.comment.communication_id}`,{body:this.textareaValue}),this.$emit("list-update"),this.isCommentActionVisible=!1}catch{this.$notify({title:"Помилка!",message:"Сталася помилка",type:"error"})}},async deleteComment(){try{await mt.delete(`/api/widget/comment/${this.id}/${this.comment.communication_id}`),this.$emit("list-update"),this.isCommentActionVisible=!1}catch{this.$notify({title:"Помилка!",message:"Сталася помилка",type:"error"})}},toggleCommentAction(){this.isCommentActionVisible=!this.isCommentActionVisible}}},MT={class:"p-6 text-base bg-white dark:bg-gray-900"},PT={class:"flex justify-between items-center mb-2"},IT={class:"flex items-center"},AT={class:"inline-flex items-center mr-3 text-sm text-gray-900 dark:text-white font-semibold capitalize"},DT={class:"text-sm text-gray-600 dark:text-gray-400"},zT={class:"text-gray-500 dark:text-gray-400"},LT={class:"flex items-center gap-[4px]"},RT={class:"flex flex-col gap-[8px] text-sm font-medium text-gray-500"},OT={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"};function BT(n,t,o,c,d,x){const y=v.resolveComponent("VsWidgetCommentsAvatar"),h=v.resolveComponent("VsDialog");return v.openBlock(),v.createElementBlock(v.Fragment,null,[v.createElementVNode("div",MT,[v.createElementVNode("div",PT,[v.createElementVNode("div",IT,[v.createElementVNode("p",AT,[v.createVNode(y,{name:o.comment.username,avatar:o.comment.avatar},null,8,["name","avatar"]),v.createTextVNode(v.toDisplayString(o.comment.username),1)]),v.createElementVNode("div",DT,v.toDisplayString(x.createDate),1)])]),v.createElementVNode("p",zT,v.toDisplayString(o.comment.body),1),v.createElementVNode("div",LT,[v.createElementVNode("button",{type:"button",class:"block py-2 dark:hover:bg-gray-600 hover:underline dark:hover:text-white text-start duration-300",onClick:t[0]||(t[0]=M=>d.isOpen=!0)}," Редагувати "),v.createElementVNode("button",{type:"button",class:"block py-2 dark:hover:bg-gray-600 hover:underline dark:hover:text-white text-start duration-300",onClick:t[1]||(t[1]=M=>x.confirnDeleteComment())}," Видалити ")])]),v.createVNode(h,{visible:d.isOpen,"onUpdate:visible":t[5]||(t[5]=M=>d.isOpen=M),title:"Редагувати"},{footer:v.withCtx(()=>[v.createElementVNode("div",OT,[v.createElementVNode("button",{onClick:t[3]||(t[3]=M=>d.isOpen=!1),class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-black border rounded-lg !border-gray-200 hover:bg-gray-100 duration-300"}," Відмінити "),v.createElementVNode("button",{onClick:t[4]||(t[4]=(...M)=>x.updateComment&&x.updateComment(...M)),class:"py-2 px-3 inline-flex items-center gap-x-2 text-[14px] font-[400] whitespace-nowrap text-white bg-blue-500 rounded-lg !border-gray-200 hover:bg-blue-700 duration-300"}," Зберегти ")])]),default:v.withCtx(()=>[v.createElementVNode("label",RT,[t[6]||(t[6]=v.createTextVNode(" Коментар ")),v.withDirectives(v.createElementVNode("textarea",{"onUpdate:modelValue":t[2]||(t[2]=M=>d.textareaValue=M),placeholder:"Напишіть коментар...",class:"w-full h-[200px] border rounded-lg outline-none resize-none p-[20px] focus:border-[2px] focus:border-blue-600 [&::-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"},null,512),[[v.vModelText,d.textareaValue]])])]),_:1},8,["visible"])],64)}const FT={components:{VsWidgetCommentsItem:vt(CT,[["render",BT]])},inject:["activeAddFormEditor"],props:{id:{type:String,default:()=>""},prefilledData:{type:Object,default:null}},data(){return{isLoaded:!1,isLoadFailed:!1,comments:[],user:{},modal:{title:"",message:"",cancel:"",confirm:"",cancelButtonText:"",confirmButtonText:""},isModalVisible:!1}},async created(){await this.getComments()},methods:{async getComments(){if(this.prefilledData){this.comments=this.prefilledData.rows,this.isLoaded=!0;return}try{const{data:n}=await mt.get(`/api/widget/comment/${this.id}`);this.comments=n.rows,this.user=n.user}catch(n){this.isLoadFailed=!0,console.error(n)}this.isLoaded=!0,this.$emit("update-comment-count")},prepareModal(n){const t={...n};return n.cancel||(t.cancel=()=>{this.isModalVisible=!1}),n.updateListOnConfirm&&(t.confirm=async()=>{await n.confirm(),this.isModalVisible=!1}),t},handleOpenModal(n){this.modal=this.prepareModal(n),this.isModalVisible=!0}}},NT={class:"flex flex-col divide-y"},VT={key:0,class:"max-h-[300px] 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"},$T={key:1},jT={class:"p-4"},UT={class:"mt-1 text-gray-500 dark:text-neutral-500"},HT={class:"mt-4 flex justify-end gap-x-3"};function qT(n,t,o,c,d,x){const y=v.resolveComponent("VsErrorOnLoading"),h=v.resolveComponent("VsWidgetCommentsItem"),M=v.resolveComponent("VsLoader"),D=v.resolveComponent("VsDialog");return v.openBlock(),v.createElementBlock("div",NT,[d.isLoaded?(v.openBlock(),v.createElementBlock(v.Fragment,{key:0},[d.isLoadFailed?(v.openBlock(),v.createBlock(y,{key:0})):(v.openBlock(),v.createElementBlock(v.Fragment,{key:1},[d.comments.length?(v.openBlock(),v.createElementBlock("div",VT,[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList(d.comments,(A,z)=>(v.openBlock(),v.createBlock(h,{key:z,comment:A,user:d.user,index:z,id:o.id,onListUpdate:x.getComments,class:"border-top",onOpenModal:t[0]||(t[0]=L=>x.handleOpenModal(L))},null,8,["comment","user","index","id","onListUpdate"]))),128))])):(v.openBlock(),v.createElementBlock("div",$T,t[4]||(t[4]=[v.createElementVNode("p",{class:"pl-3 text-sm font-medium text-gray-600"},"Коментарі відсутні",-1)])))],64))],64)):(v.openBlock(),v.createBlock(M,{key:1,class:"justify-center",text:"Please wait..."})),v.createVNode(D,{title:d.modal.title,size:"small",visible:d.isModalVisible,"onUpdate:visible":t[3]||(t[3]=A=>d.isModalVisible=A)},{default:v.withCtx(()=>[v.createElementVNode("div",jT,[v.createElementVNode("p",UT,v.toDisplayString(d.modal.message),1),v.createElementVNode("div",HT,[v.createElementVNode("button",{type:"button",class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:t[1]||(t[1]=(...A)=>d.modal.cancel&&d.modal.cancel(...A))},v.toDisplayString(d.modal.cancelButtonText),1),v.createElementVNode("button",{type:"button",class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-semibold rounded-lg border border-transparent bg-red-500 text-white hover:bg-red-600 disabled:opacity-50 disabled:pointer-events-none",onClick:t[2]||(t[2]=(...A)=>d.modal.confirm&&d.modal.confirm(...A))},v.toDisplayString(d.modal.confirmButtonText),1)])])]),_:1},8,["title","visible"])])}const ZT=vt(FT,[["render",qT]]),WT={props:{id:{type:String,default:()=>""},autofocus:{type:Boolean,default:()=>!0}},data(){return{isEditorOpen:!1,commentContent:""}},methods:{async addNewComment(){if(this.commentContent)try{await mt.post(`/api/widget/comment/${this.id}`,{body:this.commentContent}),this.commentContent="",this.$emit("list-update")}catch(n){console.error(n)}},setNewContent(n){this.commentContent=n}}},GT={class:"w-full widget-comment-form"},YT={class:"mb-4 bg-white border-gray-200 dark:bg-gray-800 dark:border-gray-700"};function XT(n,t,o,c,d,x){return v.openBlock(),v.createElementBlock("div",GT,[v.createElementVNode("div",YT,[v.withDirectives(v.createElementVNode("textarea",{"onUpdate:modelValue":t[0]||(t[0]=y=>d.commentContent=y),rows:"6",class:"w-full h-[200px] border rounded-lg outline-none resize-none p-[20px] focus:border-[2px] focus:border-blue-600 [&::-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",placeholder:"Напишіть коментар..."},null,512),[[v.vModelText,d.commentContent]])]),v.createElementVNode("button",{ref:"buttonAdd",class:"py-2 px-3 inline-flex items-center gap-x-2 text-[14px] font-[400] whitespace-nowrap text-white bg-blue-500 rounded-lg !border-gray-200 hover:bg-blue-700 duration-300",onClick:t[1]||(t[1]=(...y)=>x.addNewComment&&x.addNewComment(...y))}," Відправити коментар ",512)])}const KT={components:{VsWidgetCommentsList:ZT,VsWidgetCommentsAddForm:vt(WT,[["render",XT]])},props:{id:{type:String,default(){return""}},prefilledData:{type:Object,default:null}},data(){return{activeAddFormEditor:"",comments:[],totalComment:"0"}},mounted(){this.comments=this.$refs.commentListRef.comments},watch:{comments(n){this.$emit("count-change",n.length)}},methods:{listUpdate(){this.$refs.commentListRef.getComments()},updateCommentCount(){this.totalComment=this.$refs.commentListRef.comments.length||"0"}}},JT={class:"bg-white-200"},QT={class:"flex justify-between items-center gap-x-2 mb-4"},eC={class:"inline-block font-semibold text-gray-800 dark:text-neutral-200"},tC={key:0,class:"inline-block font-semibold text-gray-800 dark:text-neutral-200"};function iC(n,t,o,c,d,x){const y=v.resolveComponent("VsWidgetCommentsAddForm"),h=v.resolveComponent("VsWidgetCommentsList");return v.openBlock(),v.createElementBlock("div",JT,[v.createElementVNode("div",QT,[v.createElementVNode("h2",eC,[t[2]||(t[2]=v.createTextVNode("Коментарі ")),d.comments?(v.openBlock(),v.createElementBlock("span",tC,"("+v.toDisplayString(d.totalComment)+")",1)):v.createCommentVNode("",!0)])]),v.createVNode(y,{class:"mb-6",id:o.id,onListUpdate:t[0]||(t[0]=M=>x.listUpdate())},null,8,["id"]),v.createVNode(h,{id:o.id,onUpdateCommentCount:t[1]||(t[1]=M=>x.updateCommentCount()),"prefilled-data":o.prefilledData,ref:"commentListRef"},null,8,["id","prefilled-data"])])}const nC={"vs-widget-map":zE,"vs-widget-gallery":_T,"vs-widget-comments":vt(KT,[["render",iC]])},rC={},sC={style:{width:"calc(100vw - 300px)",height:"calc(100vh - 60px)"},class:"bg-gray-50 flex items-center justify-center"},oC={...nC,...rC,"vs-dashboard":{__name:"vs-dashboard",setup(n){return(t,o)=>(v.openBlock(),v.createElementBlock("div",sC,o[0]||(o[0]=[v.createElementVNode("div",{class:"p-5 md:p-8 bg-white border border-gray-200 shadow-sm rounded-xl dark:bg-neutral-800 dark:border-neutral-700"},[v.createElementVNode("div",{class:"mb-4 xl:mb-8"},[v.createElementVNode("h1",{class:"text-lg font-semibold text-gray-800 dark:text-neutral-200"}," Members "),v.createElementVNode("p",{class:"text-sm text-gray-500 dark:text-neutral-500"}," Manage members and users of your workspace and set their access level. ")]),v.createElementVNode("div",{class:"space-y-5"},[v.createElementVNode("div",{class:"flex sm:grid sm:grid-cols-2 gap-x-2 sm:gap-x-5"},[v.createElementVNode("div",{class:"relative w-full"},[v.createElementVNode("div",{class:"absolute inset-y-0 start-0 flex items-center pointer-events-none z-20 ps-3.5"},[v.createElementVNode("svg",{class:"shrink-0 size-4 text-gray-500 dark:text-neutral-400",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"},[v.createElementVNode("circle",{cx:"11",cy:"11",r:"8"}),v.createElementVNode("path",{d:"m21 21-4.3-4.3"})])]),v.createElementVNode("input",{type:"text",class:"py-2 ps-10 pe-8 block w-full bg-gray-100 border-transparent rounded-lg text-sm focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:border-transparent dark:text-neutral-400 dark:placeholder:text-neutral-400 dark:focus:ring-neutral-600",placeholder:"Search by name or email"}),v.createElementVNode("div",{class:"hidden absolute inset-y-0 end-0 flex items-center pointer-events-none z-20 pe-1"},[v.createElementVNode("button",{type:"button",class:"inline-flex shrink-0 justify-center items-center size-6 rounded-full text-gray-500 hover:text-blue-600 focus:outline-none focus:text-blue-600 dark:text-neutral-500 dark:hover:text-blue-500 dark:focus:text-blue-500","aria-label":"Close"},[v.createElementVNode("span",{class:"sr-only"},"Close"),v.createElementVNode("svg",{class:"shrink-0 size-4",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[v.createElementVNode("circle",{cx:"12",cy:"12",r:"10"}),v.createElementVNode("path",{d:"m15 9-6 6"}),v.createElementVNode("path",{d:"m9 9 6 6"})])])])]),v.createElementVNode("div",{class:"flex justify-end items-center gap-x-2"},[v.createElementVNode("button",{type:"button",class:"p-2.5 sm:py-2 sm:px-3 inline-flex items-center text-sm font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},[v.createElementVNode("svg",{class:"shrink-0 sm:me-2 size-4",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[v.createElementVNode("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),v.createElementVNode("polyline",{points:"7 10 12 15 17 10"}),v.createElementVNode("line",{x1:"12",x2:"12",y1:"15",y2:"3"})]),v.createElementVNode("span",{class:"hidden sm:block"}," Download CSV ")]),v.createElementVNode("button",{type:"button",class:"py-2 px-3 inline-flex items-center gap-x-1 text-sm font-medium rounded-lg border border-transparent bg-blue-600 text-white hover:bg-blue-700 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:ring-2 focus:ring-blue-500","data-hs-overlay":"#hs-pro-dshm"},[v.createElementVNode("span",{class:"hidden sm:block"},"Send"),v.createTextVNode("Invite ")])])]),v.createElementVNode("div",{class:"grid sm:grid-cols-2 lg:grid-cols-4 gap-2 xl:gap-4"},[v.createElementVNode("div",{class:"p-4 flex flex-col bg-white border border-gray-200 rounded-xl dark:bg-neutral-800 dark:border-neutral-700"},[v.createElementVNode("div",{class:"flex justify-between items-center mb-1"},[v.createElementVNode("h2",{class:"text-4xl font-semibold text-gray-800 dark:text-neutral-200"}),v.createElementVNode("div",{class:"flex items-center -space-x-2"},[v.createElementVNode("img",{class:"shrink-0 size-7 rounded-full",src:"https://images.unsplash.com/photo-1659482633369-9fe69af50bfb?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=facearea&facepad=3&w=320&h=320&q=80",alt:"Avatar"})])]),v.createElementVNode("h3",{class:"text-gray-500 dark:text-neutral-500"},"Admin")]),v.createElementVNode("div",{class:"p-4 flex flex-col bg-white border border-gray-200 rounded-xl dark:bg-neutral-800 dark:border-neutral-700"},[v.createElementVNode("div",{class:"flex justify-between items-center mb-1"},[v.createElementVNode("h2",{class:"text-4xl font-semibold text-gray-800 dark:text-neutral-200"}," 5 "),v.createElementVNode("div",{class:"flex items-center -space-x-2"},[v.createElementVNode("img",{class:"shrink-0 size-7 shadow-md rounded-full",src:"https://images.unsplash.com/photo-1659482633369-9fe69af50bfb?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=facearea&facepad=2.5&w=320&h=320&q=80",alt:"Avatar"}),v.createElementVNode("span",{class:"flex shrink-0 justify-center items-center size-7 bg-white border border-gray-200 text-gray-700 text-xs font-medium uppercase rounded-full dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300"}," L "),v.createElementVNode("img",{class:"shrink-0 size-7 shadow-md rounded-full",src:"https://images.unsplash.com/photo-1679412330254-90cb240038c5?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=facearea&facepad=2.5&w=320&h=320&q=80",alt:"Avatar"}),v.createElementVNode("img",{class:"shrink-0 size-7 shadow-md rounded-full",src:"https://images.unsplash.com/photo-1659482634023-2c4fda99ac0c?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=facearea&facepad=2.5&w=320&h=320&q=80",alt:"Avatar"}),v.createElementVNode("span",{class:"flex shrink-0 justify-center items-center size-7 bg-white border border-gray-200 text-gray-700 text-xs font-medium uppercase rounded-full dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300"}," O ")])]),v.createElementVNode("div",{class:"inline-flex items-center gap-x-2"},[v.createElementVNode("h3",{class:"text-gray-500 dark:text-neutral-500"},"Members"),v.createElementVNode("div",{class:"hs-tooltip inline-block"},[v.createElementVNode("svg",{class:"hs-tooltip-toggle shrink-0 size-3.5 text-gray-500 dark:text-neutral-500",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"currentColor",viewBox:"0 0 16 16"},[v.createElementVNode("path",{d:"M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"}),v.createElementVNode("path",{d:"m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z"})]),v.createElementVNode("div",{class:"hs-tooltip-content hs-tooltip-shown:opacity-100 hs-tooltip-shown:visible opacity-0 inline-block absolute invisible z-20 w-60 py-1.5 px-2.5 bg-gray-900 text-xs text-white rounded dark:bg-neutral-700",role:"tooltip","data-popper-placement":"top",style:{position:"fixed",inset:"auto auto 0px 0px",margin:"0px",transform:"translate(689px, -708px)"}}," Limited Access Members can only access the projects, tasks, and messages explicitly shared with them. ")])])]),v.createElementVNode("div",{class:"p-4 flex flex-col bg-white border border-gray-200 rounded-xl dark:bg-neutral-800 dark:border-neutral-700"},[v.createElementVNode("div",{class:"flex justify-between items-center mb-1"},[v.createElementVNode("h2",{class:"text-4xl font-semibold text-gray-800 dark:text-neutral-200"}," 2 "),v.createElementVNode("div",{class:"flex items-center -space-x-2"},[v.createElementVNode("span",{class:"flex shrink-0 justify-center items-center size-7 bg-white border border-gray-200 text-gray-700 text-xs font-medium uppercase rounded-full dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300"}," L "),v.createElementVNode("span",{class:"flex shrink-0 justify-center items-center size-7 bg-white border border-gray-200 text-gray-700 text-xs font-medium uppercase rounded-full dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300"}," 0 ")])]),v.createElementVNode("div",{class:"inline-flex items-center gap-x-2"},[v.createElementVNode("h3",{class:"text-gray-500 dark:text-neutral-500"}," Limited access members "),v.createElementVNode("div",{class:"hs-tooltip inline-block"},[v.createElementVNode("svg",{class:"hs-tooltip-toggle shrink-0 size-3.5 text-gray-500 dark:text-neutral-500",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"currentColor",viewBox:"0 0 16 16"},[v.createElementVNode("path",{d:"M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"}),v.createElementVNode("path",{d:"m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z"})]),v.createElementVNode("div",{class:"hs-tooltip-content hs-tooltip-shown:opacity-100 hs-tooltip-shown:visible opacity-0 inline-block absolute invisible z-20 w-60 py-1.5 px-2.5 bg-gray-900 text-xs text-white rounded dark:bg-neutral-700",role:"tooltip","data-popper-placement":"top",style:{position:"fixed",inset:"auto auto 0px 0px",margin:"0px",transform:"translate(1198px, -708px)"}}," Limited Access Members can only access the projects, tasks, and messages explicitly shared with them. ")])])]),v.createElementVNode("div",{class:"p-4 flex flex-col bg-white border border-gray-200 rounded-xl dark:bg-neutral-800 dark:border-neutral-700"},[v.createElementVNode("div",{class:"flex justify-between items-center mb-1"},[v.createElementVNode("h2",{class:"text-4xl font-semibold text-gray-800 dark:text-neutral-200"}," 0 "),v.createElementVNode("div",{class:"flex items-center -space-x-2"})]),v.createElementVNode("h3",{class:"text-gray-500 dark:text-neutral-500"},"Pending invites")])]),v.createElementVNode("div",{class:"overflow-x-auto [&::-webkit-scrollbar]:h-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"},[v.createElementVNode("div",{class:"min-w-full inline-block align-middle"},[v.createElementVNode("table",{class:"min-w-full divide-y divide-gray-200 dark:divide-neutral-700"},[v.createElementVNode("thead",null,[v.createElementVNode("tr",null,[v.createElementVNode("th",{scope:"col",class:"min-w-[250px]"},[v.createElementVNode("div",{class:"pe-4 py-3 text-start flex items-center gap-x-1 text-sm font-medium text-gray-800 dark:text-neutral-200"}," Member ")]),v.createElementVNode("th",{scope:"col",class:"min-w-48"},[v.createElementVNode("div",{class:"px-4 py-3 text-start flex items-center gap-x-1 text-sm font-medium text-gray-800 dark:text-neutral-200"}," Role ")]),v.createElementVNode("th",{scope:"col"},[v.createElementVNode("div",{class:"px-4 py-3 text-start flex items-center gap-x-1 text-sm font-medium text-gray-800 dark:text-neutral-200"}," Email ")]),v.createElementVNode("th",{scope:"col",class:"min-w-36"},[v.createElementVNode("div",{class:"px-4 py-3 text-start flex items-center gap-x-1 text-sm font-medium text-gray-800 dark:text-neutral-200"}," Last activity ")]),v.createElementVNode("th",{scope:"col"},[v.createElementVNode("div",{class:"px-4 py-3 text-start flex items-center gap-x-1 text-sm font-medium text-gray-800 dark:text-neutral-200"}," Status ")])])]),v.createElementVNode("tbody",{class:"divide-y divide-gray-200 dark:divide-neutral-700"},[v.createElementVNode("tr",null,[v.createElementVNode("td",{class:"size-px whitespace-nowrap pe-4 py-3"},[v.createElementVNode("div",{class:"w-full flex items-center gap-x-3"},[v.createElementVNode("img",{class:"shrink-0 size-[38px] rounded-full",src:"https://images.unsplash.com/photo-1659482633369-9fe69af50bfb?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=facearea&facepad=3&w=320&h=320&q=80",alt:"Avatar"}),v.createElementVNode("div",{class:"grow"},[v.createElementVNode("span",{class:"text-sm font-medium text-gray-800 dark:text-neutral-200"}," James Collins ")])])]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Admin ")]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," james@site.com ")]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Today ")]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"inline-flex items-center gap-x-1.5 py-1.5 px-2.5 text-xs font-medium bg-teal-100 text-teal-800 rounded-full dark:bg-teal-500/10 dark:text-teal-500"},[v.createElementVNode("span",{class:"size-1.5 inline-block bg-gray-800 rounded-full dark:bg-neutral-200"}),v.createTextVNode(" Active ")])])]),v.createElementVNode("tr",null,[v.createElementVNode("td",{class:"size-px whitespace-nowrap pe-4 py-3"},[v.createElementVNode("div",{class:"w-full flex items-center gap-x-3"},[v.createElementVNode("span",{class:"flex shrink-0 justify-center items-center size-[38px] bg-white border border-gray-200 text-gray-700 text-xs font-medium uppercase rounded-full dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300"}," L "),v.createElementVNode("div",{class:"grow"},[v.createElementVNode("span",{class:"text-sm font-medium text-gray-800 dark:text-neutral-200"}," James Collins ")])])]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Can view ")]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," liza@site.com ")]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," 2 days ago ")]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"inline-flex items-center gap-1.5 py-1.5 px-2 text-xs font-medium bg-gray-100 text-gray-800 rounded-full dark:bg-neutral-500/20 dark:text-neutral-400"},[v.createElementVNode("span",{class:"size-1.5 inline-block bg-gray-800 rounded-full dark:bg-neutral-400"}),v.createTextVNode(" Inactive ")])])]),v.createElementVNode("tr",null,[v.createElementVNode("td",{class:"size-px whitespace-nowrap pe-4 py-3"},[v.createElementVNode("div",{class:"w-full flex items-center gap-x-3"},[v.createElementVNode("img",{class:"shrink-0 size-[38px] rounded-full",src:"https://images.unsplash.com/photo-1601935111741-ae98b2b230b0?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=facearea&facepad=2.5&w=320&h=320&q=80",alt:"Avatar"}),v.createElementVNode("div",{class:"grow"},[v.createElementVNode("span",{class:"text-sm font-medium text-gray-800 dark:text-neutral-200"}," Daniel Hobbs ")])])]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Can edit ")]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," dhobbs@site.com ")]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Today ")]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"inline-flex items-center gap-1.5 py-1.5 px-2 text-xs font-medium bg-gray-100 text-gray-800 rounded-full dark:bg-neutral-500/20 dark:text-neutral-400"},[v.createElementVNode("span",{class:"size-1.5 inline-block bg-gray-800 rounded-full dark:bg-neutral-400"}),v.createTextVNode(" Inactive ")])])]),v.createElementVNode("tr",null,[v.createElementVNode("td",{class:"size-px whitespace-nowrap pe-4 py-3"},[v.createElementVNode("div",{class:"w-full flex items-center gap-x-3"},[v.createElementVNode("img",{class:"shrink-0 size-[38px] rounded-full",src:"https://images.unsplash.com/photo-1679412330254-90cb240038c5?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=facearea&facepad=2.5&w=320&h=320&q=80",alt:"Avatar"}),v.createElementVNode("div",{class:"grow"},[v.createElementVNode("span",{class:"text-sm font-medium text-gray-800 dark:text-neutral-200"}," Brian Warner ")])])]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Can edit ")]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," brian@site.com ")]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," 1 months ago ")]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"inline-flex items-center gap-x-1.5 py-1.5 px-2.5 text-xs font-medium bg-teal-100 text-teal-800 rounded-full dark:bg-teal-500/10 dark:text-teal-500"},[v.createElementVNode("span",{class:"size-1.5 inline-block bg-gray-800 rounded-full dark:bg-neutral-200"}),v.createTextVNode(" Active ")])])]),v.createElementVNode("tr",null,[v.createElementVNode("td",{class:"size-px whitespace-nowrap pe-4 py-3"},[v.createElementVNode("div",{class:"w-full flex items-center gap-x-3"},[v.createElementVNode("span",{class:"flex shrink-0 justify-center items-center size-[38px] bg-white border border-gray-200 text-gray-700 text-xs font-medium uppercase rounded-full dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300"}," O "),v.createElementVNode("div",{class:"grow"},[v.createElementVNode("span",{class:"text-sm font-medium text-gray-800 dark:text-neutral-200"}," Ols Shols ")])])]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Can view ")]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," olsshols@site.com ")]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," 6 days ago ")]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"inline-flex items-center gap-1.5 py-1.5 px-2 text-xs font-medium bg-gray-100 text-gray-800 rounded-full dark:bg-neutral-500/20 dark:text-neutral-400"},[v.createElementVNode("span",{class:"size-1.5 inline-block bg-gray-800 rounded-full dark:bg-neutral-400"}),v.createTextVNode(" Inactive ")])])])])])])])])],-1)])))}}},aC={install(n,{componentsApp:t={},menu:o=[]}){var x;mt.defaults.baseURL&&(mt.defaults.baseURL=mt.defaults.baseURL);const c=(x=Ey(o))==null?void 0:x.filter(y=>y==null?void 0:y.component).map(y=>({...y,component:t[y==null?void 0:y.component]})),{router:d}=mv(c);Object.entries({...oC,...t}).forEach(([y,h])=>{n.component(y,h)}),n.component("admin",Rb),n.config.globalProperties={...n.config.globalProperties,$componentsConfig:{...XS,componentsApp:t},$router:d},n.use(d)}},nr=v.ref(null),lC={data(){return{formValues:{},scheme:null,table:""}},mounted(){this.getFormScheme()},methods:{flattenMenu(n){const t=[];return n.forEach(o=>{o.menu?t.push(...this.flattenMenu(o.menu)):t.push(o)}),t},async getFormScheme(){var c,d;const n=this.flattenMenu(nr.value);n!=null&&n.length||this.$router.replace("/404");const t=n==null?void 0:n.find(x=>{var y,h;return(x==null?void 0:x.path)==((h=(y=this.$route)==null?void 0:y.query)==null?void 0:h.table)});t||this.$router.replace("/404");const o=t==null?void 0:t.table;this.table=o;try{const{data:{form:x}}=await mt.get(`/api/template/table/${o}`),{data:{rows:y}}=await mt.get(`/api/table-data/${this.table}/${(d=(c=this.$route)==null?void 0:c.query)==null?void 0:d.id}`);this.formValues=y==null?void 0:y[0];const{data:h}=await mt.get(`/api/template/form/${x}`);this.scheme=(h==null?void 0:h.schema)||h}catch{}},async editObject(){var n,t;try{await this.$refs.form.doValidation(),await mt.put(`/api/table/${this.table}/${(t=(n=this.$route)==null?void 0:n.query)==null?void 0:t.id}`,this.formValues),await this.$router.back(),await this.$notify({title:"Успішно!",message:"Об'єкт успішно створено",type:"success"})}catch{this.$notify({title:"Помилка!",message:"Сталася помилка",type:"error"})}}}},cC={style:{width:"calc(100vw - 260px)"}},hC={class:"h-[76px] bg-gray-50 flex items-center justify-between px-[30px]"},uC={class:"flex items-center gap-[6px]"},dC={style:{height:"calc(100vh - 140px)",width:"calc(100vw - 260px)"},class:"bg-gray-50 p-[20px] flex"},pC={class:"bg-white w-full rounded-xl border p-[20px] 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"};function fC(n,t,o,c,d,x){const y=v.resolveComponent("VsForm");return v.openBlock(),v.createElementBlock("div",cC,[v.createElementVNode("div",hC,[t[3]||(t[3]=v.createElementVNode("h2",{class:"text-xl font-medium"},"Редагувати",-1)),v.createElementVNode("div",uC,[v.createElementVNode("button",{onClick:t[0]||(t[0]=h=>n.$router.back()),class:"py-2 px-3 flex items-center gap-x-2 text-sm font-medium rounded-lg border bg-white border-gray-100 text-gray-800 shadow focus:outline-none hover:bg-gray-50 hover:border-gray-100 duration-300"}," Скасувати "),v.createElementVNode("button",{onClick:t[1]||(t[1]=(...h)=>x.editObject&&x.editObject(...h)),class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-transparent bg-blue-600 text-white hover:bg-blue-700 hover:text-white duration-300"}," Зберегти ")])]),v.createElementVNode("div",dC,[v.createElementVNode("div",pC,[d.scheme?(v.openBlock(),v.createBlock(y,{key:0,ref:"form",scheme:d.scheme,modelValue:d.formValues,"onUpdate:modelValue":t[2]||(t[2]=h=>d.formValues=h),class:"p-0 mt-[20px]"},null,8,["scheme","modelValue"])):v.createCommentVNode("",!0)])])])}const mC=Object.freeze(Object.defineProperty({__proto__:null,default:vt(lC,[["render",fC]])},Symbol.toStringTag,{value:"Module"})),gC={data(){return{formValues:{},scheme:null,table:""}},mounted(){this.getFormScheme()},methods:{flattenMenu(n){const t=[];return n.forEach(o=>{o.menu?t.push(...this.flattenMenu(o.menu)):t.push(o)}),t},async getFormScheme(){const n=this.flattenMenu(nr.value);n!=null&&n.length||this.$router.replace("/404");const t=n==null?void 0:n.find(c=>{var d,x;return(c==null?void 0:c.path)==((x=(d=this.$route)==null?void 0:d.query)==null?void 0:x.table)});t||this.$router.replace("/404");const o=t==null?void 0:t.table;this.table=o;try{const{data:{form:c}}=await mt.get(`/api/template/table/${o}`),{data:d}=await mt.get(`/api/template/form/${c}`);this.scheme=(d==null?void 0:d.schema)||d}catch{}},async createObject(){try{await this.$refs.form.doValidation(),await mt.post(`/api/table/${this.table}`,this.formValues),await this.$router.back(),await this.$notify({title:"Успішно!",message:"Об'єкт успішно створено",type:"success"})}catch{this.$notify({title:"Помилка!",message:"Сталася помилка",type:"error"})}}}},yC={style:{width:"calc(100vw - 260px)"}},_C={class:"h-[76px] bg-gray-50 flex items-center justify-between px-[30px]"},xC={class:"flex items-center gap-[6px]"},bC={style:{height:"calc(100vh - 150px)",width:"calc(100vw - 260px)"},class:"bg-gray-50 p-[20px] flex"},vC={class:"bg-white w-full rounded-xl border p-[20px] 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"};function wC(n,t,o,c,d,x){const y=v.resolveComponent("VsForm");return v.openBlock(),v.createElementBlock("div",yC,[v.createElementVNode("div",_C,[t[3]||(t[3]=v.createElementVNode("h2",{class:"text-xl font-medium"},"Створити",-1)),v.createElementVNode("div",xC,[v.createElementVNode("button",{onClick:t[0]||(t[0]=h=>n.$router.back()),class:"py-2 px-3 flex items-center gap-x-2 text-sm font-medium rounded-lg border bg-white border-gray-100 text-gray-800 shadow focus:outline-none hover:bg-gray-50 hover:border-gray-100 duration-300"}," Скасувати "),v.createElementVNode("button",{onClick:t[1]||(t[1]=(...h)=>x.createObject&&x.createObject(...h)),class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-transparent bg-blue-600 text-white hover:bg-blue-700 hover:text-white duration-300"}," Зберегти ")])]),v.createElementVNode("div",bC,[v.createElementVNode("div",vC,[d.scheme?(v.openBlock(),v.createBlock(y,{key:0,ref:"form",scheme:d.scheme,modelValue:d.formValues,"onUpdate:modelValue":t[2]||(t[2]=h=>d.formValues=h),class:"p-0 mt-[20px]"},null,8,["scheme","modelValue"])):v.createCommentVNode("",!0)])])])}const kC=Object.freeze(Object.defineProperty({__proto__:null,default:vt(gC,[["render",wC]])},Symbol.toStringTag,{value:"Module"})),SC={};function EC(n,t,o,c,d,x){const y=v.resolveComponent("router-view");return v.openBlock(),v.createBlock(y)}const S0=Object.freeze(Object.defineProperty({__proto__:null,default:vt(SC,[["render",EC]])},Symbol.toStringTag,{value:"Module"})),TC={data(){return{objectData:null,component:""}},computed:{getRoute(){const n=this.flattenMenu(nr.value);n!=null&&n.length||this.$router.replace("/404");const t=n==null?void 0:n.find(o=>{var c,d;return(o==null?void 0:o.table)==((d=(c=this.$route)==null?void 0:c.params)==null?void 0:d.table)});return t||this.$router.replace("/404"),t==null?void 0:t.path},getTitle(){var n,t,o,c,d,x,y,h,M,D,A,z,L,N,Y;if((o=(t=(n=this.objectData)==null?void 0:n.rows)==null?void 0:t[0])!=null&&o.name)return((y=(x=(d=(c=this.objectData)==null?void 0:c.rows)==null?void 0:d[0])==null?void 0:x.name)==null?void 0:y.length)<35?(D=(M=(h=this.objectData)==null?void 0:h.rows)==null?void 0:M[0])==null?void 0:D.name:((N=(L=(z=(A=this.objectData)==null?void 0:A.rows)==null?void 0:z[0])==null?void 0:L.name)==null?void 0:N.slice(0,35))+" ...";{const ee=(Y=this.flattenMenu(nr.value))==null?void 0:Y.find(oe=>{var he,_e;return(oe==null?void 0:oe.table)===((_e=(he=this.$route)==null?void 0:he.params)==null?void 0:_e.table)});return ee==null?void 0:ee.ua}}},async mounted(){await this.getObjectData(),await this.checkActiveComponent()},watch:{component(n){this.$router.replace({...this.$route,query:{tab:n}})}},methods:{async getObjectData(){var o;const{table:n,id:t}=(o=this.$route)==null?void 0:o.params;(!n||!t)&&this.$router.replace("/404");try{const{data:c}=await mt.get(`/api/table-data/${n}/${t}`);this.objectData=c}catch(c){console.error(c)}},getColClass(n){return`col-span-${n||12}`},getGridClass(){return"grid-cols-12"},checkActiveComponent(){var n,t,o,c,d,x,y,h,M;if((t=(n=this.$route)==null?void 0:n.query)!=null&&t.tab)this.component=(c=(o=this.$route)==null?void 0:o.query)==null?void 0:c.tab;else{const D=(x=(d=this.objectData)==null?void 0:d.panels)==null?void 0:x.find(A=>(A==null?void 0:A.type)==="tabs");(y=D==null?void 0:D.items)!=null&&y.length&&(this.component=((h=D.items[0])==null?void 0:h.component)||((M=D.items[0])==null?void 0:M.name))}},flattenMenu(n){const t=[];return n.forEach(o=>{o.menu?t.push(...this.flattenMenu(o.menu)):t.push(o)}),t}}},CC={style:{width:"calc(100vw - 260px)",height:"calc(100vh - 60px)"},class:"bg-gray-50 overflow-y-auto"},MC={class:"h-[76px] bg-gray-50 flex items-center justify-between px-[30px]"},PC={class:""},IC={class:"text-lg md:text-xl font-semibold text-stone-800 dark:text-neutral-200"},AC={class:"flex items-center gap-[6px]"},DC={key:0,class:"border rounded-xl bg-white"},zC={class:"p-[10px] pl-[20px] text-xl"},LC=["innerHTML"],RC={key:1},OC={class:"p-[10px] pl-[20px] text-xl"},BC={key:0,class:"p-[20px] border-t"},FC={key:1,class:"p-[20px] border-t"},NC=["innerHTML"],VC={class:"flex space-x-1 w-[1200px] bg-white border rounded-xl h-[60px] items-center pl-[20px]"},$C=["onClick"],jC={key:0,class:"border rounded-xl bg-white mt-[20px]"},UC={class:"p-[10px] pl-[20px] text-xl"},HC={key:0,class:"p-[20px] border-t"},qC={key:1,class:"p-[20px] border-t"},ZC=["innerHTML"];function WC(n,t,o,c,d,x){var h,M,D;const y=v.resolveComponent("router-link");return v.openBlock(),v.createElementBlock("div",CC,[v.createElementVNode("div",MC,[v.createElementVNode("div",PC,[v.createElementVNode("button",{onClick:t[0]||(t[0]=A=>n.$router.back()),class:"text-sm text-blue-600 decoration-2 hover:underline font-medium focus:outline-none focus:underline dark:text-green-400 dark:hover:text-green-500"}," До таблиці "),v.createElementVNode("h2",IC,v.toDisplayString(x.getTitle),1)]),v.createElementVNode("div",AC,[v.createVNode(y,{to:`/edit?table=${x.getRoute}&id=${(M=(h=n.$route)==null?void 0:h.params)==null?void 0:M.id}`,class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-transparent bg-blue-600 text-white hover:bg-blue-700 hover:text-white duration-300"},{default:v.withCtx(()=>t[1]||(t[1]=[v.createTextVNode(" Редагувати ")])),_:1},8,["to"])])]),v.createElementVNode("div",{class:v.normalizeClass(["grid gap-[20px]",x.getGridClass()])},[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList((D=d.objectData)==null?void 0:D.panels,(A,z)=>{var L;return v.openBlock(),v.createElementBlock("div",{key:z,class:v.normalizeClass([x.getColClass(A.col),"p-4"])},[A!=null&&A.name?(v.openBlock(),v.createElementBlock("div",DC,[v.createElementVNode("h2",zC,v.toDisplayString((A==null?void 0:A.title)||"Панель"),1),v.createElementVNode("div",{class:"p-[20px] border-t",innerHTML:(L=d.objectData)==null?void 0:L.data[A==null?void 0:A.name]},null,8,LC)])):A.type==="container"?(v.openBlock(),v.createElementBlock("div",RC,[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList(A.items,(N,Y)=>{var ee,oe,he,_e,me;return v.openBlock(),v.createElementBlock("div",{key:Y,class:"border rounded-xl bg-white mb-[20px]"},[v.createElementVNode("h2",OC,v.toDisplayString((N==null?void 0:N.title)||"Панель"),1),N!=null&&N.component?(v.openBlock(),v.createElementBlock("div",BC,[(v.openBlock(),v.createBlock(v.resolveDynamicComponent(N.component),{geometry:(oe=(ee=d.objectData)==null?void 0:ee.rows[0])==null?void 0:oe.geom,zoom:16,id:(_e=(he=n.$route)==null?void 0:he.params)==null?void 0:_e.id},null,8,["geometry","id"]))])):v.createCommentVNode("",!0),N!=null&&N.name?(v.openBlock(),v.createElementBlock("div",FC,[v.createElementVNode("div",{innerHTML:(me=d.objectData)==null?void 0:me.data[N==null?void 0:N.name]},null,8,NC)])):v.createCommentVNode("",!0)])}),128))])):v.createCommentVNode("",!0),(A==null?void 0:A.type)==="tabs"?(v.openBlock(),v.createElementBlock(v.Fragment,{key:2},[v.createElementVNode("nav",VC,[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList(A==null?void 0:A.items,N=>(v.openBlock(),v.createElementBlock("button",{key:(N==null?void 0:N.name)||(N==null?void 0:N.component),onClick:Y=>d.component=(N==null?void 0:N.component)||(N==null?void 0:N.name),class:v.normalizeClass(["px-2.5 h-[30px] py-1.5 relative inline-flex items-center gap-x-2 text-gray-500 hover:text-gray-800 text-sm whitespace-nowrap rounded-lg focus:outline-none",{"bg-gray-100 text-gray-800 font-semibold after:absolute after:bottom-[-14px] after:left-2.5 after:right-2.5 after:z-10 after:h-0.5 after:bg-gray-800":d.component===(N==null?void 0:N.component)||d.component===(N==null?void 0:N.name),"hover:bg-gray-100":d.component!==(N==null?void 0:N.component)&&d.component!==(N==null?void 0:N.name)}])},v.toDisplayString(N==null?void 0:N.title),11,$C))),128))]),(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList(A.items,(N,Y)=>{var ee,oe,he,_e,me;return v.openBlock(),v.createElementBlock(v.Fragment,{key:Y},[d.component===(N==null?void 0:N.component)||d.component===(N==null?void 0:N.name)?(v.openBlock(),v.createElementBlock("div",jC,[v.createElementVNode("h2",UC,v.toDisplayString((N==null?void 0:N.title)||"Панель"),1),N!=null&&N.component?(v.openBlock(),v.createElementBlock("div",HC,[(v.openBlock(),v.createBlock(v.resolveDynamicComponent(N.component),{geometry:(oe=(ee=d.objectData)==null?void 0:ee.rows[0])==null?void 0:oe.geom,zoom:16,id:(_e=(he=n.$route)==null?void 0:he.params)==null?void 0:_e.id},null,8,["geometry","id"]))])):v.createCommentVNode("",!0),N!=null&&N.name?(v.openBlock(),v.createElementBlock("div",qC,[v.createElementVNode("div",{innerHTML:(me=d.objectData)==null?void 0:me.data[N==null?void 0:N.name]},null,8,ZC)])):v.createCommentVNode("",!0)])):v.createCommentVNode("",!0)],64)}),128))],64)):v.createCommentVNode("",!0)],2)}),128))],2)])}const GC=Object.freeze(Object.defineProperty({__proto__:null,default:vt(TC,[["render",WC],["__scopeId","data-v-6289ec55"]])},Symbol.toStringTag,{value:"Module"})),YC={},XC={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 KC(n,t,o,c,d,x){return v.openBlock(),v.createElementBlock("svg",XC,t[0]||(t[0]=[v.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),v.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),v.createElementVNode("path",{d:"M9 12h12l-3 -3"},null,-1),v.createElementVNode("path",{d:"M18 15l3 -3"},null,-1)]))}const JC=vt(YC,[["render",KC]]),QC={},eM={viewBox:"0 0 1823 249",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function tM(n,t,o,c,d,x){return v.openBlock(),v.createElementBlock("svg",eM,t[0]||(t[0]=[v.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 iM=vt(QC,[["render",tM]]),nM={},rM={class:"shrink-0 size-4 text-gray-400 dark:text-white/60",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 sM(n,t,o,c,d,x){return v.openBlock(),v.createElementBlock("svg",rM,t[0]||(t[0]=[v.createElementVNode("circle",{cx:"11",cy:"11",r:"8"},null,-1),v.createElementVNode("path",{d:"m21 21-4.3-4.3"},null,-1)]))}const E0=vt(nM,[["render",sM]]),oM={},aM={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-chevron-down"};function lM(n,t,o,c,d,x){return v.openBlock(),v.createElementBlock("svg",aM,t[0]||(t[0]=[v.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),v.createElementVNode("path",{d:"M6 9l6 6l6 -6"},null,-1)]))}const cM={components:{IconChevronDown:vt(oM,[["render",lM]])},props:{route:Object},mounted(){var n,t,o;(n=this.route)!=null&&n.menu&&(o=(t=this.route)==null?void 0:t.menu)!=null&&o.some(c=>{var d,x;return(c==null?void 0:c.path)===this.$route.path.replace("/","")||((x=(d=this.$route)==null?void 0:d.params)==null?void 0:x.table)===(c==null?void 0:c.table)&&(c==null?void 0:c.table)})&&(this.isOpen=!0)},data(){return{isOpen:!1}}},hM={key:0,class:""},uM={class:"ml-[30px] py-[6px] before:block before:absolute relative w-[196px] flex flex-col gap-[6px] inline-block before:w-[2px] before:h-[100%] before:bg-gray-100 before:left-[-14px] cursor-pointer"},dM={key:1};function pM(n,t,o,c,d,x){var M,D,A,z,L,N,Y,ee,oe,he;const y=v.resolveComponent("IconChevronDown"),h=v.resolveComponent("router-link");return(M=o.route)!=null&&M.menu?(v.openBlock(),v.createElementBlock("div",hM,[v.createElementVNode("button",{onClick:t[0]||(t[0]=_e=>d.isOpen=!d.isOpen),class:v.normalizeClass(["flex cursor-pointer gap-x-3 py-2 px-3 text-sm text-gray-800 justify-start w-full border-none focus:outline-none text-gray-800 rounded-lg items-center hover:bg-gray-100 duration-300",[((A=(D=o.route)==null?void 0:D.menu)==null?void 0:A.some(_e=>{var me,Ie;return(_e==null?void 0:_e.path)===n.$route.path.replace("/","")||(_e==null?void 0:_e.table)===((Ie=(me=n.$route)==null?void 0:me.params)==null?void 0:Ie.table)&&(_e==null?void 0:_e.table)}))&&"bg-gray-100"]])},[v.createTextVNode(v.toDisplayString((z=o.route)==null?void 0:z.ua)+" ",1),v.createVNode(y,{class:v.normalizeClass([[d.isOpen&&"-rotate-180"],"ml-auto duration-300"]),width:"14",height:"14"},null,8,["class"])],2),v.createVNode(v.Transition,{name:"fade"},{default:v.withCtx(()=>{var _e;return[v.withDirectives(v.createElementVNode("ul",uM,[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList((_e=o.route)==null?void 0:_e.menu,(me,Ie)=>{var tt,gt;return v.openBlock(),v.createElementBlock("li",{key:Ie,class:"w-full"},[v.createVNode(h,{to:"/"+(me==null?void 0:me.path),class:v.normalizeClass([[((me==null?void 0:me.path)===n.$route.path.replace("/","")||((gt=(tt=n.$route)==null?void 0:tt.params)==null?void 0:gt.table)===(me==null?void 0:me.table)&&(me==null?void 0:me.table))&&"bg-gray-100"],"flex gap-x-4 py-2 px-3 text-sm text-gray-800 rounded-lg hover:bg-gray-100 focus:outline-none focus:bg-gray-100"])},{default:v.withCtx(()=>[v.createTextVNode(v.toDisplayString(me==null?void 0:me.ua),1)]),_:2},1032,["to","class"])])}),128))],512),[[v.vShow,d.isOpen]])]}),_:1})])):(v.openBlock(),v.createElementBlock("div",dM,[v.createVNode(h,{to:(L=o.route)==null?void 0:L.path,class:v.normalizeClass([[(((N=o.route)==null?void 0:N.path.replace("/",""))===n.$route.path.replace("/","")||((ee=(Y=n.$route)==null?void 0:Y.params)==null?void 0:ee.table)===((oe=o.route)==null?void 0:oe.table)&&((he=o.route)==null?void 0:he.table))&&"bg-gray-100"],"flex gap-x-3 py-2 w-full font-[400] px-3 text-sm text-gray-800 rounded-lg items-center hover:bg-gray-100 duration-300 hover:text-gray-800"])},{default:v.withCtx(()=>{var _e;return[v.createTextVNode(v.toDisplayString((_e=o.route)==null?void 0:_e.ua),1)]}),_:1},8,["to","class"])]))}const fM={components:{IconLogout:JC,NavbarItem:vt(cM,[["render",pM]]),IconLogo:iM,IconSearch:E0},data(){return{activeIndex:null,data:null,searchValue:""}},computed:{data(){var n,t;return(n=this.searchValue)!=null&&n.trim()?(t=this.flattenMenu(nr.value))==null?void 0:t.filter(o=>{var c,d,x;return(x=(c=o==null?void 0:o.ua)==null?void 0:c.toLowerCase())==null?void 0:x.includes((d=this.searchValue)==null?void 0:d.toLowerCase())}):nr.value}},methods:{flattenMenu(n){const t=[];return n.forEach(o=>{o.menu?t.push(...this.flattenMenu(o.menu)):t.push(o)}),t}}},mM={class:"flex flex-col h-[100vh] border-r w-[260px] shrink-0"},gM={class:"relative"},yM={class:"p-[16px] 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"},_M={class:"pb-3 w-full flex flex-col flex-wrap"},xM={key:0,class:"flex flex-col gap-[6px]"},bM={key:1,class:"text-gray-800 text-lg mt-[20px]"};function vM(n,t,o,c,d,x){var A;const y=v.resolveComponent("IconLogo"),h=v.resolveComponent("IconSearch"),M=v.resolveComponent("VsText"),D=v.resolveComponent("NavbarItem");return v.openBlock(),v.createElementBlock("div",mM,[v.createVNode(y,{height:"40",width:"200",class:"my-[20px] ml-[20px]"}),v.createElementVNode("div",gM,[v.createVNode(h,{height:"16",width:"16",class:"absolute top-[12px] left-[30px] text-gray-500 z-[1]"}),v.createVNode(M,{type:"text",modelValue:d.searchValue,"onUpdate:modelValue":t[0]||(t[0]=z=>d.searchValue=z),clearable:!0,placeholder:"Пошук по меню",class:"[&>input]:h-[40px] [&>input]:block [&>input]:rounded-none [&>input]:border-x-0 [&>input]:pl-[60px] [&>input:focus]:outline-none [&>input:focus]:focus:ring-0 [&>input:focus]:border-y-gray-200 [&>input:focus]:border-y-1 [&>input:focus]:border-x-0"},null,8,["modelValue"])]),v.createElementVNode("div",yM,[v.createElementVNode("nav",_M,[(A=x.data)!=null&&A.length?(v.openBlock(),v.createElementBlock("ul",xM,[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList(x.data,(z,L)=>(v.openBlock(),v.createElementBlock("li",{key:L,class:"flex flex-col gap-[6px]"},[v.createVNode(D,{route:z},null,8,["route"])]))),128))])):(v.openBlock(),v.createElementBlock("div",bM,"Не знайдено"))])])])}const wM=vt(fM,[["render",vM]]),kM={},SM={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 EM(n,t,o,c,d,x){return v.openBlock(),v.createElementBlock("svg",SM,t[0]||(t[0]=[v.createElementVNode("circle",{cx:"12",cy:"12",r:"10"},null,-1),v.createElementVNode("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"},null,-1),v.createElementVNode("path",{d:"M12 17h.01"},null,-1)]))}const TM=vt(kM,[["render",EM]]),CM={},MM={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 PM(n,t,o,c,d,x){return v.openBlock(),v.createElementBlock("svg",MM,t[0]||(t[0]=[v.createElementVNode("path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9"},null,-1),v.createElementVNode("path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0"},null,-1)]))}const IM={components:{IconQuestion:TM,IconMessage:vt(CM,[["render",PM]])}},AM={class:"h-[60px] border-b flex justify-end px-[20px]",style:{width:"calc(100vw - 260px)"}},DM={class:"flex items-center gap-[6px]"},zM={href:"docs-softpro.com",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"},LM={class:"hs-tooltip [--placement:bottom] inline-block show"},RM={class:"hs-tooltip-toggle relative 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"};function OM(n,t,o,c,d,x){const y=v.resolveComponent("IconQuestion"),h=v.resolveComponent("IconMessage");return v.openBlock(),v.createElementBlock("div",AM,[v.createElementVNode("div",DM,[v.createElementVNode("a",zM,[v.createVNode(y,{height:"24",width:"24"})]),v.createElementVNode("div",LM,[v.createElementVNode("button",RM,[v.createVNode(h,{height:"24",width:"24"}),t[0]||(t[0]=v.createElementVNode("span",{class:"flex absolute top-0 end-0 -mt-1.5 -me-1.5"},[v.createElementVNode("span",{class:"animate-ping absolute inline-flex size-full rounded-full bg-red-400 opacity-75 dark:bg-red-600"}),v.createElementVNode("span",{class:"relative min-w-[18px] min-h-[18px] inline-flex justify-center items-center text-[10px] bg-red-500 text-white rounded-full px-1"}," 1 ")],-1))]),t[1]||(t[1]=v.createElementVNode("span",{class:"hs-tooltip-content hs-tooltip-shown:opacity-100 hs-tooltip-shown:visible opacity-0 inline-block absolute invisible z-20 py-1.5 px-2.5 bg-gray-900 text-xs text-white rounded-lg dark:bg-neutral-700 hidden",role:"tooltip","data-popper-placement":"bottom",style:{position:"fixed",inset:"0px auto auto 0px",margin:"0px",transform:"translate(1686px, 53px)"}},null,-1))]),t[2]||(t[2]=v.createElementVNode("div",{class:"h-[30px] w-[1px] bg-gray-200 ml-[10px] mr-[10px]"},null,-1)),t[3]||(t[3]=v.createElementVNode("img",{class:"flex-shrink-0 size-[38px] rounded-full",src:"https://images.unsplash.com/photo-1659482633369-9fe69af50bfb?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=facearea&facepad=3&w=320&h=320&q=80",alt:"Image Description"},null,-1))])])}const BM={components:{navbar:wM,AdminHeader:vt(IM,[["render",OM]])},mounted(){this.getMenu()},computed:{isMenu(){return nr.value}},methods:{async getMenu(){try{const{data:n}=await mt.get("/api/user-menu");nr.value=n}catch{}}}},FM={class:"admin-wrapper"},NM={class:"flex flex-col"};function VM(n,t,o,c,d,x){const y=v.resolveComponent("navbar"),h=v.resolveComponent("admin-header"),M=v.resolveComponent("router-view");return v.openBlock(),v.createElementBlock("div",FM,[v.createVNode(y),v.createElementVNode("div",NM,[x.isMenu?(v.openBlock(),v.createElementBlock(v.Fragment,{key:0},[v.createVNode(h),v.createVNode(M)],64)):v.createCommentVNode("",!0)])])}const $M=Object.freeze(Object.defineProperty({__proto__:null,default:vt(BM,[["render",VM],["__scopeId","data-v-3d7ecdff"]])},Symbol.toStringTag,{value:"Module"})),jM={},UM={class:"h21yx vs0hq",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"};function HM(n,t,o,c,d,x){return v.openBlock(),v.createElementBlock("svg",UM,t[0]||(t[0]=[v.createStaticVNode('<line x1="21" x2="14" y1="4" y2="4"></line><line x1="10" x2="3" y1="4" y2="4"></line><line x1="21" x2="12" y1="12" y2="12"></line><line x1="8" x2="3" y1="12" y2="12"></line><line x1="21" x2="16" y1="20" y2="20"></line><line x1="12" x2="3" y1="20" y2="20"></line><line x1="14" x2="14" y1="2" y2="6"></line><line x1="8" x2="8" y1="10" y2="14"></line><line x1="16" x2="16" y1="18" y2="22"></line>',9)]))}const qM=vt(jM,[["render",HM]]),ZM={data(){return{currentSort:""}},props:{data:{type:Object,default:()=>null},activeColumn:{type:String}},computed:{label(){var n,t;return((n=this.data)==null?void 0:n.ua)||((t=this.data)==null?void 0:t.label)||this.data.title||"null"},selectedSortParam(){var n,t;return(t=(n=this.$route)==null?void 0:n.query)==null?void 0:t.sort},getVisibleIcon(){return this.data.format!=="image"&&this.data.format!=="verify"}},watch:{activeColumn(n){n!==this.data.name&&(this.currentSort="")}},methods:{changeCurrentSort(n){switch(n){case"":return"asc";case"asc":return"desc";case"desc":return"";default:return""}},handleClickSortBtn(n){this.$emit("change-active",this.data.name),this.currentSort=this.changeCurrentSort(n);const t=this.$route.query,{sort:o,...c}=t,d=this.currentSort?`${this.data.name}-${this.currentSort}`:"";this.$router.replace({query:{...c,...d&&{sort:d}}})},isValueEqualToSelected(n){return`${this.data.name}-${n}`===this.selectedSortParam}}},WM={scope:"col",class:"min-w-[200px] max-w-[300px] text-start"},GM={class:"flex-shrink-0 size-3.5",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"},YM={key:0,d:"m7 15 5 5 5-5"},XM={key:1,d:"m7 9 5-5 5 5"},KM={key:1,class:"text-sm text-gray-800 px-[4px] py-2.5 text-start font-normal text-gray-500"};function JM(n,t,o,c,d,x){return v.openBlock(),v.createElementBlock("th",WM,[x.getVisibleIcon?(v.openBlock(),v.createElementBlock("button",{key:0,type:"button",class:"text-sm text-gray-800 px-[4px] py-2.5 text-start font-normal text-gray-500 flex items-center gap-[6px]",onClick:t[0]||(t[0]=y=>x.handleClickSortBtn(d.currentSort))},[v.createTextVNode(v.toDisplayString(x.label)+" ",1),(v.openBlock(),v.createElementBlock("svg",GM,[d.currentSort==="asc"||d.currentSort===""?(v.openBlock(),v.createElementBlock("path",YM)):v.createCommentVNode("",!0),d.currentSort==="desc"||d.currentSort===""?(v.openBlock(),v.createElementBlock("path",XM)):v.createCommentVNode("",!0)]))])):(v.openBlock(),v.createElementBlock("p",KM,v.toDisplayString(x.label),1))])}const QM=vt(ZM,[["render",JM]]),eP={},tP={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-dots-vertical"};function iP(n,t,o,c,d,x){return v.openBlock(),v.createElementBlock("svg",tP,t[0]||(t[0]=[v.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),v.createElementVNode("path",{d:"M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},null,-1),v.createElementVNode("path",{d:"M12 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},null,-1),v.createElementVNode("path",{d:"M12 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},null,-1)]))}const nP=vt(eP,[["render",iP]]),rP={},sP={class:"flex-shrink-0 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 oP(n,t,o,c,d,x){return v.openBlock(),v.createElementBlock("svg",sP,t[0]||(t[0]=[v.createStaticVNode('<path d="M3 6h18"></path><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"></path><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"></path><line x1="10" x2="10" y1="11" y2="17"></line><line x1="14" x2="14" y1="11" y2="17"></line>',5)]))}const aP=vt(rP,[["render",oP]]),lP={props:{height:{type:String,default:"16"},width:{type:String,default:"12"},color:{type:String,default:"black"}}},cP={style:{display:"none"}},hP=["height","width","fill"];function uP(n,t,o,c,d,x){return v.openBlock(),v.createElementBlock(v.Fragment,null,[(v.openBlock(),v.createElementBlock("svg",cP,t[0]||(t[0]=[v.createElementVNode("symbol",{id:"icon-pencil",viewBox:"0 0 32 32"},[v.createElementVNode("path",{d:"M27 0c2.761 0 5 2.239 5 5 0 1.126-0.372 2.164-1 3l-2 2-7-7 2-2c0.836-0.628 1.874-1 3-1zM2 23l-2 9 9-2 18.5-18.5-7-7-18.5 18.5zM22.362 11.362l-14 14-1.724-1.724 14-14 1.724 1.724z"})],-1)]))),(v.openBlock(),v.createElementBlock("svg",{height:o.height,width:o.width,fill:o.color},t[1]||(t[1]=[v.createElementVNode("use",{"xlink:href":"#icon-pencil"},null,-1)]),8,hP))],64)}const dP={components:{IconMore:nP,IconDelete:aP,IconEdit:vt(lP,[["render",uP]])},emits:["updateTable"],props:{item:Object,table:String,isForm:null},data(){return{formVisible:!1,isDeleteConfirm:!1,formValue:{},top:0,left:0}},methods:{openConfirm(){this.isDeleteConfirm=!0,document.querySelector("body").click()},async getData(){var n;try{const{data:t}=await mt.get(`/api/table/${this.table}/${(n=this.item)==null?void 0:n.id}`);this.formValue=t}catch(t){console.error(t)}},doSomethingOnCancel(){this.formVisible=!1},async deleteElement(){var n;try{mt.delete(`/api/table/${this.table}/${(n=this.item)==null?void 0:n.id}`),this.$notify({title:"Успішно!",message:"Об`єкт успішно видалeно",type:"success"}),await this.$emit("update-table"),this.isDeleteConfirm=!1}catch{this.$notify({title:"Помилка!",message:"Сталася помилка",type:"error"})}}}},pP={class:"hs-dropdown [--placement:bottom-right] inline-flex"},fP={class:"gap-x-2 p-[4px] rounded-lg shadow-sm hover:border-transparent border focus:outline-none text-black hover:bg-gray-50"},mP={class:"flex flex-col items-start"},gP={key:1,class:"h-[1px] w-[80%] bg-gray-200 ml-auto mr-auto"},yP={class:"p-4"},_P={class:"mt-4 flex justify-end gap-x-3"};function xP(n,t,o,c,d,x){const y=v.resolveComponent("IconMore"),h=v.resolveComponent("IconEdit"),M=v.resolveComponent("router-link"),D=v.resolveComponent("IconDelete"),A=v.resolveComponent("VsPopover"),z=v.resolveComponent("VsDialog");return v.openBlock(),v.createElementBlock(v.Fragment,null,[v.createElementVNode("div",pP,[v.createVNode(A,{trigger:"click",placement:"bottom-left"},{reference:v.withCtx(()=>[v.createElementVNode("button",fP,[v.createVNode(y,{height:"16",width:"16"})])]),default:v.withCtx(()=>{var L,N,Y;return[v.createElementVNode("div",mP,[o.isForm?(v.openBlock(),v.createBlock(M,{key:0,to:`/edit?table=${(N=(L=n.$route)==null?void 0:L.params)==null?void 0:N.catchAll}&id=${(Y=o.item)==null?void 0:Y.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:v.withCtx(()=>[v.createVNode(h,{color:"#000"}),t[4]||(t[4]=v.createTextVNode(" Редагувати "))]),_:1},8,["to"])):v.createCommentVNode("",!0),o.isForm?(v.openBlock(),v.createElementBlock("div",gP)):v.createCommentVNode("",!0),v.createElementVNode("button",{onClick:t[0]||(t[0]=v.withModifiers((...ee)=>x.openConfirm&&x.openConfirm(...ee),["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"},[v.createVNode(D),t[5]||(t[5]=v.createElementVNode("span",{class:"text-gray-800"},"Видалити",-1))])])]}),_:1})]),v.createVNode(z,{visible:d.isDeleteConfirm,"onUpdate:visible":t[3]||(t[3]=L=>d.isDeleteConfirm=L),title:"Ви впевнені?"},{default:v.withCtx(()=>[v.createElementVNode("div",yP,[t[6]||(t[6]=v.createElementVNode("p",{class:"mt-1 text-gray-500 dark:text-neutral-500"}," Ви впевнені, що хочете видалити цей об'єкт? ",-1)),v.createElementVNode("div",_P,[v.createElementVNode("button",{type:"button",class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:t[1]||(t[1]=L=>d.isDeleteConfirm=!1)}," Скасувати "),v.createElementVNode("button",{type:"button",class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-semibold rounded-lg border border-transparent bg-red-500 text-white hover:bg-red-600 disabled:opacity-50 disabled:pointer-events-none",onClick:t[2]||(t[2]=(...L)=>x.deleteElement&&x.deleteElement(...L))}," Так, я впевнена/ий ")])])]),_:1},8,["visible"])],64)}const bP=vt(dP,[["render",xP]]),vP={},wP={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 kP(n,t,o,c,d,x){return v.openBlock(),v.createElementBlock("svg",wP,t[0]||(t[0]=[v.createElementVNode("path",{d:"m3 16 4 4 4-4"},null,-1),v.createElementVNode("path",{d:"M7 20V4"},null,-1),v.createElementVNode("path",{d:"m21 8-4-4-4 4"},null,-1),v.createElementVNode("path",{d:"M17 4v16"},null,-1)]))}const SP=vt(vP,[["render",kP]]),EP={props:{columns:{type:Object,default:()=>{}},table:{type:String,default:()=>""}},data(){return{tableFormats:["json","csv","xlsx"],format:"",cols:[]}},methods:{async exportTable(){try{const n=await mt.get("/api/export",{params:{table:this.table,format:this.format,cols:this.cols.join(",")},responseType:"blob"}),t=new Blob([n.data],{type:"application/octet-stream"}),o=window.URL.createObjectURL(t),c=document.createElement("a");c.href=o,c.setAttribute("download",`${this.table.split(".")[0]}.${this.format}`),document.body.appendChild(c),c.click(),document.body.removeChild(c),window.URL.revokeObjectURL(o),this.$notify({type:"success",title:"Експорт",message:"Файл успішно експортовано!"})}catch(n){console.error("Ошибка при экспорте файла:",n),this.$notify({type:"error",title:"Помилка",message:"Не вдалося експортувати файл."})}},selectFormat(n){this.format=n}}},TP={class:"p-4"},CP={class:"pb-5 mb-5 last:pb-0 last:mb-0 border-b last:border-b-0 border-gray-200 dark:border-neutral-700"},MP={class:"mt-2 flex row flex-wrap gap-y-[5px] gap-x-[10px]"},PP={class:"pb-5 mb-5 last:pb-0 last:mb-0 border-b last:border-b-0 border-gray-200 dark:border-neutral-700"},IP={class:"mt-2 space-y-2"},AP=["id","onChange"],DP=["for"],zP={class:"pb-5 last:pb-0 last:mb-0 border-b last:border-b-0 border-gray-200 dark:border-neutral-700"},LP={class:"text-center"};function RP(n,t,o,c,d,x){const y=v.resolveComponent("VsCheckbox");return v.openBlock(),v.createElementBlock(v.Fragment,null,[t[4]||(t[4]=v.createElementVNode("div",{class:"dark:border-neutral-700"},null,-1)),v.createElementVNode("div",TP,[v.createElementVNode("div",CP,[t[2]||(t[2]=v.createElementVNode("label",{class:"text-sm text-gray-500 dark:text-neutral-500"}," Виберіть стовпці таблиці для експорту: ",-1)),v.createElementVNode("div",MP,[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList(o.columns,(h,M)=>(v.openBlock(),v.createElementBlock("div",{class:"flex items-center",key:M,style:{width:"calc((100% - 10px) / 2)"}},[v.createVNode(y,{class:"py-0 shrink-0 border-gray-300 rounded text-blue-600 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",modelValue:d.cols,"onUpdate:modelValue":t[0]||(t[0]=D=>d.cols=D),value:h==null?void 0:h.name,label:h==null?void 0:h.ua},null,8,["modelValue","value","label"])]))),128))])]),v.createElementVNode("div",PP,[t[3]||(t[3]=v.createElementVNode("label",{class:"text-sm text-gray-500 dark:text-neutral-500"}," Виберіть формат таблиці: ",-1)),v.createElementVNode("div",IP,[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList(d.tableFormats,(h,M)=>(v.openBlock(),v.createElementBlock("div",{class:"flex items-center",key:M},[v.createElementVNode("input",{type:"radio",name:"hs-pro-duecmfm",class:"shrink-0 border-gray-300 rounded-full text-blue-600 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:h,onChange:D=>x.selectFormat(h)},null,40,AP),v.createElementVNode("label",{for:h,class:"text-sm text-gray-800 ms-3 dark:text-neutral-400"}," Формат "+v.toDisplayString(h),9,DP)]))),128))])]),v.createElementVNode("div",zP,[v.createElementVNode("div",LP,[v.createElementVNode("button",{type:"button",class:"p-2 inline-flex items-center gap-x-2 text-xs font-medium rounded-lg border border-transparent bg-blue-600 text-white hover:bg-blue-700 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:ring-2 focus:ring-blue-500",onClick:t[1]||(t[1]=(...h)=>x.exportTable&&x.exportTable(...h))}," Завантажити таблицю ")])])])],64)}const OP={components:{IconExport:SP,AdminTableExportForm:vt(EP,[["render",RP]])},props:{table:String,columns:Array},data(){return{isOpen:!1}}};function BP(n,t,o,c,d,x){const y=v.resolveComponent("IconExport"),h=v.resolveComponent("AdminTableExportForm"),M=v.resolveComponent("VsDialog");return v.openBlock(),v.createElementBlock(v.Fragment,null,[v.createElementVNode("button",{onClick:t[0]||(t[0]=D=>d.isOpen=!0),class:"py-2 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"},[v.createVNode(y,{height:"16",width:"16"}),t[2]||(t[2]=v.createTextVNode(" Import / Export ")),t[3]||(t[3]=v.createElementVNode("svg",{class:"shrink-0 size-3.5",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"},[v.createElementVNode("path",{d:"m6 9 6 6 6-6"})],-1))]),v.createVNode(M,{visible:d.isOpen,"onUpdate:visible":t[1]||(t[1]=D=>d.isOpen=D),title:"Експорт таблиці"},{default:v.withCtx(()=>[v.createVNode(h,{table:o.table,columns:o.columns},null,8,["table","columns"])]),_:1},8,["visible"])],64)}const FP=vt(OP,[["render",BP]]),NP={},VP={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-columns"};function $P(n,t,o,c,d,x){return v.openBlock(),v.createElementBlock("svg",VP,t[0]||(t[0]=[v.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M4 6l5.5 0"></path><path d="M4 10l5.5 0"></path><path d="M4 14l5.5 0"></path><path d="M4 18l5.5 0"></path><path d="M14.5 6l5.5 0"></path><path d="M14.5 10l5.5 0"></path><path d="M14.5 14l5.5 0"></path><path d="M14.5 18l5.5 0"></path>',9)]))}const jP=vt(NP,[["render",$P]]),UP={props:{column:Object},emits:["update-column"],data(){return{value:!1}},watch:{value(n){this.$emit("update-column",{...this.column,hidden:!n})}},mounted(){var n;((n=this.column)==null?void 0:n.hidden)!==!0&&(this.value=!0)}},HP={class:"flex w-full gap-[8px] items-centr"};function qP(n,t,o,c,d,x){var y,h;return v.openBlock(),v.createElementBlock("label",HP,[v.withDirectives(v.createElementVNode("input",{"onUpdate:modelValue":t[0]||(t[0]=M=>d.value=M),type:"checkbox"},null,512),[[v.vModelCheckbox,d.value]]),v.createTextVNode(" "+v.toDisplayString(((y=o.column)==null?void 0:y.ua)||((h=o.column)==null?void 0:h.title)),1)])}const ZP={components:{IconColumns:jP,AdminTableColumnsHiddenItem:vt(UP,[["render",qP]])},emits:["update-columns"],props:{columns:Array},methods:{updateColumn(n){const t=this.columns.findIndex(c=>(c==null?void 0:c.name)===(n==null?void 0:n.name)),o=this.columns;o[t]=n,this.$emit("update-columns",[...o])}}},WP={class:"py-2 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"},GP={class:"flex flex-col gap-[3px] h-[400px] w-[300px] 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"};function YP(n,t,o,c,d,x){const y=v.resolveComponent("IconColumns"),h=v.resolveComponent("AdminTableColumnsHiddenItem"),M=v.resolveComponent("VsPopover");return v.openBlock(),v.createBlock(M,{trigger:"click",placement:"bottom"},{reference:v.withCtx(()=>[v.createElementVNode("button",WP,[v.createVNode(y,{height:"20",width:"16"})])]),default:v.withCtx(()=>[v.createElementVNode("div",null,[t[0]||(t[0]=v.createElementVNode("h2",{class:"text-sm mb-[8px]"},"Оберіть колонки, щоб приховати",-1)),v.createElementVNode("ul",GP,[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList(o.columns,(D,A)=>(v.openBlock(),v.createElementBlock("li",{key:A},[v.createVNode(h,{column:D,onUpdateColumn:x.updateColumn},null,8,["column","onUpdateColumn"])]))),128))])])]),_:1})}const XP=vt(ZP,[["render",YP]]),KP={},JP={class:"hidden sm:block shrink-0 size-3",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 16 16"};function QP(n,t,o,c,d,x){return v.openBlock(),v.createElementBlock("svg",JP,t[0]||(t[0]=[v.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M8 1C8.55228 1 9 1.44772 9 2V7L14 7C14.5523 7 15 7.44771 15 8C15 8.55228 14.5523 9 14 9L9 9V14C9 14.5523 8.55228 15 8 15C7.44772 15 7 14.5523 7 14V9.00001L2 9.00001C1.44772 9.00001 1 8.5523 1 8.00001C0.999999 7.44773 1.44771 7.00001 2 7.00001L7 7.00001V2C7 1.44772 7.44772 1 8 1Z"},null,-1)]))}const eI=vt(KP,[["render",QP]]),tI={},iI={class:"vs-table-interface__table-wrp w-full rounded h-fit overflow-hidden"};function nI(n,t,o,c,d,x){return v.openBlock(),v.createElementBlock("div",iI,t[0]||(t[0]=[v.createStaticVNode('<div><div class="p-5 min-h-[500px] flex flex-col justify-center items-center text-center"><svg class="w-48 mx-auto" viewBox="0 0 178 90" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="27" y="50.5" width="124" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="27" y="50.5" width="124" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-50 dark:stroke-neutral-700/10"></rect><rect x="34.5" y="58" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="61" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="73" width="77" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/30"></rect><rect x="27" y="36" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="39" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="51" width="92" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><g filter="url(#filter1)"><rect x="12" y="6" width="154" height="40" rx="8" fill="currentColor" class="fill-white dark:fill-neutral-800" shape-rendering="crispEdges"></rect><rect x="12.5" y="6.5" width="153" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/60" shape-rendering="crispEdges"></rect><rect x="20" y="14" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="17" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="29" width="106" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect></g><defs><filter id="filter1" x="0" y="0" width="178" height="64" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"></feColorMatrix><feOffset dy="6"></feOffset><feGaussianBlur stdDeviation="6"></feGaussianBlur><feComposite in2="hardAlpha" operator="out"></feComposite><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0"></feColorMatrix><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1187_14810"></feBlend><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_1187_14810" result="shape"></feBlend></filter></defs></svg><div class="max-w-sm mx-auto mt-6"><p class="font-medium text-gray-800 dark:text-neutral-200"> Дані для відображення відсутні </p><p class="mt-2 text-sm text-gray-500 dark:text-neutral-500"> Змініть параметри пошуку або спробуйте пізніше </p></div></div></div>',1)]))}const rI={props:{table:String,title:String},components:{IconFilter:qM,AdminTableControl:bP,AdminTableExport:FP,AdminTableColumnsHidden:XP,AdminTableColumn:QM,AdminNodata:vt(tI,[["render",nI]]),IconPlus:eI,IconSearch:E0},data(){return{tableData:{},isFilters:!1,filterScheme:[],page:1,searchValue:"",limit:0,filters:null,activeColumn:"",onFilters:0}},mounted(){var n,t,o,c;this.page=((t=(n=this.$route)==null?void 0:n.query)==null?void 0:t.page)||1,this.limit=((c=(o=this.$route)==null?void 0:o.query)==null?void 0:c.limit)||20,this.getTableData(),this.getFilters()},computed:{defaultPage(){var n,t;return((t=(n=this.$route)==null?void 0:n.query)==null?void 0:t.page)||1},getFilterScheme(){var n;return(n=this.tableData)==null?void 0:n.filters},columns(){var n,t;return(t=(n=this.tableData)==null?void 0:n.columns)==null?void 0:t.filter(o=>(o==null?void 0:o.hidden)!==!0)},isForm(){var n;return(n=this.tableData)==null?void 0:n.form},isNoData(){var n,t;return!((n=this.tableData)!=null&&n.rows)||!((t=this.columns)!=null&&t.length)}},watch:{async table(){this.tableData=null,await this.getTableData()},searchValue(){this.getTableData()},$route:{handler(n,t){var o,c;((o=n==null?void 0:n.params)==null?void 0:o.catchAll)!==((c=t==null?void 0:t.params)==null?void 0:c.catchAll)&&(this.filterScheme=null,this.filters=null,this.onFilters=0,this.getFilters())},deep:!0},limit(n){var t;this.$router.push({query:{...(t=this.$route)==null?void 0:t.query,limit:n}})}},methods:{async getTableData(){var n,t;try{const{data:o}=await mt.get(`/api/template/table/${this.table}`),c=await mt.get(`/api/table-data/${this.table}`,{params:{page:this.page,search:this.searchValue||null,limit:this.limit,filter:this.filters||null,order:((t=(n=this.$route)==null?void 0:n.query)==null?void 0:t.sort)||null}});this.tableData={...o,...(c==null?void 0:c.data)||{}}}catch{}},async getFilters(){var n;try{const{data:t}=await mt.get(`/api/table-filter/${this.table}`);this.filterScheme=(n=t==null?void 0:t.list)==null?void 0:n.map(o=>({...o,label:(o==null?void 0:o.label)||(o==null?void 0:o.ua)}))}catch{}},async handlePageChange(n){const t=this.$route.query;this.page=n,!(!(t!=null&&t.page)&&n===1||t.page===n)&&(await this.$router.replace({query:{...t,page:n}}),await this.getTableData())},async changeLimit(n){this.limit=await n,this.defaultPage=1,await this.getTableData()},closeFilter({target:n}){this.isFilters&&n.classList.contains("filter-container")&&(this.isFilters=!1)},async filterChange({url:n,state:t}){var o;this.filters=n!=="no-url"?n:null,this.onFilters=(o=Object.entries(t))==null?void 0:o.length,this.page=1,await this.getTableData()},changeActiveColumn(n){this.activeColumn=n,this.getTableData()},pushToCard(n){var t;((t=this.tableData)==null?void 0:t.card)===!1||this.$router.push(`/card/${this.table}/${n}`)}}},sI={class:"w-[calc(100vw - 320px)]"},oI={class:"h-[76px] bg-gray-50 flex items-center justify-between px-[30px]"},aI={class:"text-xl font-medium h-[20px]"},lI={style:{height:"calc(100vh - 140px)",width:"calc(100vw - 260px)"},class:"bg-gray-50 p-[20px] flex pt-[10px]"},cI={class:"bg-white w-full rounded-xl border p-[20px]"},hI={class:"flex sm:grid sm:grid-cols-2 gap-x-2 sm:gap-x-5 mb-[10px] relative"},uI={class:"flex gap-[6px] ml-auto"},dI={key:0,class:"font-medium text-[10px] py-0.5 px-[5px] bg-gray-800 text-white leading-3 rounded-full dark:bg-neutral-500"},pI={class:"space-y-5 flex items-start w-full justify-start"},fI={style:{height:"calc(100vh - 310px)"},class:"overflow-x-auto w-full border-t [&::-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"},mI={class:"inline-block w-full align-middle"},gI={key:0,class:"divide-y divide-gray-200 min-w-full dark:divide-neutral-700 relative table-fixed"},yI={class:"sticky top-0 bg-white w-full relative after:absolute after:content-[''] after:block after:w-full after:h-px after:bg-stone-200"},_I={class:"border-stone-200 right-0 z-[1]"},xI={class:"divide-y divide-gray-200"},bI={class:"min-w-[200px] text-start pe-4 py-3 text-sm text-gray-600"},vI=["onClick"],wI={class:"text-center sticky right-0 bg-white w-[80px] px-[10px]"},kI={class:"p-[20px] flex justify-end w-full"},SI={class:"filter-content h-screen bg-white w-[400px] p-[20px] pt-[10px] overflow-x-auto bg-white [&::-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 EI(n,t,o,c,d,x){var _e,me,Ie,tt,gt,Ve;const y=v.resolveComponent("IconPlus"),h=v.resolveComponent("router-link"),M=v.resolveComponent("IconSearch"),D=v.resolveComponent("VsText"),A=v.resolveComponent("AdminTableColumnsHidden"),z=v.resolveComponent("AdminTableExport"),L=v.resolveComponent("IconFilter"),N=v.resolveComponent("AdminTableColumn"),Y=v.resolveComponent("AdminTableControl"),ee=v.resolveComponent("AdminNodata"),oe=v.resolveComponent("VsPagination"),he=v.resolveComponent("VsFilter");return v.openBlock(),v.createElementBlock(v.Fragment,null,[v.createElementVNode("div",sI,[v.createElementVNode("div",oI,[v.createElementVNode("h2",aI,v.toDisplayString(o.title),1),x.isForm?(v.openBlock(),v.createBlock(h,{key:0,to:`/add?table=${(me=(_e=n.$route)==null?void 0:_e.params)==null?void 0:me.catchAll}`,class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-transparent bg-blue-600 text-white hover:bg-blue-700 hover:text-white duration-300"},{default:v.withCtx(()=>[v.createVNode(y,{height:"16",width:"16"}),t[5]||(t[5]=v.createTextVNode(" Додати "))]),_:1},8,["to"])):v.createCommentVNode("",!0)]),v.createElementVNode("div",lI,[v.createElementVNode("div",cI,[v.createElementVNode("div",hI,[v.createVNode(M,{height:"14",width:"14",class:"absolute top-[10px] left-[14px] text-gray-500 z-[1]"}),v.createVNode(D,{modelValue:d.searchValue,"onUpdate:modelValue":t[0]||(t[0]=rt=>d.searchValue=rt),placeholder:"Пошук...",clearable:!0,class:"[&>input]:py-[7px] [&>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"]),v.createElementVNode("div",uI,[v.createVNode(A,{columns:(Ie=d.tableData)==null?void 0:Ie.columns,onUpdateColumns:t[1]||(t[1]=rt=>d.tableData.columns=rt)},null,8,["columns"]),v.createVNode(z,{table:o.table,columns:(tt=d.tableData)==null?void 0:tt.columns},null,8,["table","columns"]),v.createElementVNode("button",{onClick:t[2]||(t[2]=rt=>d.isFilters=!d.isFilters),class:"py-2 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"},[v.createVNode(L,{height:"16",width:"16"}),t[6]||(t[6]=v.createTextVNode(" Фільтри ")),d.onFilters?(v.openBlock(),v.createElementBlock("span",dI,v.toDisplayString(d.onFilters),1)):v.createCommentVNode("",!0)])])]),v.createElementVNode("div",pI,[v.createElementVNode("div",fI,[v.createElementVNode("div",mI,[x.isNoData?(v.openBlock(),v.createBlock(ee,{key:1})):(v.openBlock(),v.createElementBlock("table",gI,[v.createElementVNode("thead",yI,[v.createElementVNode("tr",_I,[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList(x.columns,rt=>(v.openBlock(),v.createBlock(N,{key:rt.name,data:rt,activeColumn:d.activeColumn,onChangeActive:x.changeActiveColumn},null,8,["data","activeColumn","onChangeActive"]))),128)),t[7]||(t[7]=v.createElementVNode("th",{class:"w-[70px] sticky right-0 top-0 bg-white"},null,-1))])]),v.createElementVNode("tbody",xI,[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList((gt=d.tableData)==null?void 0:gt.rows,(rt,xt)=>{var zt,Et,Ki,Pt,ri,Vi,yn,zi;return v.openBlock(),v.createElementBlock("tr",{key:xt},[v.createElementVNode("td",bI,[v.createElementVNode("button",{onClick:()=>x.pushToCard(rt==null?void 0:rt.id),class:v.normalizeClass(["text-sm font-medium",[((zt=d.tableData)==null?void 0:zt.card)===!1?"":"text-blue-600 decoration-2 focus:outline-none focus:underline hover:text-blue-600 hover:underline"]])},[(v.openBlock(),v.createBlock(v.resolveDynamicComponent(((Et=x.columns[0])==null?void 0:Et.format)==="custom"?(Ki=x.columns[0])==null?void 0:Ki.component:n.$componentsConfig[`table-format-${((ri=(Pt=x.columns[0])==null?void 0:Pt.format)==null?void 0:ri.toLowerCase())||"text"}`]),{name:(Vi=x.columns[0])==null?void 0:Vi.name,data:rt,value:rt==null?void 0:rt[(yn=x.columns[0])==null?void 0:yn.name]},null,8,["name","data","value"]))],10,vI)]),(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList((zi=x.columns)==null?void 0:zi.slice(1),ui=>{var an;return v.openBlock(),v.createElementBlock("td",{class:"min-w-[300px] w-full text-start px-[4px] py-3 text-sm text-gray-600",key:ui.name},[(v.openBlock(),v.createBlock(v.resolveDynamicComponent((ui==null?void 0:ui.format)==="custom"?ui==null?void 0:ui.component:n.$componentsConfig[`table-format-${((an=ui==null?void 0:ui.format)==null?void 0:an.toLowerCase())||"text"}`]),{name:ui==null?void 0:ui.name,data:rt,value:rt==null?void 0:rt[ui==null?void 0:ui.name]},null,8,["name","data","value"]))])}),128)),v.createElementVNode("td",wI,[v.createVNode(Y,{isForm:x.isForm,item:rt,table:o.table,onUpdateTable:x.getTableData},null,8,["isForm","item","table","onUpdateTable"])])])}),128))])]))])])]),v.createElementVNode("div",kI,[d.limit?(v.openBlock(),v.createBlock(oe,{key:0,goTo:!1,class:"justify-end","default-page":x.defaultPage,total:((Ve=d.tableData)==null?void 0:Ve.total)||0,pageSize:d.limit,onPageChange:x.handlePageChange,pageSizes:[10,16,20],onPageSizeChange:x.changeLimit},null,8,["default-page","total","pageSize","onPageChange","onPageSizeChange"])):v.createCommentVNode("",!0)])])])]),v.createVNode(v.Transition,{name:"fade"},{default:v.withCtx(()=>{var rt;return[v.withDirectives(v.createElementVNode("div",{onClick:t[4]||(t[4]=(...xt)=>x.closeFilter&&x.closeFilter(...xt)),style:{height:"100vh"},class:"fixed filter-container top-0 flex justify-end items-center z-[2] right-0 left-0 bottom-0 bg-[rgba(0,0,0,0.5)]"},[v.createElementVNode("div",SI,[(rt=d.filterScheme)!=null&&rt.length?(v.openBlock(),v.createBlock(he,{key:0,ref:"filter",scheme:d.filterScheme,layout:"default","apply-vue-router":"",history:"",name:"filter",onFilterChange:x.filterChange,closeFilterBtn:!0,onFilterClose:t[3]||(t[3]=xt=>d.isFilters=!1)},null,8,["scheme","onFilterChange"])):v.createCommentVNode("",!0)])],512),[[v.vShow,d.isFilters]])]}),_:1})],64)}const TI={components:{AdminTable:vt(rI,[["render",EI]])},data(){return{table:!1,interface:"",title:""}},watch:{$route:{async handler(){nr!=null&&nr.value||await this.getMenu(),await this.checkPageType()},deep:!0},title(n){n&&(document.title=n)}},async mounted(){await this.checkPageType()},methods:{flattenMenu(n){const t=[];return n.forEach(o=>{o.menu?t.push(...this.flattenMenu(o.menu)):t.push(o)}),t},async getMenu(){try{const{data:n}=await mt.get("/api/user-menu");nr.value=n}catch{}},async checkPageType(){const n=this.flattenMenu(nr.value);n!=null&&n.length||this.$router.replace("/404");const t=n==null?void 0:n.find(c=>{var d,x;return(c==null?void 0:c.path)==((x=(d=this.$route)==null?void 0:d.params)==null?void 0:x.catchAll)});this.title=t==null?void 0:t.ua,t||this.$router.replace("/404");const o=t==null?void 0:t.table;this.table=o||!1,!o&&this.getInterface()},async getInterface(){var n,t;try{const{data:o}=await mt.get(`/api/template/interface/${((t=(n=this.$route)==null?void 0:n.params)==null?void 0:t.catchAll)||""}`);this.interface=o||""}catch{this.interface=""}}}},CI=["innerHTML"];function MI(n,t,o,c,d,x){const y=v.resolveComponent("AdminTable");return d.table?(v.openBlock(),v.createBlock(y,{key:0,table:d.table,title:d.title},null,8,["table","title"])):(v.openBlock(),v.createElementBlock("div",{key:1,class:"w-full bg-gray-50",style:{height:"calc(100vh - 120px)"},innerHTML:d.interface},null,8,CI))}const PI=Object.freeze(Object.defineProperty({__proto__:null,default:vt(TI,[["render",MI]])},Symbol.toStringTag,{value:"Module"}));return aC});
|
|
629
|
+
<source src="{{src}}" type="{{format}}" />Sorry, your browser doesn't support embedded videos.</video>`,videoFormat:"",vimeo:{byline:1,color:"00adef",controls:1,dnt:1,muted:0},youtube:{controls:1,enablejsapi:1,nocookie:1,rel:0,fs:1}},jE=["image","html","ajax","inline","clone","iframe","map","pdf","html5video","youtube","vimeo"];class i0 extends Vr{onBeforeInitSlide(t,o,c){this.processType(c)}onCreateSlide(t,o,c){this.setContent(c)}onClearContent(t,o){o.xhr&&(o.xhr.abort(),o.xhr=null);const c=o.iframeEl;c&&(c.onload=c.onerror=null,c.src="//about:blank",o.iframeEl=null);const d=o.contentEl,x=o.placeholderEl;if(o.type==="inline"&&d&&x)d.classList.remove("fancybox__content"),getComputedStyle(d).getPropertyValue("display")!=="none"&&(d.style.display="none"),setTimeout(()=>{x&&(d&&x.parentNode&&x.parentNode.insertBefore(d,x),x.remove())},0),o.contentEl=void 0,o.placeholderEl=void 0;else for(;o.el&&o.el.firstChild;)o.el.removeChild(o.el.firstChild)}onSelectSlide(t,o,c){c.state===gn.Ready&&this.playVideo()}onUnselectSlide(t,o,c){var d,x;if(c.type===ac){try{(x=(d=c.el)===null||d===void 0?void 0:d.querySelector("video"))===null||x===void 0||x.pause()}catch{}return}let y;c.type===Ho?y={method:"pause",value:"true"}:c.type===Es&&(y={event:"command",func:"pauseVideo"}),y&&c.iframeEl&&c.iframeEl.contentWindow&&c.iframeEl.contentWindow.postMessage(JSON.stringify(y),"*"),c.poller&&clearTimeout(c.poller)}onDone(t,o){t.isCurrentSlide(o)&&!t.isClosing()&&this.playVideo()}onRefresh(t,o){o.slides.forEach(c=>{c.el&&(this.resizeIframe(c),this.setAspectRatio(c))})}onMessage(t){try{let o=JSON.parse(t.data);if(t.origin==="https://player.vimeo.com"){if(o.event==="ready")for(let c of Array.from(document.getElementsByClassName("fancybox__iframe")))c instanceof HTMLIFrameElement&&c.contentWindow===t.source&&(c.dataset.ready="true")}else if(t.origin.match(/^https:\/\/(www.)?youtube(-nocookie)?.com$/)&&o.event==="onReady"){const c=document.getElementById(o.id);c&&(c.dataset.ready="true")}}catch{}}loadAjaxContent(t){const o=this.instance.optionFor(t,"src")||"";this.instance.showLoading(t);const c=this.instance,d=new XMLHttpRequest;c.showLoading(t),d.onreadystatechange=function(){d.readyState===XMLHttpRequest.DONE&&c.state===Xi.Ready&&(c.hideLoading(t),d.status===200?c.setContent(t,d.responseText):c.setError(t,d.status===404?"{{AJAX_NOT_FOUND}}":"{{AJAX_FORBIDDEN}}"))};const x=t.ajax||null;d.open(x?"POST":"GET",o+""),d.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),d.setRequestHeader("X-Requested-With","XMLHttpRequest"),d.send(x),t.xhr=d}setInlineContent(t){let o=null;if(Hn(t.src))o=t.src;else if(typeof t.src=="string"){const c=t.src.split("#",2).pop();o=c?document.getElementById(c):null}if(o){if(t.type==="clone"||o.closest(".fancybox__slide")){o=o.cloneNode(!0);const c=o.dataset.animationName;c&&(o.classList.remove(c),delete o.dataset.animationName);let d=o.getAttribute("id");d=d?`${d}--clone`:`clone-${this.instance.id}-${t.index}`,o.setAttribute("id",d)}else if(o.parentNode){const c=document.createElement("div");c.classList.add("fancybox-placeholder"),o.parentNode.insertBefore(c,o),t.placeholderEl=c}this.instance.setContent(t,o)}else this.instance.setError(t,"{{ELEMENT_NOT_FOUND}}")}setIframeContent(t){const{src:o,el:c}=t;if(!o||typeof o!="string"||!c)return;c.classList.add("is-loading");const d=this.instance,x=document.createElement("iframe");x.className="fancybox__iframe",x.setAttribute("id",`fancybox__iframe_${d.id}_${t.index}`);for(const[h,M]of Object.entries(this.optionFor(t,"iframeAttr")||{}))x.setAttribute(h,M);x.onerror=()=>{d.setError(t,"{{IFRAME_ERROR}}")},t.iframeEl=x;const y=this.optionFor(t,"preload");if(t.type!=="iframe"||y===!1)return x.setAttribute("src",t.src+""),d.setContent(t,x,!1),this.resizeIframe(t),void d.revealContent(t);d.showLoading(t),x.onload=()=>{if(!x.src.length)return;const h=x.dataset.ready!=="true";x.dataset.ready="true",this.resizeIframe(t),h?d.revealContent(t):d.hideLoading(t)},x.setAttribute("src",o),d.setContent(t,x,!1)}resizeIframe(t){const{type:o,iframeEl:c}=t;if(o===Es||o===Ho)return;const d=c==null?void 0:c.parentElement;if(!c||!d)return;let x=t.autoSize;x===void 0&&(x=this.optionFor(t,"autoSize"));let y=t.width||0,h=t.height||0;y&&h&&(x=!1);const M=d&&d.style;if(t.preload!==!1&&x!==!1&&M)try{const D=window.getComputedStyle(d),A=parseFloat(D.paddingLeft)+parseFloat(D.paddingRight),z=parseFloat(D.paddingTop)+parseFloat(D.paddingBottom),L=c.contentWindow;if(L){const N=L.document,Y=N.getElementsByTagName(Lp)[0],ee=N.body;M.width="",ee.style.overflow="hidden",y=y||Y.scrollWidth+A,M.width=`${y}px`,ee.style.overflow="",M.flex="0 0 auto",M.height=`${ee.scrollHeight}px`,h=Y.scrollHeight+z}}catch{}if(y||h){const D={flex:"0 1 auto",width:"",height:""};y&&y!=="auto"&&(D.width=`${y}px`),h&&h!=="auto"&&(D.height=`${h}px`),Object.assign(M,D)}}playVideo(){const t=this.instance.getSlide();if(!t)return;const{el:o}=t;if(!o||!o.offsetParent||!this.optionFor(t,"videoAutoplay"))return;if(t.type===ac)try{const d=o.querySelector("video");if(d){const x=d.play();x!==void 0&&x.then(()=>{}).catch(y=>{d.muted=!0,d.play()})}}catch{}if(t.type!==Es&&t.type!==Ho)return;const c=()=>{if(t.iframeEl&&t.iframeEl.contentWindow){let d;if(t.iframeEl.dataset.ready==="true")return d=t.type===Es?{event:"command",func:"playVideo"}:{method:"play",value:"true"},d&&t.iframeEl.contentWindow.postMessage(JSON.stringify(d),"*"),void(t.poller=void 0);t.type===Es&&(d={event:"listening",id:t.iframeEl.getAttribute("id")},t.iframeEl.contentWindow.postMessage(JSON.stringify(d),"*"))}t.poller=setTimeout(c,250)};c()}processType(t){if(t.html)return t.type=Lp,t.src=t.html,void(t.html="");const o=this.instance.optionFor(t,"src","");if(!o||typeof o!="string")return;let c=t.type,d=null;if(d=o.match(/(youtube\.com|youtu\.be|youtube\-nocookie\.com)\/(?:watch\?(?:.*&)?v=|v\/|u\/|shorts\/|embed\/?)?(videoseries\?list=(?:.*)|[\w-]{11}|\?listType=(?:.*)&list=(?:.*))(?:.*)/i)){const x=this.optionFor(t,Es),{nocookie:y}=x,h=function(z,L){var N={};for(var Y in z)Object.prototype.hasOwnProperty.call(z,Y)&&L.indexOf(Y)<0&&(N[Y]=z[Y]);if(z!=null&&typeof Object.getOwnPropertySymbols=="function"){var ee=0;for(Y=Object.getOwnPropertySymbols(z);ee<Y.length;ee++)L.indexOf(Y[ee])<0&&Object.prototype.propertyIsEnumerable.call(z,Y[ee])&&(N[Y[ee]]=z[Y[ee]])}return N}(x,["nocookie"]),M=`www.youtube${y?"-nocookie":""}.com`,D=t0(o,h),A=encodeURIComponent(d[2]);t.videoId=A,t.src=`https://${M}/embed/${A}?${D}`,t.thumbSrc=t.thumbSrc||`https://i.ytimg.com/vi/${A}/mqdefault.jpg`,c=Es}else if(d=o.match(/^.+vimeo.com\/(?:\/)?([\d]+)((\/|\?h=)([a-z0-9]+))?(.*)?/)){const x=t0(o,this.optionFor(t,Ho)),y=encodeURIComponent(d[1]),h=d[4]||"";t.videoId=y,t.src=`https://player.vimeo.com/video/${y}?${h?`h=${h}${x?"&":""}`:""}${x}`,c=Ho}if(!c&&t.triggerEl){const x=t.triggerEl.dataset.type;jE.includes(x)&&(c=x)}c||typeof o=="string"&&(o.charAt(0)==="#"?c="inline":(d=o.match(/\.(mp4|mov|ogv|webm)((\?|#).*)?$/i))?(c=ac,t.videoFormat=t.videoFormat||"video/"+(d[1]==="ogv"?"ogg":d[1])):o.match(/(^data:image\/[a-z0-9+\/=]*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg|ico)((\?|#).*)?$)/i)?c=e0:o.match(/\.(pdf)((\?|#).*)?$/i)&&(c="pdf")),(d=o.match(/(?:maps\.)?google\.([a-z]{2,3}(?:\.[a-z]{2})?)\/(?:(?:(?:maps\/(?:place\/(?:.*)\/)?\@(.*),(\d+.?\d+?)z))|(?:\?ll=))(.*)?/i))?(t.src=`https://maps.google.${d[1]}/?ll=${(d[2]?d[2]+"&z="+Math.floor(parseFloat(d[3]))+(d[4]?d[4].replace(/^\//,"&"):""):d[4]+"").replace(/\?/,"&")}&output=${d[4]&&d[4].indexOf("layer=c")>0?"svembed":"embed"}`,c=Rp):(d=o.match(/(?:maps\.)?google\.([a-z]{2,3}(?:\.[a-z]{2})?)\/(?:maps\/search\/)(.*)/i))&&(t.src=`https://maps.google.${d[1]}/maps?q=${d[2].replace("query=","q=").replace("api=1","")}&output=embed`,c=Rp),c=c||this.instance.option("defaultType"),t.type=c,c===e0&&(t.thumbSrc=t.thumbSrc||t.src)}setContent(t){const o=this.instance.optionFor(t,"src")||"";if(t&&t.type&&o){switch(t.type){case Lp:this.instance.setContent(t,o);break;case ac:const c=this.option("videoTpl");c&&this.instance.setContent(t,c.replace(/\{\{src\}\}/gi,o+"").replace(/\{\{format\}\}/gi,this.optionFor(t,"videoFormat")||"").replace(/\{\{poster\}\}/gi,t.poster||t.thumbSrc||""));break;case"inline":case"clone":this.setInlineContent(t);break;case"ajax":this.loadAjaxContent(t);break;case"pdf":case Rp:case Es:case Ho:t.preload=!1;case"iframe":this.setIframeContent(t)}this.setAspectRatio(t)}}setAspectRatio(t){const o=t.contentEl;if(!(t.el&&o&&t.type&&[Es,Ho,ac].includes(t.type)))return;let c,d=t.width||"auto",x=t.height||"auto";if(d==="auto"||x==="auto"){c=this.optionFor(t,"videoRatio");const D=(c+"").match(/(\d+)\s*\/\s?(\d+)/);c=D&&D.length>2?parseFloat(D[1])/parseFloat(D[2]):parseFloat(c+"")}else d&&x&&(c=d/x);if(!c)return;o.style.aspectRatio="",o.style.width="",o.style.height="",o.offsetHeight;const y=o.getBoundingClientRect(),h=y.width||1,M=y.height||1;o.style.aspectRatio=c+"",c<h/M?(x=x==="auto"?M:Math.min(M,x),o.style.width="auto",o.style.height=`${x}px`):(d=d==="auto"?h:Math.min(h,d),o.style.width=`${d}px`,o.style.height="auto")}attach(){const t=this,o=t.instance;o.on("Carousel.beforeInitSlide",t.onBeforeInitSlide),o.on("Carousel.createSlide",t.onCreateSlide),o.on("Carousel.selectSlide",t.onSelectSlide),o.on("Carousel.unselectSlide",t.onUnselectSlide),o.on("Carousel.Panzoom.refresh",t.onRefresh),o.on("done",t.onDone),o.on("clearContent",t.onClearContent),window.addEventListener("message",t.onMessage)}detach(){const t=this,o=t.instance;o.off("Carousel.beforeInitSlide",t.onBeforeInitSlide),o.off("Carousel.createSlide",t.onCreateSlide),o.off("Carousel.selectSlide",t.onSelectSlide),o.off("Carousel.unselectSlide",t.onUnselectSlide),o.off("Carousel.Panzoom.refresh",t.onRefresh),o.off("done",t.onDone),o.off("clearContent",t.onClearContent),window.removeEventListener("message",t.onMessage)}}Object.defineProperty(i0,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:$E});const cu="play",hu="pause",lc="ready";class n0 extends Vr{constructor(){super(...arguments),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:lc}),Object.defineProperty(this,"inHover",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"timer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"progressBar",{enumerable:!0,configurable:!0,writable:!0,value:null})}get isActive(){return this.state!==lc}onReady(t){this.option("autoStart")&&(t.isInfinite||t.page<t.pages.length-1)&&this.start()}onChange(){this.removeProgressBar(),this.pause()}onSettle(){this.resume()}onVisibilityChange(){document.visibilityState==="visible"?this.resume():this.pause()}onMouseEnter(){this.inHover=!0,this.pause()}onMouseLeave(){var t;this.inHover=!1,!((t=this.instance.panzoom)===null||t===void 0)&&t.isResting&&this.resume()}onTimerEnd(){const t=this.instance;this.state==="play"&&(t.isInfinite||t.page!==t.pages.length-1?t.slideNext():t.slideTo(0))}removeProgressBar(){this.progressBar&&(this.progressBar.remove(),this.progressBar=null)}createProgressBar(){var t;if(!this.option("showProgress"))return null;this.removeProgressBar();const o=this.instance,c=((t=o.pages[o.page])===null||t===void 0?void 0:t.slides)||[];let d=this.option("progressParentEl");if(d||(d=(c.length===1?c[0].el:null)||o.viewport),!d)return null;const x=document.createElement("div");return dt(x,"f-progress"),d.prepend(x),this.progressBar=x,x.offsetHeight,x}set(){const t=this,o=t.instance;if(o.pages.length<2||t.timer)return;const c=t.option("timeout");t.state=cu,dt(o.container,"has-autoplay");let d=t.createProgressBar();d&&(d.style.transitionDuration=`${c}ms`,d.style.transform="scaleX(1)"),t.timer=setTimeout(()=>{t.timer=null,t.inHover||t.onTimerEnd()},c),t.emit("set")}clear(){const t=this;t.timer&&(clearTimeout(t.timer),t.timer=null),t.removeProgressBar()}start(){const t=this;if(t.set(),t.state!==lc){if(t.option("pauseOnHover")){const o=t.instance.container;o.addEventListener("mouseenter",t.onMouseEnter,!1),o.addEventListener("mouseleave",t.onMouseLeave,!1)}document.addEventListener("visibilitychange",t.onVisibilityChange,!1),t.emit("start")}}stop(){const t=this,o=t.state,c=t.instance.container;t.clear(),t.state=lc,c.removeEventListener("mouseenter",t.onMouseEnter,!1),c.removeEventListener("mouseleave",t.onMouseLeave,!1),document.removeEventListener("visibilitychange",t.onVisibilityChange,!1),ni(c,"has-autoplay"),o!==lc&&t.emit("stop")}pause(){const t=this;t.state===cu&&(t.state=hu,t.clear(),t.emit(hu))}resume(){const t=this,o=t.instance;if(o.isInfinite||o.page!==o.pages.length-1)if(t.state!==cu){if(t.state===hu&&!t.inHover){const c=new Event("resume",{bubbles:!0,cancelable:!0});t.emit("resume",c),c.defaultPrevented||t.set()}}else t.set();else t.stop()}toggle(){this.state===cu||this.state===hu?this.stop():this.start()}attach(){const t=this,o=t.instance;o.on("ready",t.onReady),o.on("Panzoom.startAnimation",t.onChange),o.on("Panzoom.endAnimation",t.onSettle),o.on("Panzoom.touchMove",t.onChange)}detach(){const t=this,o=t.instance;o.off("ready",t.onReady),o.off("Panzoom.startAnimation",t.onChange),o.off("Panzoom.endAnimation",t.onSettle),o.off("Panzoom.touchMove",t.onChange),t.stop()}}Object.defineProperty(n0,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{autoStart:!0,pauseOnHover:!0,progressParentEl:null,showProgress:!0,timeout:3e3}});class r0 extends Vr{constructor(){super(...arguments),Object.defineProperty(this,"ref",{enumerable:!0,configurable:!0,writable:!0,value:null})}onPrepare(t){const o=t.carousel;if(!o)return;const c=t.container;c&&(o.options.Autoplay=Un({autoStart:!1},this.option("Autoplay")||{},{pauseOnHover:!1,timeout:this.option("timeout"),progressParentEl:()=>this.option("progressParentEl")||null,on:{start:()=>{t.emit("startSlideshow")},set:d=>{var x;c.classList.add("has-slideshow"),((x=t.getSlide())===null||x===void 0?void 0:x.state)!==gn.Ready&&d.pause()},stop:()=>{c.classList.remove("has-slideshow"),t.isCompact||t.endIdle(),t.emit("endSlideshow")},resume:(d,x)=>{var y,h,M;!x||!x.cancelable||((y=t.getSlide())===null||y===void 0?void 0:y.state)===gn.Ready&&(!((M=(h=t.carousel)===null||h===void 0?void 0:h.panzoom)===null||M===void 0)&&M.isResting)||x.preventDefault()}}}),o.attachPlugins({Autoplay:n0}),this.ref=o.plugins.Autoplay)}onReady(t){const o=t.carousel,c=this.ref;c&&o&&this.option("playOnStart")&&(o.isInfinite||o.page<o.pages.length-1)&&c.start()}onDone(t,o){const c=this.ref,d=t.carousel;if(!c||!d)return;const x=o.panzoom;x&&x.on("startAnimation",()=>{t.isCurrentSlide(o)&&c.stop()}),t.isCurrentSlide(o)&&c.resume()}onKeydown(t,o){var c;const d=this.ref;d&&o===this.option("key")&&((c=document.activeElement)===null||c===void 0?void 0:c.nodeName)!=="BUTTON"&&d.toggle()}attach(){const t=this,o=t.instance;o.on("Carousel.init",t.onPrepare),o.on("Carousel.ready",t.onReady),o.on("done",t.onDone),o.on("keydown",t.onKeydown)}detach(){const t=this,o=t.instance;o.off("Carousel.init",t.onPrepare),o.off("Carousel.ready",t.onReady),o.off("done",t.onDone),o.off("keydown",t.onKeydown)}}Object.defineProperty(r0,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{key:" ",playOnStart:!1,progressParentEl:n=>{var t;return((t=n.instance.container)===null||t===void 0?void 0:t.querySelector(".fancybox__toolbar [data-fancybox-toggle-slideshow]"))||n.instance.container},timeout:3e3}});const s0={classes:{container:"f-thumbs f-carousel__thumbs",viewport:"f-thumbs__viewport",track:"f-thumbs__track",slide:"f-thumbs__slide",isResting:"is-resting",isSelected:"is-selected",isLoading:"is-loading",hasThumbs:"has-thumbs"},minCount:2,parentEl:null,thumbTpl:'<button class="f-thumbs__slide__button" tabindex="0" type="button" aria-label="{{GOTO}}" data-carousel-index="%i"><img class="f-thumbs__slide__img" data-lazy-src="{{%s}}" alt="" /></button>',type:"modern"};var Ts;(function(n){n[n.Init=0]="Init",n[n.Ready=1]="Ready",n[n.Hidden=2]="Hidden"})(Ts||(Ts={}));const o0="isResting",uu="thumbWidth",$a="thumbHeight",ts="thumbClipWidth";let a0=class extends Vr{constructor(){super(...arguments),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:"modern"}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"track",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"carousel",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"thumbWidth",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbClipWidth",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbHeight",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbGap",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbExtraGap",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:Ts.Init})}get isModern(){return this.type==="modern"}onInitSlide(n,t){const o=t.el?t.el.dataset:void 0;o&&(t.thumbSrc=o.thumbSrc||t.thumbSrc||"",t[ts]=parseFloat(o[ts]||"")||t[ts]||0,t[$a]=parseFloat(o.thumbHeight||"")||t[$a]||0),this.addSlide(t)}onInitSlides(){this.build()}onChange(){var n;if(!this.isModern)return;const t=this.container,o=this.instance,c=o.panzoom,d=this.carousel,x=d?d.panzoom:null,y=o.page;if(c&&d&&x){if(c.isDragging){ni(t,this.cn(o0));let h=((n=d.pages[y])===null||n===void 0?void 0:n.pos)||0;h+=o.getProgress(y)*(this[ts]+this.thumbGap);let M=x.getBounds();-1*h>M.x.min&&-1*h<M.x.max&&x.panTo({x:-1*h,friction:.12})}else es(t,this.cn(o0),c.isResting);this.shiftModern()}}onRefresh(){this.updateProps();for(const n of this.instance.slides||[])this.resizeModernSlide(n);this.shiftModern()}isDisabled(){const n=this.option("minCount")||0;if(n){const o=this.instance;let c=0;for(const d of o.slides||[])d.thumbSrc&&c++;if(c<n)return!0}const t=this.option("type");return["modern","classic"].indexOf(t)<0}getThumb(n){const t=this.option("thumbTpl")||"";return{html:this.instance.localize(t,[["%i",n.index],["%d",n.index+1],["%s",n.thumbSrc||"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"]])}}addSlide(n){const t=this.carousel;t&&t.addSlide(n.index,this.getThumb(n))}getSlides(){const n=[];for(const t of this.instance.slides||[])n.push(this.getThumb(t));return n}resizeModernSlide(n){this.isModern&&(n[uu]=n[ts]&&n[$a]?Math.round(this[$a]*(n[ts]/n[$a])):this[uu])}updateProps(){const n=this.container;if(!n)return;const t=o=>parseFloat(getComputedStyle(n).getPropertyValue("--f-thumb-"+o))||0;this.thumbGap=t("gap"),this.thumbExtraGap=t("extra-gap"),this[uu]=t("width")||40,this[ts]=t("clip-width")||40,this[$a]=t("height")||40}build(){const n=this;if(n.state!==Ts.Init)return;if(n.isDisabled())return void n.emit("disabled");const t=n.instance,o=t.container,c=n.getSlides(),d=n.option("type");n.type=d;const x=n.option("parentEl"),y=n.cn("container"),h=n.cn("track");let M=x==null?void 0:x.querySelector("."+y);M||(M=document.createElement("div"),dt(M,y),x?x.appendChild(M):o.after(M)),dt(M,`is-${d}`),dt(o,n.cn("hasThumbs")),n.container=M,n.updateProps();let D=M.querySelector("."+h);D||(D=document.createElement("div"),dt(D,n.cn("track")),M.appendChild(D)),n.track=D;const A=Un({},{track:D,infinite:!1,center:!0,fill:d==="classic",dragFree:!0,slidesPerPage:1,transition:!1,preload:.25,friction:.12,Panzoom:{maxVelocity:0},Dots:!1,Navigation:!1,classes:{container:"f-thumbs",viewport:"f-thumbs__viewport",track:"f-thumbs__track",slide:"f-thumbs__slide"}},n.option("Carousel")||{},{Sync:{target:t},slides:c}),z=new t.constructor(M,A);z.on("createSlide",(L,N)=>{n.setProps(N.index),n.emit("createSlide",N,N.el)}),z.on("ready",()=>{n.shiftModern(),n.emit("ready")}),z.on("refresh",()=>{n.shiftModern()}),z.on("Panzoom.click",(L,N,Y)=>{n.onClick(Y)}),n.carousel=z,n.state=Ts.Ready}onClick(n){n.preventDefault(),n.stopPropagation();const t=this.instance,{pages:o,page:c}=t,d=ee=>{if(ee){const oe=ee.closest("[data-carousel-index]");if(oe)return[parseInt(oe.dataset.carouselIndex||"",10)||0,oe]}return[-1,void 0]},x=(ee,oe)=>{const he=document.elementFromPoint(ee,oe);return he?d(he):[-1,void 0]};let[y,h]=d(n.target);if(y>-1)return;const M=this[ts],D=n.clientX,A=n.clientY;let[z,L]=x(D-M,A),[N,Y]=x(D+M,A);L&&Y?(y=Math.abs(D-L.getBoundingClientRect().right)<Math.abs(D-Y.getBoundingClientRect().left)?z:N,y===c&&(y=y===z?N:z)):L?y=z:Y&&(y=N),y>-1&&o[y]&&t.slideTo(y)}getShift(n){var t;const o=this,{instance:c}=o,d=o.carousel;if(!c||!d)return 0;const x=o[uu],y=o[ts],h=o.thumbGap,M=o.thumbExtraGap;if(!(!((t=d.slides[n])===null||t===void 0)&&t.el))return 0;const D=.5*(x-y),A=c.pages.length-1;let z=c.getProgress(0),L=c.getProgress(A),N=c.getProgress(n,!1,!0),Y=0,ee=D+M+h;const oe=z<0&&z>-1,he=L>0&&L<1;return n===0?(Y=ee*Math.abs(z),he&&z===1&&(Y-=ee*Math.abs(L))):n===A?(Y=ee*Math.abs(L)*-1,oe&&L===-1&&(Y+=ee*Math.abs(z))):oe||he?(Y=-1*ee,Y+=ee*Math.abs(z),Y+=ee*(1-Math.abs(L))):Y=ee*N,Y}setProps(n){var t;const o=this;if(!o.isModern)return;const{instance:c}=o,d=o.carousel;if(c&&d){const x=(t=d.slides[n])===null||t===void 0?void 0:t.el;if(x&&x.childNodes.length){let y=Ye(1-Math.abs(c.getProgress(n))),h=Ye(o.getShift(n));x.style.setProperty("--progress",y?y+"":""),x.style.setProperty("--shift",h+"")}}}shiftModern(){const n=this;if(!n.isModern)return;const{instance:t,track:o}=n,c=t.panzoom,d=n.carousel;if(!(t&&o&&c&&d)||c.state===ci.Init||c.state===ci.Destroy)return;for(const y of t.slides)n.setProps(y.index);let x=(n[ts]+n.thumbGap)*(d.slides.length||0);o.style.setProperty("--width",x+"")}cleanup(){const n=this;n.carousel&&n.carousel.destroy(),n.carousel=null,n.container&&n.container.remove(),n.container=null,n.track&&n.track.remove(),n.track=null,n.state=Ts.Init,ni(n.instance.container,n.cn("hasThumbs"))}attach(){const n=this,t=n.instance;t.on("initSlide",n.onInitSlide),t.state===Ni.Init?t.on("initSlides",n.onInitSlides):n.onInitSlides(),t.on(["change","Panzoom.afterTransform"],n.onChange),t.on("Panzoom.refresh",n.onRefresh)}detach(){const n=this,t=n.instance;t.off("initSlide",n.onInitSlide),t.off("initSlides",n.onInitSlides),t.off(["change","Panzoom.afterTransform"],n.onChange),t.off("Panzoom.refresh",n.onRefresh),n.cleanup()}};Object.defineProperty(a0,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:s0});const UE=Object.assign(Object.assign({},s0),{key:"t",showOnStart:!0,parentEl:null}),l0="is-masked",c0="aria-hidden";class h0 extends Vr{constructor(){super(...arguments),Object.defineProperty(this,"ref",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"hidden",{enumerable:!0,configurable:!0,writable:!0,value:!1})}get isEnabled(){const t=this.ref;return t&&!t.isDisabled()}get isHidden(){return this.hidden}onClick(t,o){o.stopPropagation()}onCreateSlide(t,o){var c,d,x;const y=((x=(d=(c=this.instance)===null||c===void 0?void 0:c.carousel)===null||d===void 0?void 0:d.slides[o.index])===null||x===void 0?void 0:x.type)||"",h=o.el;if(h&&y){let M=`for-${y}`;["video","youtube","vimeo","html5video"].includes(y)&&(M+=" for-video"),dt(h,M)}}onInit(){var t;const o=this,c=o.instance,d=c.carousel;if(o.ref||!d)return;const x=o.option("parentEl")||c.footer||c.container;if(!x)return;const y=Un({},o.options,{parentEl:x,classes:{container:"f-thumbs fancybox__thumbs"},Carousel:{Sync:{friction:c.option("Carousel.friction")||0}},on:{ready:h=>{const M=h.container;M&&this.hidden&&(o.refresh(),M.style.transition="none",o.hide(),M.offsetHeight,queueMicrotask(()=>{M.style.transition="",o.show()}))}}});y.Carousel=y.Carousel||{},y.Carousel.on=Un(((t=o.options.Carousel)===null||t===void 0?void 0:t.on)||{},{click:this.onClick,createSlide:this.onCreateSlide}),d.options.Thumbs=y,d.attachPlugins({Thumbs:a0}),o.ref=d.plugins.Thumbs,o.option("showOnStart")||(o.ref.state=Ts.Hidden,o.hidden=!0)}onResize(){var t;const o=(t=this.ref)===null||t===void 0?void 0:t.container;o&&(o.style.maxHeight="")}onKeydown(t,o){const c=this.option("key");c&&c===o&&this.toggle()}toggle(){const t=this.ref;if(t&&!t.isDisabled())return t.state===Ts.Hidden?(t.state=Ts.Init,void t.build()):void(this.hidden?this.show():this.hide())}show(){const t=this.ref;if(!t||t.isDisabled())return;const o=t.container;o&&(this.refresh(),o.offsetHeight,o.removeAttribute(c0),o.classList.remove(l0),this.hidden=!1)}hide(){const t=this.ref,o=t&&t.container;o&&(this.refresh(),o.offsetHeight,o.classList.add(l0),o.setAttribute(c0,"true")),this.hidden=!0}refresh(){const t=this.ref;if(!t||!t.state)return;const o=t.container,c=(o==null?void 0:o.firstChild)||null;o&&c&&c.childNodes.length&&(o.style.maxHeight=`${c.getBoundingClientRect().height}px`)}attach(){const t=this,o=t.instance;o.state===Xi.Init?o.on("Carousel.init",t.onInit):t.onInit(),o.on("resize",t.onResize),o.on("keydown",t.onKeydown)}detach(){var t;const o=this,c=o.instance;c.off("Carousel.init",o.onInit),c.off("resize",o.onResize),c.off("keydown",o.onKeydown),(t=c.carousel)===null||t===void 0||t.detachPlugins(["Thumbs"]),o.ref=null}}Object.defineProperty(h0,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:UE});const Op={panLeft:{icon:'<svg><path d="M5 12h14M5 12l6 6M5 12l6-6"/></svg>',change:{panX:-100}},panRight:{icon:'<svg><path d="M5 12h14M13 18l6-6M13 6l6 6"/></svg>',change:{panX:100}},panUp:{icon:'<svg><path d="M12 5v14M18 11l-6-6M6 11l6-6"/></svg>',change:{panY:-100}},panDown:{icon:'<svg><path d="M12 5v14M18 13l-6 6M6 13l6 6"/></svg>',change:{panY:100}},zoomIn:{icon:'<svg><circle cx="11" cy="11" r="7.5"/><path d="m21 21-4.35-4.35M11 8v6M8 11h6"/></svg>',action:"zoomIn"},zoomOut:{icon:'<svg><circle cx="11" cy="11" r="7.5"/><path d="m21 21-4.35-4.35M8 11h6"/></svg>',action:"zoomOut"},toggle1to1:{icon:'<svg><path d="M3.51 3.07c5.74.02 11.48-.02 17.22.02 1.37.1 2.34 1.64 2.18 3.13 0 4.08.02 8.16 0 12.23-.1 1.54-1.47 2.64-2.79 2.46-5.61-.01-11.24.02-16.86-.01-1.36-.12-2.33-1.65-2.17-3.14 0-4.07-.02-8.16 0-12.23.1-1.36 1.22-2.48 2.42-2.46Z"/><path d="M5.65 8.54h1.49v6.92m8.94-6.92h1.49v6.92M11.5 9.4v.02m0 5.18v0"/></svg>',action:"toggleZoom"},toggleZoom:{icon:'<svg><g><line x1="11" y1="8" x2="11" y2="14"></line></g><circle cx="11" cy="11" r="7.5"/><path d="m21 21-4.35-4.35M8 11h6"/></svg>',action:"toggleZoom"},iterateZoom:{icon:'<svg><g><line x1="11" y1="8" x2="11" y2="14"></line></g><circle cx="11" cy="11" r="7.5"/><path d="m21 21-4.35-4.35M8 11h6"/></svg>',action:"iterateZoom"},rotateCCW:{icon:'<svg><path d="M15 4.55a8 8 0 0 0-6 14.9M9 15v5H4M18.37 7.16v.01M13 19.94v.01M16.84 18.37v.01M19.37 15.1v.01M19.94 11v.01"/></svg>',action:"rotateCCW"},rotateCW:{icon:'<svg><path d="M9 4.55a8 8 0 0 1 6 14.9M15 15v5h5M5.63 7.16v.01M4.06 11v.01M4.63 15.1v.01M7.16 18.37v.01M11 19.94v.01"/></svg>',action:"rotateCW"},flipX:{icon:'<svg style="stroke-width: 1.3"><path d="M12 3v18M16 7v10h5L16 7M8 7v10H3L8 7"/></svg>',action:"flipX"},flipY:{icon:'<svg style="stroke-width: 1.3"><path d="M3 12h18M7 16h10L7 21v-5M7 8h10L7 3v5"/></svg>',action:"flipY"},fitX:{icon:'<svg><path d="M4 12V6a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v6M10 18H3M21 18h-7M6 15l-3 3 3 3M18 15l3 3-3 3"/></svg>',action:"fitX"},fitY:{icon:'<svg><path d="M12 20H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h6M18 14v7M18 3v7M15 18l3 3 3-3M15 6l3-3 3 3"/></svg>',action:"fitY"},reset:{icon:'<svg><path d="M20 11A8.1 8.1 0 0 0 4.5 9M4 5v4h4M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4"/></svg>',action:"reset"},toggleFS:{icon:'<svg><g><path d="M14.5 9.5 21 3m0 0h-6m6 0v6M3 21l6.5-6.5M3 21v-6m0 6h6"/></g><g><path d="m14 10 7-7m-7 7h6m-6 0V4M3 21l7-7m0 0v6m0-6H4"/></g></svg>',action:"toggleFS"}};var qo;(function(n){n[n.Init=0]="Init",n[n.Ready=1]="Ready",n[n.Disabled=2]="Disabled"})(qo||(qo={}));const HE={absolute:"auto",display:{left:["infobar"],middle:[],right:["iterateZoom","slideshow","fullscreen","thumbs","close"]},enabled:"auto",items:{infobar:{tpl:'<div class="fancybox__infobar" tabindex="-1"><span data-fancybox-current-index></span>/<span data-fancybox-count></span></div>'},download:{tpl:'<a class="f-button" title="{{DOWNLOAD}}" data-fancybox-download href="javasript:;"><svg><path d="M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2M7 11l5 5 5-5M12 4v12"/></svg></a>'},prev:{tpl:'<button class="f-button" title="{{PREV}}" data-fancybox-prev><svg><path d="m15 6-6 6 6 6"/></svg></button>'},next:{tpl:'<button class="f-button" title="{{NEXT}}" data-fancybox-next><svg><path d="m9 6 6 6-6 6"/></svg></button>'},slideshow:{tpl:'<button class="f-button" title="{{TOGGLE_SLIDESHOW}}" data-fancybox-toggle-slideshow><svg><g><path d="M8 4v16l13 -8z"></path></g><g><path d="M8 4v15M17 4v15"/></g></svg></button>'},fullscreen:{tpl:'<button class="f-button" title="{{TOGGLE_FULLSCREEN}}" data-fancybox-toggle-fullscreen><svg><g><path d="M4 8V6a2 2 0 0 1 2-2h2M4 16v2a2 2 0 0 0 2 2h2M16 4h2a2 2 0 0 1 2 2v2M16 20h2a2 2 0 0 0 2-2v-2"/></g><g><path d="M15 19v-2a2 2 0 0 1 2-2h2M15 5v2a2 2 0 0 0 2 2h2M5 15h2a2 2 0 0 1 2 2v2M5 9h2a2 2 0 0 0 2-2V5"/></g></svg></button>'},thumbs:{tpl:'<button class="f-button" title="{{TOGGLE_THUMBS}}" data-fancybox-toggle-thumbs><svg><circle cx="5.5" cy="5.5" r="1"/><circle cx="12" cy="5.5" r="1"/><circle cx="18.5" cy="5.5" r="1"/><circle cx="5.5" cy="12" r="1"/><circle cx="12" cy="12" r="1"/><circle cx="18.5" cy="12" r="1"/><circle cx="5.5" cy="18.5" r="1"/><circle cx="12" cy="18.5" r="1"/><circle cx="18.5" cy="18.5" r="1"/></svg></button>'},close:{tpl:'<button class="f-button" title="{{CLOSE}}" data-fancybox-close><svg><path d="m19.5 4.5-15 15M4.5 4.5l15 15"/></svg></button>'}},parentEl:null},qE={tabindex:"-1",width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},u0="has-toolbar",Bp="fancybox__toolbar";class d0 extends Vr{constructor(){super(...arguments),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:qo.Init}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null})}onReady(t){var o;if(!t.carousel)return;let c=this.option("display"),d=this.option("absolute"),x=this.option("enabled");if(x==="auto"){const D=this.instance.carousel;let A=0;if(D)for(const z of D.slides)(z.panzoom||z.type==="image")&&A++;A||(x=!1)}x||(c=void 0);let y=0;const h={left:[],middle:[],right:[]};if(c)for(const D of["left","middle","right"])for(const A of c[D]){const z=this.createEl(A);z&&((o=h[D])===null||o===void 0||o.push(z),y++)}let M=null;if(y&&(M=this.createContainer()),M){for(const[D,A]of Object.entries(h)){const z=document.createElement("div");dt(z,Bp+"__column is-"+D);for(const L of A)z.appendChild(L);d!=="auto"||D!=="middle"||A.length||(d=!0),M.appendChild(z)}d===!0&&dt(M,"is-absolute"),this.state=qo.Ready,this.onRefresh()}else this.state=qo.Disabled}onClick(t){var o,c;const d=this.instance,x=d.getSlide(),y=x==null?void 0:x.panzoom,h=t.target,M=h&&Hn(h)?h.dataset:null;if(!M)return;if(M.fancyboxToggleThumbs!==void 0)return t.preventDefault(),t.stopPropagation(),void((o=d.plugins.Thumbs)===null||o===void 0||o.toggle());if(M.fancyboxToggleFullscreen!==void 0)return t.preventDefault(),t.stopPropagation(),void this.instance.toggleFullscreen();if(M.fancyboxToggleSlideshow!==void 0){t.preventDefault(),t.stopPropagation();const z=(c=d.carousel)===null||c===void 0?void 0:c.plugins.Autoplay;let L=z.isActive;return y&&y.panMode==="mousemove"&&!L&&y.reset(),void(L?z.stop():z.start())}const D=M.panzoomAction,A=M.panzoomChange;if((A||D)&&(t.preventDefault(),t.stopPropagation()),A){let z={};try{z=JSON.parse(A)}catch{}y&&y.applyChange(z)}else D&&y&&y[D]&&y[D]()}onChange(){this.onRefresh()}onRefresh(){if(this.instance.isClosing())return;const t=this.container;if(!t)return;const o=this.instance.getSlide();if(!o||o.state!==gn.Ready)return;const c=o&&!o.error&&o.panzoom;for(const y of t.querySelectorAll("[data-panzoom-action]"))c?(y.removeAttribute("disabled"),y.removeAttribute("tabindex")):(y.setAttribute("disabled",""),y.setAttribute("tabindex","-1"));let d=c&&c.canZoomIn(),x=c&&c.canZoomOut();for(const y of t.querySelectorAll('[data-panzoom-action="zoomIn"]'))d?(y.removeAttribute("disabled"),y.removeAttribute("tabindex")):(y.setAttribute("disabled",""),y.setAttribute("tabindex","-1"));for(const y of t.querySelectorAll('[data-panzoom-action="zoomOut"]'))x?(y.removeAttribute("disabled"),y.removeAttribute("tabindex")):(y.setAttribute("disabled",""),y.setAttribute("tabindex","-1"));for(const y of t.querySelectorAll('[data-panzoom-action="toggleZoom"],[data-panzoom-action="iterateZoom"]')){x||d?(y.removeAttribute("disabled"),y.removeAttribute("tabindex")):(y.setAttribute("disabled",""),y.setAttribute("tabindex","-1"));const h=y.querySelector("g");h&&(h.style.display=d?"":"none")}}onDone(t,o){var c;(c=o.panzoom)===null||c===void 0||c.on("afterTransform",()=>{this.instance.isCurrentSlide(o)&&this.onRefresh()}),this.instance.isCurrentSlide(o)&&this.onRefresh()}createContainer(){const t=this.instance.container;if(!t)return null;const o=this.option("parentEl")||t;let c=o.querySelector("."+Bp);return c||(c=document.createElement("div"),dt(c,Bp),o.prepend(c)),c.addEventListener("click",this.onClick,{passive:!1,capture:!0}),t&&dt(t,u0),this.container=c,c}createEl(t){const o=this.instance,c=o.carousel;if(!c||t==="toggleFS"||t==="fullscreen"&&!Zy())return null;let d=null;const x=c.slides.length||0;let y=0,h=0;for(const D of c.slides)(D.panzoom||D.type==="image")&&y++,(D.type==="image"||D.downloadSrc)&&h++;if(x<2&&["infobar","prev","next"].includes(t))return d;if(Op[t]!==void 0&&!y||t==="download"&&!h)return null;if(t==="thumbs"){const D=o.plugins.Thumbs;if(!D||!D.isEnabled)return null}if(t==="slideshow"&&(!c.plugins.Autoplay||x<2))return null;if(Op[t]!==void 0){const D=Op[t];d=document.createElement("button"),d.setAttribute("title",this.instance.localize(`{{${t.toUpperCase()}}}`)),dt(d,"f-button"),D.action&&(d.dataset.panzoomAction=D.action),D.change&&(d.dataset.panzoomChange=JSON.stringify(D.change)),d.appendChild(Qr(this.instance.localize(D.icon)))}else{const D=(this.option("items")||[])[t];D&&(d=Qr(this.instance.localize(D.tpl)),typeof D.click=="function"&&d.addEventListener("click",A=>{A.preventDefault(),A.stopPropagation(),typeof D.click=="function"&&D.click.call(this,this,A)}))}const M=d==null?void 0:d.querySelector("svg");if(M)for(const[D,A]of Object.entries(qE))M.getAttribute(D)||M.setAttribute(D,String(A));return d}removeContainer(){const t=this.container;t&&t.remove(),this.container=null,this.state=qo.Disabled;const o=this.instance.container;o&&ni(o,u0)}attach(){const t=this,o=t.instance;o.on("Carousel.initSlides",t.onReady),o.on("done",t.onDone),o.on(["reveal","Carousel.change"],t.onChange),t.onReady(t.instance)}detach(){const t=this,o=t.instance;o.off("Carousel.initSlides",t.onReady),o.off("done",t.onDone),o.off(["reveal","Carousel.change"],t.onChange),t.removeContainer()}}Object.defineProperty(d0,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:HE});const ZE={Hash:class extends Vr{onReady(){oc=!1}onChange(n){Uo&&clearTimeout(Uo);const{hash:t}=Gy(),{hash:o}=au(),c=n.isOpeningSlide(n.getSlide());c&&(Wy=o===t?"":o),t&&t!==o&&(Uo=setTimeout(()=>{try{if(n.state===Xi.Ready){let d="replaceState";c&&!ou&&(d="pushState",ou=!0),window.history[d]({},document.title,window.location.pathname+window.location.search+t)}}catch{}},300))}onClose(n){if(Uo&&clearTimeout(Uo),!oc&&ou)return ou=!1,oc=!1,void window.history.back();if(!oc)try{window.history.replaceState({},document.title,window.location.pathname+window.location.search+(Wy||""))}catch{}}attach(){const n=this.instance;n.on("ready",this.onReady),n.on(["Carousel.ready","Carousel.change"],this.onChange),n.on("close",this.onClose)}detach(){const n=this.instance;n.off("ready",this.onReady),n.off(["Carousel.ready","Carousel.change"],this.onChange),n.off("close",this.onClose)}static parseURL(){return au()}static startFromUrl(){Yy()}static destroy(){window.removeEventListener("hashchange",Ky,!1)}},Html:i0,Images:Qy,Slideshow:r0,Thumbs:h0,Toolbar:d0},p0="with-fancybox",Fp="hide-scrollbar",f0="--fancybox-scrollbar-compensate",m0="--fancybox-body-margin",Np="aria-hidden",Vp="is-using-tab",$p="is-animated",g0="is-compact",y0="is-loading",jp="is-opening",du="has-caption",ja="disabled",Zo="tabindex",_0="download",Up="href",Ua="src",Ks=n=>typeof n=="string",x0=function(){var n=window.getSelection();return!!n&&n.type==="Range"};let wr,kr=null,Wo=null,b0=0,v0=0,w0=0,k0=0;const Ha=new Map;let WE=0;class Xt extends Tp{get isIdle(){return this.idle}get isCompact(){return this.option("compact")}constructor(t=[],o={},c={}){super(o),Object.defineProperty(this,"userSlides",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"userPlugins",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"idle",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"idleTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"clickTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"pwt",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"ignoreFocusChange",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"startedFs",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:Xi.Init}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"caption",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"footer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"carousel",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"lastFocus",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"prevMouseMoveEvent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),wr||(wr=Zy()),this.id=o.id||++WE,Ha.set(this.id,this),this.userSlides=t,this.userPlugins=c,queueMicrotask(()=>{this.init()})}init(){if(this.state===Xi.Destroy)return;this.state=Xi.Init,this.attachPlugins(Object.assign(Object.assign({},Xt.Plugins),this.userPlugins)),this.emit("init"),this.emit("attachPlugins"),this.option("hideScrollbar")===!0&&(()=>{if(!sc)return;const o=document,c=o.body,d=o.documentElement;if(c.classList.contains(Fp))return;let x=window.innerWidth-d.getBoundingClientRect().width;const y=parseFloat(window.getComputedStyle(c).marginRight);x<0&&(x=0),d.style.setProperty(f0,`${x}px`),y&&c.style.setProperty(m0,`${y}px`),c.classList.add(Fp)})(),this.initLayout(),this.scale();const t=()=>{this.initCarousel(this.userSlides),this.state=Xi.Ready,this.attachEvents(),this.emit("ready"),setTimeout(()=>{this.container&&this.container.setAttribute(Np,"false")},16)};this.option("Fullscreen.autoStart")&&wr&&!wr.isFullscreen()?wr.request().then(()=>{this.startedFs=!0,t()}).catch(()=>t()):t()}initLayout(){var t,o;const c=this.option("parentEl")||document.body,d=Qr(this.localize(this.option("tpl.main")||""));if(d){if(d.setAttribute("id",`fancybox-${this.id}`),d.setAttribute("aria-label",this.localize("{{MODAL}}")),d.classList.toggle(g0,this.isCompact),dt(d,this.option("mainClass")||""),dt(d,jp),this.container=d,this.footer=d.querySelector(".fancybox__footer"),c.appendChild(d),dt(document.documentElement,p0),kr&&Wo||(kr=document.createElement("span"),dt(kr,"fancybox-focus-guard"),kr.setAttribute(Zo,"0"),kr.setAttribute(Np,"true"),kr.setAttribute("aria-label","Focus guard"),Wo=kr.cloneNode(),(t=d.parentElement)===null||t===void 0||t.insertBefore(kr,d),(o=d.parentElement)===null||o===void 0||o.append(Wo)),d.addEventListener("mousedown",x=>{b0=x.pageX,v0=x.pageY,ni(d,Vp)}),this.option("closeExisting"))for(const x of Ha.values())x.id!==this.id&&x.close();else this.option("animated")&&(dt(d,$p),setTimeout(()=>{this.isClosing()||ni(d,$p)},350));this.emit("initLayout")}}initCarousel(t){const o=this.container;if(!o)return;const c=o.querySelector(".fancybox__carousel");if(!c)return;const d=this.carousel=new jo(c,Un({},{slides:t,transition:"fade",Panzoom:{lockAxis:this.option("dragToClose")?"xy":"x",infinite:!!this.option("dragToClose")&&"y"},Dots:!1,Navigation:{classes:{container:"fancybox__nav",button:"f-button",isNext:"is-next",isPrev:"is-prev"}},initialPage:this.option("startIndex"),l10n:this.option("l10n")},this.option("Carousel")||{}));d.on("*",(x,y,...h)=>{this.emit(`Carousel.${y}`,x,...h)}),d.on(["ready","change"],()=>{this.manageCaption()}),this.on("Carousel.removeSlide",(x,y,h)=>{this.clearContent(h),h.state=void 0}),d.on("Panzoom.touchStart",()=>{var x,y;this.isCompact||this.endIdle(),!((x=document.activeElement)===null||x===void 0)&&x.closest(".f-thumbs")&&((y=this.container)===null||y===void 0||y.focus())}),d.on("settle",()=>{this.idleTimer||this.isCompact||!this.option("idle")||this.setIdle(),this.option("autoFocus")&&!this.isClosing&&this.checkFocus()}),this.option("dragToClose")&&(d.on("Panzoom.afterTransform",(x,y)=>{const h=this.getSlide();if(h&&wp(h.el))return;const M=this.container;if(M){const D=Math.abs(y.current.f),A=D<1?"":Math.max(.5,Math.min(1,1-D/y.contentRect.fitHeight*1.5));M.style.setProperty("--fancybox-ts",A?"0s":""),M.style.setProperty("--fancybox-opacity",A+"")}}),d.on("Panzoom.touchEnd",(x,y,h)=>{var M;const D=this.getSlide();if(D&&wp(D.el)||y.isMobile&&document.activeElement&&["TEXTAREA","INPUT"].indexOf((M=document.activeElement)===null||M===void 0?void 0:M.nodeName)!==-1)return;const A=Math.abs(y.dragOffset.y);y.lockedAxis==="y"&&(A>=200||A>=50&&y.dragOffset.time<300)&&(h&&h.cancelable&&h.preventDefault(),this.close(h,"f-throwOut"+(y.current.f<0?"Up":"Down")))})),d.on("change",x=>{var y;let h=(y=this.getSlide())===null||y===void 0?void 0:y.triggerEl;if(h){const M=new CustomEvent("slideTo",{bubbles:!0,cancelable:!0,detail:x.page});h.dispatchEvent(M)}}),d.on(["refresh","change"],x=>{const y=this.container;if(!y)return;for(const D of y.querySelectorAll("[data-fancybox-current-index]"))D.innerHTML=x.page+1;for(const D of y.querySelectorAll("[data-fancybox-count]"))D.innerHTML=x.pages.length;if(!x.isInfinite){for(const D of y.querySelectorAll("[data-fancybox-next]"))x.page<x.pages.length-1?(D.removeAttribute(ja),D.removeAttribute(Zo)):(D.setAttribute(ja,""),D.setAttribute(Zo,"-1"));for(const D of y.querySelectorAll("[data-fancybox-prev]"))x.page>0?(D.removeAttribute(ja),D.removeAttribute(Zo)):(D.setAttribute(ja,""),D.setAttribute(Zo,"-1"))}const h=this.getSlide();if(!h)return;let M=h.downloadSrc||"";M||h.type!=="image"||h.error||!Ks(h[Ua])||(M=h[Ua]);for(const D of y.querySelectorAll("[data-fancybox-download]")){const A=h.downloadFilename;M?(D.removeAttribute(ja),D.removeAttribute(Zo),D.setAttribute(Up,M),D.setAttribute(_0,A||M),D.setAttribute("target","_blank")):(D.setAttribute(ja,""),D.setAttribute(Zo,"-1"),D.removeAttribute(Up),D.removeAttribute(_0))}}),this.emit("initCarousel")}attachEvents(){const t=this,o=t.container;if(!o)return;o.addEventListener("click",t.onClick,{passive:!1,capture:!1}),o.addEventListener("wheel",t.onWheel,{passive:!1,capture:!1}),document.addEventListener("keydown",t.onKeydown,{passive:!1,capture:!0}),document.addEventListener("visibilitychange",t.onVisibilityChange,!1),document.addEventListener("mousemove",t.onMousemove),t.option("trapFocus")&&document.addEventListener("focus",t.onFocus,!0),window.addEventListener("resize",t.onResize);const c=window.visualViewport;c&&(c.addEventListener("scroll",t.onResize),c.addEventListener("resize",t.onResize))}detachEvents(){const t=this,o=t.container;if(!o)return;document.removeEventListener("keydown",t.onKeydown,{passive:!1,capture:!0}),o.removeEventListener("wheel",t.onWheel,{passive:!1,capture:!1}),o.removeEventListener("click",t.onClick,{passive:!1,capture:!1}),document.removeEventListener("mousemove",t.onMousemove),window.removeEventListener("resize",t.onResize);const c=window.visualViewport;c&&(c.removeEventListener("resize",t.onResize),c.removeEventListener("scroll",t.onResize)),document.removeEventListener("visibilitychange",t.onVisibilityChange,!1),document.removeEventListener("focus",t.onFocus,!0)}scale(){const t=this.container;if(!t)return;const o=window.visualViewport,c=Math.max(1,(o==null?void 0:o.scale)||1);let d="",x="",y="";if(o&&c>1){let h=`${o.offsetLeft}px`,M=`${o.offsetTop}px`;d=o.width*c+"px",x=o.height*c+"px",y=`translate3d(${h}, ${M}, 0) scale(${1/c})`}t.style.transform=y,t.style.width=d,t.style.height=x}onClick(t){var o;const{container:c,isCompact:d}=this;if(!c||this.isClosing())return;!d&&this.option("idle")&&this.resetIdle();const x=t.composedPath()[0];if(x.closest(".fancybox-spinner")||x.closest("[data-fancybox-close]"))return t.preventDefault(),void this.close(t);if(x.closest("[data-fancybox-prev]"))return t.preventDefault(),void this.prev();if(x.closest("[data-fancybox-next]"))return t.preventDefault(),void this.next();if(t.type==="click"&&t.detail===0||Math.abs(t.pageX-b0)>30||Math.abs(t.pageY-v0)>30)return;const y=document.activeElement;if(x0()&&y&&c.contains(y))return;if(d&&((o=this.getSlide())===null||o===void 0?void 0:o.type)==="image")return void(this.clickTimer?(clearTimeout(this.clickTimer),this.clickTimer=null):this.clickTimer=setTimeout(()=>{this.toggleIdle(),this.clickTimer=null},350));if(this.emit("click",t),t.defaultPrevented)return;let h=!1;if(x.closest(".fancybox__content")){if(y){if(y.closest("[contenteditable]"))return;x.matches(Dp)||y.blur()}if(x0())return;h=this.option("contentClick")}else x.closest(".fancybox__carousel")&&!x.matches(Dp)&&(h=this.option("backdropClick"));h==="close"?(t.preventDefault(),this.close(t)):h==="next"?(t.preventDefault(),this.next()):h==="prev"&&(t.preventDefault(),this.prev())}onWheel(t){const o=t.target;let c=this.option("wheel",t);o.closest(".fancybox__thumbs")&&(c="slide");const d=c==="slide",x=[-t.deltaX||0,-t.deltaY||0,-t.detail||0].reduce(function(M,D){return Math.abs(D)>Math.abs(M)?D:M}),y=Math.max(-1,Math.min(1,x)),h=Date.now();this.pwt&&h-this.pwt<300?d&&t.preventDefault():(this.pwt=h,this.emit("wheel",t,y),t.defaultPrevented||(c==="close"?(t.preventDefault(),this.close(t)):c==="slide"&&(Jh(o)||(t.preventDefault(),this[y>0?"prev":"next"]()))))}onScroll(){window.scrollTo(w0,k0)}onKeydown(t){if(!this.isTopmost())return;this.isCompact||!this.option("idle")||this.isClosing()||this.resetIdle();const o=t.key,c=this.option("keyboard");if(!c)return;const d=t.composedPath()[0],x=document.activeElement&&document.activeElement.classList,y=x&&x.contains("f-button")||d.dataset.carouselPage||d.dataset.carouselIndex;if(o!=="Escape"&&!y&&Hn(d)&&(d.isContentEditable||["TEXTAREA","OPTION","INPUT","SELECT","VIDEO"].indexOf(d.nodeName)!==-1)||(t.key==="Tab"?dt(this.container,Vp):ni(this.container,Vp),t.ctrlKey||t.altKey||t.shiftKey))return;this.emit("keydown",o,t);const h=c[o];h&&typeof this[h]=="function"&&(t.preventDefault(),this[h]())}onResize(){const t=this.container;if(!t)return;const o=this.isCompact;t.classList.toggle(g0,o),this.manageCaption(this.getSlide()),this.isCompact?this.clearIdle():this.endIdle(),this.scale(),this.emit("resize")}onFocus(t){this.isTopmost()&&this.checkFocus(t)}onMousemove(t){this.prevMouseMoveEvent=t,!this.isCompact&&this.option("idle")&&this.resetIdle()}onVisibilityChange(){document.visibilityState==="visible"?this.checkFocus():this.endIdle()}manageCloseBtn(t){const o=this.optionFor(t,"closeButton")||!1;if(o==="auto"){const d=this.plugins.Toolbar;if(d&&d.state===qo.Ready)return}if(!o||!t.contentEl||t.closeBtnEl)return;const c=this.option("tpl.closeButton");if(c){const d=Qr(this.localize(c));t.closeBtnEl=t.contentEl.appendChild(d),t.el&&dt(t.el,"has-close-btn")}}manageCaption(t=void 0){var o,c;const d="fancybox__caption",x=this.container;if(!x)return;ni(x,du);const y=this.isCompact||this.option("commonCaption"),h=!y;if(this.caption&&this.stop(this.caption),h&&this.caption&&(this.caption.remove(),this.caption=null),y&&!this.caption)for(const z of((o=this.carousel)===null||o===void 0?void 0:o.slides)||[])z.captionEl&&(z.captionEl.remove(),z.captionEl=void 0,ni(z.el,du),(c=z.el)===null||c===void 0||c.removeAttribute("aria-labelledby"));if(t||(t=this.getSlide()),!t||y&&!this.isCurrentSlide(t))return;const M=t.el;let D=this.optionFor(t,"caption","");if(!D)return void(y&&this.caption&&this.animate(this.caption,"f-fadeOut",()=>{this.caption&&(this.caption.innerHTML="")}));let A=null;if(h){if(A=t.captionEl||null,M&&!A){const z=d+`_${this.id}_${t.index}`;A=document.createElement("div"),dt(A,d),A.setAttribute("id",z),t.captionEl=M.appendChild(A),dt(M,du),M.setAttribute("aria-labelledby",z)}}else A=this.caption,A||(A=x.querySelector("."+d)),!A&&(A=document.createElement("div"),A.dataset.fancyboxCaption="",dt(A,d),(this.footer||x).prepend(A)),dt(x,du),this.caption=A;A&&(A.innerHTML="",Ks(D)||typeof D=="number"?A.innerHTML=D+"":D instanceof HTMLElement&&A.appendChild(D))}checkFocus(t){this.focus(t)}focus(t){var o;if(this.ignoreFocusChange)return;const c=document.activeElement||null,d=(t==null?void 0:t.target)||null,x=this.container,y=(o=this.carousel)===null||o===void 0?void 0:o.viewport;if(!x||!y||!t&&c&&x.contains(c))return;const h=this.getSlide(),M=h&&h.state===gn.Ready?h.el:null;if(!M||M.contains(c)||x===c)return;t&&t.cancelable&&t.preventDefault(),this.ignoreFocusChange=!0;const D=Array.from(x.querySelectorAll(Dp));let A=[],z=null;for(let N of D){const Y=!N.offsetParent||!!N.closest('[aria-hidden="true"]'),ee=M&&M.contains(N),oe=!y.contains(N);if(N===x||(ee||oe)&&!Y){A.push(N);const he=N.dataset.origTabindex;he!==void 0&&he&&(N.tabIndex=parseFloat(he)),N.removeAttribute("data-orig-tabindex"),!N.hasAttribute("autoFocus")&&z||(z=N)}else{const he=N.dataset.origTabindex===void 0?N.getAttribute("tabindex")||"":N.dataset.origTabindex;he&&(N.dataset.origTabindex=he),N.tabIndex=-1}}let L=null;t?(!d||A.indexOf(d)<0)&&(L=z||x,A.length&&(c===Wo?L=A[0]:this.lastFocus!==x&&c!==kr||(L=A[A.length-1]))):L=h&&h.type==="image"?x:z||x,L&&qy(L),this.lastFocus=document.activeElement,this.ignoreFocusChange=!1}next(){const t=this.carousel;t&&t.pages.length>1&&t.slideNext()}prev(){const t=this.carousel;t&&t.pages.length>1&&t.slidePrev()}jumpTo(...t){this.carousel&&this.carousel.slideTo(...t)}isTopmost(){var t;return((t=Xt.getInstance())===null||t===void 0?void 0:t.id)==this.id}animate(t=null,o="",c){if(!t||!o)return void(c&&c());this.stop(t);const d=x=>{x.target===t&&t.dataset.animationName&&(t.removeEventListener("animationend",d),delete t.dataset.animationName,c&&c(),ni(t,o))};t.dataset.animationName=o,t.addEventListener("animationend",d),dt(t,o)}stop(t){t&&t.dispatchEvent(new CustomEvent("animationend",{bubbles:!1,cancelable:!0,currentTarget:t}))}setContent(t,o="",c=!0){if(this.isClosing())return;const d=t.el;if(!d)return;let x=null;if(Hn(o)?x=o:(x=Qr(o+""),Hn(x)||(x=document.createElement("div"),x.innerHTML=o+"")),["img","picture","iframe","video","audio"].includes(x.nodeName.toLowerCase())){const y=document.createElement("div");y.appendChild(x),x=y}Hn(x)&&t.filter&&!t.error&&(x=x.querySelector(t.filter)),x&&Hn(x)?(dt(x,"fancybox__content"),t.id&&x.setAttribute("id",t.id),d.classList.add(`has-${t.error?"error":t.type||"unknown"}`),d.prepend(x),x.style.display==="none"&&(x.style.display=""),getComputedStyle(x).getPropertyValue("display")==="none"&&(x.style.display=t.display||this.option("defaultDisplay")||"flex"),t.contentEl=x,c&&this.revealContent(t),this.manageCloseBtn(t),this.manageCaption(t)):this.setError(t,"{{ELEMENT_NOT_FOUND}}")}revealContent(t,o){const c=t.el,d=t.contentEl;c&&d&&(this.emit("reveal",t),this.hideLoading(t),t.state=gn.Opening,(o=this.isOpeningSlide(t)?o===void 0?this.optionFor(t,"showClass"):o:"f-fadeIn")?this.animate(d,o,()=>{this.done(t)}):this.done(t))}done(t){this.isClosing()||(t.state=gn.Ready,this.emit("done",t),dt(t.el,"is-done"),this.isCurrentSlide(t)&&this.option("autoFocus")&&queueMicrotask(()=>{var o;(o=t.panzoom)===null||o===void 0||o.updateControls(),this.option("autoFocus")&&this.focus()}),this.isOpeningSlide(t)&&(ni(this.container,jp),!this.isCompact&&this.option("idle")&&this.setIdle()))}isCurrentSlide(t){const o=this.getSlide();return!(!t||!o)&&o.index===t.index}isOpeningSlide(t){var o,c;return((o=this.carousel)===null||o===void 0?void 0:o.prevPage)===null&&t&&t.index===((c=this.getSlide())===null||c===void 0?void 0:c.index)}showLoading(t){t.state=gn.Loading;const o=t.el;o&&(dt(o,y0),this.emit("loading",t),t.spinnerEl||setTimeout(()=>{if(!this.isClosing()&&!t.spinnerEl&&t.state===gn.Loading){let c=Qr(Cp);dt(c,"fancybox-spinner"),t.spinnerEl=c,o.prepend(c),this.animate(c,"f-fadeIn")}},250))}hideLoading(t){const o=t.el;if(!o)return;const c=t.spinnerEl;this.isClosing()?c==null||c.remove():(ni(o,y0),c&&this.animate(c,"f-fadeOut",()=>{c.remove()}),t.state===gn.Loading&&(this.emit("loaded",t),t.state=gn.Ready))}setError(t,o){if(this.isClosing())return;const c=new Event("error",{bubbles:!0,cancelable:!0});if(this.emit("error",c,t),c.defaultPrevented)return;t.error=o,this.hideLoading(t),this.clearContent(t);const d=document.createElement("div");d.classList.add("fancybox-error"),d.innerHTML=this.localize(o||"<p>{{ERROR}}</p>"),this.setContent(t,d)}clearContent(t){if(t.state===void 0)return;this.emit("clearContent",t),t.contentEl&&(t.contentEl.remove(),t.contentEl=void 0);const o=t.el;o&&(ni(o,"has-error"),ni(o,"has-unknown"),ni(o,`has-${t.type||"unknown"}`)),t.closeBtnEl&&t.closeBtnEl.remove(),t.closeBtnEl=void 0,t.captionEl&&t.captionEl.remove(),t.captionEl=void 0,t.spinnerEl&&t.spinnerEl.remove(),t.spinnerEl=void 0}getSlide(){var t;const o=this.carousel;return((t=o==null?void 0:o.pages[o==null?void 0:o.page])===null||t===void 0?void 0:t.slides[0])||void 0}close(t,o){if(this.isClosing())return;const c=new Event("shouldClose",{bubbles:!0,cancelable:!0});if(this.emit("shouldClose",c,t),c.defaultPrevented)return;t&&t.cancelable&&(t.preventDefault(),t.stopPropagation());const d=()=>{this.proceedClose(t,o)};this.startedFs&&wr&&wr.isFullscreen()?Promise.resolve(wr.exit()).then(()=>d()):d()}clearIdle(){this.idleTimer&&clearTimeout(this.idleTimer),this.idleTimer=null}setIdle(t=!1){const o=()=>{this.clearIdle(),this.idle=!0,dt(this.container,"is-idle"),this.emit("setIdle")};if(this.clearIdle(),!this.isClosing())if(t)o();else{const c=this.option("idle");c&&(this.idleTimer=setTimeout(o,c))}}endIdle(){this.clearIdle(),this.idle&&!this.isClosing()&&(this.idle=!1,ni(this.container,"is-idle"),this.emit("endIdle"))}resetIdle(){this.endIdle(),this.setIdle()}toggleIdle(){this.idle?this.endIdle():this.setIdle(!0)}toggleFullscreen(){wr&&(wr.isFullscreen()?wr.exit():wr.request().then(()=>{this.startedFs=!0}))}isClosing(){return[Xi.Closing,Xi.CustomClosing,Xi.Destroy].includes(this.state)}proceedClose(t,o){var c,d;this.state=Xi.Closing,this.clearIdle(),this.detachEvents();const x=this.container,y=this.carousel,h=this.getSlide(),M=h&&this.option("placeFocusBack")?h.triggerEl||this.option("triggerEl"):null;if(M&&(Hy(M)?qy(M):M.focus()),x&&(ni(x,jp),dt(x,"is-closing"),x.setAttribute(Np,"true"),this.option("animated")&&dt(x,$p),x.style.pointerEvents="none"),y){y.clearTransitions(),(c=y.panzoom)===null||c===void 0||c.destroy(),(d=y.plugins.Navigation)===null||d===void 0||d.detach();for(const D of y.slides){D.state=gn.Closing,this.hideLoading(D);const A=D.contentEl;A&&this.stop(A);const z=D==null?void 0:D.panzoom;z&&(z.stop(),z.detachEvents(),z.detachObserver()),this.isCurrentSlide(D)||y.emit("removeSlide",D)}}w0=window.scrollX,k0=window.scrollY,window.addEventListener("scroll",this.onScroll),this.emit("close",t),this.state!==Xi.CustomClosing?(o===void 0&&h&&(o=this.optionFor(h,"hideClass")),o&&h?(this.animate(h.contentEl,o,()=>{y&&y.emit("removeSlide",h)}),setTimeout(()=>{this.destroy()},500)):this.destroy()):setTimeout(()=>{this.destroy()},500)}destroy(){var t;if(this.state===Xi.Destroy)return;window.removeEventListener("scroll",this.onScroll),this.state=Xi.Destroy,(t=this.carousel)===null||t===void 0||t.destroy();const o=this.container;o&&o.remove(),Ha.delete(this.id);const c=Xt.getInstance();c?c.focus():(kr&&(kr.remove(),kr=null),Wo&&(Wo.remove(),Wo=null),ni(document.documentElement,p0),(()=>{if(!sc)return;const d=document,x=d.body;x.classList.remove(Fp),x.style.setProperty(m0,""),d.documentElement.style.setProperty(f0,"")})(),this.emit("destroy"))}static bind(t,o,c){if(!sc)return;let d,x="",y={};if(t===void 0?d=document.body:Ks(t)?(d=document.body,x=t,typeof o=="object"&&(y=o||{})):(d=t,Ks(o)&&(x=o),typeof c=="object"&&(y=c||{})),!d||!Hn(d))return;x=x||"[data-fancybox]";const h=Xt.openers.get(d)||new Map;h.set(x,y),Xt.openers.set(d,h),h.size===1&&d.addEventListener("click",Xt.fromEvent)}static unbind(t,o){let c,d="";if(Ks(t)?(c=document.body,d=t):(c=t,Ks(o)&&(d=o)),!c)return;const x=Xt.openers.get(c);x&&d&&x.delete(d),d&&x||(Xt.openers.delete(c),c.removeEventListener("click",Xt.fromEvent))}static destroy(){let t;for(;t=Xt.getInstance();)t.destroy();for(const o of Xt.openers.keys())o.removeEventListener("click",Xt.fromEvent);Xt.openers=new Map}static fromEvent(t){if(t.defaultPrevented||t.button&&t.button!==0||t.ctrlKey||t.metaKey||t.shiftKey)return;let o=t.composedPath()[0];const c=o.closest("[data-fancybox-trigger]");if(c){const Y=c.dataset.fancyboxTrigger||"",ee=document.querySelectorAll(`[data-fancybox="${Y}"]`),oe=parseInt(c.dataset.fancyboxIndex||"",10)||0;o=ee[oe]||o}if(!(o&&o instanceof Element))return;let d,x,y,h;if([...Xt.openers].reverse().find(([Y,ee])=>!(!Y.contains(o)||![...ee].reverse().find(([oe,he])=>{let _e=o.closest(oe);return!!_e&&(d=Y,x=oe,y=_e,h=he,!0)}))),!d||!x||!y)return;h=h||{},t.preventDefault(),o=y;let M=[],D=Un({},zp,h);D.event=t,D.triggerEl=o,D.delegate=c;const A=D.groupAll,z=D.groupAttr,L=z&&o?o.getAttribute(`${z}`):"";if((!o||L||A)&&(M=[].slice.call(d.querySelectorAll(x))),o&&!A&&(M=L?M.filter(Y=>Y.getAttribute(`${z}`)===L):[o]),!M.length)return;const N=Xt.getInstance();return N&&N.options.triggerEl&&M.indexOf(N.options.triggerEl)>-1?void 0:(o&&(D.startIndex=M.indexOf(o)),Xt.fromNodes(M,D))}static fromSelector(t,o,c){let d=null,x="",y={};if(Ks(t)?(d=document.body,x=t,typeof o=="object"&&(y=o||{})):t instanceof HTMLElement&&Ks(o)&&(d=t,x=o,typeof c=="object"&&(y=c||{})),!d||!x)return!1;const h=Xt.openers.get(d);return!!h&&(y=Un({},h.get(x)||{},y),!!y&&Xt.fromNodes(Array.from(d.querySelectorAll(x)),y))}static fromNodes(t,o){o=Un({},zp,o||{});const c=[];for(const d of t){const x=d.dataset||{},y=x[Ua]||d.getAttribute(Up)||d.getAttribute("currentSrc")||d.getAttribute(Ua)||void 0;let h;const M=o.delegate;let D;M&&c.length===o.startIndex&&(h=M instanceof HTMLImageElement?M:M.querySelector("img:not([aria-hidden])")),h||(h=d instanceof HTMLImageElement?d:d.querySelector("img:not([aria-hidden])")),h&&(D=h.currentSrc||h[Ua]||void 0,!D&&h.dataset&&(D=h.dataset.lazySrc||h.dataset[Ua]||void 0));const A={src:y,triggerEl:d,thumbEl:h,thumbElSrc:D,thumbSrc:D};for(const z in x){let L=x[z]+"";L=L!=="false"&&(L==="true"||L),A[z]=L}c.push(A)}return new Xt(c,o)}static getInstance(t){return t?Ha.get(t):Array.from(Ha.values()).reverse().find(o=>!o.isClosing()&&o)||null}static getSlide(){var t;return((t=Xt.getInstance())===null||t===void 0?void 0:t.getSlide())||null}static show(t=[],o={}){return new Xt(t,o)}static next(){const t=Xt.getInstance();t&&t.next()}static prev(){const t=Xt.getInstance();t&&t.prev()}static close(t=!0,...o){if(t)for(const c of Ha.values())c.close(...o);else{const c=Xt.getInstance();c&&c.close(...o)}}}Object.defineProperty(Xt,"version",{enumerable:!0,configurable:!0,writable:!0,value:"5.0.36"}),Object.defineProperty(Xt,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:zp}),Object.defineProperty(Xt,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:ZE}),Object.defineProperty(Xt,"openers",{enumerable:!0,configurable:!0,writable:!0,value:new Map});const GE={props:{options:Object},mounted(){(void 0)(this.$refs.container,"[data-fancybox]",{...this.options||{}})},updated(){(void 0)(this.$refs.container),(void 0)(),(void 0)(this.$refs.container,"[data-fancybox]",{...this.options||{}})},unmounted(){(void 0)()}},YE={ref:"container"};function XE(n,t,o,c,d,x){return v.openBlock(),v.createElementBlock("div",YE,[v.renderSlot(n.$slots,"default")],512)}const KE=vt(GE,[["render",XE]]),JE={props:["text"]},QE={class:"pl-3 text-sm font-medium text-gray-600"};function eT(n,t,o,c,d,x){return v.openBlock(),v.createElementBlock("div",null,[v.createElementVNode("p",QE,v.toDisplayString(o.text),1)])}const tT={components:{Fancybox:KE,VsEmptyWidget:vt(JE,[["render",eT]])},props:{id:{type:String,default:""},readonly:{type:Boolean,default:!1},prefilledData:{type:Array,default:()=>null}},data(){return{carouselOptions:{Carousel:{infinite:!1}},isModalVisible:!1,modal:{},images:[],editAction:!1,selectedFile:null,imageExtensions:["png","jpg","jpeg","gif"]}},watch:{id(){this.getFiles()}},mounted(){this.getFiles()},methods:{async downloadFile(n){const t=document.createElement("a");t.setAttribute("download",n.uploaded_name),t.href=n.file_path,t.click()},handleOpenModal(n){this.selectedFile=n,this.modal=this.prepareModal({title:"Ви впевнені?",message:"Ви впевнені, що хочете видалити це зображення?",confirmButtonText:"Так, я впевнена/ий",cancelButtonText:"Скасувати",confirm:this.deleteFile,updateListOnConfirm:!0}),this.isModalVisible=!0},prepareModal(n){const t={...n};return n.cancel||(t.cancel=()=>{this.isModalVisible=!1}),n.updateListOnConfirm&&(t.confirm=async()=>{await n.confirm(),this.isModalVisible=!1,this.getFiles()}),t},async deleteFile(){try{await mt.delete(`/api/widget/gallery/${this.selectedFile.entity_id}/${this.selectedFile.file_id}`),this.isModalVisible=!1,this.selectedFile="",this.$emit("update","images"),this.getFiles()}catch(n){console.log(n)}},async addFile(n){console.log(n),await Promise.all(Array.from(n.target.files).map(async t=>{const o=new FormData;o.append("file",t);try{const c=`/api/widget/file/${this.id}`;return await mt.post(c,o),this.$emit("update","file-list"),t}catch(c){return console.error(c),null}})),await this.getFiles()},async getFiles(){if(this.prefilledData){this.images=this.prefilledData;return}try{const{data:n}=await mt.get(`/api/widget/gallery/${this.id}`);this.images=n.rows}catch(n){console.error(n)}},size(n,t=2){if(n===0)return"0 Bytes";const o=1024,c=t<0?0:t,d=["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"],x=Math.floor(Math.log(n)/Math.log(o));return`${parseFloat((n/o**x).toFixed(c))} ${d[x]}`},dateFormat(n){const t={day:"numeric",month:"long",year:"numeric",hour:"numeric",minute:"numeric"};return new Date(n).toLocaleDateString("uk-UK",t)}}},iT={class:"vs-widget-images flex flex-col xl:bg-white xl:rounded-xl dark:xl:bg-neutral-800 dark:xl:border-neutral-700"},nT={class:"flex justify-between items-center gap-x-2 mb-4"},rT={class:"flex justify-end items-center gap-x-2"},sT=["href"],oT=["src","alt"],aT={class:"item__text-content bg-white opacity-0 rounded-b-lg absolute w-full bottom-0 p-3 flex gap-2.5 items-center justify-between"},lT={class:"text-xs"},cT={class:"widget-images__item-desc flex items-center text-xs text-gray-600 flex-wrap"},hT={class:"flex items-center"},uT={class:"text-xs"},dT=["onClick"],pT=["onClick"],fT={class:"p-4"},mT={class:"mt-1 text-gray-500 dark:text-neutral-500"},gT={class:"mt-4 flex justify-end gap-x-3"};function yT(n,t,o,c,d,x){var D;const y=v.resolveComponent("Fancybox"),h=v.resolveComponent("VsEmptyWidget"),M=v.resolveComponent("VsDialog");return v.openBlock(),v.createElementBlock("div",iT,[v.createElementVNode("div",nT,[t[5]||(t[5]=v.createElementVNode("h2",{class:"inline-block font-semibold text-gray-800 dark:text-neutral-200"}," Зображення ",-1)),v.createElementVNode("div",rT,[v.createElementVNode("div",null,[v.createElementVNode("label",null,[v.createElementVNode("input",{type:"file",class:"hidden",onChange:t[0]||(t[0]=A=>x.addFile(A))},null,32),t[4]||(t[4]=v.createElementVNode("div",{class:"py-2 px-2.5 inline-flex relative items-center gap-x-1.5 text-xs rounded-lg border border-blue-200 bg-blue-500 text-white shadow-sm hover:bg-blue-700 cursor-pointer"},[v.createElementVNode("i",{class:"ti ti-upload"}),v.createTextVNode(" Завантажити файл ")],-1))])])])]),(D=d.images)!=null&&D.length?(v.openBlock(),v.createBlock(y,{key:0,options:d.carouselOptions,class:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4"},{default:v.withCtx(()=>[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList(d.images,A=>(v.openBlock(),v.createElementBlock("div",{key:A.file_path,class:"relative cursor-pointer rounded-b-lg item hover:shadow-lg h-[200px]"},[v.createElementVNode("a",{"data-fancybox":"gallery",href:A.file_path},[v.createElementVNode("img",{class:"h-full w-full rounded-lg",src:A.file_path||"/icons/no-image.jpg",alt:A.uploaded_name,width:"100%",height:"100%"},null,8,oT),v.createElementVNode("div",aT,[v.createElementVNode("div",null,[v.createElementVNode("span",lT,v.toDisplayString(A.uploaded_name),1),v.createElementVNode("div",cT,[v.createElementVNode("span",hT,v.toDisplayString(x.size(A.size)),1),v.createElementVNode("span",null,v.toDisplayString(x.dateFormat(A.cdate)),1)]),v.createElementVNode("span",uT,v.toDisplayString(A.username),1)]),v.createElementVNode("div",null,[v.createElementVNode("div",{class:v.normalizeClass(["flex items-center justify-center gap-2 hover:bg-gray-200 p-1 rounded",{disabled:o.readonly,"hover:cursor-pointer":!o.readonly}]),onClick:v.withModifiers(z=>x.downloadFile(A),["prevent"])},t[6]||(t[6]=[v.createElementVNode("i",{class:"ti ti-edit"},null,-1)]),10,dT),v.createElementVNode("div",{class:"flex items-center gap-2 hover:bg-gray-200 p-1 rounded hover:cursor-pointer",onClick:v.withModifiers(z=>x.handleOpenModal(A),["prevent"])},t[7]||(t[7]=[v.createElementVNode("i",{class:"ti ti-trash"},null,-1)]),8,pT)])])],8,sT)]))),128))]),_:1},8,["options"])):(v.openBlock(),v.createBlock(h,{key:1,text:"Зображення відсутні"})),v.createVNode(M,{title:d.modal.title,size:"small",visible:d.isModalVisible,"onUpdate:visible":t[3]||(t[3]=A=>d.isModalVisible=A)},{default:v.withCtx(()=>[v.createElementVNode("div",fT,[v.createElementVNode("p",mT,v.toDisplayString(d.modal.message),1),v.createElementVNode("div",gT,[v.createElementVNode("button",{type:"button",class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:t[1]||(t[1]=(...A)=>d.modal.cancel&&d.modal.cancel(...A))},v.toDisplayString(d.modal.cancelButtonText),1),v.createElementVNode("button",{type:"button",class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-semibold rounded-lg border border-transparent bg-red-500 text-white hover:bg-red-600 disabled:opacity-50 disabled:pointer-events-none",onClick:t[2]||(t[2]=(...A)=>d.modal.confirm&&d.modal.confirm(...A))},v.toDisplayString(d.modal.confirmButtonText),1)])])]),_:1},8,["title","visible"])])}const _T=vt(tT,[["render",yT]]),xT=n=>{const t=/(\b\S)?/g,o=n.match(t);return o?o.join("").toUpperCase():""},bT={props:{name:{type:String,default(){return""}},avatar:{type:String,default(){return""}}},computed:{inItials(){return xT(this.name)}}},vT={class:"mr-2"},wT=["src"],kT={key:1,class:"flex flex-shrink-0 items-center justify-center w-6 h-6 bg-gray-500 text-xs text-white rounded-full"},ST={key:0},ET={key:1,class:"text-sm"};function TT(n,t,o,c,d,x){return v.openBlock(),v.createElementBlock("div",vT,[o.avatar?(v.openBlock(),v.createElementBlock("img",{key:0,src:o.avatar,alt:"avatar",class:"flex flex-shrink-0 items-center justify-center w-6 h-6 rounded-full"},null,8,wT)):o.name?(v.openBlock(),v.createElementBlock("div",kT,[x.inItials.length?(v.openBlock(),v.createElementBlock("span",ST,v.toDisplayString(x.inItials),1)):(v.openBlock(),v.createElementBlock("span",ET,t[0]||(t[0]=[v.createElementVNode("i",{class:"ti ti-user"},null,-1)])))])):v.createCommentVNode("",!0)])}const CT={components:{VsWidgetCommentsAvatar:vt(bT,[["render",TT]])},props:{comment:{type:Object,default:()=>({})},user:{type:Object,default:()=>({})},id:{type:String,default:""}},data(){return{commentContent:this.comment.body,isCommentActionVisible:!1,isOpen:!1,textareaValue:""}},computed:{isUserAutor(){return this.user.uid===this.comment.uid},createDate(){try{const n=Je(this.comment.cdate,"YYYY-MM-DD");return new Date(n).toLocaleDateString("uk-UA",{day:"2-digit",month:"long",year:"numeric"})}catch{return""}}},watch:{isOpen(n){n&&(this.textareaValue=this.comment.body)}},methods:{confirnDeleteComment(){document.body.click(),this.$emit("openModal",{title:"Ви впевнені?",message:"Ви впевнені, що хочете видалити цей коментар?",confirmButtonText:"Так, я впевнена/ий",cancelButtonText:"Скасувати",confirm:this.deleteComment,updateListOnConfirm:!0})},async updateComment(){try{await mt.put(`/api/widget/comment/${this.id}/${this.comment.communication_id}`,{body:this.textareaValue}),this.$emit("list-update"),this.isCommentActionVisible=!1}catch{this.$notify({title:"Помилка!",message:"Сталася помилка",type:"error"})}},async deleteComment(){try{await mt.delete(`/api/widget/comment/${this.id}/${this.comment.communication_id}`),this.$emit("list-update"),this.isCommentActionVisible=!1}catch{this.$notify({title:"Помилка!",message:"Сталася помилка",type:"error"})}},toggleCommentAction(){this.isCommentActionVisible=!this.isCommentActionVisible}}},MT={class:"p-6 text-base bg-white dark:bg-gray-900"},PT={class:"flex justify-between items-center mb-2"},IT={class:"flex items-center"},AT={class:"inline-flex items-center mr-3 text-sm text-gray-900 dark:text-white font-semibold capitalize"},DT={class:"text-sm text-gray-600 dark:text-gray-400"},zT={class:"text-gray-500 dark:text-gray-400"},LT={class:"flex items-center gap-[4px]"},RT={class:"flex flex-col gap-[8px] text-sm font-medium text-gray-500"},OT={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"};function BT(n,t,o,c,d,x){const y=v.resolveComponent("VsWidgetCommentsAvatar"),h=v.resolveComponent("VsDialog");return v.openBlock(),v.createElementBlock(v.Fragment,null,[v.createElementVNode("div",MT,[v.createElementVNode("div",PT,[v.createElementVNode("div",IT,[v.createElementVNode("p",AT,[v.createVNode(y,{name:o.comment.username,avatar:o.comment.avatar},null,8,["name","avatar"]),v.createTextVNode(v.toDisplayString(o.comment.username),1)]),v.createElementVNode("div",DT,v.toDisplayString(x.createDate),1)])]),v.createElementVNode("p",zT,v.toDisplayString(o.comment.body),1),v.createElementVNode("div",LT,[v.createElementVNode("button",{type:"button",class:"block py-2 dark:hover:bg-gray-600 hover:underline dark:hover:text-white text-start duration-300",onClick:t[0]||(t[0]=M=>d.isOpen=!0)}," Редагувати "),v.createElementVNode("button",{type:"button",class:"block py-2 dark:hover:bg-gray-600 hover:underline dark:hover:text-white text-start duration-300",onClick:t[1]||(t[1]=M=>x.confirnDeleteComment())}," Видалити ")])]),v.createVNode(h,{visible:d.isOpen,"onUpdate:visible":t[5]||(t[5]=M=>d.isOpen=M),title:"Редагувати"},{footer:v.withCtx(()=>[v.createElementVNode("div",OT,[v.createElementVNode("button",{onClick:t[3]||(t[3]=M=>d.isOpen=!1),class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-black border rounded-lg !border-gray-200 hover:bg-gray-100 duration-300"}," Відмінити "),v.createElementVNode("button",{onClick:t[4]||(t[4]=(...M)=>x.updateComment&&x.updateComment(...M)),class:"py-2 px-3 inline-flex items-center gap-x-2 text-[14px] font-[400] whitespace-nowrap text-white bg-blue-500 rounded-lg !border-gray-200 hover:bg-blue-700 duration-300"}," Зберегти ")])]),default:v.withCtx(()=>[v.createElementVNode("label",RT,[t[6]||(t[6]=v.createTextVNode(" Коментар ")),v.withDirectives(v.createElementVNode("textarea",{"onUpdate:modelValue":t[2]||(t[2]=M=>d.textareaValue=M),placeholder:"Напишіть коментар...",class:"w-full h-[200px] border rounded-lg outline-none resize-none p-[20px] focus:border-[2px] focus:border-blue-600 [&::-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"},null,512),[[v.vModelText,d.textareaValue]])])]),_:1},8,["visible"])],64)}const FT={components:{VsWidgetCommentsItem:vt(CT,[["render",BT]])},inject:["activeAddFormEditor"],props:{id:{type:String,default:()=>""},prefilledData:{type:Object,default:null}},data(){return{isLoaded:!1,isLoadFailed:!1,comments:[],user:{},modal:{title:"",message:"",cancel:"",confirm:"",cancelButtonText:"",confirmButtonText:""},isModalVisible:!1}},async created(){await this.getComments()},methods:{async getComments(){if(this.prefilledData){this.comments=this.prefilledData.rows,this.isLoaded=!0;return}try{const{data:n}=await mt.get(`/api/widget/comment/${this.id}`);this.comments=n.rows,this.user=n.user}catch(n){this.isLoadFailed=!0,console.error(n)}this.isLoaded=!0,this.$emit("update-comment-count")},prepareModal(n){const t={...n};return n.cancel||(t.cancel=()=>{this.isModalVisible=!1}),n.updateListOnConfirm&&(t.confirm=async()=>{await n.confirm(),this.isModalVisible=!1}),t},handleOpenModal(n){this.modal=this.prepareModal(n),this.isModalVisible=!0}}},NT={class:"flex flex-col divide-y"},VT={key:0,class:"max-h-[300px] 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"},$T={key:1},jT={class:"p-4"},UT={class:"mt-1 text-gray-500 dark:text-neutral-500"},HT={class:"mt-4 flex justify-end gap-x-3"};function qT(n,t,o,c,d,x){const y=v.resolveComponent("VsErrorOnLoading"),h=v.resolveComponent("VsWidgetCommentsItem"),M=v.resolveComponent("VsLoader"),D=v.resolveComponent("VsDialog");return v.openBlock(),v.createElementBlock("div",NT,[d.isLoaded?(v.openBlock(),v.createElementBlock(v.Fragment,{key:0},[d.isLoadFailed?(v.openBlock(),v.createBlock(y,{key:0})):(v.openBlock(),v.createElementBlock(v.Fragment,{key:1},[d.comments.length?(v.openBlock(),v.createElementBlock("div",VT,[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList(d.comments,(A,z)=>(v.openBlock(),v.createBlock(h,{key:z,comment:A,user:d.user,index:z,id:o.id,onListUpdate:x.getComments,class:"border-top",onOpenModal:t[0]||(t[0]=L=>x.handleOpenModal(L))},null,8,["comment","user","index","id","onListUpdate"]))),128))])):(v.openBlock(),v.createElementBlock("div",$T,t[4]||(t[4]=[v.createElementVNode("p",{class:"pl-3 text-sm font-medium text-gray-600"},"Коментарі відсутні",-1)])))],64))],64)):(v.openBlock(),v.createBlock(M,{key:1,class:"justify-center",text:"Please wait..."})),v.createVNode(D,{title:d.modal.title,size:"small",visible:d.isModalVisible,"onUpdate:visible":t[3]||(t[3]=A=>d.isModalVisible=A)},{default:v.withCtx(()=>[v.createElementVNode("div",jT,[v.createElementVNode("p",UT,v.toDisplayString(d.modal.message),1),v.createElementVNode("div",HT,[v.createElementVNode("button",{type:"button",class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:t[1]||(t[1]=(...A)=>d.modal.cancel&&d.modal.cancel(...A))},v.toDisplayString(d.modal.cancelButtonText),1),v.createElementVNode("button",{type:"button",class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-semibold rounded-lg border border-transparent bg-red-500 text-white hover:bg-red-600 disabled:opacity-50 disabled:pointer-events-none",onClick:t[2]||(t[2]=(...A)=>d.modal.confirm&&d.modal.confirm(...A))},v.toDisplayString(d.modal.confirmButtonText),1)])])]),_:1},8,["title","visible"])])}const ZT=vt(FT,[["render",qT]]),WT={props:{id:{type:String,default:()=>""},autofocus:{type:Boolean,default:()=>!0}},data(){return{isEditorOpen:!1,commentContent:""}},methods:{async addNewComment(){if(this.commentContent)try{await mt.post(`/api/widget/comment/${this.id}`,{body:this.commentContent}),this.commentContent="",this.$emit("list-update")}catch(n){console.error(n)}},setNewContent(n){this.commentContent=n}}},GT={class:"w-full widget-comment-form"},YT={class:"mb-4 bg-white border-gray-200 dark:bg-gray-800 dark:border-gray-700"};function XT(n,t,o,c,d,x){return v.openBlock(),v.createElementBlock("div",GT,[v.createElementVNode("div",YT,[v.withDirectives(v.createElementVNode("textarea",{"onUpdate:modelValue":t[0]||(t[0]=y=>d.commentContent=y),rows:"6",class:"w-full h-[200px] border rounded-lg outline-none resize-none p-[20px] focus:border-[2px] focus:border-blue-600 [&::-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",placeholder:"Напишіть коментар..."},null,512),[[v.vModelText,d.commentContent]])]),v.createElementVNode("button",{ref:"buttonAdd",class:"py-2 px-3 inline-flex items-center gap-x-2 text-[14px] font-[400] whitespace-nowrap text-white bg-blue-500 rounded-lg !border-gray-200 hover:bg-blue-700 duration-300",onClick:t[1]||(t[1]=(...y)=>x.addNewComment&&x.addNewComment(...y))}," Відправити коментар ",512)])}const KT={components:{VsWidgetCommentsList:ZT,VsWidgetCommentsAddForm:vt(WT,[["render",XT]])},props:{id:{type:String,default(){return""}},prefilledData:{type:Object,default:null}},data(){return{activeAddFormEditor:"",comments:[],totalComment:"0"}},mounted(){this.comments=this.$refs.commentListRef.comments},watch:{comments(n){this.$emit("count-change",n.length)}},methods:{listUpdate(){this.$refs.commentListRef.getComments()},updateCommentCount(){this.totalComment=this.$refs.commentListRef.comments.length||"0"}}},JT={class:"bg-white-200"},QT={class:"flex justify-between items-center gap-x-2 mb-4"},eC={class:"inline-block font-semibold text-gray-800 dark:text-neutral-200"},tC={key:0,class:"inline-block font-semibold text-gray-800 dark:text-neutral-200"};function iC(n,t,o,c,d,x){const y=v.resolveComponent("VsWidgetCommentsAddForm"),h=v.resolveComponent("VsWidgetCommentsList");return v.openBlock(),v.createElementBlock("div",JT,[v.createElementVNode("div",QT,[v.createElementVNode("h2",eC,[t[2]||(t[2]=v.createTextVNode("Коментарі ")),d.comments?(v.openBlock(),v.createElementBlock("span",tC,"("+v.toDisplayString(d.totalComment)+")",1)):v.createCommentVNode("",!0)])]),v.createVNode(y,{class:"mb-6",id:o.id,onListUpdate:t[0]||(t[0]=M=>x.listUpdate())},null,8,["id"]),v.createVNode(h,{id:o.id,onUpdateCommentCount:t[1]||(t[1]=M=>x.updateCommentCount()),"prefilled-data":o.prefilledData,ref:"commentListRef"},null,8,["id","prefilled-data"])])}const nC={"vs-widget-map":zE,"vs-widget-gallery":_T,"vs-widget-comments":vt(KT,[["render",iC]])},rC={},sC={style:{width:"calc(100vw - 300px)",height:"calc(100vh - 60px)"},class:"bg-gray-50 flex items-center justify-center"},oC={...nC,...rC,"vs-dashboard":{__name:"vs-dashboard",setup(n){return(t,o)=>(v.openBlock(),v.createElementBlock("div",sC,o[0]||(o[0]=[v.createElementVNode("div",{class:"p-5 md:p-8 bg-white border border-gray-200 shadow-sm rounded-xl dark:bg-neutral-800 dark:border-neutral-700"},[v.createElementVNode("div",{class:"mb-4 xl:mb-8"},[v.createElementVNode("h1",{class:"text-lg font-semibold text-gray-800 dark:text-neutral-200"}," Members "),v.createElementVNode("p",{class:"text-sm text-gray-500 dark:text-neutral-500"}," Manage members and users of your workspace and set their access level. ")]),v.createElementVNode("div",{class:"space-y-5"},[v.createElementVNode("div",{class:"flex sm:grid sm:grid-cols-2 gap-x-2 sm:gap-x-5"},[v.createElementVNode("div",{class:"relative w-full"},[v.createElementVNode("div",{class:"absolute inset-y-0 start-0 flex items-center pointer-events-none z-20 ps-3.5"},[v.createElementVNode("svg",{class:"shrink-0 size-4 text-gray-500 dark:text-neutral-400",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"},[v.createElementVNode("circle",{cx:"11",cy:"11",r:"8"}),v.createElementVNode("path",{d:"m21 21-4.3-4.3"})])]),v.createElementVNode("input",{type:"text",class:"py-2 ps-10 pe-8 block w-full bg-gray-100 border-transparent rounded-lg text-sm focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:border-transparent dark:text-neutral-400 dark:placeholder:text-neutral-400 dark:focus:ring-neutral-600",placeholder:"Search by name or email"}),v.createElementVNode("div",{class:"hidden absolute inset-y-0 end-0 flex items-center pointer-events-none z-20 pe-1"},[v.createElementVNode("button",{type:"button",class:"inline-flex shrink-0 justify-center items-center size-6 rounded-full text-gray-500 hover:text-blue-600 focus:outline-none focus:text-blue-600 dark:text-neutral-500 dark:hover:text-blue-500 dark:focus:text-blue-500","aria-label":"Close"},[v.createElementVNode("span",{class:"sr-only"},"Close"),v.createElementVNode("svg",{class:"shrink-0 size-4",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[v.createElementVNode("circle",{cx:"12",cy:"12",r:"10"}),v.createElementVNode("path",{d:"m15 9-6 6"}),v.createElementVNode("path",{d:"m9 9 6 6"})])])])]),v.createElementVNode("div",{class:"flex justify-end items-center gap-x-2"},[v.createElementVNode("button",{type:"button",class:"p-2.5 sm:py-2 sm:px-3 inline-flex items-center text-sm font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},[v.createElementVNode("svg",{class:"shrink-0 sm:me-2 size-4",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[v.createElementVNode("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),v.createElementVNode("polyline",{points:"7 10 12 15 17 10"}),v.createElementVNode("line",{x1:"12",x2:"12",y1:"15",y2:"3"})]),v.createElementVNode("span",{class:"hidden sm:block"}," Download CSV ")]),v.createElementVNode("button",{type:"button",class:"py-2 px-3 inline-flex items-center gap-x-1 text-sm font-medium rounded-lg border border-transparent bg-blue-600 text-white hover:bg-blue-700 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:ring-2 focus:ring-blue-500","data-hs-overlay":"#hs-pro-dshm"},[v.createElementVNode("span",{class:"hidden sm:block"},"Send"),v.createTextVNode("Invite ")])])]),v.createElementVNode("div",{class:"grid sm:grid-cols-2 lg:grid-cols-4 gap-2 xl:gap-4"},[v.createElementVNode("div",{class:"p-4 flex flex-col bg-white border border-gray-200 rounded-xl dark:bg-neutral-800 dark:border-neutral-700"},[v.createElementVNode("div",{class:"flex justify-between items-center mb-1"},[v.createElementVNode("h2",{class:"text-4xl font-semibold text-gray-800 dark:text-neutral-200"}),v.createElementVNode("div",{class:"flex items-center -space-x-2"},[v.createElementVNode("img",{class:"shrink-0 size-7 rounded-full",src:"https://images.unsplash.com/photo-1659482633369-9fe69af50bfb?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=facearea&facepad=3&w=320&h=320&q=80",alt:"Avatar"})])]),v.createElementVNode("h3",{class:"text-gray-500 dark:text-neutral-500"},"Admin")]),v.createElementVNode("div",{class:"p-4 flex flex-col bg-white border border-gray-200 rounded-xl dark:bg-neutral-800 dark:border-neutral-700"},[v.createElementVNode("div",{class:"flex justify-between items-center mb-1"},[v.createElementVNode("h2",{class:"text-4xl font-semibold text-gray-800 dark:text-neutral-200"}," 5 "),v.createElementVNode("div",{class:"flex items-center -space-x-2"},[v.createElementVNode("img",{class:"shrink-0 size-7 shadow-md rounded-full",src:"https://images.unsplash.com/photo-1659482633369-9fe69af50bfb?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=facearea&facepad=2.5&w=320&h=320&q=80",alt:"Avatar"}),v.createElementVNode("span",{class:"flex shrink-0 justify-center items-center size-7 bg-white border border-gray-200 text-gray-700 text-xs font-medium uppercase rounded-full dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300"}," L "),v.createElementVNode("img",{class:"shrink-0 size-7 shadow-md rounded-full",src:"https://images.unsplash.com/photo-1679412330254-90cb240038c5?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=facearea&facepad=2.5&w=320&h=320&q=80",alt:"Avatar"}),v.createElementVNode("img",{class:"shrink-0 size-7 shadow-md rounded-full",src:"https://images.unsplash.com/photo-1659482634023-2c4fda99ac0c?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=facearea&facepad=2.5&w=320&h=320&q=80",alt:"Avatar"}),v.createElementVNode("span",{class:"flex shrink-0 justify-center items-center size-7 bg-white border border-gray-200 text-gray-700 text-xs font-medium uppercase rounded-full dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300"}," O ")])]),v.createElementVNode("div",{class:"inline-flex items-center gap-x-2"},[v.createElementVNode("h3",{class:"text-gray-500 dark:text-neutral-500"},"Members"),v.createElementVNode("div",{class:"hs-tooltip inline-block"},[v.createElementVNode("svg",{class:"hs-tooltip-toggle shrink-0 size-3.5 text-gray-500 dark:text-neutral-500",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"currentColor",viewBox:"0 0 16 16"},[v.createElementVNode("path",{d:"M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"}),v.createElementVNode("path",{d:"m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z"})]),v.createElementVNode("div",{class:"hs-tooltip-content hs-tooltip-shown:opacity-100 hs-tooltip-shown:visible opacity-0 inline-block absolute invisible z-20 w-60 py-1.5 px-2.5 bg-gray-900 text-xs text-white rounded dark:bg-neutral-700",role:"tooltip","data-popper-placement":"top",style:{position:"fixed",inset:"auto auto 0px 0px",margin:"0px",transform:"translate(689px, -708px)"}}," Limited Access Members can only access the projects, tasks, and messages explicitly shared with them. ")])])]),v.createElementVNode("div",{class:"p-4 flex flex-col bg-white border border-gray-200 rounded-xl dark:bg-neutral-800 dark:border-neutral-700"},[v.createElementVNode("div",{class:"flex justify-between items-center mb-1"},[v.createElementVNode("h2",{class:"text-4xl font-semibold text-gray-800 dark:text-neutral-200"}," 2 "),v.createElementVNode("div",{class:"flex items-center -space-x-2"},[v.createElementVNode("span",{class:"flex shrink-0 justify-center items-center size-7 bg-white border border-gray-200 text-gray-700 text-xs font-medium uppercase rounded-full dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300"}," L "),v.createElementVNode("span",{class:"flex shrink-0 justify-center items-center size-7 bg-white border border-gray-200 text-gray-700 text-xs font-medium uppercase rounded-full dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300"}," 0 ")])]),v.createElementVNode("div",{class:"inline-flex items-center gap-x-2"},[v.createElementVNode("h3",{class:"text-gray-500 dark:text-neutral-500"}," Limited access members "),v.createElementVNode("div",{class:"hs-tooltip inline-block"},[v.createElementVNode("svg",{class:"hs-tooltip-toggle shrink-0 size-3.5 text-gray-500 dark:text-neutral-500",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"currentColor",viewBox:"0 0 16 16"},[v.createElementVNode("path",{d:"M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"}),v.createElementVNode("path",{d:"m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z"})]),v.createElementVNode("div",{class:"hs-tooltip-content hs-tooltip-shown:opacity-100 hs-tooltip-shown:visible opacity-0 inline-block absolute invisible z-20 w-60 py-1.5 px-2.5 bg-gray-900 text-xs text-white rounded dark:bg-neutral-700",role:"tooltip","data-popper-placement":"top",style:{position:"fixed",inset:"auto auto 0px 0px",margin:"0px",transform:"translate(1198px, -708px)"}}," Limited Access Members can only access the projects, tasks, and messages explicitly shared with them. ")])])]),v.createElementVNode("div",{class:"p-4 flex flex-col bg-white border border-gray-200 rounded-xl dark:bg-neutral-800 dark:border-neutral-700"},[v.createElementVNode("div",{class:"flex justify-between items-center mb-1"},[v.createElementVNode("h2",{class:"text-4xl font-semibold text-gray-800 dark:text-neutral-200"}," 0 "),v.createElementVNode("div",{class:"flex items-center -space-x-2"})]),v.createElementVNode("h3",{class:"text-gray-500 dark:text-neutral-500"},"Pending invites")])]),v.createElementVNode("div",{class:"overflow-x-auto [&::-webkit-scrollbar]:h-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"},[v.createElementVNode("div",{class:"min-w-full inline-block align-middle"},[v.createElementVNode("table",{class:"min-w-full divide-y divide-gray-200 dark:divide-neutral-700"},[v.createElementVNode("thead",null,[v.createElementVNode("tr",null,[v.createElementVNode("th",{scope:"col",class:"min-w-[250px]"},[v.createElementVNode("div",{class:"pe-4 py-3 text-start flex items-center gap-x-1 text-sm font-medium text-gray-800 dark:text-neutral-200"}," Member ")]),v.createElementVNode("th",{scope:"col",class:"min-w-48"},[v.createElementVNode("div",{class:"px-4 py-3 text-start flex items-center gap-x-1 text-sm font-medium text-gray-800 dark:text-neutral-200"}," Role ")]),v.createElementVNode("th",{scope:"col"},[v.createElementVNode("div",{class:"px-4 py-3 text-start flex items-center gap-x-1 text-sm font-medium text-gray-800 dark:text-neutral-200"}," Email ")]),v.createElementVNode("th",{scope:"col",class:"min-w-36"},[v.createElementVNode("div",{class:"px-4 py-3 text-start flex items-center gap-x-1 text-sm font-medium text-gray-800 dark:text-neutral-200"}," Last activity ")]),v.createElementVNode("th",{scope:"col"},[v.createElementVNode("div",{class:"px-4 py-3 text-start flex items-center gap-x-1 text-sm font-medium text-gray-800 dark:text-neutral-200"}," Status ")])])]),v.createElementVNode("tbody",{class:"divide-y divide-gray-200 dark:divide-neutral-700"},[v.createElementVNode("tr",null,[v.createElementVNode("td",{class:"size-px whitespace-nowrap pe-4 py-3"},[v.createElementVNode("div",{class:"w-full flex items-center gap-x-3"},[v.createElementVNode("img",{class:"shrink-0 size-[38px] rounded-full",src:"https://images.unsplash.com/photo-1659482633369-9fe69af50bfb?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=facearea&facepad=3&w=320&h=320&q=80",alt:"Avatar"}),v.createElementVNode("div",{class:"grow"},[v.createElementVNode("span",{class:"text-sm font-medium text-gray-800 dark:text-neutral-200"}," James Collins ")])])]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Admin ")]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," james@site.com ")]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Today ")]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"inline-flex items-center gap-x-1.5 py-1.5 px-2.5 text-xs font-medium bg-teal-100 text-teal-800 rounded-full dark:bg-teal-500/10 dark:text-teal-500"},[v.createElementVNode("span",{class:"size-1.5 inline-block bg-gray-800 rounded-full dark:bg-neutral-200"}),v.createTextVNode(" Active ")])])]),v.createElementVNode("tr",null,[v.createElementVNode("td",{class:"size-px whitespace-nowrap pe-4 py-3"},[v.createElementVNode("div",{class:"w-full flex items-center gap-x-3"},[v.createElementVNode("span",{class:"flex shrink-0 justify-center items-center size-[38px] bg-white border border-gray-200 text-gray-700 text-xs font-medium uppercase rounded-full dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300"}," L "),v.createElementVNode("div",{class:"grow"},[v.createElementVNode("span",{class:"text-sm font-medium text-gray-800 dark:text-neutral-200"}," James Collins ")])])]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Can view ")]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," liza@site.com ")]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," 2 days ago ")]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"inline-flex items-center gap-1.5 py-1.5 px-2 text-xs font-medium bg-gray-100 text-gray-800 rounded-full dark:bg-neutral-500/20 dark:text-neutral-400"},[v.createElementVNode("span",{class:"size-1.5 inline-block bg-gray-800 rounded-full dark:bg-neutral-400"}),v.createTextVNode(" Inactive ")])])]),v.createElementVNode("tr",null,[v.createElementVNode("td",{class:"size-px whitespace-nowrap pe-4 py-3"},[v.createElementVNode("div",{class:"w-full flex items-center gap-x-3"},[v.createElementVNode("img",{class:"shrink-0 size-[38px] rounded-full",src:"https://images.unsplash.com/photo-1601935111741-ae98b2b230b0?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=facearea&facepad=2.5&w=320&h=320&q=80",alt:"Avatar"}),v.createElementVNode("div",{class:"grow"},[v.createElementVNode("span",{class:"text-sm font-medium text-gray-800 dark:text-neutral-200"}," Daniel Hobbs ")])])]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Can edit ")]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," dhobbs@site.com ")]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Today ")]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"inline-flex items-center gap-1.5 py-1.5 px-2 text-xs font-medium bg-gray-100 text-gray-800 rounded-full dark:bg-neutral-500/20 dark:text-neutral-400"},[v.createElementVNode("span",{class:"size-1.5 inline-block bg-gray-800 rounded-full dark:bg-neutral-400"}),v.createTextVNode(" Inactive ")])])]),v.createElementVNode("tr",null,[v.createElementVNode("td",{class:"size-px whitespace-nowrap pe-4 py-3"},[v.createElementVNode("div",{class:"w-full flex items-center gap-x-3"},[v.createElementVNode("img",{class:"shrink-0 size-[38px] rounded-full",src:"https://images.unsplash.com/photo-1679412330254-90cb240038c5?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=facearea&facepad=2.5&w=320&h=320&q=80",alt:"Avatar"}),v.createElementVNode("div",{class:"grow"},[v.createElementVNode("span",{class:"text-sm font-medium text-gray-800 dark:text-neutral-200"}," Brian Warner ")])])]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Can edit ")]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," brian@site.com ")]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," 1 months ago ")]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"inline-flex items-center gap-x-1.5 py-1.5 px-2.5 text-xs font-medium bg-teal-100 text-teal-800 rounded-full dark:bg-teal-500/10 dark:text-teal-500"},[v.createElementVNode("span",{class:"size-1.5 inline-block bg-gray-800 rounded-full dark:bg-neutral-200"}),v.createTextVNode(" Active ")])])]),v.createElementVNode("tr",null,[v.createElementVNode("td",{class:"size-px whitespace-nowrap pe-4 py-3"},[v.createElementVNode("div",{class:"w-full flex items-center gap-x-3"},[v.createElementVNode("span",{class:"flex shrink-0 justify-center items-center size-[38px] bg-white border border-gray-200 text-gray-700 text-xs font-medium uppercase rounded-full dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300"}," O "),v.createElementVNode("div",{class:"grow"},[v.createElementVNode("span",{class:"text-sm font-medium text-gray-800 dark:text-neutral-200"}," Ols Shols ")])])]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Can view ")]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," olsshols@site.com ")]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," 6 days ago ")]),v.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[v.createElementVNode("span",{class:"inline-flex items-center gap-1.5 py-1.5 px-2 text-xs font-medium bg-gray-100 text-gray-800 rounded-full dark:bg-neutral-500/20 dark:text-neutral-400"},[v.createElementVNode("span",{class:"size-1.5 inline-block bg-gray-800 rounded-full dark:bg-neutral-400"}),v.createTextVNode(" Inactive ")])])])])])])])])],-1)])))}}},aC={install(n,{componentsApp:t={},menu:o=[]}){var x;mt.defaults.baseURL&&(mt.defaults.baseURL=mt.defaults.baseURL);const c=(x=Ey(o))==null?void 0:x.filter(y=>y==null?void 0:y.component).map(y=>({...y,component:t[y==null?void 0:y.component]})),{router:d}=mv(c);Object.entries({...oC,...t}).forEach(([y,h])=>{n.component(y,h)}),n.component("admin",Rb),n.config.globalProperties={...n.config.globalProperties,$componentsConfig:{...XS,componentsApp:t},$router:d},n.use(d)}},nr=v.ref(null),lC={data(){return{formValues:{},scheme:null,table:""}},mounted(){this.getFormScheme()},methods:{flattenMenu(n){const t=[];return n.forEach(o=>{o.menu?t.push(...this.flattenMenu(o.menu)):t.push(o)}),t},async getFormScheme(){var c,d;const n=this.flattenMenu(nr.value);n!=null&&n.length||this.$router.replace("/404");const t=n==null?void 0:n.find(x=>{var y,h;return(x==null?void 0:x.path)==((h=(y=this.$route)==null?void 0:y.query)==null?void 0:h.table)});t||this.$router.replace("/404");const o=t==null?void 0:t.table;this.table=o;try{const{data:{form:x}}=await mt.get(`/api/template/table/${o}`),{data:{rows:y}}=await mt.get(`/api/table-data/${this.table}/${(d=(c=this.$route)==null?void 0:c.query)==null?void 0:d.id}`);this.formValues=y==null?void 0:y[0];const{data:h}=await mt.get(`/api/template/form/${x}`);this.scheme=(h==null?void 0:h.schema)||h}catch{}},async editObject(){var n,t;try{await this.$refs.form.doValidation(),await mt.put(`/api/table/${this.table}/${(t=(n=this.$route)==null?void 0:n.query)==null?void 0:t.id}`,this.formValues),await this.$router.back(),await this.$notify({title:"Успішно!",message:"Об'єкт успішно створено",type:"success"})}catch{this.$notify({title:"Помилка!",message:"Сталася помилка",type:"error"})}}}},cC={style:{width:"calc(100vw - 260px)"}},hC={class:"h-[76px] bg-gray-50 flex items-center justify-between px-[30px]"},uC={class:"flex items-center gap-[6px]"},dC={style:{height:"calc(100vh - 140px)",width:"calc(100vw - 260px)"},class:"bg-gray-50 p-[20px] flex"},pC={class:"bg-white w-full rounded-xl border p-[20px] 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"};function fC(n,t,o,c,d,x){const y=v.resolveComponent("VsForm");return v.openBlock(),v.createElementBlock("div",cC,[v.createElementVNode("div",hC,[t[3]||(t[3]=v.createElementVNode("h2",{class:"text-xl font-medium"},"Редагувати",-1)),v.createElementVNode("div",uC,[v.createElementVNode("button",{onClick:t[0]||(t[0]=h=>n.$router.back()),class:"py-2 px-3 flex items-center gap-x-2 text-sm font-medium rounded-lg border bg-white border-gray-100 text-gray-800 shadow focus:outline-none hover:bg-gray-50 hover:border-gray-100 duration-300"}," Скасувати "),v.createElementVNode("button",{onClick:t[1]||(t[1]=(...h)=>x.editObject&&x.editObject(...h)),class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-transparent bg-blue-600 text-white hover:bg-blue-700 hover:text-white duration-300"}," Зберегти ")])]),v.createElementVNode("div",dC,[v.createElementVNode("div",pC,[d.scheme?(v.openBlock(),v.createBlock(y,{key:0,ref:"form",scheme:d.scheme,modelValue:d.formValues,"onUpdate:modelValue":t[2]||(t[2]=h=>d.formValues=h),class:"p-0 mt-[20px]"},null,8,["scheme","modelValue"])):v.createCommentVNode("",!0)])])])}const mC=Object.freeze(Object.defineProperty({__proto__:null,default:vt(lC,[["render",fC]])},Symbol.toStringTag,{value:"Module"})),gC={data(){return{formValues:{},scheme:null,table:""}},mounted(){this.getFormScheme()},methods:{flattenMenu(n){const t=[];return n.forEach(o=>{o.menu?t.push(...this.flattenMenu(o.menu)):t.push(o)}),t},async getFormScheme(){const n=this.flattenMenu(nr.value);n!=null&&n.length||this.$router.replace("/404");const t=n==null?void 0:n.find(c=>{var d,x;return(c==null?void 0:c.path)==((x=(d=this.$route)==null?void 0:d.query)==null?void 0:x.table)});t||this.$router.replace("/404");const o=t==null?void 0:t.table;this.table=o;try{const{data:{form:c}}=await mt.get(`/api/template/table/${o}`),{data:d}=await mt.get(`/api/template/form/${c}`);this.scheme=(d==null?void 0:d.schema)||d}catch{}},async createObject(){try{await this.$refs.form.doValidation(),await mt.post(`/api/table/${this.table}`,this.formValues),await this.$router.back(),await this.$notify({title:"Успішно!",message:"Об'єкт успішно створено",type:"success"})}catch{this.$notify({title:"Помилка!",message:"Сталася помилка",type:"error"})}}}},yC={style:{width:"calc(100vw - 260px)"}},_C={class:"h-[76px] bg-gray-50 flex items-center justify-between px-[30px]"},xC={class:"flex items-center gap-[6px]"},bC={style:{height:"calc(100vh - 150px)",width:"calc(100vw - 260px)"},class:"bg-gray-50 p-[20px] flex"},vC={class:"bg-white w-full rounded-xl border p-[20px] 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"};function wC(n,t,o,c,d,x){const y=v.resolveComponent("VsForm");return v.openBlock(),v.createElementBlock("div",yC,[v.createElementVNode("div",_C,[t[3]||(t[3]=v.createElementVNode("h2",{class:"text-xl font-medium"},"Створити",-1)),v.createElementVNode("div",xC,[v.createElementVNode("button",{onClick:t[0]||(t[0]=h=>n.$router.back()),class:"py-2 px-3 flex items-center gap-x-2 text-sm font-medium rounded-lg border bg-white border-gray-100 text-gray-800 shadow focus:outline-none hover:bg-gray-50 hover:border-gray-100 duration-300"}," Скасувати "),v.createElementVNode("button",{onClick:t[1]||(t[1]=(...h)=>x.createObject&&x.createObject(...h)),class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-transparent bg-blue-600 text-white hover:bg-blue-700 hover:text-white duration-300"}," Зберегти ")])]),v.createElementVNode("div",bC,[v.createElementVNode("div",vC,[d.scheme?(v.openBlock(),v.createBlock(y,{key:0,ref:"form",scheme:d.scheme,modelValue:d.formValues,"onUpdate:modelValue":t[2]||(t[2]=h=>d.formValues=h),class:"p-0 mt-[20px]"},null,8,["scheme","modelValue"])):v.createCommentVNode("",!0)])])])}const kC=Object.freeze(Object.defineProperty({__proto__:null,default:vt(gC,[["render",wC]])},Symbol.toStringTag,{value:"Module"})),SC={};function EC(n,t,o,c,d,x){const y=v.resolveComponent("router-view");return v.openBlock(),v.createBlock(y)}const S0=Object.freeze(Object.defineProperty({__proto__:null,default:vt(SC,[["render",EC]])},Symbol.toStringTag,{value:"Module"})),TC={data(){return{objectData:null,component:""}},computed:{getRoute(){const n=this.flattenMenu(nr.value);n!=null&&n.length||this.$router.replace("/404");const t=n==null?void 0:n.find(o=>{var c,d;return(o==null?void 0:o.table)==((d=(c=this.$route)==null?void 0:c.params)==null?void 0:d.table)});return t||this.$router.replace("/404"),t==null?void 0:t.path},getTitle(){var n,t,o,c,d,x,y,h,M,D,A,z,L,N,Y;if((o=(t=(n=this.objectData)==null?void 0:n.rows)==null?void 0:t[0])!=null&&o.name)return((y=(x=(d=(c=this.objectData)==null?void 0:c.rows)==null?void 0:d[0])==null?void 0:x.name)==null?void 0:y.length)<35?(D=(M=(h=this.objectData)==null?void 0:h.rows)==null?void 0:M[0])==null?void 0:D.name:((N=(L=(z=(A=this.objectData)==null?void 0:A.rows)==null?void 0:z[0])==null?void 0:L.name)==null?void 0:N.slice(0,35))+" ...";{const ee=(Y=this.flattenMenu(nr.value))==null?void 0:Y.find(oe=>{var he,_e;return(oe==null?void 0:oe.table)===((_e=(he=this.$route)==null?void 0:he.params)==null?void 0:_e.table)});return ee==null?void 0:ee.ua}}},async mounted(){await this.getObjectData(),await this.checkActiveComponent()},watch:{component(n){this.$router.replace({...this.$route,query:{tab:n}})}},methods:{async getObjectData(){var o;const{table:n,id:t}=(o=this.$route)==null?void 0:o.params;(!n||!t)&&this.$router.replace("/404");try{const{data:c}=await mt.get(`/api/table-data/${n}/${t}`);this.objectData=c}catch(c){console.error(c)}},getColClass(n){return`col-span-${n||12}`},getGridClass(){return"grid-cols-12"},checkActiveComponent(){var n,t,o,c,d,x,y,h,M;if((t=(n=this.$route)==null?void 0:n.query)!=null&&t.tab)this.component=(c=(o=this.$route)==null?void 0:o.query)==null?void 0:c.tab;else{const D=(x=(d=this.objectData)==null?void 0:d.panels)==null?void 0:x.find(A=>(A==null?void 0:A.type)==="tabs");(y=D==null?void 0:D.items)!=null&&y.length&&(this.component=((h=D.items[0])==null?void 0:h.component)||((M=D.items[0])==null?void 0:M.name))}},flattenMenu(n){const t=[];return n.forEach(o=>{o.menu?t.push(...this.flattenMenu(o.menu)):t.push(o)}),t}}},CC={style:{width:"calc(100vw - 260px)",height:"calc(100vh - 60px)"},class:"bg-gray-50 overflow-y-auto"},MC={class:"h-[76px] bg-gray-50 flex items-center justify-between px-[30px]"},PC={class:""},IC={class:"text-lg md:text-xl font-semibold text-stone-800 dark:text-neutral-200"},AC={class:"flex items-center gap-[6px]"},DC={key:0,class:"border rounded-xl bg-white"},zC={class:"p-[10px] pl-[20px] text-xl"},LC=["innerHTML"],RC={key:1},OC={class:"p-[10px] pl-[20px] text-xl"},BC={key:0,class:"p-[20px] border-t"},FC={key:1,class:"p-[20px] border-t"},NC=["innerHTML"],VC={class:"flex space-x-1 w-[1200px] bg-white border rounded-xl h-[60px] items-center pl-[20px]"},$C=["onClick"],jC={key:0,class:"border rounded-xl bg-white mt-[20px]"},UC={class:"p-[10px] pl-[20px] text-xl"},HC={key:0,class:"p-[20px] border-t"},qC={key:1,class:"p-[20px] border-t"},ZC=["innerHTML"];function WC(n,t,o,c,d,x){var h,M,D;const y=v.resolveComponent("router-link");return v.openBlock(),v.createElementBlock("div",CC,[v.createElementVNode("div",MC,[v.createElementVNode("div",PC,[v.createElementVNode("button",{onClick:t[0]||(t[0]=A=>n.$router.back()),class:"text-sm text-blue-600 decoration-2 hover:underline font-medium focus:outline-none focus:underline dark:text-green-400 dark:hover:text-green-500"}," До таблиці "),v.createElementVNode("h2",IC,v.toDisplayString(x.getTitle),1)]),v.createElementVNode("div",AC,[v.createVNode(y,{to:`/edit?table=${x.getRoute}&id=${(M=(h=n.$route)==null?void 0:h.params)==null?void 0:M.id}`,class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-transparent bg-blue-600 text-white hover:bg-blue-700 hover:text-white duration-300"},{default:v.withCtx(()=>t[1]||(t[1]=[v.createTextVNode(" Редагувати ")])),_:1},8,["to"])])]),v.createElementVNode("div",{class:v.normalizeClass(["grid gap-[20px]",x.getGridClass()])},[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList((D=d.objectData)==null?void 0:D.panels,(A,z)=>{var L;return v.openBlock(),v.createElementBlock("div",{key:z,class:v.normalizeClass([x.getColClass(A.col),"p-4"])},[A!=null&&A.name?(v.openBlock(),v.createElementBlock("div",DC,[v.createElementVNode("h2",zC,v.toDisplayString((A==null?void 0:A.title)||"Панель"),1),v.createElementVNode("div",{class:"p-[20px] border-t",innerHTML:(L=d.objectData)==null?void 0:L.data[A==null?void 0:A.name]},null,8,LC)])):A.type==="container"?(v.openBlock(),v.createElementBlock("div",RC,[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList(A.items,(N,Y)=>{var ee,oe,he,_e,me;return v.openBlock(),v.createElementBlock("div",{key:Y,class:"border rounded-xl bg-white mb-[20px]"},[v.createElementVNode("h2",OC,v.toDisplayString((N==null?void 0:N.title)||"Панель"),1),N!=null&&N.component?(v.openBlock(),v.createElementBlock("div",BC,[(v.openBlock(),v.createBlock(v.resolveDynamicComponent(N.component),{geometry:(oe=(ee=d.objectData)==null?void 0:ee.rows[0])==null?void 0:oe.geom,zoom:16,id:(_e=(he=n.$route)==null?void 0:he.params)==null?void 0:_e.id},null,8,["geometry","id"]))])):v.createCommentVNode("",!0),N!=null&&N.name?(v.openBlock(),v.createElementBlock("div",FC,[v.createElementVNode("div",{innerHTML:(me=d.objectData)==null?void 0:me.data[N==null?void 0:N.name]},null,8,NC)])):v.createCommentVNode("",!0)])}),128))])):v.createCommentVNode("",!0),(A==null?void 0:A.type)==="tabs"?(v.openBlock(),v.createElementBlock(v.Fragment,{key:2},[v.createElementVNode("nav",VC,[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList(A==null?void 0:A.items,N=>(v.openBlock(),v.createElementBlock("button",{key:(N==null?void 0:N.name)||(N==null?void 0:N.component),onClick:Y=>d.component=(N==null?void 0:N.component)||(N==null?void 0:N.name),class:v.normalizeClass(["px-2.5 h-[30px] py-1.5 relative inline-flex items-center gap-x-2 text-gray-500 hover:text-gray-800 text-sm whitespace-nowrap rounded-lg focus:outline-none",{"bg-gray-100 text-gray-800 font-semibold after:absolute after:bottom-[-14px] after:left-2.5 after:right-2.5 after:z-10 after:h-0.5 after:bg-gray-800":d.component===(N==null?void 0:N.component)||d.component===(N==null?void 0:N.name),"hover:bg-gray-100":d.component!==(N==null?void 0:N.component)&&d.component!==(N==null?void 0:N.name)}])},v.toDisplayString(N==null?void 0:N.title),11,$C))),128))]),(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList(A.items,(N,Y)=>{var ee,oe,he,_e,me;return v.openBlock(),v.createElementBlock(v.Fragment,{key:Y},[d.component===(N==null?void 0:N.component)||d.component===(N==null?void 0:N.name)?(v.openBlock(),v.createElementBlock("div",jC,[v.createElementVNode("h2",UC,v.toDisplayString((N==null?void 0:N.title)||"Панель"),1),N!=null&&N.component?(v.openBlock(),v.createElementBlock("div",HC,[(v.openBlock(),v.createBlock(v.resolveDynamicComponent(N.component),{geometry:(oe=(ee=d.objectData)==null?void 0:ee.rows[0])==null?void 0:oe.geom,zoom:16,id:(_e=(he=n.$route)==null?void 0:he.params)==null?void 0:_e.id},null,8,["geometry","id"]))])):v.createCommentVNode("",!0),N!=null&&N.name?(v.openBlock(),v.createElementBlock("div",qC,[v.createElementVNode("div",{innerHTML:(me=d.objectData)==null?void 0:me.data[N==null?void 0:N.name]},null,8,ZC)])):v.createCommentVNode("",!0)])):v.createCommentVNode("",!0)],64)}),128))],64)):v.createCommentVNode("",!0)],2)}),128))],2)])}const GC=Object.freeze(Object.defineProperty({__proto__:null,default:vt(TC,[["render",WC],["__scopeId","data-v-8a369c39"]])},Symbol.toStringTag,{value:"Module"})),YC={},XC={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 KC(n,t,o,c,d,x){return v.openBlock(),v.createElementBlock("svg",XC,t[0]||(t[0]=[v.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),v.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),v.createElementVNode("path",{d:"M9 12h12l-3 -3"},null,-1),v.createElementVNode("path",{d:"M18 15l3 -3"},null,-1)]))}const JC=vt(YC,[["render",KC]]),QC={},eM={viewBox:"0 0 1823 249",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function tM(n,t,o,c,d,x){return v.openBlock(),v.createElementBlock("svg",eM,t[0]||(t[0]=[v.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 iM=vt(QC,[["render",tM]]),nM={},rM={class:"shrink-0 size-4 text-gray-400 dark:text-white/60",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 sM(n,t,o,c,d,x){return v.openBlock(),v.createElementBlock("svg",rM,t[0]||(t[0]=[v.createElementVNode("circle",{cx:"11",cy:"11",r:"8"},null,-1),v.createElementVNode("path",{d:"m21 21-4.3-4.3"},null,-1)]))}const E0=vt(nM,[["render",sM]]),oM={},aM={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-chevron-down"};function lM(n,t,o,c,d,x){return v.openBlock(),v.createElementBlock("svg",aM,t[0]||(t[0]=[v.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),v.createElementVNode("path",{d:"M6 9l6 6l6 -6"},null,-1)]))}const cM={components:{IconChevronDown:vt(oM,[["render",lM]])},props:{route:Object},mounted(){var n,t,o;(n=this.route)!=null&&n.menu&&(o=(t=this.route)==null?void 0:t.menu)!=null&&o.some(c=>{var d,x;return(c==null?void 0:c.path)===this.$route.path.replace("/","")||((x=(d=this.$route)==null?void 0:d.params)==null?void 0:x.table)===(c==null?void 0:c.table)&&(c==null?void 0:c.table)})&&(this.isOpen=!0)},data(){return{isOpen:!1}}},hM={key:0,class:""},uM={class:"ml-[30px] py-[6px] before:block before:absolute relative w-[196px] flex flex-col gap-[6px] inline-block before:w-[2px] before:h-[100%] before:bg-gray-100 before:left-[-14px] cursor-pointer"},dM={key:1};function pM(n,t,o,c,d,x){var M,D,A,z,L,N,Y,ee,oe,he;const y=v.resolveComponent("IconChevronDown"),h=v.resolveComponent("router-link");return(M=o.route)!=null&&M.menu?(v.openBlock(),v.createElementBlock("div",hM,[v.createElementVNode("button",{onClick:t[0]||(t[0]=_e=>d.isOpen=!d.isOpen),class:v.normalizeClass(["flex cursor-pointer gap-x-3 py-2 px-3 text-sm text-gray-800 justify-start w-full border-none focus:outline-none text-gray-800 rounded-lg items-center hover:bg-gray-100 duration-300",[((A=(D=o.route)==null?void 0:D.menu)==null?void 0:A.some(_e=>{var me,Ie;return(_e==null?void 0:_e.path)===n.$route.path.replace("/","")||(_e==null?void 0:_e.table)===((Ie=(me=n.$route)==null?void 0:me.params)==null?void 0:Ie.table)&&(_e==null?void 0:_e.table)}))&&"bg-gray-100"]])},[v.createTextVNode(v.toDisplayString((z=o.route)==null?void 0:z.ua)+" ",1),v.createVNode(y,{class:v.normalizeClass([[d.isOpen&&"-rotate-180"],"ml-auto duration-300"]),width:"14",height:"14"},null,8,["class"])],2),v.createVNode(v.Transition,{name:"fade"},{default:v.withCtx(()=>{var _e;return[v.withDirectives(v.createElementVNode("ul",uM,[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList((_e=o.route)==null?void 0:_e.menu,(me,Ie)=>{var tt,gt;return v.openBlock(),v.createElementBlock("li",{key:Ie,class:"w-full"},[v.createVNode(h,{to:"/"+(me==null?void 0:me.path),class:v.normalizeClass([[((me==null?void 0:me.path)===n.$route.path.replace("/","")||((gt=(tt=n.$route)==null?void 0:tt.params)==null?void 0:gt.table)===(me==null?void 0:me.table)&&(me==null?void 0:me.table))&&"bg-gray-100"],"flex gap-x-4 py-2 px-3 text-sm text-gray-800 rounded-lg hover:bg-gray-100 focus:outline-none focus:bg-gray-100"])},{default:v.withCtx(()=>[v.createTextVNode(v.toDisplayString(me==null?void 0:me.ua),1)]),_:2},1032,["to","class"])])}),128))],512),[[v.vShow,d.isOpen]])]}),_:1})])):(v.openBlock(),v.createElementBlock("div",dM,[v.createVNode(h,{to:(L=o.route)==null?void 0:L.path,class:v.normalizeClass([[(((N=o.route)==null?void 0:N.path.replace("/",""))===n.$route.path.replace("/","")||((ee=(Y=n.$route)==null?void 0:Y.params)==null?void 0:ee.table)===((oe=o.route)==null?void 0:oe.table)&&((he=o.route)==null?void 0:he.table))&&"bg-gray-100"],"flex gap-x-3 py-2 w-full font-[400] px-3 text-sm text-gray-800 rounded-lg items-center hover:bg-gray-100 duration-300 hover:text-gray-800"])},{default:v.withCtx(()=>{var _e;return[v.createTextVNode(v.toDisplayString((_e=o.route)==null?void 0:_e.ua),1)]}),_:1},8,["to","class"])]))}const fM={components:{IconLogout:JC,NavbarItem:vt(cM,[["render",pM]]),IconLogo:iM,IconSearch:E0},data(){return{activeIndex:null,data:null,searchValue:""}},computed:{data(){var n,t;return(n=this.searchValue)!=null&&n.trim()?(t=this.flattenMenu(nr.value))==null?void 0:t.filter(o=>{var c,d,x;return(x=(c=o==null?void 0:o.ua)==null?void 0:c.toLowerCase())==null?void 0:x.includes((d=this.searchValue)==null?void 0:d.toLowerCase())}):nr.value}},methods:{flattenMenu(n){const t=[];return n.forEach(o=>{o.menu?t.push(...this.flattenMenu(o.menu)):t.push(o)}),t}}},mM={class:"flex flex-col h-[100vh] border-r w-[260px] shrink-0"},gM={class:"relative"},yM={class:"p-[16px] 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"},_M={class:"pb-3 w-full flex flex-col flex-wrap"},xM={key:0,class:"flex flex-col gap-[6px]"},bM={key:1,class:"text-gray-800 text-lg mt-[20px]"};function vM(n,t,o,c,d,x){var A;const y=v.resolveComponent("IconLogo"),h=v.resolveComponent("IconSearch"),M=v.resolveComponent("VsText"),D=v.resolveComponent("NavbarItem");return v.openBlock(),v.createElementBlock("div",mM,[v.createVNode(y,{height:"40",width:"200",class:"my-[20px] ml-[20px]"}),v.createElementVNode("div",gM,[v.createVNode(h,{height:"16",width:"16",class:"absolute top-[12px] left-[30px] text-gray-500 z-[1]"}),v.createVNode(M,{type:"text",modelValue:d.searchValue,"onUpdate:modelValue":t[0]||(t[0]=z=>d.searchValue=z),clearable:!0,placeholder:"Пошук по меню",class:"[&>input]:h-[40px] [&>input]:block [&>input]:rounded-none [&>input]:border-x-0 [&>input]:pl-[60px] [&>input:focus]:outline-none [&>input:focus]:focus:ring-0 [&>input:focus]:border-y-gray-200 [&>input:focus]:border-y-1 [&>input:focus]:border-x-0"},null,8,["modelValue"])]),v.createElementVNode("div",yM,[v.createElementVNode("nav",_M,[(A=x.data)!=null&&A.length?(v.openBlock(),v.createElementBlock("ul",xM,[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList(x.data,(z,L)=>(v.openBlock(),v.createElementBlock("li",{key:L,class:"flex flex-col gap-[6px]"},[v.createVNode(D,{route:z},null,8,["route"])]))),128))])):(v.openBlock(),v.createElementBlock("div",bM,"Не знайдено"))])])])}const wM=vt(fM,[["render",vM]]),kM={},SM={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 EM(n,t,o,c,d,x){return v.openBlock(),v.createElementBlock("svg",SM,t[0]||(t[0]=[v.createElementVNode("circle",{cx:"12",cy:"12",r:"10"},null,-1),v.createElementVNode("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"},null,-1),v.createElementVNode("path",{d:"M12 17h.01"},null,-1)]))}const TM=vt(kM,[["render",EM]]),CM={},MM={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 PM(n,t,o,c,d,x){return v.openBlock(),v.createElementBlock("svg",MM,t[0]||(t[0]=[v.createElementVNode("path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9"},null,-1),v.createElementVNode("path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0"},null,-1)]))}const IM={components:{IconQuestion:TM,IconMessage:vt(CM,[["render",PM]])}},AM={class:"h-[60px] border-b flex justify-end px-[20px]",style:{width:"calc(100vw - 260px)"}},DM={class:"flex items-center gap-[6px]"},zM={href:"docs-softpro.com",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"},LM={class:"hs-tooltip [--placement:bottom] inline-block show"},RM={class:"hs-tooltip-toggle relative 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"};function OM(n,t,o,c,d,x){const y=v.resolveComponent("IconQuestion"),h=v.resolveComponent("IconMessage");return v.openBlock(),v.createElementBlock("div",AM,[v.createElementVNode("div",DM,[v.createElementVNode("a",zM,[v.createVNode(y,{height:"24",width:"24"})]),v.createElementVNode("div",LM,[v.createElementVNode("button",RM,[v.createVNode(h,{height:"24",width:"24"}),t[0]||(t[0]=v.createElementVNode("span",{class:"flex absolute top-0 end-0 -mt-1.5 -me-1.5"},[v.createElementVNode("span",{class:"animate-ping absolute inline-flex size-full rounded-full bg-red-400 opacity-75 dark:bg-red-600"}),v.createElementVNode("span",{class:"relative min-w-[18px] min-h-[18px] inline-flex justify-center items-center text-[10px] bg-red-500 text-white rounded-full px-1"}," 1 ")],-1))]),t[1]||(t[1]=v.createElementVNode("span",{class:"hs-tooltip-content hs-tooltip-shown:opacity-100 hs-tooltip-shown:visible opacity-0 inline-block absolute invisible z-20 py-1.5 px-2.5 bg-gray-900 text-xs text-white rounded-lg dark:bg-neutral-700 hidden",role:"tooltip","data-popper-placement":"bottom",style:{position:"fixed",inset:"0px auto auto 0px",margin:"0px",transform:"translate(1686px, 53px)"}},null,-1))]),t[2]||(t[2]=v.createElementVNode("div",{class:"h-[30px] w-[1px] bg-gray-200 ml-[10px] mr-[10px]"},null,-1)),t[3]||(t[3]=v.createElementVNode("img",{class:"flex-shrink-0 size-[38px] rounded-full",src:"https://images.unsplash.com/photo-1659482633369-9fe69af50bfb?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=facearea&facepad=3&w=320&h=320&q=80",alt:"Image Description"},null,-1))])])}const BM={components:{navbar:wM,AdminHeader:vt(IM,[["render",OM]])},mounted(){this.getMenu()},computed:{isMenu(){return nr.value}},methods:{async getMenu(){try{const{data:n}=await mt.get("/api/user-menu");nr.value=n}catch{}}}},FM={class:"admin-wrapper"},NM={class:"flex flex-col"};function VM(n,t,o,c,d,x){const y=v.resolveComponent("navbar"),h=v.resolveComponent("admin-header"),M=v.resolveComponent("router-view");return v.openBlock(),v.createElementBlock("div",FM,[v.createVNode(y),v.createElementVNode("div",NM,[x.isMenu?(v.openBlock(),v.createElementBlock(v.Fragment,{key:0},[v.createVNode(h),v.createVNode(M)],64)):v.createCommentVNode("",!0)])])}const $M=Object.freeze(Object.defineProperty({__proto__:null,default:vt(BM,[["render",VM],["__scopeId","data-v-c3c91323"]])},Symbol.toStringTag,{value:"Module"})),jM={},UM={class:"h21yx vs0hq",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"};function HM(n,t,o,c,d,x){return v.openBlock(),v.createElementBlock("svg",UM,t[0]||(t[0]=[v.createStaticVNode('<line x1="21" x2="14" y1="4" y2="4"></line><line x1="10" x2="3" y1="4" y2="4"></line><line x1="21" x2="12" y1="12" y2="12"></line><line x1="8" x2="3" y1="12" y2="12"></line><line x1="21" x2="16" y1="20" y2="20"></line><line x1="12" x2="3" y1="20" y2="20"></line><line x1="14" x2="14" y1="2" y2="6"></line><line x1="8" x2="8" y1="10" y2="14"></line><line x1="16" x2="16" y1="18" y2="22"></line>',9)]))}const qM=vt(jM,[["render",HM]]),ZM={data(){return{currentSort:""}},props:{data:{type:Object,default:()=>null},activeColumn:{type:String}},computed:{label(){var n,t;return((n=this.data)==null?void 0:n.ua)||((t=this.data)==null?void 0:t.label)||this.data.title||"null"},selectedSortParam(){var n,t;return(t=(n=this.$route)==null?void 0:n.query)==null?void 0:t.sort},getVisibleIcon(){return this.data.format!=="image"&&this.data.format!=="verify"}},watch:{activeColumn(n){n!==this.data.name&&(this.currentSort="")}},methods:{changeCurrentSort(n){switch(n){case"":return"asc";case"asc":return"desc";case"desc":return"";default:return""}},handleClickSortBtn(n){this.$emit("change-active",this.data.name),this.currentSort=this.changeCurrentSort(n);const t=this.$route.query,{sort:o,...c}=t,d=this.currentSort?`${this.data.name}-${this.currentSort}`:"";this.$router.replace({query:{...c,...d&&{sort:d}}})},isValueEqualToSelected(n){return`${this.data.name}-${n}`===this.selectedSortParam}}},WM={scope:"col",class:"min-w-[200px] max-w-[300px] text-start"},GM={class:"flex-shrink-0 size-3.5",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"},YM={key:0,d:"m7 15 5 5 5-5"},XM={key:1,d:"m7 9 5-5 5 5"},KM={key:1,class:"text-sm text-gray-800 px-[4px] py-2.5 text-start font-normal text-gray-500"};function JM(n,t,o,c,d,x){return v.openBlock(),v.createElementBlock("th",WM,[x.getVisibleIcon?(v.openBlock(),v.createElementBlock("button",{key:0,type:"button",class:"text-sm text-gray-800 px-[4px] py-2.5 text-start font-normal text-gray-500 flex items-center gap-[6px]",onClick:t[0]||(t[0]=y=>x.handleClickSortBtn(d.currentSort))},[v.createTextVNode(v.toDisplayString(x.label)+" ",1),(v.openBlock(),v.createElementBlock("svg",GM,[d.currentSort==="asc"||d.currentSort===""?(v.openBlock(),v.createElementBlock("path",YM)):v.createCommentVNode("",!0),d.currentSort==="desc"||d.currentSort===""?(v.openBlock(),v.createElementBlock("path",XM)):v.createCommentVNode("",!0)]))])):(v.openBlock(),v.createElementBlock("p",KM,v.toDisplayString(x.label),1))])}const QM=vt(ZM,[["render",JM]]),eP={},tP={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-dots-vertical"};function iP(n,t,o,c,d,x){return v.openBlock(),v.createElementBlock("svg",tP,t[0]||(t[0]=[v.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),v.createElementVNode("path",{d:"M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},null,-1),v.createElementVNode("path",{d:"M12 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},null,-1),v.createElementVNode("path",{d:"M12 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},null,-1)]))}const nP=vt(eP,[["render",iP]]),rP={},sP={class:"flex-shrink-0 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 oP(n,t,o,c,d,x){return v.openBlock(),v.createElementBlock("svg",sP,t[0]||(t[0]=[v.createStaticVNode('<path d="M3 6h18"></path><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"></path><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"></path><line x1="10" x2="10" y1="11" y2="17"></line><line x1="14" x2="14" y1="11" y2="17"></line>',5)]))}const aP=vt(rP,[["render",oP]]),lP={props:{height:{type:String,default:"16"},width:{type:String,default:"12"},color:{type:String,default:"black"}}},cP={style:{display:"none"}},hP=["height","width","fill"];function uP(n,t,o,c,d,x){return v.openBlock(),v.createElementBlock(v.Fragment,null,[(v.openBlock(),v.createElementBlock("svg",cP,t[0]||(t[0]=[v.createElementVNode("symbol",{id:"icon-pencil",viewBox:"0 0 32 32"},[v.createElementVNode("path",{d:"M27 0c2.761 0 5 2.239 5 5 0 1.126-0.372 2.164-1 3l-2 2-7-7 2-2c0.836-0.628 1.874-1 3-1zM2 23l-2 9 9-2 18.5-18.5-7-7-18.5 18.5zM22.362 11.362l-14 14-1.724-1.724 14-14 1.724 1.724z"})],-1)]))),(v.openBlock(),v.createElementBlock("svg",{height:o.height,width:o.width,fill:o.color},t[1]||(t[1]=[v.createElementVNode("use",{"xlink:href":"#icon-pencil"},null,-1)]),8,hP))],64)}const dP={components:{IconMore:nP,IconDelete:aP,IconEdit:vt(lP,[["render",uP]])},emits:["updateTable"],props:{item:Object,table:String,isForm:null},data(){return{formVisible:!1,isDeleteConfirm:!1,formValue:{},top:0,left:0}},methods:{openConfirm(){this.isDeleteConfirm=!0,document.querySelector("body").click()},async getData(){var n;try{const{data:t}=await mt.get(`/api/table/${this.table}/${(n=this.item)==null?void 0:n.id}`);this.formValue=t}catch(t){console.error(t)}},doSomethingOnCancel(){this.formVisible=!1},async deleteElement(){var n;try{mt.delete(`/api/table/${this.table}/${(n=this.item)==null?void 0:n.id}`),this.$notify({title:"Успішно!",message:"Об`єкт успішно видалeно",type:"success"}),await this.$emit("update-table"),this.isDeleteConfirm=!1}catch{this.$notify({title:"Помилка!",message:"Сталася помилка",type:"error"})}}}},pP={class:"hs-dropdown [--placement:bottom-right] inline-flex"},fP={class:"gap-x-2 p-[4px] rounded-lg shadow-sm hover:border-transparent border focus:outline-none text-black hover:bg-gray-50"},mP={class:"flex flex-col items-start"},gP={key:1,class:"h-[1px] w-[80%] bg-gray-200 ml-auto mr-auto"},yP={class:"p-4"},_P={class:"mt-4 flex justify-end gap-x-3"};function xP(n,t,o,c,d,x){const y=v.resolveComponent("IconMore"),h=v.resolveComponent("IconEdit"),M=v.resolveComponent("router-link"),D=v.resolveComponent("IconDelete"),A=v.resolveComponent("VsPopover"),z=v.resolveComponent("VsDialog");return v.openBlock(),v.createElementBlock(v.Fragment,null,[v.createElementVNode("div",pP,[v.createVNode(A,{trigger:"click",placement:"bottom-left"},{reference:v.withCtx(()=>[v.createElementVNode("button",fP,[v.createVNode(y,{height:"16",width:"16"})])]),default:v.withCtx(()=>{var L,N,Y;return[v.createElementVNode("div",mP,[o.isForm?(v.openBlock(),v.createBlock(M,{key:0,to:`/edit?table=${(N=(L=n.$route)==null?void 0:L.params)==null?void 0:N.catchAll}&id=${(Y=o.item)==null?void 0:Y.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:v.withCtx(()=>[v.createVNode(h,{color:"#000"}),t[4]||(t[4]=v.createTextVNode(" Редагувати "))]),_:1},8,["to"])):v.createCommentVNode("",!0),o.isForm?(v.openBlock(),v.createElementBlock("div",gP)):v.createCommentVNode("",!0),v.createElementVNode("button",{onClick:t[0]||(t[0]=v.withModifiers((...ee)=>x.openConfirm&&x.openConfirm(...ee),["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"},[v.createVNode(D),t[5]||(t[5]=v.createElementVNode("span",{class:"text-gray-800"},"Видалити",-1))])])]}),_:1})]),v.createVNode(z,{visible:d.isDeleteConfirm,"onUpdate:visible":t[3]||(t[3]=L=>d.isDeleteConfirm=L),title:"Ви впевнені?"},{default:v.withCtx(()=>[v.createElementVNode("div",yP,[t[6]||(t[6]=v.createElementVNode("p",{class:"mt-1 text-gray-500 dark:text-neutral-500"}," Ви впевнені, що хочете видалити цей об'єкт? ",-1)),v.createElementVNode("div",_P,[v.createElementVNode("button",{type:"button",class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:t[1]||(t[1]=L=>d.isDeleteConfirm=!1)}," Скасувати "),v.createElementVNode("button",{type:"button",class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-semibold rounded-lg border border-transparent bg-red-500 text-white hover:bg-red-600 disabled:opacity-50 disabled:pointer-events-none",onClick:t[2]||(t[2]=(...L)=>x.deleteElement&&x.deleteElement(...L))}," Так, я впевнена/ий ")])])]),_:1},8,["visible"])],64)}const bP=vt(dP,[["render",xP]]),vP={},wP={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 kP(n,t,o,c,d,x){return v.openBlock(),v.createElementBlock("svg",wP,t[0]||(t[0]=[v.createElementVNode("path",{d:"m3 16 4 4 4-4"},null,-1),v.createElementVNode("path",{d:"M7 20V4"},null,-1),v.createElementVNode("path",{d:"m21 8-4-4-4 4"},null,-1),v.createElementVNode("path",{d:"M17 4v16"},null,-1)]))}const SP=vt(vP,[["render",kP]]),EP={props:{columns:{type:Object,default:()=>{}},table:{type:String,default:()=>""}},data(){return{tableFormats:["json","csv","xlsx"],format:"",cols:[]}},methods:{async exportTable(){try{const n=await mt.get("/api/export",{params:{table:this.table,format:this.format,cols:this.cols.join(",")},responseType:"blob"}),t=new Blob([n.data],{type:"application/octet-stream"}),o=window.URL.createObjectURL(t),c=document.createElement("a");c.href=o,c.setAttribute("download",`${this.table.split(".")[0]}.${this.format}`),document.body.appendChild(c),c.click(),document.body.removeChild(c),window.URL.revokeObjectURL(o),this.$notify({type:"success",title:"Експорт",message:"Файл успішно експортовано!"})}catch(n){console.error("Ошибка при экспорте файла:",n),this.$notify({type:"error",title:"Помилка",message:"Не вдалося експортувати файл."})}},selectFormat(n){this.format=n}}},TP={class:"p-4"},CP={class:"pb-5 mb-5 last:pb-0 last:mb-0 border-b last:border-b-0 border-gray-200 dark:border-neutral-700"},MP={class:"mt-2 flex row flex-wrap gap-y-[5px] gap-x-[10px]"},PP={class:"pb-5 mb-5 last:pb-0 last:mb-0 border-b last:border-b-0 border-gray-200 dark:border-neutral-700"},IP={class:"mt-2 space-y-2"},AP=["id","onChange"],DP=["for"],zP={class:"pb-5 last:pb-0 last:mb-0 border-b last:border-b-0 border-gray-200 dark:border-neutral-700"},LP={class:"text-center"};function RP(n,t,o,c,d,x){const y=v.resolveComponent("VsCheckbox");return v.openBlock(),v.createElementBlock(v.Fragment,null,[t[4]||(t[4]=v.createElementVNode("div",{class:"dark:border-neutral-700"},null,-1)),v.createElementVNode("div",TP,[v.createElementVNode("div",CP,[t[2]||(t[2]=v.createElementVNode("label",{class:"text-sm text-gray-500 dark:text-neutral-500"}," Виберіть стовпці таблиці для експорту: ",-1)),v.createElementVNode("div",MP,[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList(o.columns,(h,M)=>(v.openBlock(),v.createElementBlock("div",{class:"flex items-center",key:M,style:{width:"calc((100% - 10px) / 2)"}},[v.createVNode(y,{class:"py-0 shrink-0 border-gray-300 rounded text-blue-600 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",modelValue:d.cols,"onUpdate:modelValue":t[0]||(t[0]=D=>d.cols=D),value:h==null?void 0:h.name,label:h==null?void 0:h.ua},null,8,["modelValue","value","label"])]))),128))])]),v.createElementVNode("div",PP,[t[3]||(t[3]=v.createElementVNode("label",{class:"text-sm text-gray-500 dark:text-neutral-500"}," Виберіть формат таблиці: ",-1)),v.createElementVNode("div",IP,[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList(d.tableFormats,(h,M)=>(v.openBlock(),v.createElementBlock("div",{class:"flex items-center",key:M},[v.createElementVNode("input",{type:"radio",name:"hs-pro-duecmfm",class:"shrink-0 border-gray-300 rounded-full text-blue-600 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:h,onChange:D=>x.selectFormat(h)},null,40,AP),v.createElementVNode("label",{for:h,class:"text-sm text-gray-800 ms-3 dark:text-neutral-400"}," Формат "+v.toDisplayString(h),9,DP)]))),128))])]),v.createElementVNode("div",zP,[v.createElementVNode("div",LP,[v.createElementVNode("button",{type:"button",class:"p-2 inline-flex items-center gap-x-2 text-xs font-medium rounded-lg border border-transparent bg-blue-600 text-white hover:bg-blue-700 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:ring-2 focus:ring-blue-500",onClick:t[1]||(t[1]=(...h)=>x.exportTable&&x.exportTable(...h))}," Завантажити таблицю ")])])])],64)}const OP={components:{IconExport:SP,AdminTableExportForm:vt(EP,[["render",RP]])},props:{table:String,columns:Array},data(){return{isOpen:!1}}};function BP(n,t,o,c,d,x){const y=v.resolveComponent("IconExport"),h=v.resolveComponent("AdminTableExportForm"),M=v.resolveComponent("VsDialog");return v.openBlock(),v.createElementBlock(v.Fragment,null,[v.createElementVNode("button",{onClick:t[0]||(t[0]=D=>d.isOpen=!0),class:"py-2 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"},[v.createVNode(y,{height:"16",width:"16"}),t[2]||(t[2]=v.createTextVNode(" Import / Export ")),t[3]||(t[3]=v.createElementVNode("svg",{class:"shrink-0 size-3.5",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"},[v.createElementVNode("path",{d:"m6 9 6 6 6-6"})],-1))]),v.createVNode(M,{visible:d.isOpen,"onUpdate:visible":t[1]||(t[1]=D=>d.isOpen=D),title:"Експорт таблиці"},{default:v.withCtx(()=>[v.createVNode(h,{table:o.table,columns:o.columns},null,8,["table","columns"])]),_:1},8,["visible"])],64)}const FP=vt(OP,[["render",BP]]),NP={},VP={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-columns"};function $P(n,t,o,c,d,x){return v.openBlock(),v.createElementBlock("svg",VP,t[0]||(t[0]=[v.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M4 6l5.5 0"></path><path d="M4 10l5.5 0"></path><path d="M4 14l5.5 0"></path><path d="M4 18l5.5 0"></path><path d="M14.5 6l5.5 0"></path><path d="M14.5 10l5.5 0"></path><path d="M14.5 14l5.5 0"></path><path d="M14.5 18l5.5 0"></path>',9)]))}const jP=vt(NP,[["render",$P]]),UP={props:{column:Object},emits:["update-column"],data(){return{value:!1}},watch:{value(n){this.$emit("update-column",{...this.column,hidden:!n})}},mounted(){var n;((n=this.column)==null?void 0:n.hidden)!==!0&&(this.value=!0)}},HP={class:"flex w-full gap-[8px] items-centr"};function qP(n,t,o,c,d,x){var y,h;return v.openBlock(),v.createElementBlock("label",HP,[v.withDirectives(v.createElementVNode("input",{"onUpdate:modelValue":t[0]||(t[0]=M=>d.value=M),type:"checkbox"},null,512),[[v.vModelCheckbox,d.value]]),v.createTextVNode(" "+v.toDisplayString(((y=o.column)==null?void 0:y.ua)||((h=o.column)==null?void 0:h.title)),1)])}const ZP={components:{IconColumns:jP,AdminTableColumnsHiddenItem:vt(UP,[["render",qP]])},emits:["update-columns"],props:{columns:Array},methods:{updateColumn(n){const t=this.columns.findIndex(c=>(c==null?void 0:c.name)===(n==null?void 0:n.name)),o=this.columns;o[t]=n,this.$emit("update-columns",[...o])}}},WP={class:"py-2 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"},GP={class:"flex flex-col gap-[3px] h-[400px] w-[300px] 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"};function YP(n,t,o,c,d,x){const y=v.resolveComponent("IconColumns"),h=v.resolveComponent("AdminTableColumnsHiddenItem"),M=v.resolveComponent("VsPopover");return v.openBlock(),v.createBlock(M,{trigger:"click",placement:"bottom"},{reference:v.withCtx(()=>[v.createElementVNode("button",WP,[v.createVNode(y,{height:"20",width:"16"})])]),default:v.withCtx(()=>[v.createElementVNode("div",null,[t[0]||(t[0]=v.createElementVNode("h2",{class:"text-sm mb-[8px]"},"Оберіть колонки, щоб приховати",-1)),v.createElementVNode("ul",GP,[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList(o.columns,(D,A)=>(v.openBlock(),v.createElementBlock("li",{key:A},[v.createVNode(h,{column:D,onUpdateColumn:x.updateColumn},null,8,["column","onUpdateColumn"])]))),128))])])]),_:1})}const XP=vt(ZP,[["render",YP]]),KP={},JP={class:"hidden sm:block shrink-0 size-3",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 16 16"};function QP(n,t,o,c,d,x){return v.openBlock(),v.createElementBlock("svg",JP,t[0]||(t[0]=[v.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M8 1C8.55228 1 9 1.44772 9 2V7L14 7C14.5523 7 15 7.44771 15 8C15 8.55228 14.5523 9 14 9L9 9V14C9 14.5523 8.55228 15 8 15C7.44772 15 7 14.5523 7 14V9.00001L2 9.00001C1.44772 9.00001 1 8.5523 1 8.00001C0.999999 7.44773 1.44771 7.00001 2 7.00001L7 7.00001V2C7 1.44772 7.44772 1 8 1Z"},null,-1)]))}const eI=vt(KP,[["render",QP]]),tI={},iI={class:"vs-table-interface__table-wrp w-full rounded h-fit overflow-hidden"};function nI(n,t,o,c,d,x){return v.openBlock(),v.createElementBlock("div",iI,t[0]||(t[0]=[v.createStaticVNode('<div><div class="p-5 min-h-[500px] flex flex-col justify-center items-center text-center"><svg class="w-48 mx-auto" viewBox="0 0 178 90" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="27" y="50.5" width="124" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="27" y="50.5" width="124" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-50 dark:stroke-neutral-700/10"></rect><rect x="34.5" y="58" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="61" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="73" width="77" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/30"></rect><rect x="27" y="36" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="39" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="51" width="92" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><g filter="url(#filter1)"><rect x="12" y="6" width="154" height="40" rx="8" fill="currentColor" class="fill-white dark:fill-neutral-800" shape-rendering="crispEdges"></rect><rect x="12.5" y="6.5" width="153" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/60" shape-rendering="crispEdges"></rect><rect x="20" y="14" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="17" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="29" width="106" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect></g><defs><filter id="filter1" x="0" y="0" width="178" height="64" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"></feColorMatrix><feOffset dy="6"></feOffset><feGaussianBlur stdDeviation="6"></feGaussianBlur><feComposite in2="hardAlpha" operator="out"></feComposite><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0"></feColorMatrix><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1187_14810"></feBlend><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_1187_14810" result="shape"></feBlend></filter></defs></svg><div class="max-w-sm mx-auto mt-6"><p class="font-medium text-gray-800 dark:text-neutral-200"> Дані для відображення відсутні </p><p class="mt-2 text-sm text-gray-500 dark:text-neutral-500"> Змініть параметри пошуку або спробуйте пізніше </p></div></div></div>',1)]))}const rI={props:{table:String,title:String},components:{IconFilter:qM,AdminTableControl:bP,AdminTableExport:FP,AdminTableColumnsHidden:XP,AdminTableColumn:QM,AdminNodata:vt(tI,[["render",nI]]),IconPlus:eI,IconSearch:E0},data(){return{tableData:{},isFilters:!1,filterScheme:[],page:1,searchValue:"",limit:0,filters:null,activeColumn:"",onFilters:0}},mounted(){var n,t,o,c;this.page=((t=(n=this.$route)==null?void 0:n.query)==null?void 0:t.page)||1,this.limit=((c=(o=this.$route)==null?void 0:o.query)==null?void 0:c.limit)||20,this.getTableData(),this.getFilters()},computed:{defaultPage(){var n,t;return((t=(n=this.$route)==null?void 0:n.query)==null?void 0:t.page)||1},getFilterScheme(){var n;return(n=this.tableData)==null?void 0:n.filters},columns(){var n,t;return(t=(n=this.tableData)==null?void 0:n.columns)==null?void 0:t.filter(o=>(o==null?void 0:o.hidden)!==!0)},isForm(){var n;return(n=this.tableData)==null?void 0:n.form},isNoData(){var n,t;return!((n=this.tableData)!=null&&n.rows)||!((t=this.columns)!=null&&t.length)}},watch:{async table(){this.tableData=null,await this.getTableData()},searchValue(){this.getTableData()},$route:{handler(n,t){var o,c;((o=n==null?void 0:n.params)==null?void 0:o.catchAll)!==((c=t==null?void 0:t.params)==null?void 0:c.catchAll)&&(this.filterScheme=null,this.filters=null,this.onFilters=0,this.getFilters())},deep:!0},limit(n){var t;this.$router.push({query:{...(t=this.$route)==null?void 0:t.query,limit:n}})}},methods:{async getTableData(){var n,t;try{const{data:o}=await mt.get(`/api/template/table/${this.table}`),c=await mt.get(`/api/table-data/${this.table}`,{params:{page:this.page,search:this.searchValue||null,limit:this.limit,filter:this.filters||null,order:((t=(n=this.$route)==null?void 0:n.query)==null?void 0:t.sort)||null}});this.tableData={...o,...(c==null?void 0:c.data)||{}}}catch{}},async getFilters(){var n;try{const{data:t}=await mt.get(`/api/table-filter/${this.table}`);this.filterScheme=(n=t==null?void 0:t.list)==null?void 0:n.map(o=>({...o,label:(o==null?void 0:o.label)||(o==null?void 0:o.ua)}))}catch{}},async handlePageChange(n){const t=this.$route.query;this.page=n,!(!(t!=null&&t.page)&&n===1||t.page===n)&&(await this.$router.replace({query:{...t,page:n}}),await this.getTableData())},async changeLimit(n){this.limit=await n,this.defaultPage=1,await this.getTableData()},closeFilter({target:n}){this.isFilters&&n.classList.contains("filter-container")&&(this.isFilters=!1)},async filterChange({url:n,state:t}){var o;this.filters=n!=="no-url"?n:null,this.onFilters=(o=Object.entries(t))==null?void 0:o.length,this.page=1,await this.getTableData()},changeActiveColumn(n){this.activeColumn=n,this.getTableData()},pushToCard(n){var t;((t=this.tableData)==null?void 0:t.card)===!1||this.$router.push(`/card/${this.table}/${n}`)}}},sI={class:"w-[calc(100vw - 320px)]"},oI={class:"h-[76px] bg-gray-50 flex items-center justify-between px-[30px]"},aI={class:"text-xl font-medium h-[20px]"},lI={style:{height:"calc(100vh - 140px)",width:"calc(100vw - 260px)"},class:"bg-gray-50 p-[20px] flex pt-[10px]"},cI={class:"bg-white w-full rounded-xl border p-[20px]"},hI={class:"flex sm:grid sm:grid-cols-2 gap-x-2 sm:gap-x-5 mb-[10px] relative"},uI={class:"flex gap-[6px] ml-auto"},dI={key:0,class:"font-medium text-[10px] py-0.5 px-[5px] bg-gray-800 text-white leading-3 rounded-full dark:bg-neutral-500"},pI={class:"space-y-5 flex items-start w-full justify-start"},fI={style:{height:"calc(100vh - 310px)"},class:"overflow-x-auto w-full border-t [&::-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"},mI={class:"inline-block w-full align-middle"},gI={key:0,class:"divide-y divide-gray-200 min-w-full dark:divide-neutral-700 relative table-fixed"},yI={class:"sticky top-0 bg-white w-full relative after:absolute after:content-[''] after:block after:w-full after:h-px after:bg-stone-200"},_I={class:"border-stone-200 right-0 z-[1]"},xI={class:"divide-y divide-gray-200"},bI={class:"min-w-[200px] text-start pe-4 py-3 text-sm text-gray-600"},vI=["onClick"],wI={class:"text-center sticky right-0 bg-white w-[80px] px-[10px]"},kI={class:"p-[20px] flex justify-end w-full"},SI={class:"filter-content h-screen bg-white w-[400px] p-[20px] pt-[10px] overflow-x-auto bg-white [&::-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 EI(n,t,o,c,d,x){var _e,me,Ie,tt,gt,Ve;const y=v.resolveComponent("IconPlus"),h=v.resolveComponent("router-link"),M=v.resolveComponent("IconSearch"),D=v.resolveComponent("VsText"),A=v.resolveComponent("AdminTableColumnsHidden"),z=v.resolveComponent("AdminTableExport"),L=v.resolveComponent("IconFilter"),N=v.resolveComponent("AdminTableColumn"),Y=v.resolveComponent("AdminTableControl"),ee=v.resolveComponent("AdminNodata"),oe=v.resolveComponent("VsPagination"),he=v.resolveComponent("VsFilter");return v.openBlock(),v.createElementBlock(v.Fragment,null,[v.createElementVNode("div",sI,[v.createElementVNode("div",oI,[v.createElementVNode("h2",aI,v.toDisplayString(o.title),1),x.isForm?(v.openBlock(),v.createBlock(h,{key:0,to:`/add?table=${(me=(_e=n.$route)==null?void 0:_e.params)==null?void 0:me.catchAll}`,class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-transparent bg-blue-600 text-white hover:bg-blue-700 hover:text-white duration-300"},{default:v.withCtx(()=>[v.createVNode(y,{height:"16",width:"16"}),t[5]||(t[5]=v.createTextVNode(" Додати "))]),_:1},8,["to"])):v.createCommentVNode("",!0)]),v.createElementVNode("div",lI,[v.createElementVNode("div",cI,[v.createElementVNode("div",hI,[v.createVNode(M,{height:"14",width:"14",class:"absolute top-[10px] left-[14px] text-gray-500 z-[1]"}),v.createVNode(D,{modelValue:d.searchValue,"onUpdate:modelValue":t[0]||(t[0]=rt=>d.searchValue=rt),placeholder:"Пошук...",clearable:!0,class:"[&>input]:py-[7px] [&>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"]),v.createElementVNode("div",uI,[v.createVNode(A,{columns:(Ie=d.tableData)==null?void 0:Ie.columns,onUpdateColumns:t[1]||(t[1]=rt=>d.tableData.columns=rt)},null,8,["columns"]),v.createVNode(z,{table:o.table,columns:(tt=d.tableData)==null?void 0:tt.columns},null,8,["table","columns"]),v.createElementVNode("button",{onClick:t[2]||(t[2]=rt=>d.isFilters=!d.isFilters),class:"py-2 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"},[v.createVNode(L,{height:"16",width:"16"}),t[6]||(t[6]=v.createTextVNode(" Фільтри ")),d.onFilters?(v.openBlock(),v.createElementBlock("span",dI,v.toDisplayString(d.onFilters),1)):v.createCommentVNode("",!0)])])]),v.createElementVNode("div",pI,[v.createElementVNode("div",fI,[v.createElementVNode("div",mI,[x.isNoData?(v.openBlock(),v.createBlock(ee,{key:1})):(v.openBlock(),v.createElementBlock("table",gI,[v.createElementVNode("thead",yI,[v.createElementVNode("tr",_I,[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList(x.columns,rt=>(v.openBlock(),v.createBlock(N,{key:rt.name,data:rt,activeColumn:d.activeColumn,onChangeActive:x.changeActiveColumn},null,8,["data","activeColumn","onChangeActive"]))),128)),t[7]||(t[7]=v.createElementVNode("th",{class:"w-[70px] sticky right-0 top-0 bg-white"},null,-1))])]),v.createElementVNode("tbody",xI,[(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList((gt=d.tableData)==null?void 0:gt.rows,(rt,xt)=>{var zt,Et,Ki,Pt,ri,Vi,yn,zi;return v.openBlock(),v.createElementBlock("tr",{key:xt},[v.createElementVNode("td",bI,[v.createElementVNode("button",{onClick:()=>x.pushToCard(rt==null?void 0:rt.id),class:v.normalizeClass(["text-sm font-medium",[((zt=d.tableData)==null?void 0:zt.card)===!1?"":"text-blue-600 decoration-2 focus:outline-none focus:underline hover:text-blue-600 hover:underline"]])},[(v.openBlock(),v.createBlock(v.resolveDynamicComponent(((Et=x.columns[0])==null?void 0:Et.format)==="custom"?(Ki=x.columns[0])==null?void 0:Ki.component:n.$componentsConfig[`table-format-${((ri=(Pt=x.columns[0])==null?void 0:Pt.format)==null?void 0:ri.toLowerCase())||"text"}`]),{name:(Vi=x.columns[0])==null?void 0:Vi.name,data:rt,value:rt==null?void 0:rt[(yn=x.columns[0])==null?void 0:yn.name]},null,8,["name","data","value"]))],10,vI)]),(v.openBlock(!0),v.createElementBlock(v.Fragment,null,v.renderList((zi=x.columns)==null?void 0:zi.slice(1),ui=>{var an;return v.openBlock(),v.createElementBlock("td",{class:"min-w-[300px] w-full text-start px-[4px] py-3 text-sm text-gray-600",key:ui.name},[(v.openBlock(),v.createBlock(v.resolveDynamicComponent((ui==null?void 0:ui.format)==="custom"?ui==null?void 0:ui.component:n.$componentsConfig[`table-format-${((an=ui==null?void 0:ui.format)==null?void 0:an.toLowerCase())||"text"}`]),{name:ui==null?void 0:ui.name,data:rt,value:rt==null?void 0:rt[ui==null?void 0:ui.name]},null,8,["name","data","value"]))])}),128)),v.createElementVNode("td",wI,[v.createVNode(Y,{isForm:x.isForm,item:rt,table:o.table,onUpdateTable:x.getTableData},null,8,["isForm","item","table","onUpdateTable"])])])}),128))])]))])])]),v.createElementVNode("div",kI,[d.limit?(v.openBlock(),v.createBlock(oe,{key:0,goTo:!1,class:"justify-end","default-page":x.defaultPage,total:((Ve=d.tableData)==null?void 0:Ve.total)||0,pageSize:d.limit,onPageChange:x.handlePageChange,pageSizes:[10,16,20],onPageSizeChange:x.changeLimit},null,8,["default-page","total","pageSize","onPageChange","onPageSizeChange"])):v.createCommentVNode("",!0)])])])]),v.createVNode(v.Transition,{name:"fade"},{default:v.withCtx(()=>{var rt;return[v.withDirectives(v.createElementVNode("div",{onClick:t[4]||(t[4]=(...xt)=>x.closeFilter&&x.closeFilter(...xt)),style:{height:"100vh"},class:"fixed filter-container top-0 flex justify-end items-center z-[2] right-0 left-0 bottom-0 bg-[rgba(0,0,0,0.5)]"},[v.createElementVNode("div",SI,[(rt=d.filterScheme)!=null&&rt.length?(v.openBlock(),v.createBlock(he,{key:0,ref:"filter",scheme:d.filterScheme,layout:"default","apply-vue-router":"",history:"",name:"filter",onFilterChange:x.filterChange,closeFilterBtn:!0,onFilterClose:t[3]||(t[3]=xt=>d.isFilters=!1)},null,8,["scheme","onFilterChange"])):v.createCommentVNode("",!0)])],512),[[v.vShow,d.isFilters]])]}),_:1})],64)}const TI={components:{AdminTable:vt(rI,[["render",EI]])},data(){return{table:!1,interface:"",title:""}},watch:{$route:{async handler(){nr!=null&&nr.value||await this.getMenu(),await this.checkPageType()},deep:!0},title(n){n&&(document.title=n)}},async mounted(){await this.checkPageType()},methods:{flattenMenu(n){const t=[];return n.forEach(o=>{o.menu?t.push(...this.flattenMenu(o.menu)):t.push(o)}),t},async getMenu(){try{const{data:n}=await mt.get("/api/user-menu");nr.value=n}catch{}},async checkPageType(){const n=this.flattenMenu(nr.value);n!=null&&n.length||this.$router.replace("/404");const t=n==null?void 0:n.find(c=>{var d,x;return(c==null?void 0:c.path)==((x=(d=this.$route)==null?void 0:d.params)==null?void 0:x.catchAll)});this.title=t==null?void 0:t.ua,t||this.$router.replace("/404");const o=t==null?void 0:t.table;this.table=o||!1,!o&&this.getInterface()},async getInterface(){var n,t;try{const{data:o}=await mt.get(`/api/template/interface/${((t=(n=this.$route)==null?void 0:n.params)==null?void 0:t.catchAll)||""}`);this.interface=o||""}catch{this.interface=""}}}},CI=["innerHTML"];function MI(n,t,o,c,d,x){const y=v.resolveComponent("AdminTable");return d.table?(v.openBlock(),v.createBlock(y,{key:0,table:d.table,title:d.title},null,8,["table","title"])):(v.openBlock(),v.createElementBlock("div",{key:1,class:"w-full bg-gray-50",style:{height:"calc(100vh - 120px)"},innerHTML:d.interface},null,8,CI))}const PI=Object.freeze(Object.defineProperty({__proto__:null,default:vt(TI,[["render",MI]])},Symbol.toStringTag,{value:"Module"}));return aC});
|