"use strict";(self.webpackChunkelement_web=self.webpackChunkelement_web||[]).push([[5372],{"./src/components/views/location/Marker.tsx":(e,t,o)=>{o.d(t,{A:()=>m});var r=o("./node_modules/react/index.js"),n=o("./node_modules/classnames/index.js"),a=o.n(n),l=o("./res/img/element-icons/location.svg"),i=o("./src/utils/FormattingUtils.ts"),s=o("./src/components/views/avatars/MemberAvatar.tsx");const c=({tooltip:e,children:t})=>{const[o,n]=(0,r.useState)(!1);if(!e)return r.createElement(r.Fragment,null,t);return r.createElement("div",{onMouseEnter:()=>n(!0),onClick:e=>{e.stopPropagation(),n(!o)},onMouseLeave:()=>n(!1)},t,o&&e)},m=r.forwardRef((({id:e,roomMember:t,useMemberColor:o,tooltip:n},m)=>{const u=o&&t?(0,i.yJ)(t.userId):"";return r.createElement("div",{ref:m,id:e,className:a()("mx_Marker",u,{mx_Marker_defaultColor:!u})},r.createElement(c,{tooltip:n},r.createElement("div",{className:"mx_Marker_border"},t?r.createElement(s.A,{member:t,size:"36px",viewUserOnClick:!1,hideTitle:!!n}):r.createElement(l.I,{className:"mx_Marker_icon"}))))}))},"./src/components/views/location/SmartMarker.tsx":(e,t,o)=>{o.r(t),o.d(t,{default:()=>i});var r=o("./node_modules/react/index.js"),n=o("./src/utils/location/index.ts"),a=o("./src/utils/location/map.ts"),l=o("./src/components/views/location/Marker.tsx");const i=({id:e,map:t,geoUri:o,roomMember:i,useMemberColor:s,tooltip:c})=>{const{onElementRef:m}=((e,t)=>{const[o,l]=(0,r.useState)(),i=(0,r.useCallback)((r=>{if(o||!r)return;const i=(0,n.XB)(t);if(i){const t=(0,a.h)(i,r);t.addTo(e),l(t)}}),[o,t,e]);return(0,r.useEffect)((()=>{if(o){const e=(0,n.XB)(t);e&&o.setLngLat({lon:e.longitude,lat:e.latitude})}}),[o,t]),(0,r.useEffect)((()=>()=>{o&&o.remove()}),[o]),{marker:o,onElementRef:i}})(t,o);return r.createElement("span",null,r.createElement(l.A,{ref:m,id:e,roomMember:i,useMemberColor:s,tooltip:c}))}},"./src/utils/location/map.ts":(e,t,o)=>{o.d(t,{h:()=>c,p:()=>s});var r=o("./node_modules/maplibre-gl/dist/maplibre-gl.js"),n=o("./node_modules/matrix-js-sdk/src/logger.ts"),a=o("./src/languageHandler.tsx"),l=o("./src/utils/location/findMapStyleUrl.ts"),i=o("./src/utils/location/LocationShareErrors.ts");const s=(e,t,o,s)=>{try{const c=(0,l.M)(e),m=new r.Map({container:o,style:c,zoom:15,interactive:t,attributionControl:!1,locale:{"AttributionControl.ToggleAttribution":(0,a._t)("location_sharing|toggle_attribution"),"AttributionControl.MapFeedback":(0,a._t)("location_sharing|map_feedback"),"FullscreenControl.Enter":(0,a._t)("action|enter_fullscreen"),"FullscreenControl.Exit":(0,a._t)("action|exit_fullscreeen"),"GeolocateControl.FindMyLocation":(0,a._t)("location_sharing|find_my_location"),"GeolocateControl.LocationNotAvailable":(0,a._t)("location_sharing|location_not_available"),"LogoControl.Title":(0,a._t)("location_sharing|mapbox_logo"),"NavigationControl.ResetBearing":(0,a._t)("location_sharing|reset_bearing"),"NavigationControl.ZoomIn":(0,a._t)("action|zoom_in"),"NavigationControl.ZoomOut":(0,a._t)("action|zoom_out")}});return m.addControl(new r.AttributionControl,"top-right"),m.on("error",(e=>{n.v.error("Failed to load map: check map_style_url in config.json has a valid URL and API key",e.error),null==s||s(new Error(i.$.MapStyleUrlNotReachable))})),m}catch(e){n.v.error("Failed to render map",e);if((null==e?void 0:e.message).includes("Failed to initialize WebGL"))throw new Error(i.$.WebGLNotEnabled);throw e}},c=(e,t)=>new r.Marker({element:t,anchor:"bottom",offset:[0,-1]}).setLngLat({lon:e.longitude,lat:e.latitude})}}]);
//# sourceMappingURL=5372.js.map